@capagents/forgeqe 3.2.5 → 3.2.7
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/HOW_TO_USE.md +12 -5
- package/dist/docs-site/CREDITS.md +3 -3
- package/dist/docs-site/{LICENSE.dm-sans.txt → LICENSE.geist.txt} +1 -1
- package/dist/docs-site/app-look.css +72 -32
- package/dist/docs-site/architecture-map/arch-theme.css +31 -40
- package/dist/docs-site/docs/app-theme.css +109 -108
- package/dist/docs-site/docs/architecture-reference/index.html +1 -0
- package/dist/docs-site/docs/area-api/index.html +17 -4
- package/dist/docs-site/docs/area-browser/index.html +2 -0
- package/dist/docs-site/docs/area-setup/index.html +1 -0
- package/dist/docs-site/docs/get-started/index.html +7 -4
- package/dist/docs-site/docs/overview/index.html +1 -1
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +6 -3
- package/dist/docs-site/security/security-theme.css +66 -69
- package/dist/forgeqe.js +1890 -1860
- package/dist/web/THIRD_PARTY_NOTICES.md +0 -101
- package/dist/web/assets/{3d-force-graph-D62h_vvb.js → 3d-force-graph-CUGt_TSW.js} +1 -1
- package/dist/web/assets/Agent-DiX8ljlC.js +8 -0
- package/dist/web/assets/AgentWork-BpfMY_xu.js +2 -0
- package/dist/web/assets/ApiTests-4jfzlfVd.js +15 -0
- package/dist/web/assets/Browse-ByDemInL.js +1 -0
- package/dist/web/assets/Chat-C3wKV0CI.js +3 -0
- package/dist/web/assets/CommandPalette-CKJHtRjo.js +1 -0
- package/dist/web/assets/Compare-DtW2g-qb.js +1 -0
- package/dist/web/assets/Cost-DW-kVEL8.js +1 -0
- package/dist/web/assets/Data--HGneNun.js +6 -0
- package/dist/web/assets/Desktop-DQf5gv7D.js +1 -0
- package/dist/web/assets/DesktopReview-BaPYt0kl.js +2 -0
- package/dist/web/assets/DeviceScreen-DzVNfMwl.js +1 -0
- package/dist/web/assets/Evidence-CxRMnZch.js +1 -0
- package/dist/web/assets/Explore-ChpAuezG.js +2 -0
- package/dist/web/assets/Features-VsLb8QTH.js +1 -0
- package/dist/web/assets/Flags-Do-pvmCF.js +2 -0
- package/dist/web/assets/Flaky-CyhTszAg.js +1 -0
- package/dist/web/assets/Impact-BWBAXRuw.js +3 -0
- package/dist/web/assets/Jobs-C_MjXv0_.js +5 -0
- package/dist/web/assets/KindPage-Bb3Kp4-q.js +6 -0
- package/dist/web/assets/LiveDevice-OyxEiqBt.js +1 -0
- package/dist/web/assets/Migration-C80mGA3h.js +8 -0
- package/dist/web/assets/Mobile-C4wVBYfr.js +1 -0
- package/dist/web/assets/Observability-DdTOLp2C.js +1 -0
- package/dist/web/assets/PageAgent-Bi53-H99.js +1 -0
- package/dist/web/assets/Product-0LXndvp-.js +12 -0
- package/dist/web/assets/Production-oTXhv40a.js +1 -0
- package/dist/web/assets/Quality-CY0CJF9e.js +1 -0
- package/dist/web/assets/Readiness-Bv9uTTiI.js +1 -0
- package/dist/web/assets/Record-C-kyOkYq.js +1 -0
- package/dist/web/assets/Regression-CwKxvG1h.js +5 -0
- package/dist/web/assets/RelationGraph-BQl3M4zd.js +1 -0
- package/dist/web/assets/Reports-Ck8rc3br.js +2 -0
- package/dist/web/assets/Responsive-COmV2NXo.js +3 -0
- package/dist/web/assets/RunDiff-BBT1sQLh.js +1 -0
- package/dist/web/assets/Settings-7aMk9Sqx.js +21 -0
- package/dist/web/assets/Steps-C_vL6-8p.js +3 -0
- package/dist/web/assets/TestData-KzMy9N9f.js +2 -0
- package/dist/web/assets/TestManagement-BCEhOGB9.js +4 -0
- package/dist/web/assets/WhatsNew-DTcaqdOJ.js +1 -0
- package/dist/web/assets/agentSettingsSheet-DM1aa237.js +1 -0
- package/dist/web/assets/choice-B6z9CWyZ.js +1 -0
- package/dist/web/assets/code-DzYywAs5.js +1 -0
- package/dist/web/assets/{coverage-xSRsKFL6.js → coverage-BhtF065n.js} +4 -4
- package/dist/web/assets/dataParts-BNDVxwFb.js +3 -0
- package/dist/web/assets/desktopAppPath-D4hHP56R.js +1 -0
- package/dist/web/assets/frame-CNYHTG4T.js +13 -0
- package/dist/web/assets/index-B1Q2Dlqw.js +56 -0
- package/dist/web/assets/index-sxUpjgyw.css +2 -0
- package/dist/web/assets/markdown-BhU7ng6c.js +8 -0
- package/dist/web/assets/pageBack-BoSbGSU6.js +3 -0
- package/dist/web/assets/palette-BsY8OLxd.js +1 -0
- package/dist/web/assets/paletteCommands-DflHQ05x.js +1 -0
- package/dist/web/assets/parts-C4QMgN_N.js +1 -0
- package/dist/web/assets/preload-helper-qorOEK5q.js +1 -0
- package/dist/web/assets/productParts-Dxl-TQKY.js +1 -0
- package/dist/web/assets/qualityParts-ClGKtjEv.js +1 -0
- package/dist/web/assets/radio-DDxnnflQ.js +1 -0
- package/dist/web/assets/recordTest-B33rIncn.js +1 -0
- package/dist/web/assets/route-D9uPlFWw.js +1 -0
- package/dist/web/assets/sectionList-e5mFDaS2.js +1 -0
- package/dist/web/assets/stepper-DSDz0uu8.js +1 -0
- package/dist/web/index.html +10 -9
- package/docs/ARCHITECTURE_REFERENCE.md +1 -0
- package/docs/WEB_APP.md +6 -3
- package/docs/user-guide.html +26 -7
- package/forgeqe.example.yaml +3 -2
- package/llms.example.json +22 -0
- package/package.json +1 -1
- package/prompts/api-scenarios.md +1 -0
- package/prompts/brain.md +1 -0
- package/prompts/test-agent.md +0 -2
- package/prompts/test-rules.md +3 -8
- package/py/forgeqe_desktop/replay.py +48 -1
- package/py/forgeqe_desktop/workflow.py +79 -7
- package/py/forgeqe_engine/capture.py +19 -4
- package/py/forgeqe_engine/cli.py +12 -10
- package/py/forgeqe_engine/clientcert.py +28 -0
- package/py/forgeqe_engine/copilot_gateway.py +208 -23
- package/py/forgeqe_engine/d365.py +182 -0
- package/py/forgeqe_engine/logins.py +20 -16
- package/py/forgeqe_engine/memory.py +9 -3
- package/py/forgeqe_engine/recordsession.py +23 -3
- package/py/forgeqe_engine/webrecord.py +16 -0
- package/py/forgeqe_engine/webrecord_page.py +26 -1
- package/py/forgeqe_mobile/appium_driver.py +26 -0
- package/py/forgeqe_mobile/maestro.py +5 -1
- package/dist/web/assets/Agent-BadQe1GY.js +0 -8
- package/dist/web/assets/AgentWork-BGc6uVxB.js +0 -2
- package/dist/web/assets/ApiTests-Bo4ds0wk.js +0 -14
- package/dist/web/assets/Browse-CmVZJZ72.js +0 -1
- package/dist/web/assets/Chat-LTtQQHqr.js +0 -3
- package/dist/web/assets/CommandPalette-Dl_DibqU.js +0 -1
- package/dist/web/assets/Compare-Dlzg7S1a.js +0 -1
- package/dist/web/assets/Cost-DRKVox_i.js +0 -1
- package/dist/web/assets/Data-c2c1QLI9.js +0 -6
- package/dist/web/assets/Desktop-BMLYLWq1.js +0 -1
- package/dist/web/assets/DesktopReview-CO0vz-8o.js +0 -2
- package/dist/web/assets/DeviceScreen-CCDj-wqV.js +0 -1
- package/dist/web/assets/Evidence-BQmhYE2G.js +0 -1
- package/dist/web/assets/Explore-CVurlUoU.js +0 -2
- package/dist/web/assets/Features-DPc3_RSA.js +0 -1
- package/dist/web/assets/Flags-D4d9STIv.js +0 -2
- package/dist/web/assets/Flaky-Dt3iYOZg.js +0 -1
- package/dist/web/assets/Impact-CKy2Ezzt.js +0 -3
- package/dist/web/assets/Jobs-BZ4zn_7P.js +0 -5
- package/dist/web/assets/KindPage-joSX8gyV.js +0 -6
- package/dist/web/assets/LiveDevice-DQNdKoh3.js +0 -1
- package/dist/web/assets/Migration-EO--lNV1.js +0 -8
- package/dist/web/assets/Mobile-DWGNs3HT.js +0 -1
- package/dist/web/assets/Observability-DPjKbwcO.js +0 -1
- package/dist/web/assets/PageAgent-h70DL1L7.js +0 -1
- package/dist/web/assets/Product-ddlw8A_d.js +0 -12
- package/dist/web/assets/Production-svTscJhy.js +0 -1
- package/dist/web/assets/Quality-CgIo3fM8.js +0 -1
- package/dist/web/assets/Readiness-D6s73wXK.js +0 -1
- package/dist/web/assets/Record-Cmzr-0-f.js +0 -1
- package/dist/web/assets/Regression--3mygZAw.js +0 -5
- package/dist/web/assets/RelationGraph-BZYcwCVA.js +0 -1
- package/dist/web/assets/Reports-CDv_x9iB.js +0 -2
- package/dist/web/assets/Responsive-BhRYdJlZ.js +0 -3
- package/dist/web/assets/RunDiff-CO8asgjK.js +0 -1
- package/dist/web/assets/Settings-D3zWorNs.js +0 -21
- package/dist/web/assets/Steps-Dn12ePte.js +0 -3
- package/dist/web/assets/TestCases-CzXHBm5G.js +0 -1
- package/dist/web/assets/TestData-CL9bxSAI.js +0 -2
- package/dist/web/assets/TestDebt-B1_-OBJe.js +0 -1
- package/dist/web/assets/TestManagement-MwMgDuO_.js +0 -4
- package/dist/web/assets/WhatsNew-DLE9LimG.js +0 -1
- package/dist/web/assets/agents-DPabR9dS.js +0 -1
- package/dist/web/assets/dataParts-DAuDeT2W.js +0 -3
- package/dist/web/assets/desktopAppPath-C_bB4dWx.js +0 -1
- package/dist/web/assets/dm-sans-latin-400-normal-BwCSEQnW.woff +0 -0
- package/dist/web/assets/dm-sans-latin-400-normal-CW0RaeGs.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-500-normal-B9HHJjqV.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-500-normal-Dr3UlScf.woff +0 -0
- package/dist/web/assets/dm-sans-latin-600-normal-Aqo67rzb.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-600-normal-BmdmIIQ2.woff +0 -0
- package/dist/web/assets/dm-sans-latin-ext-400-normal-BjWJ59Pq.woff +0 -0
- package/dist/web/assets/dm-sans-latin-ext-400-normal-BtiwyxMk.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-ext-500-normal-BJfUCQsA.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-ext-500-normal-DR84L5F-.woff +0 -0
- package/dist/web/assets/dm-sans-latin-ext-600-normal-4vooXBpG.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-ext-600-normal-DRtaDpgU.woff +0 -0
- package/dist/web/assets/frame-DBWtBguh.js +0 -13
- package/dist/web/assets/index-ByIauY65.css +0 -2
- package/dist/web/assets/index-Tsofflw2.js +0 -57
- package/dist/web/assets/input-DX7REka8.js +0 -1
- package/dist/web/assets/markdown-Cj6qWQq7.js +0 -8
- package/dist/web/assets/pageBack-DmmT2q53.js +0 -3
- package/dist/web/assets/palette-CtM-T-2Q.js +0 -1
- package/dist/web/assets/paletteCommands-BYTeXpSW.js +0 -1
- package/dist/web/assets/parts-BQWLwMBf.js +0 -1
- package/dist/web/assets/productParts-2Ar8qxlW.js +0 -1
- package/dist/web/assets/qualityParts-_Sify8OE.js +0 -1
- package/dist/web/assets/recordTest-CL1Z2YWn.js +0 -1
- package/dist/web/assets/route-D8G-pTdk.js +0 -1
- package/dist/web/assets/stepper-p4Pkqn9_.js +0 -1
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/paletteCommands-BYTeXpSW.js","assets/route-D8G-pTdk.js","assets/rolldown-runtime-XKyaHtl9.js","assets/agents-DPabR9dS.js","assets/index-Tsofflw2.js","assets/jsx-runtime-LKYXHABd.js","assets/input-DX7REka8.js","assets/pageBack-DmmT2q53.js","assets/palette-CtM-T-2Q.js","assets/when-BuWCTaKm.js","assets/markdown-Cj6qWQq7.js","assets/default-DB4ZMZxa.js","assets/index-ByIauY65.css","assets/coverage-xSRsKFL6.js","assets/CommandPalette-Dl_DibqU.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$n as t,$t as n,A as r,An as i,At as a,C as o,Cr as s,D as c,Dn as l,En as u,Er as d,Et as f,Fn as p,Gn as m,H as h,Hr as g,I as _,In as v,K as y,Kr as b,Ln as x,Lt as ee,M as S,Mn as C,N as te,Nn as ne,Nt as w,O as re,Ot as T,Pr as ie,Pt as ae,Q as oe,Rr as se,Rt as ce,S as le,Sn as ue,T as de,Tr as fe,Tt as pe,U as me,Un as he,Ut as ge,Vr as _e,W as ve,Wn as ye,X as be,Xn as xe,Y as Se,Yt as Ce,Zn as we,Zt as Te,_n as Ee,_r as De,_t as Oe,a as ke,an as Ae,ar as je,b as Me,br as Ne,en as Pe,er as Fe,f as Ie,fr as Le,ft as Re,g as ze,gr as Be,h as Ve,hn as He,ir as Ue,it as We,jn as Ge,jr as Ke,kn as qe,kt as Je,ln as Ye,m as Xe,mr as Ze,mt as Qe,nn as $e,nr as et,o as tt,p as nt,q as rt,qn as it,r as E,rn as at,s as ot,sn as st,sr as ct,tn as lt,tt as ut,u as dt,un as ft,v as pt,vr as mt,w as ht,wr as gt,wt as _t,xr as vt,xt as yt,y as bt,yn as xt,yt as St,z as Ct,zt as wt}from"./route-D8G-pTdk.js";import{A as Tt,f as Et,n as Dt,u as Ot,y as kt}from"./agents-DPabR9dS.js";import{t as At}from"./jsx-runtime-LKYXHABd.js";import{A as D,At as jt,H as O,Ht as Mt,Mt as Nt,Pt,Wt as Ft,Z as It,j as Lt,l as k,n as Rt,o as zt,q as Bt,r as Vt,s as Ht,t as Ut,z as Wt}from"./input-DX7REka8.js";import{C as Gt,E as A,S as Kt,T as qt,_ as Jt,a as Yt,c as Xt,d as Zt,f as Qt,g as $t,h as en,l as tn,m as nn,p as rn,r as an,u as on,w as j,y as sn}from"./pageBack-DmmT2q53.js";import{F as cn,L as ln,R as un,a as dn,i as fn,j as pn,n as mn,u as M}from"./palette-CtM-T-2Q.js";var N=e(b(),1),P=At();function hn({open:e,onClose:t,title:n,description:r,children:i,footer:a,wide:o}){let s=(0,N.useRef)(null),c=(0,N.useId)(),l=(0,N.useRef)({title:n,description:r,children:i,footer:a});e&&(l.current={title:n,description:r,children:i,footer:a});let[u,d]=(0,N.useState)(!1),f=e?{title:n,description:r,children:i,footer:a}:l.current;return(0,N.useEffect)(()=>{let t=s.current;if(!t)return;if(e){t.classList.remove(`is-closing`),d(!1),t.open||t.showModal();return}if(!t.open)return;if(window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return t.close();t.classList.add(`is-closing`),d(!0);let n=setTimeout(()=>{t.classList.remove(`is-closing`),d(!1),t.close()},150);return()=>clearTimeout(n)},[e]),(0,P.jsx)(`dialog`,{ref:s,"aria-labelledby":c,onCancel:e=>{e.target===s.current&&(e.preventDefault(),t())},onClick:e=>{e.target===s.current&&t()},className:D(`sheet fixed inset-y-0 right-0 left-auto m-0 h-[calc(100dvh/var(--ui-zoom))] max-h-none w-full border-0 border-l border-line bg-bg p-0 text-ink shadow-menu backdrop:bg-[rgba(17,25,40,0.28)]`,o?`max-w-[760px]`:`max-w-[480px]`),children:(e||u)&&(0,P.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-4 border-b border-line-soft px-6 pt-6 pb-4`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,P.jsx)(`h2`,{id:c,className:`m-0 text-lg font-semibold`,children:f.title}),f.description&&(0,P.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-muted`,children:f.description})]}),(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Close`,"data-tip":`Close`,onClick:t,className:`-mt-1 -mr-2`,children:(0,P.jsx)(g,{size:20,"aria-hidden":`true`})})]}),(0,P.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-6`,children:f.children}),(0,P.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-line-soft px-6 py-4`,children:f.footer})]})})}var gn=new Map,_n=!1,vn=()=>typeof document>`u`?null:document,yn=()=>vn()?.visibilityState===`hidden`;function bn(){if(!yn())for(let e of[...gn.values()])e()}function xn(e,t){let n=setInterval(()=>{yn()||e()},t);gn.set(n,e);let r=vn();return r&&!_n&&(r.addEventListener(`visibilitychange`,bn),_n=!0),n}function Sn(e){if(e==null)return;clearInterval(e),gn.delete(e);let t=vn();t&&_n&&gn.size===0&&(t.removeEventListener(`visibilitychange`,bn),_n=!1)}function F({open:e,id:t,className:n,children:r}){let[i,a]=(0,N.useState)(e),[o,s]=(0,N.useState)(e),[c,l]=(0,N.useState)(e);return(0,N.useEffect)(()=>{if(e){a(!0);let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>s(!0))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}}s(!1),l(!1);let t=setTimeout(()=>a(!1),320);return()=>clearTimeout(t)},[e]),i?(0,P.jsx)(`div`,{id:t,inert:!e||void 0,className:D(`collapse-box`,o&&`is-open`),onTransitionEnd:t=>{t.target===t.currentTarget&&t.propertyName===`grid-template-rows`&&(e?l(!0):a(!1))},children:(0,P.jsx)(`div`,{className:D(`min-h-0 min-w-0`,c?`overflow-visible`:`overflow-hidden`),children:(0,P.jsx)(`div`,{className:n,children:r})})}):null}var Cn=null,wn=e=>void(Cn=e),Tn=/password|secret|token|api.?key|\bkey\b|credential|\bprod(uction)?\b|\bprd\b|\blive\b/i,En=1e3,Dn=60,On=e=>e.replace(/[\u0000-\u001f\u007f\u2028\u2029]+/g,` `).replace(/\s+/g,` `).trim();function kn(e){let t=new Set,n=[];for(let r of e){let e=On(r.label).slice(0,Dn);if(!e||r.kind===`link`&&!/^#\/[^\s]*$/.test(r.href??``))continue;let i=`${r.kind} ${e.toLowerCase()}`;if(t.has(i)||(t.add(i),(r.kind===`setting`||r.kind===`field`||r.kind===`button`)&&Tn.test(e)))continue;let a=r.value===void 0?void 0:On(r.value).slice(0,Dn);if(n.push({ref:`c${n.length+1}`,kind:r.kind,label:e,...a===void 0?{}:{value:a},from:r}),n.length>=120)break}return n}var An=e=>e.map(e=>`${e.ref} ${e.kind}: ${e.label}${e.value===void 0?``:` (now: ${e.value||`empty`})`}`).join(`
|
|
3
|
-
`);function jn(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(typeof n.ref!=`string`||!/^c\d{1,3}$/.test(n.ref)||typeof n.label!=`string`)return null;let r=typeof n.text==`string`?On(n.text).slice(0,En):``;return{ref:n.ref,label:On(n.label),text:r}}function Mn(e,t){let n=e.find(e=>e.ref===t.ref);return!n||n.label.toLowerCase()!==t.label.toLowerCase()?`The page changed since it was read: read it again.`:(n.kind===`search`||n.kind===`field`)&&!t.text?`Say what to type into “${n.label}”.`:n.kind===`setting`&&!t.text?`Say what to set “${n.label}” to.`:n.kind!==`search`&&n.kind!==`setting`&&n.kind!==`field`&&t.text?`“${n.label}” takes a click, not text.`:n}var Nn=()=>/^#\/settings(?:\/|$)/.test(location.hash)&&!/^#\/settings\/secrets/.test(location.hash);function Pn(e){let t=e.id?document.querySelector(`label[for="${CSS.escape(e.id)}"]`):null,n=e.getAttribute(`aria-labelledby`)?.split(/\s+/).map(e=>document.getElementById(e)?.innerText||``).join(` `);return e.getAttribute(`aria-label`)||t?.innerText||n||e.closest(`label`)?.innerText||``}function Fn(e){return e instanceof HTMLInputElement&&e.type===`checkbox`?e.checked?`on`:`off`:e.getAttribute(`role`)===`switch`?e.getAttribute(`aria-checked`)===`true`?`on`:`off`:e instanceof HTMLSelectElement?e.selectedOptions[0]?.text||``:e.value??``}function In(){let e=[],t=e=>e.offsetParent!==null&&!e.closest(`[aria-label="Talk"]`)&&!e.closest(`[inert]`),n=e=>e.getAttribute(`aria-label`)||e.innerText||e.getAttribute(`placeholder`)||e.getAttribute(`title`)||``,r=Nn();for(let i of document.querySelectorAll(`a[href^="#/"], [role="tab"], [role="radiogroup"] [role="radio"], input, textarea, select, [role="switch"], button, [role="button"]`)){if(!t(i))continue;let a=i.disabled||i.readOnly||i.getAttribute(`aria-disabled`)===`true`;if(!i.closest(`dialog[open], [role='dialog'], [role='alertdialog']`)||i.matches(`button, [role='button']`)&&/^(cancel|close|no|back|not now)$/i.test(On(n(i)))){if(i instanceof HTMLTextAreaElement)a||e.push({kind:r?`setting`:`field`,label:Pn(i)||i.placeholder||`Text`,value:r?Fn(i):void 0,el:i});else if(i.matches(`button, [role='button']`)&&!i.matches(`[role='tab'], [role='radio'], [role='switch']`))a||e.push({kind:`button`,label:n(i),el:i});else if(!(i instanceof HTMLInputElement&&[`hidden`,`password`,`file`,`submit`,`button`,`image`,`reset`].includes(i.type))){if(i instanceof HTMLInputElement&&i.type!==`checkbox`&&i.type!==`radio`){let t=`${i.getAttribute(`aria-label`)||``} ${i.placeholder||``} ${i.type}`;if(a)continue;/search|filter|find/i.test(t)?e.push({kind:`search`,label:i.getAttribute(`aria-label`)||i.placeholder||`Search`,el:i}):r?e.push({kind:`setting`,label:Pn(i),value:Fn(i),el:i}):e.push({kind:`field`,label:Pn(i)||i.placeholder||`Text`,el:i})}else i instanceof HTMLSelectElement||i.getAttribute(`role`)===`switch`||i instanceof HTMLInputElement&&i.type===`checkbox`?r&&!a&&e.push({kind:`setting`,label:Pn(i)||n(i),value:Fn(i),el:i}):i.matches(`a`)?e.push({kind:`link`,label:n(i),href:i.getAttribute(`href`)||``,el:i}):i instanceof HTMLInputElement||e.push({kind:i.getAttribute(`role`)===`tab`?`tab`:`option`,label:n(i),el:i})}}}return e}var Ln=()=>kn(In());function Rn(e){let t=Ln(),n=((document.querySelector(`[data-screen]`)??document.body).innerText||``).replace(/[ \t]+/g,` `).replace(/\n{3,}/g,`
|
|
4
|
-
|
|
5
|
-
`).trim(),r=An(t);return`${r?`Controls (page_act takes a ref and its label):\n${r}\n\n`:``}Page text:\n${n}`.slice(0,e)}function zn(e,t){if(e instanceof HTMLInputElement&&e.type===`checkbox`){let n=Bn(t);return n===null?`Say on or off.`:(e.checked!==n&&e.click(),null)}if(e.getAttribute(`role`)===`switch`){let n=Bn(t);return n===null?`Say on or off.`:(e.getAttribute(`aria-checked`)===`true`!==n&&e.click(),null)}if(e instanceof HTMLSelectElement){let n=[...e.options].find(e=>e.text.trim().toLowerCase()===t.toLowerCase()||e.value.toLowerCase()===t.toLowerCase());return n?(e.value=n.value,e.dispatchEvent(new Event(`change`,{bubbles:!0})),null):`It is one of: ${[...e.options].map(e=>e.text.trim()).filter(Boolean).slice(0,8).join(`, `)}.`}let n=e;return Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,`value`)?.set?.call(n,t),n.dispatchEvent(new Event(`input`,{bubbles:!0})),n.dispatchEvent(new Event(`change`,{bubbles:!0})),null}var Bn=e=>/^(on|yes|true|enabled?|shown?)$/i.test(e)?!0:!/^(off|no|false|disabled?|hidden)$/i.test(e)&&null;async function Vn(e){let t=jn(e);if(!t)return`That is not a control of this page.`;let n=Mn(Ln(),t);if(typeof n==`string`)return n;let r=n.from.el;if(n.kind===`setting`||n.kind===`option`&&Nn()){let e=n.kind===`setting`?t.text:n.label;return Cn?await Cn(n.kind===`setting`?`Change ${n.label} to ${e}?`:`Switch to ${e}?`)?n.kind===`option`?(r.click(),`Switched to ${e}. Settings saves it.`):zn(r,t.text)??`Changed ${n.label} to ${t.text}. Settings saves it.`:`Not changed: the person did not say yes.`:`Changing a setting needs Talk on: ask the person to change it on the page.`}if(n.kind===`button`)return Cn?await Cn(`Press ${n.label}?`)?(r.click(),`Pressed ${n.label}.`):`Not pressed: the person did not say yes.`:`Pressing a button needs Talk on: ask the person to press it.`;if(n.kind===`field`){let e=r instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype;return Object.getOwnPropertyDescriptor(e,`value`)?.set?.call(r,t.text),r.dispatchEvent(new Event(`input`,{bubbles:!0})),r.focus(),`Typed into ${n.label}.`}return n.kind===`search`&&r instanceof HTMLInputElement?(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set?.call(r,t.text),r.dispatchEvent(new Event(`input`,{bubbles:!0})),r.focus(),`Typed “${t.text}” into ${n.label}.`):(r.click(),n.kind===`link`?`Opened ${n.label}.`:`Picked ${n.label}.`)}var Hn=[`open`,`open_run`,`open_chat`,`search`,`back`,`new_chat`,`set`,`read`,`act`],Un={theme:[`light`,`dark`,`system`],sidebar:[`open`,`closed`],browser:[`shown`,`hidden`],talk:[`off`]},Wn=8e3,Gn=/^(?:latest|last|newest|most recent)?$/i,Kn=/^[A-Za-z0-9_-]{1,80}$/,qn=e=>e.replace(/[\u0000-\u001f\u007f]+/g,` `).trim().slice(0,1200);function Jn(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.id!=`string`||!Kn.test(t.id)||!Hn.includes(t.action))return null;let n=typeof t.what==`string`?qn(t.what):void 0;return{id:t.id,action:t.action,...n?{what:n}:{}}}function Yn(e,t){let n=e=>{let t=e.toLowerCase().replace(/[^a-z]/g,``).replace(/c(?=[eiy])/g,`s`).replace(/c/g,`k`).replace(/ph/g,`f`).replace(/sh/g,`s`);return((/^[aeiou]/.test(t)?`a`:``)+t.replace(/[aeiouyhw]/g,``)).replace(/(.)\1+/g,`$1`)},r=t.replace(/^(the|a|an|my)\s+|\s+(page|section|settings?)$/gi,``).toLowerCase().replace(/[^a-z]/g,``),i=n(r);if(i.length<2)return[];let a=e.filter(e=>e.kind!==`field`).map(e=>{let t=e.label.toLowerCase().replace(/[^a-z]/g,``),a=Xn(i,n(t))/Math.max(i.length,n(t).length);return{label:e.label,sound:a,d:a+.5*Math.abs(r.length-t.length)/Math.max(r.length,t.length)}}).filter(e=>e.sound<=.5).sort((e,t)=>e.d-t.d);return[...new Set(a.map(e=>e.label))].slice(0,3)}function Xn(e,t){let n=Array.from({length:t.length+1},(e,t)=>t);for(let r=1;r<=e.length;r++){let i=n[0];n[0]=r;for(let a=1;a<=t.length;a++){let o=n[a];n[a]=Math.min(n[a]+1,n[a-1]+1,i+(e[r-1]===t[a-1]?0:1)),i=o}}return n[t.length]}var Zn=e=>e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,``);function Qn(e,t){let n=Zn(t),r=n.length>=4?e.filter(e=>e.kind!==`field`&&Zn(e.label)===n):[];return r.length===1?r[0]:void 0}var $n=/^(?:settings\s*[›>:/-]\s*(.+)|(?:the\s+)?(.+?)\s+settings?)$/i;async function er(e,t){let n=(e.what||``).trim();switch(e.action){case`open`:{let e=await t.commands(),r=$n.exec(n),i=r?(r[1]||r[2]||``).trim():``,a=n?i&&mn(e.filter(e=>e.kind===`setting`),i.toLowerCase())||mn(e,n.toLowerCase())||Qn(e,n):void 0;if(!a){let t=Yn(e,n);return`Nothing in ForgeQE is called “${n}”.${t.length?` The nearest: ${t.join(`, `)}.`:``}`}return t.go(a.href)===!1?`${a.label} is already open.`:`Opened ${a.label}.`}case`open_run`:{let e=await t.runs(),r=Gn.test(n)?e[0]:e.find(e=>e.name===n)??e.find(e=>e.title.toLowerCase()===n.toLowerCase());return r?(t.go(E(`runs`,encodeURIComponent(r.name))),`Opened the run “${r.title||r.name}”.`):e.length?`No run is called “${n}”.`:`There are no runs yet.`}case`open_chat`:{let e=await t.chats(),r=Gn.test(n)?e.find(e=>e.id!==t.current):e.find(e=>e.id===n)??e.find(e=>e.title.toLowerCase()===n.toLowerCase());return r?(t.go(E(`chats`,r.id)),`Opened the chat “${r.title}”.`):`No chat is called “${n}”.`}case`search`:return n?(t.find(n),`Searching for “${n}”.`):`Nothing to search for.`;case`back`:return t.back(),`Went back.`;case`new_chat`:return t.go(E()),`Opened a new chat.`;case`set`:{let[e,r,...i]=n.split(` `),a=e&&Object.hasOwn(Un,e)?Un[e]:void 0;return!a||!r||i.length||!a.includes(r)?`That cannot be changed from here.`:t.set?await t.set(e,r):`That cannot be changed from here.`}case`read`:return(t.screen?.(Wn)??``).slice(0,Wn);case`act`:return t.actOn?await t.actOn(n):`That cannot be done from here.`}}var tr=new Set;function nr(e,t){tr.has(e.id)||(tr.add(e.id),t(e))}function rr(e,t,n,r){let i=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(n&&e){if(i.current!==e){i.current=e;for(let e of t)tr.add(e.id)}else for(let e of t)tr.has(e.id)||(tr.add(e.id),r(e))}},[e,t.length,n])}var ir=(0,N.createContext)(null);function ar({pages:e,find:t,set:n,children:r}){let i=(0,N.useRef)(null),a=(0,N.useCallback)(r=>({commands:()=>i.current??=Ht(()=>import(`./paletteCommands-BYTeXpSW.js`).then(t=>t.everyCommand(e)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),runs:async()=>(await jt.list()).runs.map(e=>({name:e.name,title:e.title})),chats:async()=>(await It.list()).chats.map(e=>({id:e.id,title:e.title})),find:t,go:e=>location.hash.replace(/^#/,``)===e.replace(/^#/,``)?(window.dispatchEvent(new HashChangeEvent(`hashchange`)),!1):(location.hash=e,!0),back:()=>history.back(),...r?{current:r}:{},...n?{set:(e,t)=>n(e,t,r)}:{},screen:Rn,actOn:Vn}),[e,t,n]),o=(0,N.useCallback)(async(e,t)=>{let n=await er(e,a(t)).catch(e=>`That did not work: ${e.message}`);return t&&/^act_[a-f0-9]{16}$/.test(e.id)&&await It.screen(t,e.id,n).catch(()=>{}),n},[a]),s=(0,N.useMemo)(()=>({act:o}),[o]);return(0,P.jsx)(ir.Provider,{value:s,children:r})}function or(){let e=(0,N.useContext)(ir);return e?e.act:async()=>``}var sr=16e3;function cr(e,t){if(!e.length||!(t>0))return new Int16Array;let n=t/sr,r=Math.floor(e.length/n),i=new Int16Array(r);for(let t=0;t<r;t++){let r=Math.floor(t*n),a=Math.max(r+1,Math.floor((t+1)*n)),o=0;for(let t=r;t<a;t++)o+=e[t]??0;let s=Math.max(-1,Math.min(1,o/(a-r)));i[t]=Math.round(s<0?s*32768:s*32767)}return i}function lr(e){let t;try{t=atob(e)}catch{return new Float32Array}let n=Math.floor(t.length/2),r=new Float32Array(n);for(let e=0;e<n;e++){let n=t.charCodeAt(2*e)|t.charCodeAt(2*e+1)<<8;n>=32768&&(n-=65536),r[e]=n/32768}return r}var ur=(0,N.createContext)(null);function dr(){let e=(0,N.useContext)(ur);if(!e)throw Error(`useTalk outside TalkProvider`);return e}var fr=e=>{try{return localStorage.getItem(e)}catch{return null}},pr=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},mr=()=>{let e=fr(`forgeqe.voice.eagerness`);return e===`eager`||e===`patient`?e:`normal`},hr=e=>pr(`forgeqe.voice.eagerness`,e),gr=null;function _r(e=!1){return(e||!gr)&&(gr=Mt.status()),gr.catch(()=>gr=null),gr}var vr=()=>/^#\/chats\/([a-f0-9]{18})(?:[/?]|$)/.exec(location.hash)?.[1]??null,yr=320;function br({children:e}){let[t,n]=(0,N.useState)(`off`),[r,i]=(0,N.useState)(null),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(null),d=or(),f=(0,N.useRef)(null),p=(0,N.useRef)(null),m=(0,N.useRef)(null),h=(0,N.useRef)(null),g=(0,N.useRef)([]),_=(0,N.useRef)(0),v=(0,N.useRef)(0),y=(0,N.useRef)(new Int16Array),b=(0,N.useRef)({hearing:!1,thinking:!1,speaking:!1}),x=(0,N.useRef)(null),ee=(0,N.useRef)(0),S=(0,N.useRef)(new Map),C=(0,N.useCallback)(()=>{let e=b.current;n(e.hearing?`hearing`:e.speaking?`speaking`:e.thinking?`thinking`:`listening`)},[]),te=(0,N.useCallback)(e=>{v.current=e;let t=p.current,n=m.current;if(!t||!n)return;let r=t.currentTime;n.gain.cancelScheduledValues(r),n.gain.setValueAtTime(n.gain.value,r),n.gain.linearRampToValueAtTime(0,r+.08);let i=g.current;g.current=[],_.current=0,setTimeout(()=>{for(let e of i)try{e.stop()}catch{}n.gain.setValueAtTime(1,t.currentTime)},90),b.current.speaking=!1,C()},[C]),ne=(0,N.useCallback)((e,t,n)=>{let r=p.current,i=m.current;if(!r||!i||e<v.current)return;let a=lr(n);if(!a.length||!(t>=8e3&&t<=48e3))return;let o=r.createBuffer(1,a.length,t);o.copyToChannel(a,0);let s=r.createBufferSource();s.buffer=o,s.connect(i),_.current=Math.max(_.current,r.currentTime+.04),s.start(_.current),_.current+=o.duration,g.current.push(s),s.onended=()=>{g.current=g.current.filter(e=>e!==s),g.current.length||(b.current.speaking=!1,C())},b.current.speaking=!0,C()},[C]),w=(0,N.useCallback)(e=>{let t;try{t=JSON.parse(e)}catch{return}let n=e=>typeof e==`string`?e:``;switch(t.type){case`audio`:typeof t.gen==`number`&&typeof t.rate==`number`&&ne(t.gen,t.rate,n(t.pcm));break;case`interrupt`:typeof t.gen==`number`&&te(t.gen);break;case`chat`:{if(t.id===null){x.current=null,i(null),u(null);break}let e=n(t.id);if(!/^[a-f0-9]{18}$/.test(e))break;x.current=e,i(e);break}case`caption`:{let e=n(t.text).slice(0,300);t.who===`you`?u({who:`you`,text:e}):u(t=>({who:`atlas`,text:t?.who===`atlas`?`${t.text} ${e}`.slice(-300):e}));break}case`state`:for(let e of[`hearing`,`thinking`,`speaking`])typeof t[e]==`boolean`&&(b.current[e]=t[e]);typeof t.thinking==`boolean`&&o(t.thinking),C();break;case`app_action`:{let e=Jn(t);e&&(ee.current=Date.now(),nr(e,e=>d(e,x.current??void 0)));break}case`confirmed`:{let e=S.current.get(n(t.id));S.current.delete(n(t.id)),e?.(t.yes===!0);break}case`error`:c(n(t.message).slice(0,300))}},[d,te,ne,C]),re=()=>{wn(null);for(let e of S.current.values())e(!1);S.current.clear();try{f.current?.close()}catch{}f.current=null,h.current?.getTracks().forEach(e=>e.stop()),h.current=null,p.current?.close().catch(()=>{}),p.current=null,m.current=null,g.current=[],_.current=0,y.current=new Int16Array},T=(0,N.useCallback)(()=>{re(),b.current={hearing:!1,thinking:!1,speaking:!1},x.current=null,i(null),u(null),n(`off`),o(!1)},[]),ie=(0,N.useCallback)(async()=>{if(!f.current){c(``),n(`connecting`);try{if(!(await _r()).ready)throw Error(`Speech is not set up on this computer yet: Settings › Voice.`);Mt.warm().catch(()=>{});let e=new AudioContext;p.current=e;let t=e.createGain();t.connect(e.destination),m.current=t;let r=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}});h.current=r;let{default:a}=await Ht(async()=>{let{default:e}=await import(`./capture.worklet-C65DyLpl.js`);return{default:e}},[]);await e.audioWorklet.addModule(a);let o=new AudioWorkletNode(e,`forgeqe-capture`);e.createMediaStreamSource(r).connect(o),o.port.onmessage=t=>{let n=cr(t.data,e.sampleRate),r=new Int16Array(y.current.length+n.length);r.set(y.current),r.set(n,y.current.length);let i=0;for(;r.length-i>=yr;i+=yr)f.current?.readyState===WebSocket.OPEN&&f.current.send(r.slice(i,i+yr).buffer);y.current=r.slice(i)},x.current=vr(),i(x.current);let{ticket:s}=await Mt.ticket(x.current,mr()),c=new WebSocket(`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/api/voice/session?ticket=${s}`);c.binaryType=`arraybuffer`,c.onmessage=e=>typeof e.data==`string`&&w(e.data),c.onopen=()=>{b.current={hearing:!1,thinking:!1,speaking:!1},n(`listening`),wn(e=>new Promise(t=>{if(c.readyState!==WebSocket.OPEN)return t(!1);let n=Math.random().toString(36).slice(2,12);S.current.set(n,t),setTimeout(()=>S.current.get(n)===t&&(S.current.delete(n),t(!1)),35e3),c.send(JSON.stringify({type:`confirm`,id:n,text:e.slice(0,200)}))}))},c.onclose=()=>{f.current===c&&(re(),n(`off`))},f.current=c}catch(e){re(),n(`off`),c(e.name===`NotAllowedError`?`The browser was not allowed to use the microphone: allow it in the address bar, then try again.`:e.message)}}},[w]);(0,N.useEffect)(()=>()=>re(),[]),(0,N.useEffect)(()=>{let e=()=>{let e=()=>g.current.length?setTimeout(e,300):T();setTimeout(e,1500)};return window.addEventListener(`forgeqe:talk-off`,e),()=>window.removeEventListener(`forgeqe:talk-off`,e)},[T]),(0,N.useEffect)(()=>{if(t===`off`)return;let e=()=>{if(Date.now()-ee.current<3e3)return;let e=vr(),t=location.hash===``||location.hash===`#`||location.hash===`#/`;(e||t)&&(e??null)!==x.current&&f.current?.readyState===WebSocket.OPEN&&f.current.send(JSON.stringify({type:`page`,chat:e}))};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[t]);let ae=(0,N.useMemo)(()=>({phase:t,chat:r,working:a,error:s,line:l,start:()=>void ie(),end:T,dismiss:()=>c(``)}),[t,r,a,s,l,ie,T]);return(0,P.jsx)(ur.Provider,{value:ae,children:e})}function xr({chat:e,disabled:t}){let n=dr(),[r,i]=(0,N.useState)(null);(0,N.useEffect)(()=>{_r().then(e=>i(e.ready)).catch(()=>i(!1))},[]);let a=Tr(n,e),o=r===!1;return(0,P.jsx)(A,{variant:`ghost`,className:D(`flex-none px-2 text-[16px] sm:px-2`,a&&`bg-accent-soft text-accent-fg hover:bg-accent-soft`),"aria-label":`Talk`,"aria-pressed":a,disabled:o||t&&!a,"data-tip":o?`Talk needs a one-time setup: Settings › Voice`:a?`End the talk`:`Talk to Atlas: speech stays on this computer`,onClick:()=>{if(a)return n.end();n.phase!==`off`&&n.end(),n.start()},children:(0,P.jsx)(Ie,{"aria-hidden":`true`})})}function Sr({chat:e}){let t=dr(),n=Tr(t,e);if(!n&&!t.error)return null;let r=n&&t.phase!==`thinking`;return(0,P.jsxs)(`div`,{"aria-live":`polite`,className:`-mt-1 mb-4 flex flex-col gap-2 border-b border-line-soft pb-4 text-[13px]`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-7 flex-wrap items-center gap-x-2 gap-y-1`,children:[r?(0,P.jsx)(Gt,{state:Dr[t.phase],px:18}):(0,P.jsx)(Ie,{size:16,"aria-hidden":`true`,className:`text-muted`}),(0,P.jsx)(`span`,{className:`font-medium`,children:n?Er[t.phase]:`Talk stopped`}),n&&(0,P.jsx)(`span`,{className:`text-muted`,children:`Talk over Atlas any time; it stops and listens.`}),(0,P.jsx)(`span`,{className:`flex-auto`}),n?(0,P.jsx)(A,{size:`sm`,variant:`ghost`,onClick:t.end,children:`End`}):(0,P.jsx)(`button`,{type:`button`,"aria-label":`Close the note`,"data-tip":`Close the note`,onClick:t.dismiss,className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-[7px] border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,P.jsx)(g,{size:14,"aria-hidden":`true`})})]}),t.error&&(0,P.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:t.error})]})}function Cr({rail:e=!1}){let t=dr(),n=t.phase!==`off`,r=()=>n?t.end():t.start();return e?(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Talk`,"aria-pressed":n,"data-tip":`Talk to Atlas`,"data-tip-side":`left`,onClick:r,className:D(`size-9`,n&&`bg-accent-soft text-accent-fg`),children:(0,P.jsx)(Ie,{strokeWidth:1.8,"aria-hidden":`true`})}):(0,P.jsxs)(A,{size:`sm`,"aria-pressed":n,onClick:r,className:D(`w-full justify-start px-2`,n&&`bg-accent-soft text-accent-fg`),children:[(0,P.jsx)(Ie,{strokeWidth:1.8,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`flex-1 text-left`,children:`Talk`})]})}function wr(){let e=dr(),[t,n]=(0,N.useState)(location.hash);(0,N.useEffect)(()=>{let e=()=>n(location.hash);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let r=t===``||t===`#`||t===`#/`;if(e.phase===`off`||(e.chat?vr()===e.chat:r))return null;let i=`inline-flex min-h-7 flex-none items-center rounded-[8px] px-2 font-medium text-muted no-underline hover:bg-surface-strong hover:text-ink`;return(0,P.jsxs)(`div`,{role:`region`,"aria-label":`Talk`,"aria-live":`polite`,className:`fixed right-4 bottom-4 z-30 flex max-w-[min(560px,calc(100vw-32px))] items-center gap-2 rounded-full border border-line bg-bg py-1 pr-1 pl-4 text-[13px] shadow-menu`,children:[e.phase===`thinking`?(0,P.jsx)(Ie,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}):(0,P.jsx)(Gt,{state:Dr[e.phase],px:18}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.line?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`text-muted`,children:e.line.who===`you`?`You: `:`Atlas: `}),e.line.text]}):(0,P.jsx)(`span`,{className:`font-medium`,children:Er[e.phase]})}),e.chat&&(0,P.jsx)(`a`,{href:E(`chats`,e.chat),className:i,children:`Open the chat`}),(0,P.jsx)(`button`,{type:`button`,onClick:e.end,className:D(i,`cursor-pointer border-0 bg-transparent`),children:`End`})]})}var Tr=(e,t)=>e.phase!==`off`&&(e.chat??null)===t,Er={off:`Talk stopped`,connecting:`Starting Talk…`,listening:`Listening. Just talk.`,hearing:`Hearing you…`,thinking:`Listening while Atlas works.`,speaking:`Speaking.`},Dr={off:`idle`,connecting:`waiting`,listening:`waiting`,hearing:`recording`,thinking:`thinking`,speaking:`writing`};function Or({icon:e,logo:t,pixel:n,size:r=`md`,className:i}){return(0,P.jsx)(`span`,{"aria-hidden":`true`,className:D(`inline-flex flex-none items-center justify-center rounded-[10px]`,t?`border border-line bg-bg`:n||e&&qt.has(e)?`theme-side border border-line-soft`:`bg-surface-strong text-ink-2`,r===`lg`?`size-10`:`size-9`,i),children:n?(0,P.jsx)(k,{name:n,px:r===`lg`?24:20}):t?(0,P.jsx)(t,{className:r===`lg`?`size-5`:`size-[18px]`}):e?(0,P.jsx)(j,{icon:e,size:r===`lg`?20:18}):null})}var kr=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{};function Ar(e,t){let n=e;for(let e of t)n=kr(n)[e];return n}var jr=e=>e===void 0||e===``||typeof e==`number`&&Number.isNaN(e);function Mr(e,t,n){let[r,...i]=t;if(r===void 0)return e;let a={...e},o=i.length?Mr(kr(e[r]),i,n):n;return jr(o)||i.length&&jr(n)&&!Object.keys(kr(o)).length?delete a[r]:a[r]=o,a}function Nr(e,t,n){let r={};for(let[i,a]of Object.entries(e))r[i===t?n:i]=a;return r}function Pr(e,t){if(!(t in e))return t;for(let n=2;;n++)if(!(`${t}-${n}`in e))return`${t}-${n}`}var Fr=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Ir({checked:e,onChange:t,label:n,id:r,disabled:i}){return(0,P.jsx)(`button`,{type:`button`,role:`switch`,id:r,"aria-checked":e,"aria-label":n,disabled:i,onClick:()=>t(!e),className:D(`relative h-5 w-9 flex-none cursor-pointer rounded-full border-0 p-0 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e?`bg-accent`:`bg-line`),children:(0,P.jsx)(`span`,{"aria-hidden":`true`,className:D(`absolute top-1/2 size-4 -translate-y-1/2 rounded-full bg-white shadow-sm left-0.5 transition-transform`,e&&`translate-x-4`)})})}function Lr(e){let t=Zt.find(t=>t.agents?.includes(e));return!t||t.id===`agents`?{label:`All agents`,href:E(`agents`)}:{label:t.label,href:nn(t)}}var Rr=`orchestrator`;function zr(e){return e.page?Ot(e.page)??Dt.find(e=>e.id===`orchestrator`):Dt.find(t=>t.agent!==`forgeqe`&&e.title.startsWith(`${Et(t.agent).name}: `))??Dt.find(e=>e.id===`orchestrator`)}var Br=(e,t)=>t.filter(t=>zr(t)?.id===e.id);function Vr(e,t){if(e[0]!==`chats`||!e[1]||!t)return e;let n=zr(t);return n&&n.agent!==`forgeqe`?[`agents`,n.id]:e}function Hr(e){let t=e[0]===`chats`?e[1]:void 0,[n,r]=(0,N.useState)(null);return(0,N.useEffect)(()=>{if(!t)return;let e=!1;return It.events(t,2**53-1,!1).then(n=>!e&&r({id:t,title:n.title,...n.page?{page:n.page}:{}}),()=>{}),()=>{e=!0}},[t]),Vr(e,n&&n.id===t?n:null)}var Ur={x:0,y:0,w:0,h:0,on:!1},Wr=(e,t)=>e.on===t.on&&e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h;function Gr(e,t){if(!t||!t.isConnected||t.closest(`[inert]`)||!t.offsetHeight)return Ur;let n=0,r=0,i=t;for(;i&&i!==e;)n+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return i===e?{x:n,y:r,w:t.offsetWidth,h:t.offsetHeight,on:!0}:Ur}function Kr(e,t,n){let[r,i]=(0,N.useState)(Ur),a=(0,N.useCallback)(()=>{let n=e.current;if(!n)return;let r=Gr(n,n.querySelector(t));i(e=>Wr(e,r)?e:r)},[e,t]);return(0,N.useLayoutEffect)(a,[n,a]),(0,N.useLayoutEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(a);n.observe(t);for(let e of Array.from(t.children))n.observe(e);return()=>n.disconnect()},[a]),r}var qr=new Map,Jr=1500;function I({pill:e,className:t,memory:n,children:r}){let[i,a]=(0,N.useState)(()=>{let e=n?qr.get(n):void 0;return e&&Date.now()-e.at<Jr?e.pill:void 0});(0,N.useEffect)(()=>{n&&e.on&&qr.set(n,{pill:e,at:Date.now()})},[n,e]),(0,N.useEffect)(()=>{if(!i||!e.on)return;let t=0,n=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>a(void 0))});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}},[i,e.on]);let o=i&&e.on?i:e,s=(0,N.useRef)(!1),c=s.current;return o.on&&(s.current=!0),(0,P.jsx)(`span`,{"aria-hidden":`true`,className:D(`pointer-events-none absolute top-0 left-0 z-0 motion-reduce:transition-none`,c&&`transition-[transform,width,height,opacity] duration-(--motion) ease-out`,t),style:{transform:`translate(${o.x}px, ${o.y}px)`,width:o.w,height:o.h,opacity:+!!o.on},children:r})}var Yr=`flex w-fit max-w-full flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,Xr=e=>D(`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[7px] border-0 px-4 text-sm font-medium whitespace-nowrap`,e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),Zr=`rounded-[7px] bg-bg shadow-sm`,Qr=(e,t)=>D(Xr(e),`relative z-10 transition-colors duration-(--motion-fast)`,e&&t&&`bg-transparent shadow-none`);function $r({icon:e}){return typeof e==`object`&&e&&`pixel`in e?(0,P.jsx)(k,{name:e.pixel,px:18,className:`flex-none`}):(0,P.jsx)(j,{icon:e,size:16,className:`flex-none`})}function ei(e,t,n,r,i){let a=n===`ArrowRight`?e[(t+1)%e.length]:n===`ArrowLeft`?e[(t-1+e.length)%e.length]:void 0;return a?(i(a.id),document.getElementById(`${r}-${a.id}`)?.focus(),!0):!1}function ti({tabs:e,current:t,onPick:n,hrefOf:r,label:i,className:a,prefix:o=`tab`}){let s=o===`tab`?`panel`:`${o}-panel`,c=(0,N.useRef)(null),l=Kr(c,`[aria-selected="true"], [aria-current="page"]`,t);(0,N.useEffect)(()=>{let e=c.current?.querySelector(`[aria-selected="true"], [aria-current="page"]`),t=c.current;if(!e||!t)return;let n=e.offsetLeft-t.offsetLeft;n<t.scrollLeft?t.scrollLeft=n:n+e.offsetWidth>t.scrollLeft+t.clientWidth&&(t.scrollLeft=n+e.offsetWidth-t.clientWidth)},[t]);let u=D(`relative mb-6`,Yr,`flex-nowrap overflow-x-auto [scrollbar-width:thin]`,a),d=e=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)($r,{icon:e.icon}),e.label,e.n!==void 0&&e.n!==null&&(0,P.jsx)(`span`,{className:D(`text-[13px] font-normal tabular-nums`,e.tone||`text-muted`),children:e.n})]}),f=e=>D(Qr(t===e.id,l.on),`flex-none focus-visible:outline-offset-[-2px]`,e.mono&&`font-mono text-[13px] font-normal`);return r?(0,P.jsxs)(`nav`,{ref:c,"aria-label":i,className:u,children:[(0,P.jsx)(I,{pill:l,className:Zr,memory:`tabs:${i}`}),e.map(e=>(0,P.jsx)(`a`,{id:`${o}-${e.id}`,href:r(e.id),"aria-current":t===e.id?`page`:void 0,className:D(f(e),`no-underline hover:no-underline`,t===e.id&&`hover:text-ink`),children:d(e)},e.id))]}):(0,P.jsxs)(`div`,{ref:c,role:`tablist`,"aria-label":i,className:u,children:[(0,P.jsx)(I,{pill:l,className:Zr}),e.map((r,i)=>(0,P.jsx)(`button`,{id:`${o}-${r.id}`,type:`button`,role:`tab`,"aria-selected":t===r.id,"aria-controls":`${s}-${r.id}`,tabIndex:t===r.id?0:-1,onClick:()=>n?.(r.id),onKeyDown:t=>{n&&ei(e,i,t.key,o,n)&&t.preventDefault()},className:f(r),children:d(r)},r.id))]})}function ni({tabs:e,current:t,onPick:n,label:r,className:i,prefix:a=`tab`}){let o=a===`tab`?`panel`:`${a}-panel`,s=(0,N.useRef)(null),c=Kr(s,`[aria-selected="true"]`,t);return(0,P.jsxs)(`div`,{ref:s,role:`tablist`,"aria-label":r,className:D(`relative mb-6 flex flex-wrap gap-x-6 border-b border-line-soft`,i),children:[(0,P.jsx)(I,{pill:c,className:`border-b-2 border-ink`}),e.map((r,i)=>(0,P.jsxs)(`button`,{id:`${a}-${r.id}`,type:`button`,role:`tab`,"aria-selected":t===r.id,"aria-controls":`${o}-${r.id}`,tabIndex:t===r.id?0:-1,onClick:()=>n(r.id),onKeyDown:t=>{ei(e,i,t.key,a,n)&&t.preventDefault()},className:D(`relative z-10 -mb-px inline-flex min-h-11 cursor-pointer items-center gap-2 border-0 border-b-2 bg-transparent px-1 text-sm font-medium transition-colors duration-(--motion-fast)`,r.mono&&`font-mono text-[13px] font-normal`,t===r.id?D(`text-ink`,c.on?`border-transparent`:`border-ink`):`border-transparent text-muted hover:text-ink`),children:[r.label,r.n!==void 0&&r.n!==null&&(0,P.jsx)(`span`,{className:D(`text-[13px] font-normal tabular-nums`,r.tone||`text-muted`),children:r.n})]},r.id))]})}function ri({links:e,current:t,label:n,className:r}){let i=(0,N.useRef)(null),a=Kr(i,`[aria-current="page"]`,t);return(0,P.jsxs)(`nav`,{ref:i,"aria-label":n,className:D(`relative`,Yr,r),children:[(0,P.jsx)(I,{pill:a,className:Zr,memory:`links:${n}`}),e.map(e=>(0,P.jsxs)(`a`,{href:e.href,"aria-current":t===e.id?`page`:void 0,className:D(Qr(t===e.id,a.on),`no-underline hover:no-underline`,t===e.id&&`hover:text-ink`),children:[(0,P.jsx)($r,{icon:e.icon}),e.label]},e.id))]})}function ii({options:e,value:t,onChange:n,label:r,labelledBy:i,disabled:a=!1,className:o}){let s=e.filter(e=>!e.disabled&&!a),c=(0,N.useRef)(null),l=Kr(c,`[aria-checked="true"]`,t),u=(e,t)=>{let a=s.findIndex(t=>t.id===e),o=s[(a+t+s.length)%s.length];o&&(n(o.id),document.querySelector(`[data-choice="${CSS.escape(o.id)}"][data-group="${CSS.escape(r||i||``)}"]`)?.focus())};return(0,P.jsxs)(`span`,{ref:c,role:`radiogroup`,"aria-label":r,"aria-labelledby":i,className:D(`relative`,Yr,o),children:[(0,P.jsx)(I,{pill:l,className:Zr}),e.map(e=>{let o=a||!!e.disabled;return(0,P.jsxs)(`button`,{type:`button`,role:`radio`,"data-choice":e.id,"data-group":r||i||``,"aria-checked":t===e.id,"aria-disabled":o||void 0,tabIndex:t===e.id?0:-1,"data-tip":e.tip,onClick:()=>!o&&n(e.id),onKeyDown:t=>{(t.key===`ArrowRight`||t.key===`ArrowLeft`)&&(t.preventDefault(),u(e.id,t.key===`ArrowRight`?1:-1))},className:D(Qr(t===e.id,l.on),o&&`cursor-not-allowed opacity-50`),children:[e.icon,e.label,e.n!==void 0&&e.n!==null&&(0,P.jsx)(`span`,{className:D(`text-[13px] font-normal tabular-nums`,e.tone||`text-muted`),children:e.n})]},e.id)})]})}var ai={line:16,inset:24},oi={line:8,inset:16},si=(0,N.createContext)(null),ci=`relative z-10 flex h-8 short:h-7 w-full min-w-0 items-center gap-2 rounded-[8px] px-2 text-[13px] no-underline outline-none select-none focus-visible:ring-2 focus-visible:ring-accent`;function li({offsets:e,width:t,className:n,style:r}){if(!e.length)return null;let i=e[e.length-1],a=i+1;return(0,P.jsxs)(`svg`,{"aria-hidden":`true`,width:t,height:a,viewBox:`0 0 ${t} ${a}`,fill:`none`,style:r,className:D(`pointer-events-none absolute top-0 z-0 text-line-strong`,n),children:[(0,P.jsx)(`path`,{d:`M0.5 0 V${i-5}`,stroke:`currentColor`,strokeWidth:`1`}),e.map((e,n)=>(0,P.jsx)(`path`,{d:`M0.5 ${e-5} Q0.5 ${e} 5.5 ${e} H${t-.5}`,stroke:`currentColor`,strokeWidth:`1`},n))]})}function ui({lines:e,label:t,className:n,children:r}){let i=(0,N.useRef)(null),[a,o]=(0,N.useState)([]),s=N.Children.count(r),c=(0,N.useCallback)(()=>{let t=i.current;if(!t||!e)return;let n=Array.from(t.children).filter(e=>e.tagName.toLowerCase()!==`svg`&&!e.hasAttribute(`data-tree-group`)).map(e=>{let n=e.matches(`[data-tree-row]`)?e:e.querySelector(`[data-tree-row]`);if(!n)return 0;let r=0,i=n;for(;i&&i!==t;)r+=i.offsetTop,i=i.offsetParent;return i===t?Math.round(r+n.offsetHeight/2):0}).filter(e=>e>0);o(e=>e.join()===n.join()?e:n)},[e]);return(0,N.useLayoutEffect)(()=>{if(c(),!i.current||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(c);return e.observe(i.current),()=>e.disconnect()},[s,c]),(0,P.jsxs)(`div`,{ref:i,role:`group`,"aria-label":t,className:D(`relative flex flex-col gap-px`,n),style:e?{paddingLeft:e.inset}:void 0,children:[e&&(0,P.jsx)(li,{offsets:a,width:e.inset-e.line,style:{left:e.line}}),r]})}function di(){let e=(0,N.useContext)(si);return{onPointerEnter:t=>t.pointerType===`mouse`&&e?.hover(t.currentTarget),onFocus:t=>t.currentTarget.matches(`:focus-visible`)&&e?.hover(t.currentTarget)}}function fi({href:e,label:t,current:n,icon:r,badge:i,after:a,tip:o,className:s}){let c=di(),l=(0,P.jsxs)(`a`,{href:e,"data-tree-row":``,"aria-current":n?`page`:void 0,"data-tip":o,"data-tip-side":o?`right`:void 0,...c,className:D(ci,n?`font-medium text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:text-ink`,a&&`pr-8`,s),children:[r??(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`size-[18px] flex-none`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),i]});return a?(0,P.jsxs)(`div`,{className:`group relative`,children:[l,a]}):l}function pi(e,t,n){let[r,i]=(0,N.useState)(t),a=e??r;return[a,()=>{e===void 0&&i(!a),n?.(!a)}]}function mi({href:e,label:t}){return(0,P.jsx)(`a`,{href:e,"aria-label":t,"data-tip":t,"data-tip-side":`right`,className:`absolute top-1/2 right-[30px] z-20 flex size-6 -translate-y-1/2 items-center justify-center rounded-[6px] bg-surface-strong text-muted no-underline opacity-0 transition-opacity group-hover:opacity-100 hover:text-ink focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,P.jsx)(dt,{size:14,strokeWidth:2,"aria-hidden":`true`})})}function hi({label:e,href:t,current:n,className:r,children:i}){let a=(0,N.useId)(),o=`flex h-7 short:h-6 items-center rounded-[6px] px-2 text-[13px] font-medium text-muted no-underline`;return(0,P.jsxs)(`div`,{"data-tree-group":``,role:`group`,"aria-labelledby":a,className:D(`flex flex-col gap-px`,r),children:[t?(0,P.jsx)(`a`,{id:a,href:t,"aria-current":n?`page`:void 0,className:D(o,`hover:text-ink`,n&&`text-(--side-current-ink)`),children:e}):(0,P.jsx)(`span`,{id:a,className:o,children:e}),i]})}function gi({label:e,icon:t,badge:n,href:r,hrefLabel:i,current:a,open:o,defaultOpen:s=!1,onOpenChange:c,children:l,className:u}){let[d,f]=pi(o,s,c),p=(0,N.useId)(),m=di();return(0,P.jsxs)(`div`,{className:D(`flex flex-col gap-px`,u),children:[(0,P.jsxs)(`div`,{className:`group relative`,children:[(0,P.jsxs)(`button`,{type:`button`,"data-tree-row":``,"aria-expanded":d,"aria-controls":p,"aria-current":a?`page`:void 0,onClick:f,...m,className:D(ci,`cursor-pointer text-left`,a?`font-medium text-(--side-current-ink)`:`text-ink-2 hover:text-ink`),children:[t,(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),n,(0,P.jsx)(S,{size:14,strokeWidth:2,"aria-hidden":`true`,className:D(`flex-none text-muted transition-transform group-hover:text-ink motion-reduce:transition-none`,d&&`rotate-90`)})]}),r&&(0,P.jsx)(mi,{href:r,label:i||`Open ${e}`})]}),(0,P.jsx)(F,{open:d,id:p,children:(0,P.jsx)(ui,{lines:oi,label:e,children:l})})]})}function _i({label:e,icon:t,href:n,hrefLabel:i,current:a,lines:o,open:s,defaultOpen:c=!0,onOpenChange:l,children:u,className:d}){let[f,p]=pi(s,c,l),m=(0,N.useId)(),h=di();return(0,P.jsxs)(`div`,{className:D(`flex flex-col gap-px`,d),children:[(0,P.jsxs)(`div`,{className:`group relative`,children:[(0,P.jsxs)(`button`,{type:`button`,"data-tree-row":``,"aria-expanded":f,"aria-controls":m,"aria-current":a?`page`:void 0,onClick:p,...h,className:D(ci,`cursor-pointer text-left font-medium`,a?`text-(--side-current-ink)`:t?`text-ink`:`text-muted hover:text-ink`),children:[t,(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),(0,P.jsx)(r,{size:14,strokeWidth:2,"aria-hidden":`true`,className:D(`flex-none text-muted transition-transform group-hover:text-ink motion-reduce:transition-none`,!f&&`-rotate-90`)})]}),n&&(0,P.jsx)(mi,{href:n,label:i||`Open ${e}`})]}),(0,P.jsx)(F,{open:f,id:m,children:(0,P.jsx)(ui,{lines:o,label:e,children:u})})]})}function vi({routeKey:e,className:t,children:n}){let r=(0,N.useRef)(null),i=(0,N.useRef)(null),[a,o]=(0,N.useState)([]),[s,c]=(0,N.useState)(Ur),l=(0,N.useCallback)(()=>{let e=r.current;if(!e)return;let t=[...e.querySelectorAll(`[data-tree-row][aria-current="page"]`)].map(t=>Gr(e,t)).filter(e=>e.on);o(e=>e.length===t.length&&e.every((e,n)=>Wr(e,t[n]))?e:t);let n=i.current?.getAttribute(`aria-current`)===`page`?Ur:Gr(e,i.current);c(e=>Wr(e,n)?e:n)},[]);(0,N.useLayoutEffect)(l,[e,l]),(0,N.useLayoutEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(l);t.observe(e);let n=new MutationObserver(l);return n.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`aria-current`,`inert`],childList:!0}),()=>{t.disconnect(),n.disconnect()}},[l]);let u=(0,N.useRef)({hover:e=>{i.current=e,l()}}).current;return(0,P.jsx)(si.Provider,{value:u,children:(0,P.jsxs)(`div`,{ref:r,onPointerLeave:()=>u.hover(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||u.hover(null)},className:D(`relative flex w-full flex-col gap-px`,t),children:[(0,P.jsx)(I,{pill:s,className:`rounded-[8px] bg-surface-strong/60`}),a.map((e,t)=>(0,P.jsx)(I,{pill:e,className:`rounded-[8px] bg-(--side-current-bg)`},t)),n]})})}var yi={good:`pass`,bad:`fail`,same:`neutral`},bi={good:`text-pass`,bad:`text-fail`,same:`text-muted`};function xi(e){return e.dir===`same`||e.good===void 0?`same`:e.good?`good`:`bad`}function Si({children:e,label:t,className:n}){return(0,P.jsx)(`section`,{"aria-label":t,className:D(`grid grid-cols-[repeat(auto-fit,minmax(min(100%,150px),1fr))] overflow-hidden rounded-[14px] card border`,n),children:e})}function L({label:e,value:t,note:n,icon:r,period:i,change:a,tone:o,big:s,compact:c,className:l}){let u=a&&xi(a),d=a?.dir===`up`?fe:a?.dir===`down`?gt:void 0;return(0,P.jsxs)(`div`,{className:D(`-mr-px -mb-px flex min-w-0 flex-col border-r border-b border-line-soft`,c?`gap-1 px-4 py-2`:`gap-1 px-6 py-4`,l),children:[(0,P.jsxs)(`span`,{className:D(`flex min-w-0 items-center gap-2 font-medium text-ink`,`text-[13px]`),children:[r&&(0,P.jsx)(j,{icon:r,size:14,className:`flex-none text-muted`}),(0,P.jsx)(`span`,{className:`min-w-0`,children:e})]}),i&&(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:i}),(0,P.jsxs)(`span`,{className:D(`flex flex-wrap items-center gap-x-2 gap-y-1`,c?`mt-0`:i?`mt-2`:`mt-1`),children:[(0,P.jsx)(`span`,{className:D(`leading-tight font-semibold tracking-[-0.02em] tabular-nums`,s?`text-[25px]`:c?`text-[20px]`:`text-[25px]`,o),children:t}),a&&u&&(0,P.jsx)(`span`,{"aria-hidden":a.against?!0:void 0,className:`inline-flex`,children:(0,P.jsxs)(Xt,{tone:yi[u],icon:!1,className:`tabular-nums`,children:[d&&(0,P.jsx)(d,{size:12,strokeWidth:2.5,"aria-hidden":`true`,className:`flex-none`}),a.text]})})]}),(n||a?.against)&&(0,P.jsx)(`span`,{className:D(`text-muted tabular-nums`,c?`truncate text-[13px]`:`text-[13px]`),children:a?.against&&u?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:bi[u],children:a.amount??a.text}),` `,a.against,n?(0,P.jsxs)(P.Fragment,{children:[` · `,n]}):null]}):n})]})}var Ci=`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,wi=`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,Ti=`border-t border-line-soft align-top`,Ei=`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,Di=`px-4 py-2`,Oi=`px-4 py-2 text-right whitespace-nowrap tabular-nums`,ki=new Set([`className`,`style`,`key`,`ref`,`id`,`role`,`type`,`colSpan`,`rowSpan`,`scope`,`data-tip-side`]);function Ai(e,t=0){if(e==null||typeof e==`boolean`||typeof e==`function`||t>12)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(e=>Ai(e,t+1)).join(` `);if((0,N.isValidElement)(e))return Ai(e.props,t+1);if(typeof e==`object`){let n=[];for(let[r,i]of Object.entries(e))ki.has(r)||r.startsWith(`on`)||r.startsWith(`aria-`)||n.push(Ai(i,t+1));return n.join(` `)}return``}function ji({label:e,head:t,children:n,empty:r=`None.`,size:i=25,resetKey:a,fixed:o=!1,minWidth:s,className:c,search:l=!0,placeholder:u,tools:d,height:f}){let p=N.Children.toArray(n),[m,h]=(0,N.useState)(``),g=m.toLowerCase().split(/\s+/).filter(Boolean),_=(0,N.useMemo)(()=>l?p.map(e=>Ai(e).toLowerCase()):[],[n,l]),v=g.length?p.filter((e,t)=>g.every(e=>_[t].includes(e))):p,[y,b]=(0,N.useState)(0);(0,N.useEffect)(()=>b(0),[a,m]);let x=(0,N.useRef)(null);(0,N.useEffect)(()=>{f&&x.current&&(x.current.scrollTop=0)},[y,m,a,f]);let ee=Math.max(1,Math.ceil(v.length/i)),S=Math.min(y,ee-1),C=v.slice(S*i,S*i+i),[te,ne]=(0,N.useState)(!1);(0,N.useEffect)(()=>{let e=x.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>ne(e.scrollWidth>e.clientWidth+1||!!f&&e.scrollHeight>e.clientHeight+1),n=new ResizeObserver(t);return n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),t(),()=>n.disconnect()},[f]);let w=N.Children.toArray((0,N.isValidElement)(t)&&t.type===N.Fragment?t.props.children:t).length;return(0,P.jsxs)(`div`,{className:D(`overflow-hidden border-t border-line`,c),children:[(l||d)&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-2 py-2`,children:[l&&(0,P.jsxs)(`label`,{className:`relative flex min-w-0 w-full max-w-[320px] flex-[0_1_320px] items-center`,children:[(0,P.jsx)(we,{size:14,"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 text-muted`}),(0,P.jsxs)(`span`,{className:`sr-only`,children:[`Find in `,e.toLowerCase()]}),(0,P.jsx)(Ut,{size:`sm`,type:`search`,value:m,spellCheck:!1,placeholder:u??`Find in ${e.toLowerCase()}`,onChange:e=>h(e.target.value),className:`pl-8`})]}),d,g.length>0&&(0,P.jsxs)(`span`,{className:`text-[13px] whitespace-nowrap text-muted`,role:`status`,children:[v.length,` of `,p.length]})]}),(0,P.jsx)(`div`,{ref:x,...te?{tabIndex:0,role:`region`,"aria-label":`${e}, scrolls`}:{},className:D(`relative overflow-x-auto focus-visible:outline-offset-[-2px]`,f&&`overflow-y-auto overscroll-contain`),style:f?{height:f}:void 0,children:(0,P.jsxs)(`table`,{"aria-label":e,className:D(`w-full border-collapse text-[13px]`,o&&`table-fixed`),style:s?{minWidth:s}:void 0,children:[(0,P.jsx)(`thead`,{children:(0,P.jsx)(`tr`,{className:D(`bg-surface-strong text-left text-[13px] text-muted`,f&&`sticky top-0 z-[1]`),children:t})}),(0,P.jsxs)(`tbody`,{children:[C,!v.length&&(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{colSpan:Math.max(1,w),className:`px-4 py-4 text-center text-muted`,children:g.length&&p.length?`Nothing matches.`:r})})]})]})}),v.length>0&&(0,P.jsx)(Yt,{page:S,size:i,total:v.length,onPage:b,label:`Pages of ${e.toLowerCase()}`})]})}var Mi=(0,N.createContext)({pending:{},set:()=>{},saved:new Set,vars:{},store:`the credential store`}),Ni=()=>(0,N.useContext)(Mi);function Pi(e){return/[\\/]/.test(e)?`ForgeQE's private credentials file (readable only by you)`:e}var Fi=/^[A-Za-z_][A-Za-z0-9_]*$/;function Ii(e,t){return t in e.pending?e.pending[t]===null?`removing`:`pending`:e.saved.has(t)?`saved`:e.vars[t]?`environment`:`missing`}var Li={pending:`Not saved yet`,removing:`Removed when you save`,saved:`Saved`,environment:`Set in the environment`,missing:`Not set`},Ri=(e,t)=>[`pending`,`saved`,`environment`].includes(Ii(e,t));function zi({name:e}){let t=Ni();if(!e)return null;if(!Fi.test(e))return(0,P.jsx)(`span`,{className:`text-[13px] text-fail`,children:`Not a variable name`});let n=Ii(t,e);return(0,P.jsx)(`span`,{className:D(`text-[13px]`,n===`saved`||n===`environment`?`text-pass`:n===`missing`?`text-muted`:`text-accent-fg`),children:Li[n]})}var Bi=/user|email|login|client_id|account/i;function Vi({id:e,name:t,field:n,onRename:r,compact:i}){let a=Ni(),o=(0,N.useId)(),c=e||o,[l,u]=(0,N.useState)(!1),d=Ii(a,t),f=typeof a.pending[t]==`string`?a.pending[t]:``,m=Bi.test(n)||Bi.test(t);return(0,P.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(Ut,{id:c,"aria-label":e?void 0:n,type:m?`text`:`password`,autoComplete:`off`,spellCheck:!1,value:f,disabled:!Fi.test(t),placeholder:d===`saved`?`Saved. Type a new value to replace it`:d===`environment`?`Set in the environment. Type a value to save one`:m?`Type it once`:`Paste it once`,onChange:e=>a.set(t,e.target.value||void 0)}),d===`saved`&&(0,P.jsx)(A,{variant:`icon`,size:`icon-sm`,onClick:()=>a.set(t,null),"aria-label":`Remove the saved value of ${t}`,"data-tip":`Remove the saved value of ${t}`,children:(0,P.jsx)(s,{"aria-hidden":`true`})}),d===`removing`&&(0,P.jsxs)(A,{size:`sm`,"data-tip":`Keep the saved value of ${t}`,onClick:()=>a.set(t,void 0),children:[(0,P.jsx)(re,{"aria-hidden":`true`}),`Keep`]})]}),!i&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,P.jsx)(zi,{name:t}),(0,P.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),l&&r?(0,P.jsx)(Ut,{size:`sm`,"aria-label":`Variable name`,autoFocus:!0,defaultValue:t,spellCheck:!1,onBlur:e=>{let n=e.target.value.trim();n&&Fi.test(n)&&n!==t&&r(n),u(!1)},onKeyDown:e=>fn(e)&&e.target.blur(),className:`max-w-[260px] font-mono`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[`Kept as `,(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:t})]}),r&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),"data-tip":`Change the variable's name`,className:`inline-flex min-h-8 cursor-pointer items-center gap-1 border-0 bg-transparent p-0 text-[13px] font-medium text-accent-fg hover:text-accent-fg-hover [&>svg]:size-3.5`,children:[(0,P.jsx)(p,{"aria-hidden":`true`}),`Rename`]})]})]})]})}function Hi({name:e}){return(0,P.jsx)(zi,{name:e})}function Ui({id:e,name:t,field:n,named:r,onName:i}){let a=Ni();return(0,P.jsx)(Wi,{onFirstValue:()=>{!r&&t&&i(t)},secrets:a,children:(0,P.jsx)(Vi,{id:e,name:t,field:n,onRename:i})})}function Wi({secrets:e,onFirstValue:t,children:n}){return(0,P.jsx)(Mi.Provider,{value:{...e,set:(n,r)=>{r&&t(),e.set(n,r)}},children:n})}function Gi({label:e,help:t,htmlFor:n,children:r,className:i,stacked:a,yamlKey:o}){let s=o?(0,P.jsx)(`code`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:o}):null;return a?(0,P.jsxs)(`div`,{className:D(`flex flex-col gap-4 py-4`,i),children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[n?(0,P.jsx)(`label`,{htmlFor:n,className:`text-[13px] leading-snug font-medium text-ink`,children:e}):(0,P.jsx)(`span`,{className:`text-[13px] leading-snug font-medium text-ink`,children:e}),t&&(0,P.jsx)(`span`,{className:`text-[13px] leading-relaxed text-ink-2`,children:t}),s]}),(0,P.jsx)(`div`,{className:`[&>*]:max-w-none`,children:r})]}):(0,P.jsxs)(`div`,{className:D(`flex min-h-16 flex-wrap items-center gap-x-10 gap-y-4 border-t border-line-soft py-4`,i),children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[n?(0,P.jsx)(`label`,{htmlFor:n,className:`text-[13px] leading-snug font-medium text-ink`,children:e}):(0,P.jsx)(`span`,{className:`text-[13px] leading-snug font-medium text-ink`,children:e}),t&&(0,P.jsx)(`span`,{className:`text-[13px] leading-relaxed text-ink-2`,children:t}),s]}),r!=null&&r!==!1&&(0,P.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:w-[340px] sm:flex-none sm:justify-end`,children:r})]})}var Ki=`flex w-full flex-wrap items-center gap-2 sm:w-[340px] sm:flex-none sm:justify-end`,qi={"By how you asked":Ee,"Test runs":x,"Speech on this computer":Ie,Conversation:xt,"What went wrong":d,"What ForgeQE found":St,Questions:Ct,"The bug":o,"What is attached":ne,Send:t,"Test case ids":Ne,"Where runs happen":He,"The browser window":ot,"Limits and checks":vt,"Remote browser, set here":y,"Where tests go":Je,"How hard it tries":he,"Help it gets":at,Reports:Re,"Memory and replays":le,Suites:st,"Flaky tests":Ue,"Release readiness":ye,"Regression packs in a pipeline":l,"Defect analysis":o,Accessibility:ke,"Performance and visual changes":w,"API tests":se,"The product":Me,"Instructions and knowledge":pt,Capabilities:_e,"Project report":c,"Report datasets":Be,"Running in parallel":be,Driver:ut,Appium:je,"Devices on this computer":n,"TestMu AI devices":y,"BrowserStack devices":y,"Browser devices":lt,"Appium on this computer":je,Maestro:De,"Windows desktop apps":ue,Runtime:oe,"Tests in a container":pe,"The coding agents' workspace":rt,"Browser in a container":ce,"How skills are used":wt,Budgets:ie,"Project folder":f,"ForgeQE in this folder":T,Repository:Je,"Features to download":l,Onboarding:ye,"This computer":n,"A model":ct,"Models file":Qe,"Default model":ct,"Product knowledge graph":u,Repositories:Je,"Documents and links":$e,"Search service":pt,Documents:$e,"The product and its knowledge":Me,"Building the graph":_e,"The team's knowledge":Ke,"Agent names":mt,"Custom agents":bt,"Sign-ins":Te,"Recent runs":ge,"Saved runs":he,"Test data":Be,"Areas of work":it,"Which model a call gets":it,Alerts:Ve,"When to alert":tt,Apps:lt,"By kind of run":et,"By run, newest first":ge,Guides:pt,"Last 30 days":de,"Latest problems":d,"Links in alerts":Ae,"Model calls":xt,Plans:Ye,"Recent requests":Ce,"Results and bugs":me,"What used the most":_t,"Send a test":t,Services:Fe,"Tools used":_e,"What runs":x,"Check the agent's domain knowledge":nt,"Test cases and bugs":ve,"Browser grids":y,Notifications:Xe,"Other tools":ze},Ji=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),Yi=e=>typeof e==`string`?e.trim().replace(/^\d+\.\s*/,``):``;function R({children:e,help:t,first:n,icon:r}){let i=r??qi[Yi(e)];return(0,P.jsxs)(`div`,{"data-group-title":``,"data-tour":Ji(Yi(e)),className:D(`mb-4 flex flex-col gap-2`,n?`mt-0`:`mt-8 border-t border-line pt-6`),children:[(0,P.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-[16px] leading-snug font-semibold text-ink`,children:[i&&(0,P.jsx)(j,{icon:i,size:18,className:`flex-none text-accent-fg`}),e]}),t&&(0,P.jsx)(`p`,{className:D(`m-0 text-[13px] leading-relaxed text-ink-2`,i&&`pl-8`),children:t})]})}var Xi=e=>Array.isArray(e)?e.map(String).join(`, `):typeof e==`string`?e:``,Zi=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function Qi({id:e,value:t,onChange:n,placeholder:r,mono:i}){let[a,o]=(0,N.useState)(Xi(t)),[s,c]=(0,N.useState)(t);return JSON.stringify(s)!==JSON.stringify(t)&&(c(t),o(Xi(t))),(0,P.jsx)(Ut,{id:e,value:a,placeholder:r,className:D(i&&`font-mono text-[13px]`),onChange:e=>{o(e.target.value);let t=Zi(e.target.value);c(t.length?t:void 0),n(t.length?t:void 0)}})}function $i({def:e,edit:t,base:n,stacked:r}){let i=(0,N.useId)(),a=e.key?[...n,...e.key.split(`.`)]:n,o=Ar(t.value,a),s=e=>t.set(Mr(t.value,a,e)),c=`w-full`,l=t.file?a.join(`.`):void 0,u;switch(e.type){case`switch`:{let t=o===void 0?!!e.default:o===!0||o===`true`||o===`on`;return(0,P.jsx)(Gi,{label:e.label,help:e.help,yamlKey:l,children:(0,P.jsx)(Ir,{checked:t,onChange:s,label:e.label})})}case`select`:u=(0,P.jsxs)(Rt,{id:i,value:String(o===void 0?e.default??``:o),onChange:e=>s(e.target.value!==`false`&&e.target.value),className:`w-full`,children:[e.default===void 0&&(0,P.jsx)(`option`,{value:``,children:e.emptyLabel||`Not set`}),e.options.map(e=>(0,P.jsx)(`option`,{value:e.value,children:e.label},e.value))]});break;case`number`:u=(0,P.jsx)(Ut,{id:i,type:`number`,inputMode:`numeric`,value:o==null?``:String(o),placeholder:e.default===void 0?e.placeholder:String(e.default),onChange:e=>s(e.target.value===``?void 0:Number(e.target.value)),className:`w-full`});break;case`list`:u=(0,P.jsx)(`div`,{className:c,children:(0,P.jsx)(Qi,{id:i,value:o,onChange:s,placeholder:e.placeholder})});break;case`kv`:u=(0,P.jsx)(`div`,{className:c,children:(0,P.jsx)(ea,{id:i,value:o,onChange:s,placeholder:e.placeholder})});break;case`textarea`:u=(0,P.jsx)(Vt,{id:i,rows:3,value:o===void 0?``:String(o),placeholder:e.placeholder,onChange:e=>s(e.target.value),className:c});break;case`var`:{let t=String(o??e.default??e.placeholder??``);return u=(0,P.jsx)(`div`,{className:c,children:(0,P.jsx)(Ui,{id:i,name:t,field:e.key,named:o!==void 0||e.default!==void 0,onName:e=>s(e)})}),(0,P.jsx)(Gi,{label:e.label.replace(/ variable$/,``),help:e.help,htmlFor:i,stacked:r,yamlKey:l,children:u})}default:u=(0,P.jsx)(Ut,{id:i,type:e.type===`url`?`url`:`text`,value:o===void 0?``:String(o),placeholder:e.placeholder??(e.default===void 0?void 0:String(e.default)),spellCheck:e.type===`text`,onChange:e=>s(e.target.value),className:D(c,e.type===`path`&&`font-mono text-[13px]`)})}return(0,P.jsx)(Gi,{label:e.label,help:e.help,htmlFor:i,stacked:r,yamlKey:l,children:u})}function ea({id:e,value:t,onChange:n,placeholder:r}){let i=e=>Object.entries(e&&typeof e==`object`&&!Array.isArray(e)?e:{}).map(([e,t])=>`${e} = ${typeof t==`object`?JSON.stringify(t):String(t)}`).join(`
|
|
6
|
-
`),[a,o]=(0,N.useState)(i(t)),[s,c]=(0,N.useState)(t);return JSON.stringify(s)!==JSON.stringify(t)&&(c(t),o(i(t))),(0,P.jsx)(Vt,{id:e,rows:3,value:a,spellCheck:!1,placeholder:r??`NAME = value`,className:`font-mono`,onChange:e=>{o(e.target.value);let t={};for(let n of e.target.value.split(`
|
|
7
|
-
`)){let e=n.indexOf(`=`),r=(e<0?n:n.slice(0,e)).trim();if(!r)continue;let i=e<0?``:n.slice(e+1).trim();t[r]=/^-?\d+(\.\d+)?$/.test(i)?Number(i):i===`true`||i!==`false`&&i}let r=Object.keys(t).length?t:void 0;c(r),n(r)}})}function ta({defs:e,edit:t,base:n,stacked:r}){let i=Ar(t.value,n),a=i&&typeof i==`object`&&!Array.isArray(i)?i:{};return(0,P.jsx)(P.Fragment,{children:e.filter(e=>!e.when||e.when(a)).map(e=>(0,P.jsx)($i,{def:e,edit:t,base:n,stacked:r},e.key))})}function na({title:e,meta:t,state:n,open:i,onToggle:a,lead:o,actions:s,children:c,expandable:l}){let u=(0,N.useId)();return(0,P.jsxs)(`div`,{className:`border-t border-line-soft`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 py-4`,children:[o,l===!1?(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:e}),t&&(0,P.jsx)(`span`,{className:`text-sm text-muted`,children:t})]}):(0,P.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":u,onClick:a,className:`flex min-w-0 flex-[1_1_260px] cursor-pointer items-center gap-4 rounded-[10px] border-0 bg-transparent p-0 text-left text-ink`,children:[(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:e}),t&&(0,P.jsx)(`span`,{className:`text-sm text-muted`,children:t})]}),(0,P.jsx)(r,{size:18,"aria-hidden":`true`,className:D(`flex-none text-muted transition-transform`,i&&`rotate-180`)})]}),n,s]}),l!==!1&&(0,P.jsx)(F,{open:i,id:u,children:(0,P.jsx)(`div`,{className:`mb-4 border-l-2 border-line-soft pb-2 pl-4 sm:pl-6 [&>*:first-child]:border-t-0`,children:c})})]})}function ra(e){let[t,n]=(0,N.useState)(null),[r,i]=(0,N.useState)(``),a=(0,N.useCallback)(()=>{i(``),e().then(n,e=>i(e.message))},[e]);return(0,N.useEffect)(a,[a]),{data:t,error:r,reload:a}}function ia({error:e,reload:t}){return e?(0,P.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-4 rounded-[14px] card border p-6`,children:[(0,P.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:e}),(0,P.jsxs)(A,{size:`sm`,onClick:t,children:[(0,P.jsx)(m,{"aria-hidden":`true`}),`Retry`]})]}):(0,P.jsx)(`p`,{role:`status`,className:`m-0 py-4 text-sm text-muted`,children:`Loading…`})}function z({children:e}){return(0,P.jsx)(tn,{className:`py-4`,children:e})}function B(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function aa(e){return`${B(e.input)} read${e.cached?` (${B(e.cached)} from cache)`:``} · ${B(e.output)} written`}var V=null;function oa(e){V=e}function H(e,t){if(!t)return`—`;let n=V?.to,r=V?.perEur?.[t],i=n?V?.perEur?.[n]:void 0,[a,o]=n&&n!==t&&r&&i?[e/r*i,n]:[e,t];try{let e=Math.abs(a)>=1e4;return new Intl.NumberFormat(void 0,{style:`currency`,currency:o,...e?{notation:`compact`,maximumFractionDigits:1}:{maximumFractionDigits:Math.abs(a)<1?3:2}}).format(a)}catch{return`${a.toFixed(2)} ${o}`}}function sa(e){if(!V?.perEur||!e||V.to===e||!V.perEur[e])return``;let t=H(1,e);return`Shown in ${V.to}, converted from ${e} at the European Central Bank's rate of ${V.date}: ${new Intl.NumberFormat(void 0,{style:`currency`,currency:e}).format(1)} = ${t}.`}var U=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})},ca=e=>e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} bytes`;function W({head:e,children:t,label:n}){return(0,P.jsx)(ji,{label:n,head:e.map((e,t)=>(0,P.jsx)(`th`,{scope:`col`,className:t>0?wi:Ci,children:e},e||t)),children:t})}function G({cells:e}){return(0,P.jsx)(`tr`,{className:`border-t border-line-soft`,children:e.map((e,t)=>(0,P.jsx)(`td`,{className:D(`px-4 py-2 align-top`,t>0?`text-right whitespace-nowrap tabular-nums`:`min-w-[200px]`),children:e},t))})}var la={title:`How skills are used`,base:[`skills`],fields:[{key:`enabled`,label:`Use skills`,type:`switch`,default:!0},{key:`external`,label:`Also read Claude and agent skills`,help:`~/.claude/skills, ~/.agents/skills, and the repository's own.`,type:`switch`,default:!1},{key:`dirs`,label:`More skill folders`,help:`Comma separated. They win over the others.`,type:`list`,placeholder:`../shared-skills`},{key:`browser_max_chars`,label:`Skill text per browser run`,help:`Characters.`,type:`number`,default:6e3}]},ua={"no match":`not run before`,"not a rerun":`not run before`,"not a recorded goal":`not run before`,"no recorded run matches":`not run before`,"its last run did not pass":`its last run failed`,"marked stale":`its saved steps are out of date`,"more than one recorded start page for this goal":`saved from more than one start page`};function da(e,t){return e===`tier0`?t===`shadow`?`Test mode: AI ran it, could have replayed`:`Replayed for free`:`AI: ${ua[e]||e}`}function fa({edit:e}){let{data:t,error:n,reload:i}=ra(O.registry),[a,o]=(0,N.useState)(!1),s=String(Ar(e.value,[`registry`,`mode`])??`on`);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Gi,{label:`Replay passed runs for free`,help:s===`shadow`?`In test mode now: ForgeQE only notes what it would have replayed, and the AI runs everything. Turn it on to use replays.`:`If the page changed, the AI takes over.`,yamlKey:e.file?`registry.mode`:void 0,children:(0,P.jsx)(Ir,{checked:s===`on`,onChange:t=>e.set(Mr(e.value,[`registry`,`mode`],t?`on`:`off`)),label:`Replay passed runs for free`})}),t?!t.exists||t.plans.length===0?(0,P.jsx)(z,{children:`Nothing to replay yet. When a run passes, ForgeQE saves its steps, and running it again is free.`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Si,{label:`Replays`,className:`mt-4`,children:[(0,P.jsx)(L,{icon:he,label:`Free reruns`,value:String(t.replayed),note:`of ${Lt(t.total,`run`)}`}),(0,P.jsx)(L,{icon:v,label:`Tokens saved`,value:B(t.tokensSaved),note:`${Lt(t.plans.length,`passed run`)} ready to replay`})]}),(0,P.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-controls":`replay-details`,onClick:()=>o(!a),"data-tip":a?`Hide details`:`Show details`,className:`mt-2 inline-flex min-h-10 cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-accent-fg hover:text-accent-fg-hover [&>svg]:size-4`,children:[a?(0,P.jsx)(te,{"aria-hidden":`true`}):(0,P.jsx)(r,{"aria-hidden":`true`}),a?`Less`:`Details`]}),(0,P.jsxs)(F,{open:a,id:`replay-details`,children:[(0,P.jsx)(R,{first:!0,children:`Saved runs`}),(0,P.jsx)(W,{label:`Saved runs`,head:[`Goal`,`Passed`,`Failed`,`Tokens the first time`,`Last used`],children:t.plans.map(e=>(0,P.jsx)(G,{cells:[(0,P.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`line-clamp-2`,children:e.goal}),e.stale&&(0,P.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Out of date: the AI runs it next time`})]}),e.successes,e.failures,e.firstTokens?B(e.firstTokens):`—`,U(e.lastAt)]},e.id))}),(0,P.jsx)(R,{children:`Recent runs`}),t.requests.length===0?(0,P.jsx)(z,{children:`No runs yet.`}):(0,P.jsx)(W,{label:`Recent runs`,head:[`Request`,`How it ran`,`Result`,`Tokens`,`When`],children:t.requests.map(e=>(0,P.jsx)(G,{cells:[(0,P.jsx)(`span`,{className:`line-clamp-2`,children:e.request||e.planGoal||e.id}),da(e.decision,e.mode),e.outcome||`—`,B(e.tokens),U(e.startedAt)]},e.id))})]})]}):(0,P.jsx)(ia,{error:n,reload:i})]})}function pa(){let{data:e,error:t,reload:n}=ra(O.logs),[r,i]=(0,N.useState)(null),[a,o]=(0,N.useState)(``);return e?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`p`,{className:`mt-0 mb-4 text-sm text-muted`,children:[`Kept in `,(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.dir}),`. Secrets are replaced with their names before a log is shown.`]}),a&&(0,P.jsx)(`p`,{role:`alert`,className:`mt-0 mb-4 text-sm text-fail`,children:a}),e.logs.length===0?(0,P.jsx)(z,{children:`No session logs yet. ForgeQE writes one for each chat, run and suite.`}):e.logs.map(e=>(0,P.jsxs)(`div`,{className:`flex min-h-[60px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-2`,children:[(0,P.jsx)(Or,{icon:xe}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[13px] break-all`,children:e.name}),(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[U(e.modified),`, `,ca(e.size)]})]}),(0,P.jsx)(A,{variant:`icon`,size:`icon-sm`,"aria-label":`Open ${e.name}`,"data-tip":`Open ${e.name}`,onClick:()=>{o(``),O.log(e.name).then(i,e=>o(e.message))},children:(0,P.jsx)(xe,{"aria-hidden":`true`})})]},e.name)),(0,P.jsx)(hn,{wide:!0,open:!!r,onClose:()=>i(null),title:r?.name||``,description:r?.truncated?`The end of the log; the start is cut to keep it quick to open.`:void 0,footer:(0,P.jsxs)(A,{onClick:()=>i(null),children:[(0,P.jsx)(g,{"aria-hidden":`true`}),`Close`]}),children:r&&(0,P.jsx)(`pre`,{className:`m-0 mt-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap break-all`,children:(0,P.jsx)(an,{text:r.text})})})]}):(0,P.jsx)(ia,{error:t,reload:n})}var ma={error:`Error`,tool:`Tool call failed`,run:`Run failed`,engine:`Browser engine stopped`,agent:`Agent error`,model:`Model call failed`},ha={chat:`Chat`,start:`Shell`,run:`Run`,suite:`Suite`,code:`Write tests`,heal:`Heal`,monitor:`Monitor`,mcp:`MCP`,explore:`Explore`};function ga(){let[e,t]=(0,N.useState)(null),[n,r]=(0,N.useState)(``);return{show:e=>{r(``),O.log(e).then(t,e=>r(e.message))},error:n,sheet:(0,P.jsx)(hn,{wide:!0,open:!!e,onClose:()=>t(null),title:e?.name||``,description:e?.truncated?`The end of the log; the start is cut to keep it quick to open.`:void 0,footer:(0,P.jsxs)(A,{onClick:()=>t(null),children:[(0,P.jsx)(g,{"aria-hidden":`true`}),`Close`]}),children:e&&(0,P.jsx)(`pre`,{className:`m-0 mt-4 font-mono text-[13px] leading-relaxed break-all whitespace-pre-wrap`,children:(0,P.jsx)(an,{text:e.text})})})}}function _a({entries:e}){let[t,n]=(0,N.useState)(-1);return e.length?(0,P.jsx)(P.Fragment,{children:e.map((e,r)=>(0,P.jsx)(na,{lead:(0,P.jsx)(Or,{icon:ge}),title:`${e.action}: ${e.file}`,meta:`${U(e.at)}, ${e.user} on ${e.machine}, ${e.changes.length} change${e.changes.length===1?``:`s`}`,open:t===r,onToggle:()=>n(t===r?-1:r),children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0 py-4`,children:e.changes.map((e,t)=>(0,P.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1 text-sm`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.key}),(0,P.jsx)(`span`,{className:`text-muted`,children:e.before===void 0?(0,P.jsxs)(P.Fragment,{children:[`added `,(0,P.jsx)(`span`,{className:`text-ink`,children:e.after})]}):e.after===void 0?(0,P.jsxs)(P.Fragment,{children:[`removed `,(0,P.jsx)(`span`,{className:`text-ink line-through`,children:e.before})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`text-ink line-through`,children:e.before}),` → `,(0,P.jsx)(`span`,{className:`text-ink`,children:e.after})]})})]},t))})},r))}):(0,P.jsx)(z,{children:`No changes made in Settings yet.`})}function va(){let{data:e,error:t,reload:n}=ra(O.audit),[r,i]=(0,N.useState)(`summary`),a=ga();if(!e)return(0,P.jsx)(ia,{error:t,reload:n});let o=e.summary,s=o.totals,c=e=>e?`${e} failed`:`None failed`;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{className:`mt-0 mb-4 text-sm text-muted`,children:`The last 30 days, from the session logs on this machine and its usage ledger. Model calls count every project on this machine.`}),(0,P.jsx)(ni,{label:`Audit`,current:r,onPick:i,tabs:[{id:`summary`,label:`Summary`},{id:`problems`,label:`Problems (${o.problems.length})`},{id:`sessions`,label:`Sessions (${o.sessions.length})`},{id:`changes`,label:`Settings changes (${e.entries.length})`}]}),a.error&&(0,P.jsx)(`p`,{role:`alert`,className:`mt-0 mb-4 text-sm text-fail`,children:a.error}),(0,P.jsxs)(`div`,{id:`panel-${r}`,role:`tabpanel`,"aria-labelledby":`tab-${r}`,children:[r===`summary`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Si,{label:`Activity summary`,children:[(0,P.jsx)(L,{icon:xt,label:`Sessions`,value:String(s.sessions),note:s.replays?`${s.replays} request${s.replays===1?``:`s`} replayed without the agent`:void 0}),(0,P.jsx)(L,{icon:_e,label:`Tool calls`,value:String(s.toolCalls),note:c(s.toolErrors)}),(0,P.jsx)(L,{icon:x,label:`Runs`,value:String(s.runs),note:c(s.runsFailed)}),(0,P.jsx)(L,{icon:ct,label:`Model calls`,value:String(s.modelCalls),note:c(s.modelErrors)}),(0,P.jsx)(L,{icon:d,label:`Errors`,value:String(s.errors),note:s.escalations?`${s.escalations} switch${s.escalations===1?``:`es`} to a stronger model`:void 0})]}),o.problems.length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(R,{children:`Latest problems`}),(0,P.jsx)(ya,{problems:o.problems.slice(0,5),onLog:a.show}),o.problems.length>5&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(`problems`),"data-tip":`All ${o.problems.length} problems`,className:`mt-4 inline-flex min-h-10 cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-accent-fg hover:text-accent-fg-hover [&>svg]:size-4`,children:[(0,P.jsx)(dt,{"aria-hidden":`true`}),`All (`,o.problems.length,`)`]})]}),(0,P.jsx)(R,{children:`Tools used`}),o.tools.length===0?(0,P.jsx)(z,{children:`No tool calls logged in the last 30 days.`}):(0,P.jsx)(W,{label:`Tools used`,head:[`Tool`,`Calls`,`Failed`,`Average time`],children:o.tools.map(e=>(0,P.jsx)(G,{cells:[(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.name}),e.calls,e.errors?(0,P.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,e.calls?`${(e.ms/e.calls/1e3).toFixed(1)} s`:`—`]},e.name))}),(0,P.jsx)(R,{children:`Model calls`}),o.models.length===0?(0,P.jsx)(z,{children:`No model calls in the usage ledger in the last 30 days.`}):(0,P.jsx)(W,{label:`Model calls`,head:[`Model`,`Calls`,`Failed`,`Tokens`],children:o.models.map(e=>(0,P.jsx)(G,{cells:[e.model,e.calls,e.errors?(0,P.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,B(e.tokens)]},e.model))})]}),r===`problems`&&(o.problems.length?(0,P.jsx)(ya,{problems:o.problems,onLog:a.show}):(0,P.jsx)(z,{children:`Nothing failed in the last 30 days.`})),r===`sessions`&&(o.sessions.length?(0,P.jsx)(W,{label:`Sessions`,head:[`Session`,`Tool calls`,`Runs`,`Errors`,`Tokens`,``],children:o.sessions.map(e=>(0,P.jsx)(G,{cells:[(0,P.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:ha[e.command]||e.command}),(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[U(e.started),e.model?`, ${e.model}`:``]})]}),e.toolErrors?`${e.tools} (${e.toolErrors} failed)`:e.tools,e.runsFailed?`${e.runs} (${e.runsFailed} failed)`:e.runs,e.errors?(0,P.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,B(e.tokens),(0,P.jsx)(A,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the log of the ${ha[e.command]||e.command} session at ${U(e.started)}`,"data-tip":`Open the log of the ${ha[e.command]||e.command} session at ${U(e.started)}`,onClick:()=>a.show(e.log),children:(0,P.jsx)(xe,{"aria-hidden":`true`})})]},e.log))}):(0,P.jsx)(z,{children:`No sessions logged in the last 30 days.`})),r===`changes`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`p`,{className:`mt-0 mb-4 text-sm text-muted`,children:[`Every change made in Settings, kept in `,(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.file}),`. Changes made to the files by hand are not here.`]}),(0,P.jsx)(_a,{entries:e.entries})]})]}),a.sheet]})}function ya({problems:e,onLog:t}){return(0,P.jsx)(P.Fragment,{children:e.map((e,n)=>(0,P.jsxs)(`div`,{className:`flex min-h-[64px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,P.jsx)(Or,{icon:e.kind===`run`||e.kind===`tool`?h:d,className:`bg-fail-soft text-fail`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:ma[e.kind]}),(0,P.jsx)(`span`,{className:`text-sm break-words text-ink-2`,children:e.text}),(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[U(e.at),`, `,ha[e.command]||e.command]})]}),e.log&&(0,P.jsx)(A,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the log for: ${e.text.slice(0,60)}`,"data-tip":`Open the log for: ${e.text.slice(0,60)}`,onClick:()=>t(e.log),children:(0,P.jsx)(xe,{"aria-hidden":`true`})})]},n))})}var ba={title:`Budgets`,help:`Money in the model's price currency, or GitHub Copilot premium requests. They only warn, at 80, 90 and 100 percent, and never stop a run. Day and month count every ForgeQE process on this machine.`,base:[`budget`],fields:[{key:`run`,label:`Per browser run`,type:`number`},{key:`day`,label:`Per day`,type:`number`},{key:`month`,label:`Per month`,type:`number`},{key:`currency`,label:`Currency`,type:`text`,placeholder:`USD`},{key:`premium_requests.run`,label:`Premium requests per browser run`,help:`GitHub Copilot: each call uses the model's multiplier, 0 for a model included in your plan.`,type:`number`},{key:`premium_requests.day`,label:`Premium requests per day`,type:`number`},{key:`premium_requests.month`,label:`Premium requests per month`,type:`number`}]},xa={suite:`Suites`,monitor:`Monitor rounds`,run:`Browser runs`,explore:`Exploratory`,api:`API tests`,desktop:`Desktop runs`,mobile:`Mobile runs`},Sa={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploratory`,api:`API test`,desktop:`Desktop run`,mobile:`Mobile run`,chat:`Chat`,"custom agent":`Custom agent`,talk:`Talk`,"browser test":`Browser run`,"mobile test":`Mobile run`},Ca=e=>Sa[e]||e.charAt(0).toUpperCase()+e.slice(1);function wa({days:e,currency:t}){let[n,r]=(0,N.useState)(-1),i=Math.max(1,...e.map(e=>e.input+e.output)),a=e.reduce((e,t)=>e+t.input+t.output,0),o=e.filter(e=>e.runs>0).length,s=e.reduce((e,t)=>t.input+t.output>e.input+e.output?t:e,e[0]),c=n>=0?e[n]:e[e.length-1],l=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,P.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,P.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-sm text-ink-2`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:l(c.day)}),`: `,B(c.input+c.output),` tokens, `,c.runs,` run`,c.runs===1?``:`s`,t?`, ${H(c.amount,t)}`:``]}),(0,P.jsx)(`div`,{role:`img`,"aria-label":`Tokens a day for the last 30 days: ${B(a)} in all, on ${o} days with runs; the busiest was ${l(s.day)} with ${B(s.input+s.output)}.`,className:`flex h-[160px] items-end gap-1 border-b border-line`,onMouseLeave:()=>r(-1),children:e.map((t,a)=>{let o=t.input+t.output;return(0,P.jsx)(`div`,{className:`flex h-full flex-1 cursor-default items-end`,onMouseEnter:()=>r(a),children:(0,P.jsx)(`div`,{className:D(`w-full rounded-t-[4px] transition-[height]`,a===e.length-1||a===n?`bg-accent`:`bg-accent-line`),style:{height:o?`${Math.max(2,o/i*100)}%`:`0`}})},t.day)})}),(0,P.jsxs)(`div`,{"aria-hidden":`true`,className:`flex justify-between text-[13px] text-muted`,children:[(0,P.jsx)(`span`,{children:l(e[0].day)}),(0,P.jsx)(`span`,{children:l(e[e.length-1].day)})]})]})}function Ta({rows:e,currency:t,label:n}){if(!e.length)return(0,P.jsx)(z,{children:`Nothing yet.`});let r=Math.max(1,...e.map(e=>e.sum.input+e.sum.output));return(0,P.jsx)(`ul`,{"aria-label":n,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.map(e=>{let n=e.sum.input+e.sum.output;return(0,P.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,P.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 text-sm`,children:[(0,P.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,P.jsxs)(`span`,{className:`whitespace-nowrap text-ink-2 tabular-nums`,children:[B(n),` tokens`,t&&e.sum.amount?`, ${H(e.sum.amount,t)}`:``]})]}),(0,P.jsx)(`div`,{"aria-hidden":`true`,className:`h-2 rounded-full bg-surface-strong`,children:(0,P.jsx)(`div`,{className:`h-2 rounded-full bg-accent transition-[width] duration-200 ease-out`,style:{width:`${Math.max(1,n/r*100)}%`}})})]},e.name)})})}var Ea=e=>{let t=Math.round(e*100)/100;return`${t} premium request${t===1?``:`s`}`};function Da({label:e,spent:t,limit:n,currency:r,premium:i}){let a=e=>i?Ea(e):H(e,r),o=t/n*100,s=o>=100?`fail`:o>=80?`warn`:`ok`;return(0,P.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 text-sm`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:e}),(0,P.jsxs)(`span`,{className:D(`tabular-nums`,s===`fail`?`text-fail`:s===`warn`?`text-warn`:`text-ink-2`),children:[a(t),` of `,a(n),s===`fail`?`, over budget`:s===`warn`?`, ${Math.round(o)} percent used`:``]})]}),(0,P.jsx)(`div`,{role:`img`,"aria-label":`${e}: ${a(t)} of ${a(n)}, ${Math.round(o)} percent`,className:`h-2 rounded-full bg-surface-strong`,children:(0,P.jsx)(`div`,{className:D(`h-2 rounded-full transition-[width] duration-200 ease-out`,s===`fail`?`bg-fail`:s===`warn`?`bg-warn`:`bg-accent`),style:{width:`${Math.min(100,Math.max(1,o))}%`}})})]})}function Oa({edit:e}){let{data:t,error:n,reload:r}=ra(O.tokenomics),i=(0,P.jsx)(ta,{defs:ba.fields,edit:e,base:ba.base});if(!t)return(0,P.jsx)(ia,{error:n,reload:r});let a=t,o=a.currency,s=a.totals.input+a.totals.output,c=a.budget,l=c?.currency||a.spent?.currency||o,u=a.project?.days30.calls?a.project:void 0,d=u?u.days30.input+u.days30.output:0;return(0,P.jsxs)(P.Fragment,{children:[u&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`p`,{className:`mt-0 mb-4 text-sm text-muted`,children:[`Every model call made for this project from `,a.days[0]?.day,` to today: chats, runs and the agents they started, each priced when it was made. These are the figures the workspace panel shows. `,(0,P.jsx)(`a`,{href:E(`cost`),children:`Cost and model usage`}),` breaks them down by agent, job and model, priced at today's prices.`]}),(0,P.jsxs)(Si,{label:`All model calls, last 30 days`,children:[(0,P.jsx)(L,{icon:Se,label:`Tokens`,value:B(d),note:aa(u.days30)}),(0,P.jsx)(L,{icon:ie,label:`Cost`,value:u.currency?H(u.days30.amount,u.currency):`—`,note:u.currency?`When each call was made`:`No prices known`}),(0,P.jsx)(L,{icon:w,label:`Calls`,value:u.days30.calls.toLocaleString(),note:`${B(u.today.input+u.today.output)} tokens today`}),(0,P.jsx)(L,{icon:We,label:`Read from cache`,value:u.days30.input?`${Math.round(u.days30.cached/u.days30.input*100)}%`:`—`,note:`Of the tokens read`})]}),sa(u.currency)&&(0,P.jsx)(`p`,{className:`mt-4 mb-0 text-[13px] text-muted`,children:sa(u.currency)}),u.byChannel&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(R,{help:`The same calls, by how the request was made: said aloud through Talk, or typed (and everything else ForgeQE ran).`,children:`By how you asked`}),(0,P.jsx)(Ta,{label:`Tokens by how you asked`,currency:u.currency,rows:[{name:`Voice (Talk), ${u.byChannel.voice.calls.toLocaleString()} calls`,sum:{runs:0,...u.byChannel.voice}},{name:`Typed and other, ${u.byChannel.typed.calls.toLocaleString()} calls`,sum:{runs:0,...u.byChannel.typed}}]})]}),!!u.top?.length&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(R,{help:`Every chat, custom agent, test run and writing job of the last 30 days, by the model calls it made.`,children:`What used the most`}),(0,P.jsx)(W,{label:`Work that used the most tokens`,head:[`Work`,`Kind`,`Tokens`,`Cost`,`When`],children:u.top.map(e=>(0,P.jsx)(G,{cells:[(0,P.jsxs)(`span`,{className:`line-clamp-2`,children:[e.title,e.voice?(0,P.jsx)(`span`,{className:`text-muted`,children:` · by voice`}):null]}),Ca(e.kind),B(e.tokens),e.amount!==void 0&&u.currency?H(e.amount,u.currency):`—`,e.startedAt?U(e.startedAt):`—`]},e.id))})]}),(0,P.jsx)(R,{children:`Test runs`})]}),a.totals.runs===0?(0,P.jsx)(z,{children:`No test runs with token counts in the last 30 days. Every run and suite ForgeQE reports on is counted here; chats are not.`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`p`,{className:`mt-0 mb-4 text-sm text-muted`,children:[`From `,a.totals.runs,` run`,a.totals.runs===1?``:`s`,` in this project's reports in the last 30 days`,a.from?`, ${a.from} to ${a.to}`:``,`: test runs only, not chats. Models and agents come from the `,a.totals.withCalls,` run`,a.totals.withCalls===1?``:`s`,` that kept their model calls.`]}),(0,P.jsxs)(Si,{label:`Test runs, last 30 days`,children:[(0,P.jsx)(L,{icon:Se,label:`Tokens`,value:B(s),note:aa(a.totals)}),(0,P.jsx)(L,{icon:ie,label:`Cost`,value:H(a.totals.amount,o),note:a.totals.unpriced?`${a.totals.unpriced} run${a.totals.unpriced===1?``:`s`} had no price`:o?`At the models' prices`:`No prices known`}),(0,P.jsx)(L,{icon:w,label:`Per run`,value:B(Math.round(s/a.totals.runs)),note:o?H(a.totals.amount/a.totals.runs,o):void 0}),(0,P.jsx)(L,{icon:We,label:`Read from cache`,value:a.totals.input?`${Math.round(a.totals.cached/a.totals.input*100)}%`:`—`,note:`Of the tokens read`})]}),sa(a.currency)&&u?.currency!==a.currency&&(0,P.jsx)(`p`,{className:`mt-4 mb-0 text-[13px] text-muted`,children:sa(a.currency)}),a.otherCurrency>0&&(0,P.jsxs)(`p`,{className:`mt-4 mb-0 text-[13px] text-muted`,children:[a.otherCurrency,` run`,a.otherCurrency===1?` was`:`s were`,` priced in another currency and left out of the cost.`]}),(0,P.jsx)(R,{children:`Last 30 days`}),(0,P.jsx)(wa,{days:a.days,currency:o}),(0,P.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-x-10 gap-y-8`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-4`,children:[(0,P.jsx)(`h3`,{className:`m-0 text-base font-semibold`,children:`By model`}),(0,P.jsx)(Ta,{label:`Tokens by model`,rows:a.byModel.map(e=>({name:e.model,sum:e})),currency:o})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-4`,children:[(0,P.jsx)(`h3`,{className:`m-0 text-base font-semibold`,children:`By agent`}),(0,P.jsx)(Ta,{label:`Tokens by agent`,rows:a.byAgent.map(e=>({name:e.agent,sum:e})),currency:o})]})]}),(0,P.jsx)(R,{children:`By kind of run`}),(0,P.jsx)(Ta,{label:`Tokens by kind of run`,rows:a.byKind.map(e=>({name:`${xa[e.kind]||e.kind} (${e.runs})`,sum:e})),currency:o})]}),(0,P.jsx)(R,{help:ba.help,children:ba.title}),c&&a.spent&&(c.day||c.month)?(0,P.jsxs)(`div`,{className:`mb-4 flex flex-col gap-4 rounded-[14px] card border p-4`,children:[c.day?(0,P.jsx)(Da,{label:`Today`,spent:a.spent.today,limit:c.day,currency:l}):null,c.month?(0,P.jsx)(Da,{label:`This month`,spent:a.spent.month,limit:c.month,currency:l}):null]}):null,c?.premium&&a.spent&&(c.premium.day||c.premium.month)?(0,P.jsxs)(`div`,{className:`mb-4 flex flex-col gap-4 rounded-[14px] card border p-4`,children:[c.premium.day?(0,P.jsx)(Da,{label:`Premium requests today`,spent:a.spent.premiumToday||0,limit:c.premium.day,premium:!0}):null,c.premium.month?(0,P.jsx)(Da,{label:`Premium requests this month`,spent:a.spent.premiumMonth||0,limit:c.premium.month,premium:!0}):null]}):null,i]})}var K=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},q=e=>typeof e==`string`?e:e==null?``:String(e),ka=e=>e.replace(/(?:\s*\[(?:They spoke while you were talking; they heard up to: |Running elsewhere in ForgeQE now, as data: )[^\n]*\])+\s*$/,``),Aa=(e,t=400)=>e.length>t?`${e.slice(0,t-1)}…`:e,J=e=>typeof e==`number`?` in ${Math.round(e/1e3)}s`:``;function Y(e,t=400){return Aa(e.replace(/\s+/g,` `).trim(),t).replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}function ja(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return``;let n=t.includes("`")?"``":"`";return`${n}${n==="``"?` `:``}${t}${n==="``"?` `:``}${n}`}function Ma(e,t){return/^https?:\/\/[^\s)]+$/i.test(t)?`[${Y(e||t,120)}](${t})`:Y(e)}var Na=e=>[ja(q(K(e).id)),Y(q(K(e).title),200)].filter(Boolean).join(` `);function Pa(e){return e.replace(/<!--[\s\S]*?(?:-->|$)/g,``).trim()}function Fa(e){return e.replace(/\[((?:\\.|[^\]\\])*)\]\(https?:\/\/[^\s)]+\)/g,`$1`).replace(/\\(.)/g,`$1`).replace(/[*`]/g,``)}var X=(e,t)=>({tone:e,kind:`item`,md:t}),Ia=(e,t)=>({tone:e,kind:`sub`,md:t});function La(e,t=``){let n=t||(e.agent&&e.agent!==`forgeqe`?`**${Y(q(e.agent))}:** `:``);switch(e.kind){case`info`:return X(`info`,`${n}${Y(q(e.text))}`);case`start`:return X(`dim`,`${n}→ ${ja(q(e.tool))}${e.text&&e.text!==e.tool?` ${Y(q(e.text),200)}`:``}`);case`tool`:{let t=K(e.file),r=K(e.shell).exit,i=typeof r==`number`&&r!==0?` (exit code ${r})`:``;return X(e.ok===!1?`warn`:`dim`,`${n}${e.ok===!1?`⚠`:`✓`} ${Y(q(e.text)||q(e.tool),240)}${i}${t.path?` (${Y(q(t.action))} ${ja(q(t.path))})`:``}`)}case`say`:{let t=Pa(q(e.text));return t?X(`say`,`${n}*${Y(t)}*`):null}case`test`:return Number(e.attempt)>0?X(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} **Test, attempt ${Y(q(e.attempt))}:** ${Y(q(e.text),240)}`):X(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} ${Y(q(e.text),240)}`);case`plan`:{let t=Array.isArray(e.items)?e.items.map(K):[],r=t.find(e=>e.status===`in_progress`);return X(`info`,`${n}**Plan:** ${t.filter(e=>e.status===`completed`).length} of ${t.length} done${r?`; now: ${Y(q(r.text))}`:``}`)}case`review`:return X(e.approved?`ok`:`warn`,`${n}**Review, attempt ${Y(q(e.attempt))}:** ${e.approved?`approved`:`changes asked`}. ${Y(q(e.summary),240)}`);case`attempt`:return X(`warn`,`${n}**Attempt ${Y(q(e.attempt))} of ${Y(q(e.max))}:** ${Y(q(e.why),240)}`);case`answer`:return X(`dim`,`${n}Attempt ${Y(q(e.attempt))}: ${Y(q(e.notes)||`changed ${(Array.isArray(e.changed)?e.changed:[]).map(q).join(`, `)}`,240)}`);case`context`:return e.compacted?X(`info`,`${n}Context compacted: the conversation was summarised to make room.`):null;default:return null}}function Ra(e,t=``){switch(e.type){case`log`:return X(e.level===`error`?`fail`:e.level===`warn`?`warn`:`dim`,`${t}${e.level===`warn`||e.level===`error`?`⚠ `:``}${Y(q(e.text))}`);case`step`:return X(`dim`,`${t}**Step ${Y(q(e.step))}** · ${e.source===`memory`?`from memory`:Y(q(e.category))} · ${Ma(q(e.title)||`untitled`,q(e.url))}`);case`memory`:return X(`info`,`${t}↻ ${Y(q(e.text))}`);case`thought`:return Ia(`think`,`*${Y(q(e.text))}*`);case`outcome`:return Ia(e.ok?`ok`:`fail`,`${e.ok?`✓`:`✗`} ${Y(q(e.text),300)}`);case`done`:{let n=K(e.result);return X(n.status===`complete`?`ok`:`fail`,`${t}**${Y(q(n.status))}:** ${Y(q(n.summary))}`)}case`code`:return La(e,t);default:return null}}function za(e){switch(e.type){case`run-start`:return{tone:`info`,kind:`head`,md:`Browser run: ${Y(q(e.goal),200)}${e.url?` · ${Ma(q(e.url).replace(/^https?:\/\//,``),q(e.url))}`:``}`};case`run-event`:return Ra(K(e.event));case`run-done`:{let t=K(e.result),n=!e.error&&(t.outcome===`passed`||!t.outcome&&t.status===`complete`);return X(n?`ok`:`fail`,`${n?`✓`:`✗`} **Run ${n?`passed`:`failed`}**${J(e.ms)}: ${Y(q(e.error)||q(t.summary))}${e.runDir?` · ${ja(q(e.runDir))}`:``}`)}case`suite-start`:return{tone:`info`,kind:`head`,md:`Suite: ${(Array.isArray(e.cases)?e.cases:[]).length} cases, ${Y(q(e.parallel))} at once`};case`suite-event`:{let t=K(e.event);if(t.type===`case-start`)return X(`info`,`**Case ${Number(t.index)+1} of ${Y(q(t.total))}:** ${Na(t.case)}`);if(t.type===`case-event`)return Ra(K(t.event),`${ja(q(K(t.case).id))} `);if(t.type===`case-done`){let e=K(t.result);return X(e.status===`passed`?`ok`:`fail`,`${e.status===`passed`?`✓`:`✗`} ${Na(e.case)}: **${Y(q(e.status))}**${J(e.ms)}${e.summary?`. ${Y(q(e.summary),240)}`:``}`)}return t.type===`code-start`?X(`info`,`${ja(q(K(t.case).id))} writing its test`):t.type===`writeback`?X(`dim`,`Posted the result back: ${Y(JSON.stringify(t.item),240)}`):null}case`suite-done`:{let t=(Array.isArray(K(e.suite).results)?K(e.suite).results:[]).map(K),n=t.filter(e=>e.status===`passed`).length;return X(n===t.length?`ok`:`fail`,`**Suite: ${n} of ${t.length} passed**${J(K(e.suite).ms)}`)}case`info`:return X(e.ok===!1?`fail`:e.ok===!0?`ok`:`info`,Y(q(e.text)));case`agent`:return La(K(K(e.event)),`**Quill:** `);case`code-start`:return{tone:`info`,kind:`head`,md:`Writing a test: ${Y(q(e.goal),200)}`};case`code-done`:{let t=q(K(e.result).status);return e.error?X(`fail`,`✗ **Test not written**${J(e.ms)}: ${Y(q(e.error),240)}`):!t||t===`passed`?X(`ok`,`✓ **Test written**${J(e.ms)}`):t===`stopped`?X(`warn`,`**Test writing stopped**${J(e.ms)}`):X(`fail`,`✗ **Test not finished**${J(e.ms)} (${Y(t,40)})`)}case`card`:{let t=K(e.card),n=(Array.isArray(t.body)?t.body:[]).map(q).filter(Boolean);return X(t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,`**${Y(q(t.title))}**${t.stats?` · ${Y(q(t.stats))}`:``}${n.length?`: ${Y(n.join(`; `),300)}`:``}`)}case`report`:return X(`ok`,`✓ Report saved: ${Y(q(e.title))}`);case`call-start`:return X(`dim`,`→ ${Y(q(e.text),240)}`);case`call`:return X(e.ok===!1?`warn`:`dim`,`${e.ok===!1?`⚠`:`✓`} ${Y(q(e.text),240)}`);default:return null}}function Ba(e){let t=q(e.at)||q(e.t),n=null;switch(e.type){case`user`:n=X(`you`,`**You:** ${Y(ka(q(e.text)),240)}`);break;case`agent`:n=La(K(e.event));break;case`tool`:n=za(K(e.event));break;case`ask`:n=X(`you`,`**Asked:** ${Y(q(K(e.question).title))}`);break;case`wait`:n=X(`you`,`**Waiting for you:** ${Y(q(e.prompt))}`);break;case`answered`:n=X(`you`,`**You:** ${e.label===void 0?e.ok?`done, continue`:`cancel`:Y(q(e.label))}`);break;case`turn_done`:n=X(e.outcome===`done`?`ok`:e.outcome===`stopped`?`warn`:`fail`,`**${e.outcome===`done`?`Done`:e.outcome===`stopped`?`Stopped`:e.outcome===`needs_input`?`Needs your input`:`Failed`}**${e.error?`: ${Y(q(e.error),300)}`:``}`);break;case`settings`:n=X(`you`,`**Settings:** browser ${e.headed?`shown`:`headless`}, ${e.writeTests?`passed runs become tests`:`no tests written`}`);break;case`model`:n=X(`you`,`**Model:** ${Y(q(K(e.profile).name),80)}`);break;case`settings_applied`:n=X(`you`,`**Settings:** carried on with the settings as they are on disk now`);break;case`stderr`:n={tone:`dim`,kind:`out`,md:q(e.text)};break;case`error`:n=X(`warn`,`⚠ ${Y(q(e.message))}`);break;case`fatal`:n=X(`fail`,`✗ **ForgeQE cannot go on:** ${Y(q(e.message))}`);break;case`exit`:n=X(e.code===0?`dim`:`fail`,`ForgeQE stopped${e.code!==null&&e.code!==void 0?` (exit ${Y(q(e.code))})`:``}${e.message?`: ${Y(q(e.message))}`:``}`)}return n?{at:t,...n,plain:n.kind===`out`?n.md:Fa(n.md)}:null}function Va(e,t){if(!e||!t)return``;let n=Math.max(0,Math.round((Date.parse(t)-Date.parse(e))/1e3));return Number.isFinite(n)?`+${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:``}function Ha(e,t,n){let r=n?[`## ${Y(n,200)}`,``]:[],i=[],a=()=>{if(!i.length)return;let e=Math.max(2,...i.map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),t="`".repeat(e+1);r.push(``,`${t}text`,...i,t,``),i=[]};for(let n of e){let e=Va(t,n.at),o=e?`\`${e}\``:``;n.kind===`out`?i.push(e?`${e} ${n.md}`:n.md):(a(),n.kind===`head`?r.push(``,`#### ${n.md}${o?` ${o}`:``}`,``):n.kind===`sub`?r.push(` - ${n.md}`):r.push(`- ${o?`${o} `:``}${n.md}`))}return a(),r.join(`
|
|
8
|
-
`).replace(/\n{3,}/g,`
|
|
9
|
-
|
|
10
|
-
`).trim()+`
|
|
11
|
-
`}var Ua=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0;function Wa(e){let t=Z(e),n=Ua(t.input),r=Ua(t.output);if(n===void 0||r===void 0)return;let i=Ua(t.cached),a=Ua(t.ms),o=Ua(t.premium);return{input:n,output:r,...i?{cached:i}:{},...a===void 0?{}:{ms:a},...o===void 0?t.copilot===!0?{copilot:!0}:{}:{premium:o}}}var Ga=e=>{let t=Z(e);return typeof t.input==`number`&&typeof t.output==`number`?{input:t.input,output:t.output,cached:typeof t.cached==`number`?t.cached:void 0}:void 0};function Ka(e,t){let n=(e?.cached||0)+(t?.cached||0);return{input:(e?.input||0)+(t?.input||0),output:(e?.output||0)+(t?.output||0),...n?{cached:n}:{}}}var Z=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},Q=e=>typeof e==`string`?e:e==null?``:String(e),qa=[[/^(product_(knowledge|docs|code|runs?)|services|database_schema)$/,`Product knowledge`],[/^page_memory$/,`Memory`],[/^playbook$/,`Playbook`],[/^(requirements_file|trace_criteria)$/,`Requirements`],[/^read_confluence$/,`Confluence pages`],[/^read_mapping_file$/,`Mapping file`]],Ja={github:`GitHub`,gitlab:`GitLab`,azure_devops:`Azure DevOps`,atlassian:`Jira`,confluence:`Confluence`,notify:`Notifications`,sentry:`Sentry`,browserstack:`BrowserStack`,testmu:`TestMu`,dataverse:`Dataverse`,aws:`AWS`,azure:`Azure`,gcp:`Google Cloud`,postman:`Postman`},Ya=20;function Xa(e,t,n){let r=(e,t)=>{t&&e.length<Ya&&!e.includes(t)&&e.push(t)},i=t.toLowerCase();if(i===`skill`){let t=(n||``).trim();/^[\w.:-]{1,64}$/.test(t)&&r(e.skills,t);return}let a=i.replace(/^forgeqe_/,``),o=qa.find(([e])=>e.test(a));if(o)return r(e.knowledge,o[1]);if(Object.hasOwn(Ja,a))return r(e.systems,Ja[a]);let s=co.find(([e])=>e.test(a))?.[1];s&&r(e.systems,s)}function Za(e,t){let n=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0,r=e.sections??=[];for(let e of Array.isArray(t.sections)?t.sections:[]){let t=Q(e).replace(/\s+/g,` `).trim().slice(0,160);t&&r.length<Ya&&!r.includes(t)&&r.push(t)}let i=e.text??={sent:0,whole:0};i.sent+=n(t.sent),i.whole+=n(t.whole)}var Qa=[[/find_test_cases|story_test_cases|check_test_cases|list_sprints/,`Finding test cases`,`searching`],[/environment|logins/,`Preparing the environment`,`handing`],[/run_test_cases|browser_run|suite|run_goal|run_direct/,`Running in the browser`,`browsing`],[/comment_on_pr/,`Commenting on the pull request`,`working`],[/write_back|post_result|post_results|file_bugs|create_bugs/,`Posting the result`,`working`],[/heal_api_contracts/,`Healing the API contracts`,`retrying`],[/run_api_contracts/,`Running the API contracts`,`working`],[/run_api_scenarios/,`Running the API scenarios`,`working`],[/run_api_load/,`Load testing the API`,`working`],[/run_api_security/,`Checking the API's security`,`working`],[/api_find_calls/,`Looking up API calls`,`working`],[/api_delete_set/,`Deleting an API`,`working`],[/api_rename_folder/,`Renaming a folder`,`working`],[/api_move_calls/,`Moving calls`,`working`],[/api_contracts|api_new_set|api_add_calls|api_import_collection/,`Making API contracts`,`working`],[/write_test|heal/,`Writing the test`,`writing`],[/run_tests/,`Running the tests`,`working`],[/^(bash|shell)$/,`Running a command`,`working`],[/read_confluence|read|grep|glob|list|webfetch/,`Reading`,`reading`],[/edit|write|patch/,`Changing the code`,`writing`],[/task/,`Handing work to another agent`,`handing`]],$a=/^(test|attempt|info|review)$/,eo=/run_test_cases|browser_run|run_suite|write_test/,to=[[/(^|_)skill/,`skill`],[/code_element/,`element`],[/code_outline/,`outline`],[/code_references/,`references`],[/code_impact|(^|_)impact/,`impact`],[/code_find|find_tests/,`find`],[/code_test_file/,`testfile`],[/code_command|code_status|run_tests|bash|shell/,`run`],[/find_test_cases|story_test_cases|check_test_cases|list_sprints/,`cases`],[/environment|logins/,`environment`],[/run_test_cases|browser_run|suite|run_goal|run_direct/,`browser`],[/comment_on_pr|write_back|post_result|post_results|file_bugs|create_bugs/,`post`],[/grep|glob|search/,`search`],[/webfetch|websearch|fetch/,`web`],[/(^|_)list/,`list`],[/read/,`read`],[/edit|write|patch/,`edit`],[/task/,`task`]];function no(e){let t=e.toLowerCase();return to.find(([e])=>e.test(t))?.[1]??`work`}function ro(e){let t=/^(.*?\(attempt \d+\/\d+\))\s*:\s*([\s\S]+)$/.exec(e)??/^([^:\n]{1,160}?):\s+([\s\S]{40,})$/.exec(e),n=(t?t[1]:e).replace(/\s*\(attempt \d+\/\d+\)$/,``).replace(/(^|\s)(?:[\w.-]+[\\/])+([\w.-]+)/g,`$1$2`);return{summary:n.length>140?`${n.slice(0,139)}…`:n,detail:t?t[2].trim():``}}var io=[[/find_test_cases|story_test_cases|check_test_cases/,`forgeqe-find`],[/run_test_cases|browser_run|run_goal|run_direct|suite|explore_run/,`engine`],[/write_test/,`forgeqe-test`],[/heal(?!_api_contracts)/,`forgeqe-heal`],[/review_pr|pr_review/,`forgeqe-pr-review`],[/api_plan/,`forgeqe-api-plan`],[/write_api|api_test/,`forgeqe-api`],[/explore_plan|plan_charters/,`forgeqe-explore-plan`],[/defect_rca|root_cause/,`forgeqe-defect-rca`],[/insights|forgeqe_bi|defect_intelligence/,`forgeqe-bi`],[/refine/,`forgeqe-refine`]];function ao(e){let t=e.toLowerCase();if(!uo(t))return io.find(([e])=>e.test(t))?.[1]}var oo=[[/write_api_tests/,`forgeqe-api`,`Write the API tests`],[/(?<!run_)api_scenarios$/,`forgeqe-api-plan`,`Plan the API scenarios`]];function so(e){let t=e.toLowerCase();if(uo(t))return;let n=oo.find(([e])=>e.test(t));return n?{agent:n[1],task:n[2]}:void 0}var co=[[/^(azure_devops|ado|azuredevops)_/,`Azure DevOps`],[/^(jira|atlassian)_/,`Jira`],[/^confluence_/,`Confluence`],[/^github_/,`GitHub`],[/^xray_/,`Xray`],[/^testrail_/,`TestRail`],[/^zephyr_/,`Zephyr Scale`],[/^qtest_/,`qTest`]],lo=/(^|_)(create|update|add|delete|remove|post|comment|link|unlink|upload|set|assign|transition|edit|merge|close|reopen|queue|trigger|run|push|move|copy|import|write|publish|approve|vote|lock|unlock)(_|$)/;function uo(e){let t=e.toLowerCase();if(!t.startsWith(`forgeqe_`))return co.find(([e])=>e.test(t))?.[1]}var fo=e=>{let t=Z(e);return typeof t.diff==`string`&&t.diff?{diff:t.diff,added:Number(t.added)||0,removed:Number(t.removed)||0}:void 0},po=e=>Array.isArray(e)?e.map(Q).filter(Boolean):[];function mo(e,t,n){let r=Q(e.status)||(t?`failed`:``);return{status:r,ok:!t&&/^(passed|pass|written|ok|known_defect)$/i.test(r),...Q(e.testFile)?{testFile:Q(e.testFile)}:{},...Q(e.testName)?{testName:Q(e.testName)}:{},...Q(e.command)?{command:Q(e.command)}:{},...typeof e.attempts==`number`?{attempts:e.attempts}:{},...typeof e.maxAttempts==`number`?{maxAttempts:e.maxAttempts}:{},changed:po(e.changed),reused:po(e.reused),...n?{runDir:n}:{},...t?{error:t}:{},...Q(e.notes)?{notes:Q(e.notes)}:{}}}function ho(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=Z(n),r=(typeof n==`string`?n:Q(e.label)||Q(e.request)).replace(/\s+/g,` `).trim(),i=(typeof n==`string`?n:Q(e.request)||Q(e.label)).trim();r&&i&&!t.some(e=>e.label.toLowerCase()===r.toLowerCase())&&t.push({label:r.length>60?`${r.slice(0,59)}…`:r,request:i})}return t.slice(0,4)}function go(e){let t=e.toLowerCase(),n=uo(t);if(n)return lo.test(t.replace(/^[a-z]+_/,``))?{label:`Updating ${n}`,orb:`working`}:{label:`Reading ${n}`,orb:`reading`};for(let[e,n,r]of Qa)if(e.test(t))return{label:n,orb:r};let r=t.replace(/^forgeqe_/,``).replace(/[_-]+/g,` `).trim();return{label:r?r[0].toUpperCase()+r.slice(1):`Working`,orb:`working`}}function _o(e,t){return{id:e,user:t,steps:[],parts:[],next:[],asks:[],waits:[],log:[],plan:[],changes:[],tests:[],reports:[],actions:[]}}function vo(e){let t=Z(e);return[Q(t.id),Q(t.title)].filter(Boolean).join(`: `)}function yo(e){let t=e.split(`
|
|
12
|
-
`)[0].trim(),n=e.includes(`
|
|
13
|
-
`)?`${t} …`:t;return n.length>80?`${n.slice(0,79)}…`:n}function bo(e,t,n){let r=Z(e),i=typeof r.command==`string`?r.command:``;if(!i)return;let a=typeof r.exit==`number`&&Number.isInteger(r.exit)?r.exit:void 0,o=typeof r.output==`string`?r.output:``;return{arg:yo(i),step:{command:i,...o?{output:o}:{},shell:{...a===void 0?{}:{exit:a},...t?n===`running`?{started:t}:{ended:t}:{}}}}}function xo(e){let t=[],n=(e,r,i)=>{for(let a of e){let e=a.handoff?.agent||a.agent||r;if(a.shell&&a.command){let n=a.status===`running`?i?`running`:`stopped`:a.status===`fail`?`fail`:a.status===`ok`?`ok`:`stopped`;t.push({key:a.key,command:a.command,status:n,...a.shell.exit===void 0?{}:{exit:a.shell.exit},...e?{agent:e}:{},...a.shell.started?{started:a.shell.started}:{},...a.shell.ended?{ended:a.shell.ended}:{}})}a.children&&n(a.children,e,i)}};for(let t of e.turns)n(t.steps,void 0,!t.outcome&&!e.ended);return t}function So(e){let t={turns:[],notes:[]},n=new Map,r=e=>(typeof e==`string`?n.get(e):void 0)??t.turns.at(-1),i=(e,t)=>{let n=e=>{for(let r of e){if(r.key===t)return r;let e=r.children&&n(r.children);if(e)return e}};return n(e.steps)},a=(e,t,n)=>{let r={lines:[],...t};if(n)n.push(r);else{let t=e.plan.find(e=>e.status===`active`)??e.plan.find(e=>e.status===`pending`)??e.plan.at(-1);t&&(r.phase=t.text),e.steps.push(r)}return r},o=(e,t,n)=>{let r=t.parent?i(e,`c:${Q(t.parent)}`):void 0;if(r)return r.children??=[];let o=Q(t.agent);if(!o&&$a.test(Q(t.kind))){let t=e.steps.findLast(e=>e.status===`running`&&!!e.agent&&e.agent!==`forgeqe`);return t?s(t):void 0}if(!n||!o||o===`forgeqe`)return;let c=e.steps.findLast(e=>e.status===`running`);return c||=a(e,{key:`ag:${o}:${e.steps.length}`,label:Et(o).name,status:`running`,orb:`handing`,agent:o}),c.agent??=o,s(c)},s=e=>{let t=e.children??=[],n=t.at(-1);return n&&n.key.startsWith(`try:`)&&n.status===`running`?n.children??=[]:t},c=(e,t)=>{let n=e?.children?.at(-1);if(!n||!n.key.startsWith(`try:`)||n.status!==`running`)return;let r=[...n.children||[]].reverse().find(e=>e.key.startsWith(`t:`)||!!e.review),i=t??(r?r.review?r.review.approved:r.status===`ok`:void 0);n.status=i===void 0?`info`:i?`ok`:`fail`},l,u=new Map,d=new Map,f=0,p=e=>{let n=t.agents??=[],r=n.find(t=>t.agent===e);return r||n.push(r={agent:e,usage:{input:0,output:0},at:0}),r.at=++f,r},m=(e,n,r,s)=>{let f=Q(n.kind),m=Q(n.id);if(f===`output`){let t=m?i(e,`c:${m}`):void 0;t?.shell&&t.status===`running`&&typeof n.text==`string`&&n.text&&(t.output=n.text);return}if((f===`start`||f===`tool`)&&eo.test(Q(n.tool))&&!uo(Q(n.tool)))return;let h=o(e,n,r),g=Z(n.delegate),_=Q(n.tool)||Q(n.text),v=Q(g.agent)?{agent:Q(g.agent),task:Q(g.task)}:!r&&!h?so(Q(n.tool)):void 0;if(f===`start`){if(v)a(e,{key:`c:${m}`,label:`Hands off to ${kt(Et(v.agent).name)}`,arg:v.task||void 0,status:`running`,orb:`handing`,agent:v.agent,handoff:v,children:[]},h);else{let{label:t,orb:r}=go(_),i=h?void 0:ao(Q(n.tool)),o=bo(n.shell,s,`running`);a(e,{key:`c:${m}`,label:t,arg:o?o.arg:Q(n.text)&&Q(n.text)!==Q(n.tool)?Q(n.text):void 0,status:`running`,orb:r,icon:no(_),...i?{agent:i}:{},...o?o.step:{}},h)}}else if(f===`tool`){n.ok!==!1&&Q(n.tool)&&Xa(t.uses??={skills:[],knowledge:[],systems:[]},Q(n.tool),Q(n.skill));let r=m?i(e,`c:${m}`):void 0,o=Z(n.file),c=fo(n.change);if(c&&Q(o.path)){let t=e.changes.find(e=>e.path===Q(o.path));t?Object.assign(t,{diff:`${t.diff}\n${c.diff}`,added:t.added+c.added,removed:t.removed+c.removed}):e.changes.push({path:Q(o.path),...c,...Q(n.agent)?{agent:Q(n.agent)}:{}})}let l=bo(n.shell,s,`ended`);if(r)r.status=n.ok===!1?`fail`:`ok`,r.handoff&&Q(g.result)&&(r.handoff.result=Q(g.result)),l&&(r.command=l.step.command,r.shell={...r.shell,...l.step.shell},l.step.output?r.output=l.step.output:delete r.output);else if(v)a(e,{key:`c:${m||e.steps.length}`,label:`Hands off to ${kt(Et(v.agent).name)}`,arg:v.task||void 0,status:n.ok===!1?`fail`:`ok`,orb:`handing`,agent:v.agent,handoff:{...v,...Q(g.result)?{result:Q(g.result)}:{}},children:[]},h);else{let{label:t,orb:r}=go(_),i=h?void 0:ao(Q(n.tool));a(e,{key:`c:${m||e.steps.length}`,label:t,arg:l?l.arg:Q(o.path)||Q(n.text)||void 0,status:n.ok===!1?`fail`:`ok`,orb:r,icon:no(_),...i?{agent:i}:{},...c?{change:c}:{},...l?l.step:{}},h)}r&&c&&(r.change=c)}else if(f===`stream`||f===`say`){if(r)return;let t=e.parts.find(e=>e.id===m);t?t.text=f===`say`?Q(n.text):t.text+Q(n.text):e.parts.push({id:m||`p${e.parts.length}`,text:Q(n.text)})}else if(f===`plan`){if(h||n.agent&&n.agent!==`forgeqe`)return;let t=Array.isArray(n.items)?n.items.map(Z):[],r=e=>e===`completed`?`done`:e===`in_progress`?`active`:e===`cancelled`?`skipped`:`pending`;e.plan=t.map(e=>({text:Q(e.text),status:r(e.status)})).filter(e=>e.text)}else if(f===`test`){let t=Number(n.attempt)||0;if(t>0){let{summary:r,detail:i}=ro(Q(n.text));a(e,{key:`t:${t}:${e.steps.length}`,label:`Test, attempt ${t}`,arg:r||void 0,status:n.ok?`ok`:`fail`,orb:`retrying`,icon:`test`,...i?{output:i}:{},...l?{command:l}:{}},h),l=void 0}else if(n.ok&&/\bconnected$/i.test(Q(n.text)))return;else a(e,{key:`t:${e.steps.length}`,label:Q(n.text)||(n.ok?`Checked`:`Check failed`),status:n.ok?`ok`:`fail`,orb:/connect|mcp/i.test(Q(n.text))?`waiting`:`working`},h)}else if(f===`attempt`){let t=e.steps.findLast(e=>e.status===`running`&&!!e.agent&&e.agent!==`forgeqe`);if(!t)return;c(t);let r=Q(n.fixing)||Q(n.why);(t.children??=[]).push({key:`try:${Q(n.attempt)}:${t.children.length}`,label:`Attempt ${Q(n.attempt)} of ${Q(n.max)}`,arg:r?r.length>120?`${r.slice(0,119)}…`:r:void 0,status:`running`,orb:`retrying`,icon:`retry`,lines:r.length>120?[{text:r}]:[],children:[]})}else if(f===`review`){let t=(Array.isArray(n.issues)?n.issues:[]).map(Z).map(e=>({kind:Q(e.kind)===`standards`?`standards`:`correctness`,...Q(e.file)?{file:Q(e.file)}:{},problem:Q(e.problem),...Q(e.fix)?{fix:Q(e.fix)}:{}})).filter(e=>e.problem).slice(0,20),r=n.approved===!0,i=(h??e.steps).length;a(e,{key:`r:${Q(n.attempt)}:${i}`,label:r?`Review approved`:`Review asked for changes`,arg:t.length?`${t.length} ${t.length===1?`issue`:`issues`}`:void 0,status:r?`ok`:`fail`,orb:`thinking`,agent:`forgeqe-review`,icon:`review`,review:{approved:r,summary:Q(n.summary),issues:t}},h)}else if(f===`context`||f===`usage`){let e=Q(n.agent)||`forgeqe`,r=p(e);f===`context`&&typeof n.tokens==`number`&&typeof n.limit==`number`&&(r.context={tokens:n.tokens,limit:n.limit,compactsAt:typeof n.compactsAt==`number`?n.compactsAt:void 0},e===`forgeqe`&&(t.context=r.context));let i=f===`usage`?Ga(n.usage):void 0;if(i){let n=u.get(e);n&&(i.input<n.input||i.output<n.output)&&d.set(e,Ka(d.get(e),n)),u.set(e,i),r.usage=Ka(d.get(e),i),t.usage=(t.agents||[]).reduce((e,t)=>Ka(e,t.usage),void 0)}}else if(f===`info`){let t=(h??e.steps).at(-1),r=/^ForgeQE runs the test:\s*([\s\S]+)$/.exec(Q(n.text));r?l=r[1].trim():t&&t.lines.push({text:Q(n.text)})}},h,g=(e,n,r)=>{let o=Q(n.type);if(o===`docs`)return Za(t.uses??={skills:[],knowledge:[],systems:[]},n);if(o===`ui-action`){let t=Jn(n);t&&!e.actions.some(e=>e.id===t.id)&&e.actions.push(t)}else if(o===`run-start`)a(e,{key:`run:${e.steps.length}`,label:`Running in the browser`,arg:Q(n.goal),status:`running`,orb:`browsing`,agent:`engine`});else if(o===`run-event`){let t=e.steps.findLast(e=>e.key.startsWith(`run:`)),r=Z(n.event);if(!t)return;r.type===`outcome`?t.lines.push({text:`Step ${Q(r.step)}: ${Q(r.action)||Q(r.text)}`,ok:r.ok===!0||r.ok!==!1&&void 0}):r.type===`log`&&(r.level!==`info`||r.progress)&&t.lines.push({text:Q(r.text),ok:r.level!==`error`&&void 0})}else if(o===`run-done`){let t=e.steps.findLast(e=>e.key.startsWith(`run:`)&&e.status===`running`),r=Z(n.result),i=!n.error&&(r.outcome===`passed`||!r.outcome&&r.status===`complete`);if(t){t.status=i?`ok`:`fail`;let e=Q(n.error)||Q(r.summary);e&&t.lines.push({text:e,ok:!!i})}Q(n.runDir)&&e.reports.push({label:i?`Browser run report`:`Browser run report (failed)`,path:Q(n.runDir)})}else if(o===`suite-start`){let t=Array.isArray(n.cases)?n.cases:[];a(e,{key:`suite:${e.steps.length}`,label:`Running ${t.length} test case${t.length===1?``:`s`}`,status:`running`,orb:`working`,agent:`engine`})}else if(o===`suite-event`){let t=e.steps.findLast(e=>e.key.startsWith(`suite:`)),r=Z(n.event);if(t&&r.type===`case-done`){let e=Z(r.result);t.lines.push({text:`${vo(e.case)}: ${Q(e.status)}`,ok:e.status===`passed`})}}else if(o===`suite-done`){let t=e.steps.findLast(e=>e.key.startsWith(`suite:`)),r=Array.isArray(Z(n.suite).results)?Z(n.suite).results.map(Z):[];if(t){let e=r.filter(e=>e.status!==`passed`).length;t.status=e?`fail`:`ok`,t.arg=`${r.length-e} of ${r.length} passed`}}else if(o===`card`){let t=Z(n.card);a(e,{key:`card:${e.steps.length}`,label:Q(t.title),arg:Q(t.stats)||void 0,status:t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,orb:`working`,lines:(Array.isArray(t.body)?t.body:[]).map(e=>({text:Q(e)}))})}else if(o===`call-start`&&!n.quiet)a(e,{key:`call:${Q(n.id)}`,label:Q(n.text),status:`running`,orb:`working`});else if(o===`call`&&!n.quiet){let t=n.id?i(e,`call:${Q(n.id)}`):void 0;t?t.status=n.ok===!1?`fail`:`ok`:a(e,{key:`call:${e.steps.length}`,label:Q(n.text),status:n.ok===!1?`fail`:`ok`,orb:`working`})}else if(o===`code-start`)h=Q(n.runDir)||void 0,a(e,{key:`code:${e.steps.length}`,label:`Hands off to Quill`,arg:Q(n.goal),status:`running`,orb:`writing`,agent:`forgeqe-test`,handoff:{agent:`forgeqe-test`,task:Q(n.goal)},children:[]});else if(o===`code-done`){let t=e.steps.findLast(e=>e.key.startsWith(`code:`)&&e.status===`running`);c(t),t&&(t.status=n.error?`fail`:`ok`,n.error&&t.lines.push({text:Q(n.error),ok:!1}));let r=[],i=(e=[])=>e.forEach(e=>(r.push(e),i(e.children)));i(t?.children);let a=r.filter(e=>e.key.startsWith(`t:`)),o=r.filter(e=>e.review);e.tests.push({...mo(Z(n.result),Q(n.error),h),...t?{runs:a.length,failedRuns:a.filter(e=>e.status===`fail`).length,reviews:o.length}:{},...o.length?{review:o.at(-1).review}:{}}),h=void 0}else if(o===`agent`)m(e,Z(n.event),!0,r);else if(o===`info`){let t=e.steps.at(-1);t?t.lines.push({text:Q(n.text),ok:n.ok===!0||n.ok!==!1&&void 0}):a(e,{key:`info:${e.steps.length}`,label:Q(n.text),status:n.ok===!1?`fail`:`info`,orb:`working`})}else o===`report`&&(a(e,{key:`report:${e.steps.length}`,label:`Report saved`,arg:Q(n.title),status:`ok`,orb:`working`}),Q(n.html)&&e.reports.push({label:Q(n.title)||`Report`,path:Q(n.html)}))};for(let r of e){_(r);let e=Ba(r);e&&(typeof r.id==`string`&&n.get(r.id)||typeof r.turn==`string`&&n.get(r.turn)||t.turns.at(-1))?.log.push(e)}return t;function _(e){switch(e.type){case`user`:{let r=_o(Q(e.id),ka(Q(e.text)));t.turns.push(r),n.set(r.id,r);break}case`ready`:{t.ended=void 0,t.fatal=void 0;let n=Z(e.profile);n.name&&(t.model={name:Q(n.name),provider:Q(n.provider)}),t.writeTests=e.writeTests!==!1,t.headed=e.headed===!0;break}case`models`:case`model`:{let n=Z(e.profile);n.name&&(t.model={name:Q(n.name),provider:Q(n.provider)}),e.type===`models`&&Array.isArray(e.models)&&(t.models=e.models.map(e=>({name:Q(Z(e).name),provider:Q(Z(e).provider)})).filter(e=>e.name));break}case`settings`:typeof e.writeTests==`boolean`&&(t.writeTests=e.writeTests),typeof e.headed==`boolean`&&(t.headed=e.headed);break;case`turn_start`:{let t=r(e.id);t&&(t.started=Q(e.t)||Q(e.at));break}case`agent`:{let t=r(e.id);t&&m(t,Z(e.event),!1,Q(e.t)||void 0);break}case`tool`:{let t=r(e.id);t&&g(t,Z(e.event),Q(e.t)||void 0);break}case`ask`:{let t=r(e.turn),n=Z(e.question);t?.asks.push({id:Q(e.id),title:Q(n.title),detail:Q(n.detail)||void 0,lines:Array.isArray(n.lines)?n.lines.map(Q):[],options:(Array.isArray(n.options)?n.options:[]).map(e=>({id:Q(Z(e).id),label:Q(Z(e).label)}))});break}case`wait`:r(e.turn)?.waits.push({id:Q(e.id),prompt:Q(e.prompt)});break;case`answered`:for(let n of t.turns){let t=n.asks.find(t=>t.id===e.ask);t&&(t.answer=Q(e.label));let r=n.waits.find(t=>t.id===e.ask);r&&(r.answer=e.ok===!0)}break;case`turn_done`:{let n=r(e.id);if(!n)break;n.outcome=e.outcome,n.reply=Q(e.reply),n.next=ho(e.next),n.error=Q(e.error)||void 0,n.ended=Q(e.t)||Q(e.at),n.spent=Wa(e.spent),t.agents?.length||(t.usage=Ga(e.usage)??t.usage);let i=e=>{for(let t of e)t.status===`running`&&(t.status=n.outcome===`done`?`ok`:`info`),t.children&&i(t.children)};if(i(n.steps),n.outcome===`done`)for(let e of n.plan)e.status===`active`&&(e.status=`done`);break}case`error`:e.code!==`busy`&&t.notes.push(Q(e.message));break;case`fatal`:t.fatal=Q(e.message);break;case`exit`:t.ended={code:typeof e.code==`number`?e.code:null,stderr:Array.isArray(e.stderr)?e.stderr.map(Q):void 0,message:Q(e.message)||void 0}}}}function Co(e){let t=e.asks.find(e=>e.answer===void 0),n=e.waits.find(e=>e.answer===void 0);if(t||n)return{text:`Waiting for you…`,orb:`waiting`};let r=e.steps.findLast(e=>e.status===`running`);return r?{text:`${r.label}…`,orb:r.orb}:e.parts.some(e=>e.text.trim())&&e.steps.length?{text:`Writing a reply…`,orb:`writing`}:{text:`Thinking…`,orb:`thinking`}}function wo(e){if(!e.started||!e.ended)return`Done`;let t=Math.max(1,Math.round((Date.parse(e.ended)-Date.parse(e.started))/1e3)),n=e.outcome===`stopped`?`Stopped after`:`Worked for`;return t<60?`${n} ${t} second${t===1?``:`s`}`:`${n} ${Math.floor(t/60)} min ${t%60} s`}function To(e){let t=Math.max(0,Math.round(e));for(let[e,n]of[[1e9,`B`],[1e6,`M`],[1e3,`K`]])if(t>=e*.99995)return`${(t/e).toFixed(1)}${n}`;return String(t)}function Eo(e){if(e===0)return`included in your plan`;let t=Number(e.toFixed(2));return`${t} premium request${t===1?``:`s`}`}function Do(e){if(e<6e4)return`${(Math.max(0,e)/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);return t<3600?`${Math.floor(t/60)}m ${String(t%60).padStart(2,`0`)}s`:`${Math.floor(t/3600)}h ${String(Math.floor(t%3600/60)).padStart(2,`0`)}m`}function Oo(e,t){let n=e?Date.parse(e):NaN;if(Number.isNaN(n))return``;let r=Math.max(0,Math.floor((t-n)/1e3)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=String(r%60).padStart(2,`0`);return i?`${i}:${String(a).padStart(2,`0`)}:${o}`:`${a}:${o}`}var ko={running:`active`,ok:`done`,fail:`failed`,info:`note`};function Ao(e,t){let n=e=>e===`active`&&!t?`done`:e;if(!e.plan.length)return e.steps.map(e=>({key:e.key,label:e.label,status:n(ko[e.status]),steps:[],step:e}));let r=new Set(e.plan.map(e=>e.text)),i=new Map,a=``;for(let t of e.steps)t.phase&&r.has(t.phase)&&(a=t.phase),i.set(a,[...i.get(a)||[],t]);let o=e=>e.some(e=>e.status===`running`),s=[],c=i.get(``)||[];c.length&&s.push({key:`plan:start`,label:`Getting started`,status:n(o(c)?`active`:`done`),steps:c});let l=e.plan.map((e,n)=>{let r=i.get(e.text)||[],a=e.status===`done`?`done`:e.status===`skipped`?`skipped`:e.status===`active`||o(r)?`active`:`pending`;return{key:`plan:${n}`,label:e.text,status:a===`active`&&!t?`pending`:a,steps:r}});return[...s,...jo(l)]}function jo(e){let t=e.findIndex(e=>e.status===`active`);return t<0?e:e.map((e,n)=>e.status===`skipped`||e.status===`failed`||n===t?e:{...e,status:n<t?`done`:`pending`})}function Mo(e){let t=e.filter(e=>e.status===`running`).reverse(),n=e.filter(e=>e.status!==`running`).reverse();return[...t,...n].slice(0,Math.max(8,t.length))}var No=`forgeqe-sidebar-panels`;function Po(e,t){let[n,r]=(0,N.useState)(()=>{try{return JSON.parse(localStorage.getItem(No)||`{}`)[e]??t}catch{return t}});return[n,()=>{r(!n);try{let t=JSON.parse(localStorage.getItem(No)||`{}`);localStorage.setItem(No,JSON.stringify({...t,[e]:!n}))}catch{}}]}function $({id:e,title:t,children:n,initial:i=!0}){let[a,o]=Po(e,i);return(0,P.jsxs)(`section`,{"aria-labelledby":`panel-${e}`,className:`flex flex-col pt-1`,children:[(0,P.jsx)(`h3`,{id:`panel-${e}`,className:`m-0`,children:(0,P.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:o,className:`flex min-h-8 w-full cursor-pointer items-center gap-1 rounded-[8px] border-0 bg-transparent px-2 text-left text-[13px] font-semibold text-ink hover:bg-surface-muted`,children:[(0,P.jsx)(`span`,{className:`flex-1`,children:t}),(0,P.jsx)(r,{size:14,"aria-hidden":`true`,className:D(`text-muted transition-transform`,!a&&`-rotate-90`)})]})}),(0,P.jsx)(F,{open:a,className:`flex flex-col pt-1 pb-1`,children:n})]})}function Fo({icon:e,label:t,value:n,to:r,title:i}){let a=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(j,{icon:e,size:14,className:`flex-none`}),(0,P.jsx)(`span`,{className:`max-w-[120px] flex-none truncate text-[13px] text-muted`,children:t}),(0,P.jsx)(`span`,{className:`line-clamp-2 min-w-0 flex-1 text-right text-[13px] leading-snug [overflow-wrap:anywhere] text-ink`,children:n})]}),o=`flex min-h-7 items-center gap-2 rounded-[8px] px-2 py-1 no-underline`;return r?(0,P.jsx)(`a`,{href:r,"data-tip":i,className:D(o,`hover:bg-surface-muted`),children:a}):(0,P.jsx)(`div`,{"data-tip":i,className:o,children:a})}function Io({icon:e,label:t,value:n,detail:r,to:i,title:a,onClick:o,open:s,muted:c}){let l=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(j,{icon:e,size:16,className:`mt-1 flex-none text-muted`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-[13px] leading-tight text-muted`,children:t}),(0,P.jsx)(`span`,{className:D(`line-clamp-2 text-[13px] leading-snug font-medium [overflow-wrap:anywhere]`,c?`text-muted`:`text-ink`),children:n}),r&&(0,P.jsx)(`span`,{className:`truncate text-[13px] leading-snug text-muted`,children:r})]}),(i||o)&&(0,P.jsx)(S,{size:14,"aria-hidden":`true`,className:D(`mt-1 flex-none text-muted opacity-0 transition-[opacity,transform] group-hover:opacity-100 group-focus-visible:opacity-100`,s&&`rotate-90 opacity-100`)})]}),u=`group flex w-full items-start gap-4 rounded-[10px] px-2 py-2 text-left no-underline`;return o?(0,P.jsx)(`button`,{type:`button`,"aria-expanded":s,"data-tip":a,onClick:o,className:D(u,`cursor-pointer border-0 bg-transparent hover:bg-surface-muted`),children:l}):i?(0,P.jsx)(`a`,{href:i,"data-tip":a,className:D(u,`hover:bg-surface-muted`),children:l}):(0,P.jsx)(`div`,{"data-tip":a,className:u,children:l})}function Lo({title:e,children:t}){return(0,P.jsxs)(`div`,{className:`flex flex-col`,children:[(0,P.jsx)(`span`,{className:`px-2 pt-2 pb-1 text-[13px] font-medium tracking-wide text-muted uppercase`,children:e}),t]})}var Ro=e=>`Tokens used, added up over every model call: ${aa(e)}. Each call reads the conversation so far again, so this grows past the context window.`,zo=`How much of the model's context window the conversation fills now. It drops when the conversation is compacted.`;function Bo({a:e,working:t}){let n=Et(e.agent);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[8px] px-2 py-1`,children:[(0,P.jsxs)(`span`,{className:`flex min-h-6 items-center gap-2`,"data-tip":Ro(e.usage),children:[(0,P.jsx)(dn,{agent:e.agent,px:16,decorative:!0,working:t}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] text-ink`,children:n.name}),(0,P.jsxs)(`span`,{className:`flex-none text-[13px] text-ink tabular-nums`,children:[B(e.usage.input+e.usage.output),` `,(0,P.jsx)(`span`,{className:`text-muted`,children:`used`})]})]}),e.context&&e.context.limit>0&&(0,P.jsxs)(`span`,{className:`flex flex-col pl-6`,"data-tip":zo,children:[(0,P.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[13px] text-muted`,children:[(0,P.jsxs)(`span`,{className:`flex-1`,children:[`Context `,Math.round(Math.min(1,e.context.tokens/e.context.limit)*100),`% full`]}),(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[B(e.context.tokens),` of `,B(e.context.limit)]})]}),(0,P.jsx)(Vo,{value:e.context.tokens,max:e.context.limit,warnAt:e.context.compactsAt})]})]})}function Vo({value:e,max:t,warnAt:n}){let r=t>0?Math.min(1,e/t):0,i=n?e>=n*.9:r>.75;return(0,P.jsx)(`span`,{role:`meter`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-label":`Context used`,className:`mt-1 block h-1.5 w-full overflow-hidden rounded-full bg-line`,children:(0,P.jsx)(`span`,{className:D(`block h-full rounded-full transition-[width] duration-200 ease-out`,i?`bg-warn`:`bg-accent`),style:{width:`${Math.max(2,r*100)}%`}})})}var Ho=e=>{try{return e?new URL(e).host:``}catch{return``}},Uo=e=>e.split(/[\\/]/).filter(Boolean).pop()||e;function Wo({path:e,icon:t,extra:n}){let[r,i]=(0,N.useState)(``);return(0,P.jsxs)(`li`,{className:`flex flex-col`,children:[(0,P.jsxs)(`button`,{type:`button`,"data-tip":`Open ${e}`,onClick:async()=>i(await Kt(e)),className:`flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-[10px] border-0 bg-transparent px-4 text-left hover:bg-surface-muted`,children:[(0,P.jsx)(j,{icon:t,size:15,className:`flex-none text-muted`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] text-accent-fg`,children:Uo(e)}),n]}),r&&(0,P.jsx)(`span`,{className:`px-4 text-[13px] text-fail`,children:r})]})}function Go(e,t){let n=e?Date.parse(e):NaN,r=t?Date.parse(t):NaN;if(Number.isNaN(n)||Number.isNaN(r))return``;let i=Math.max(0,Math.round((r-n)/1e3));return i<60?`${i}s`:`${Math.floor(i/60)} min`}function Ko({c:e}){let t=e.status===`running`?qo(e.started):Go(e.started,e.ended),n=e.status===`running`?`Running`:e.status===`ok`?`Done`:e.status===`stopped`?`Stopped`:e.exit===void 0?`Failed`:`Exit code ${e.exit}`;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`div`,{tabIndex:0,"data-tip":e.command,"aria-label":`${e.command}. ${n}${t?`, ${t}`:``}`,className:`flex items-start gap-2 rounded-[10px] px-4 py-2 hover:bg-surface-muted`,children:[e.status===`running`?(0,P.jsx)(ft,{size:15,"aria-hidden":`true`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,P.jsx)(j,{icon:e.status===`ok`?_:h,size:15,className:D(`mt-1 flex-none`,e.status===`ok`?`text-pass`:e.status===`fail`?`text-fail`:`text-muted`)}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`span`,{className:`truncate font-mono text-[13px] text-ink`,children:yo(e.command)}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:[e.agent?Et(e.agent).name:``,n,t].filter(Boolean).join(` · `)})]})]})})}function qo(e){let t=e?Date.parse(e):NaN;if(Number.isNaN(t))return``;let n=Math.max(0,Math.round((Date.now()-t)/1e3));return n<60?`${n}s`:`${Math.floor(n/60)} min`}function Jo({chat:e}){let[t,n]=(0,N.useState)(null),[r,i]=(0,N.useState)(null),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)([]);(0,N.useEffect)(()=>{let e=!1,t=()=>Bt.list().then(t=>!e&&d(t.tasks),()=>{});t();let n=xn(t,4e3);return()=>{e=!0,Sn(n)}},[]);let p=location.hash.replace(/^#\/?/,``),m=e?.commands??[],h=Mo(m),g=u.filter(e=>e.to!==p);(0,N.useEffect)(()=>{let e=!1,t=()=>Nt.state().then(t=>{if(!e){if(n(t),!t.ready)return i(null);Ft.get().then(t=>!e&&i(t),()=>{})}},()=>{});return t(),window.addEventListener(`hashchange`,t),()=>{e=!0,window.removeEventListener(`hashchange`,t)}},[]),(0,N.useEffect)(()=>{if(!t?.ready)return;let n=!1,r=()=>O.tokenomics().then(e=>!n&&s(e),()=>{});r();let i=xn(r,e?.busy?3e4:18e4);return()=>{n=!0,Sn(i)}},[t?.ready,t?.project,e?.busy]);let _=t?t.project.split(/[\\/]/).filter(Boolean).pop()||t.project:``,v=r?.codeRepo||r?.repo,y=o?.days.find(e=>e.day===new Date().toISOString().slice(0,10)),b=r?.environment,x=(e,t)=>`${B(e.input+e.output)} tokens${t&&e.amount?` · ${H(e.amount,t)}`:``}`,S=o?.project?x(o.project.today,o.project.currency):y?x(y,o?.currency):void 0,C=o?o.project?{tokens:o.project.days30.input+o.project.days30.output,cost:o.project.currency&&o.project.days30.amount?H(o.project.days30.amount,o.project.currency):void 0,title:`Every model call made for this project in the last 30 days.`}:{tokens:o.totals.input+o.totals.output,cost:o.currency&&o.totals.amount?H(o.totals.amount,o.currency):void 0,title:`Test runs of this project in the last 30 days.`}:void 0;return(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,P.jsx)($,{id:`env`,title:`Environment`,initial:!1,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,P.jsx)(Io,{icon:f,label:`Project`,value:t?.ready?_:`Not set up`,muted:!t?.ready,to:E(`settings`,`setup`),title:t?.project}),r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Io,{icon:ae,label:r.codeRepo?`Tests go to`:`Repository`,value:v?v.name:`Not a git repository`,muted:!v,detail:v?.branch?`Branch ${v.branch}`:v?.commit?`Commit ${v.commit}`:void 0,title:v?`${v.root}${v.commit?` @ ${v.commit}`:``}`:void 0,to:E(`settings`,`tests`)}),(0,P.jsx)(Io,{icon:Fe,label:`Test environment`,value:b?.active?b.active:b?.names.length?`None active`:`None yet`,muted:!b?.active,detail:b?.active&&Ho(b.startUrl)||void 0,title:b?.names.length?`${b.names.length} environment${b.names.length===1?``:`s`}: ${b.names.join(`, `)}${b.apps.length?`. Apps: ${b.apps.join(`, `)}`:``}`:void 0,to:E(`settings`,`environments`)}),(0,P.jsx)(Io,{icon:Qe,label:`Files`,value:`${r.files.filter(e=>e.exists).length} in this project`,onClick:()=>l(!c),open:c}),(0,P.jsx)(F,{open:c,children:(0,P.jsx)(`ul`,{className:`m-0 mb-1 ml-10 flex list-none flex-col gap-1 p-0`,children:r.files.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`a`,{href:E(`settings`,`files`),"data-tip":e.path,className:D(`flex flex-col rounded-md px-2 py-1 no-underline hover:bg-surface-muted`,!e.exists&&`opacity-60`),children:[(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.label}),(0,P.jsx)(`span`,{className:`truncate font-mono text-[13px] text-ink`,children:e.path})]})},e.label))})})]})]})}),t?.ready&&(0,P.jsxs)($,{id:`usage`,title:`Context and tokens`,children:[e&&(0,P.jsx)(Lo,{title:`This chat`,children:e.agents?.length&&e.usage?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex min-h-7 items-center gap-2 px-2 py-1`,"data-tip":Ro(e.usage),children:[(0,P.jsx)(j,{icon:Se,size:14,className:`flex-none`}),(0,P.jsx)(`span`,{className:`flex-1 text-[13px] text-muted`,children:`Tokens used, all agents`}),(0,P.jsx)(`span`,{className:`text-[13px] font-medium text-ink tabular-nums`,children:B(e.usage.input+e.usage.output)})]}),(0,P.jsx)(`span`,{className:`px-2 pb-1 pl-8 text-[13px] text-muted tabular-nums`,children:aa(e.usage)}),e.agents.toSorted((e,t)=>t.at-e.at).map((t,n)=>(0,P.jsx)(Bo,{a:t,working:!!e.busy&&n===0},t.agent))]}):(0,P.jsx)(`p`,{className:`m-0 px-2 py-1 text-[13px] text-muted`,children:e.busy?`Counted as soon as the agent's first model call comes back.`:`No model calls in this chat yet.`})}),(0,P.jsxs)(Lo,{title:`This project`,children:[C&&(0,P.jsxs)(`a`,{href:E(`settings`,`tokenomics`),"data-tip":C.title,className:`my-1 flex items-center gap-4 rounded-[10px] px-2 py-2 no-underline hover:bg-surface-muted`,children:[(0,P.jsx)(`span`,{className:`flex size-11 flex-none items-center justify-center rounded-full border-[3px] border-accent-line bg-accent-soft text-accent-fg`,children:(0,P.jsx)(Pe,{size:20,strokeWidth:1.8,"aria-hidden":`true`})}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,P.jsx)(`span`,{className:`text-[20px] leading-tight font-semibold tracking-[-0.01em] text-ink tabular-nums`,children:B(C.tokens)}),` tokens`]}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:C.cost?`${C.cost} · last 30 days`:`Last 30 days`})]})]}),(0,P.jsx)(Fo,{icon:ht,label:`Today`,value:(0,P.jsx)(`span`,{className:`tabular-nums`,children:S??`Nothing yet`}),title:o?.project?`Every model call made for this project today: chats, runs and the agents they started.`:`Test runs of this project today.`,to:E(`settings`,`tokenomics`)}),o?.spent&&o.budget?.month?(0,P.jsxs)(`div`,{className:`px-2 py-2`,children:[(0,P.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[13px] text-muted`,children:[(0,P.jsx)(`span`,{className:`flex-1`,children:`This month, this computer`}),(0,P.jsxs)(`span`,{className:`text-ink tabular-nums`,children:[H(o.spent.month,o.spent.currency),` of `,H(o.budget.month,o.budget.currency||o.spent.currency)]})]}),(0,P.jsx)(Vo,{value:o.spent.month,max:o.budget.month})]}):null]})]}),g.length>0&&(0,P.jsx)($,{id:`background`,title:`Background tasks · ${g.length}`,children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:g.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`a`,{href:E(...e.to.split(`/`).filter(Boolean)),className:`flex items-start gap-2 rounded-[10px] px-4 py-2 no-underline hover:bg-surface-muted`,children:[(0,P.jsx)(ft,{size:15,"aria-hidden":`true`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`span`,{className:`truncate text-[13px] text-ink`,children:e.label}),(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.detail||`Running`,qo(e.startedAt)&&` · ${qo(e.startedAt)}`]})]})]})},`${e.kind}-${t}`))})}),m.length>0&&(0,P.jsxs)($,{id:`commands`,title:`Commands · ${m.length}`,children:[(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:h.map(e=>(0,P.jsx)(Ko,{c:e},e.key))}),m.length>h.length&&(0,P.jsxs)(`span`,{className:`px-4 pb-1 text-[13px] text-muted`,children:[Lt(m.length-h.length,`earlier command`),` in the chat`]})]}),e?.changes&&e.changes.length>0&&(0,P.jsxs)($,{id:`changes`,title:`Changes · ${e.changes.length}`,children:[(0,P.jsxs)(`span`,{className:`px-4 pb-1 font-mono text-[13px] tabular-nums`,children:[Lt(e.changes.length,`file`),` · `,(0,P.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,P.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map(e=>(0,P.jsx)(Wo,{path:e.path,icon:Oe,extra:(0,P.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,P.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,P.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})},e.path))}),e.onCreatePr&&(0,P.jsx)(`div`,{className:`px-2 pt-2 pb-1`,children:(0,P.jsxs)(A,{size:`sm`,variant:`primary`,disabled:e.busy,"data-tip":e.busy?`When ForgeQE has finished`:`Ask ForgeQE to open a pull request with these changes`,onClick:e.onCreatePr,className:`w-full justify-center`,children:[(0,P.jsx)(ee,{"aria-hidden":`true`}),`Pull request`]})})]}),e?.outputs&&e.outputs.length>0&&(0,P.jsx)($,{id:`outputs`,title:`Outputs · ${e.outputs.length}`,children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.outputs.map(e=>(0,P.jsx)(Wo,{path:e.path,icon:e.kind===`test`?Qe:/\.html?$/i.test(e.path)?Re:e.kind===`report`?a:yt,extra:(0,P.jsx)(`span`,{className:`flex-none text-[13px] text-muted`,children:e.label})},e.path))})})]})}var Yo=24;function Xo(e,t,n){if(!t||!n||e.length<t*n*4)return null;let r=(e,n)=>(n*t+e)*4,i=[r(0,0),r(t-1,0),r(0,n-1),r(t-1,n-1)],a=i.every(t=>e[t+3]>=250),o=a&&i.every(t=>[0,1,2].every(n=>Math.abs(e[t+n]-e[i[0]+n])<=Yo));if(a&&!o)return null;let s=[0,1,2].map(t=>e[i[0]+t]),c=t=>a?[0,1,2].every(n=>Math.abs(e[t+n]-s[n])<=Yo):e[t+3]<16,l=t,u=n,d=-1,f=-1;for(let e=0;e<n;e++)for(let n=0;n<t;n++)c(r(n,e))||(n<l&&(l=n),n>d&&(d=n),e<u&&(u=e),e>f&&(f=e));if(d<0)return null;let p=Math.round(Math.max(d-l+1,f-u+1)*.02),m={x:Math.max(0,l-p),y:Math.max(0,u-p),w:0,h:0};return m.w=Math.min(t,d+1+p)-m.x,m.h=Math.min(n,f+1+p)-m.y,m.w>=t*.96&&m.h>=n*.96?null:m}function Zo(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The logo could not be read.`)),r.src=e})}function Qo(e){let t=e.naturalWidth||0,n=e.naturalHeight||0;if(!t||!n)return null;let r=Math.min(1,1024/Math.max(t,n))||1,i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(t*r)),i.height=Math.max(1,Math.round(n*r));let a=i.getContext(`2d`,{willReadFrequently:!0});return a?(a.drawImage(e,0,0,i.width,i.height),{canvas:i,ctx:a}):null}async function $o(e){let t=Qo(await Zo(e));if(!t)return null;let{canvas:n,ctx:r}=t,i=Xo(r.getImageData(0,0,n.width,n.height).data,n.width,n.height);if(!i)return null;let a=document.createElement(`canvas`);return a.width=i.w,a.height=i.h,a.getContext(`2d`)?.drawImage(n,i.x,i.y,i.w,i.h,0,0,i.w,i.h),a}var es=new Map;function ts(e){return es.has(e)||es.set(e,$o(e).then(t=>t?t.toDataURL(`image/png`):e).catch(()=>e)),es.get(e)}var ns=20971520,rs=[1,.75,.5,.35],is=[[`image/png`,void 0],[`image/webp`,.92],[`image/webp`,.8]];async function as(e,t){for(let n of rs)for(let[r,i]of is){let a=await e(n,r,i);if(a&&a.type===r&&a.size<=t)return a}return null}function os(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error??Error(`the file could not be read`)),r.readAsDataURL(e)})}var ss={"image/png":`.png`,"image/webp":`.webp`};async function cs(e,t){let n=t=>new File([t],e.name.replace(/\.[^.]+$/,``)+ss[t.type],{type:t.type});if(e.size>t){if(e.type===`image/svg+xml`)throw Error(`${e.name} is over ${t/1024} KB.`);if(e.size>20971520)throw Error(`${e.name} is over ${ns/1024/1024} MB: save a smaller copy and upload that.`);let r=await Zo(await os(e)).catch(()=>null),i=r&&Qo(r);if(!i)throw Error(`${e.name} could not be read: save it again as PNG or JPEG and upload that.`);let{canvas:a,ctx:o}=i,s=Xo(o.getImageData(0,0,a.width,a.height).data,a.width,a.height)??{x:0,y:0,w:a.width,h:a.height},c=await as((e,t,n)=>{let r=document.createElement(`canvas`);r.width=Math.max(1,Math.round(s.w*e)),r.height=Math.max(1,Math.round(s.h*e));let i=r.getContext(`2d`);return i?(i.imageSmoothingQuality=`high`,i.drawImage(a,s.x,s.y,s.w,s.h,0,0,r.width,r.height),new Promise(e=>r.toBlob(e,t,n))):Promise.resolve(null)},t);if(!c)throw Error(`${e.name} could not be made smaller than ${t/1024} KB: save a smaller copy and upload that.`);return n(c)}try{let r=await $o(await os(e));if(!r)return e;let i=await new Promise(e=>r.toBlob(e,`image/png`));return!i||i.size>t?e:n(i)}catch{return e}}var ls=`/assets/forgeqe-logo-D3CwM2Jl.png`,us=`/assets/forgeqe-logo-white-CoE-hF2l.png`,ds=`/assets/forgeqe-mark-ZLd4S3hw.png`;function fs(e){let[t,n]=(0,N.useState)({});return(0,N.useEffect)(()=>{if(!e)return;let t=!0;return ts(e).then(r=>t&&n({from:e,to:r})),()=>{t=!1}},[e]),e&&t.from===e?t.to:e}var ps=e=>`#${e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`;function ms(e){try{let t=document.createElement(`canvas`);t.width=t.height=32;let n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)return null;n.drawImage(e,0,0,32,32);let r=n.getImageData(0,0,32,32).data,i=(e,t)=>[...r.subarray((t*32+e)*4,(t*32+e)*4+4)],a=[i(1,1),i(30,1),i(1,30),i(30,30)];if(a.every(e=>e[3]>=200))return{kind:`background`,colour:ps([0,1,2].map(e=>a.reduce((t,n)=>t+n[e],0)/4))};let o=[0,0,0],s=0;for(let e=0;e<r.length;e+=4)if(r[e+3]>=200){for(let t=0;t<3;t++)o[t]+=r[e+t];s++}return s?{kind:`ink`,colour:ps(o.map(e=>e/s))}:null}catch{return null}}var hs=`h-auto w-auto min-h-10 max-h-[112px] max-w-full object-contain`,gs=`h-11 w-auto max-w-[168px] object-contain object-left`;function _s({aspect:e,alone:t,own:n,size:r,circle:i}){let a=e>1.6,o=a||t;if(n&&(!r||r===`auto`))return o?!a&&(e<=1.25||i)?{cls:i?`size-14 rounded-full object-cover`:`size-14 object-contain`,grow:!1,auto:!0}:{cls:hs,grow:!0,auto:!0}:{cls:i?`size-10 rounded-full object-cover`:`size-10 object-contain`,grow:!1,auto:!0};let s=r===`large`;return i?{cls:`${t?s?`size-16`:`size-11`:s?`size-12`:`size-8`} rounded-full object-cover`,grow:!1,auto:!1}:o?{cls:s?hs:gs,grow:s,auto:!1}:{cls:s?`size-12 object-contain`:`size-8 object-contain`,grow:!1,auto:!1}}function vs({theme:e,compact:t=!1,onPlate:n}){let{mode:r}=M(),i=r===`dark`?us:ls,a=fs(e.logo)||i,[o,s]=(0,N.useState)(e.logo?1:2.1),[c,l]=(0,N.useState)(null),u=o>1.6,d=_s({aspect:o,alone:!!e.logo&&!e.name,own:!!e.logo,size:t?`standard`:e.logoSize,circle:e.logoFrame===`circle`&&!u}),f=d.auto&&!e.logoFrame&&c?.kind===`background`,p=e.logo&&e.logoFrame!==`tile`&&!f?pn(c,cn(e,r)):null,m=f&&!!pn(c,cn(e,r));(0,N.useEffect)(()=>n?.(!!p),[p,n]);let h=e.logo?e.logoFrame===`circle`&&u?`rounded`:e.logoFrame||(d.auto&&c?.kind===`background`?`rounded`:`plain`):`plain`,g=d.cls,_=(0,P.jsx)(`img`,{src:a,alt:``,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&s(t.naturalWidth/t.naturalHeight),l(ms(t))},className:D(`block min-w-0`,d.grow?`flex-initial`:`flex-none`,g,h===`rounded`&&`overflow-hidden rounded-[8px]`,m&&`shadow-[0_0_0_1px_rgb(0_0_0/0.12)]`)});return(0,P.jsxs)(`span`,{className:D(`flex min-w-0 items-center gap-2`,d.grow&&`flex-1`),children:[h===`tile`||p?(0,P.jsx)(`span`,{style:p?{background:p}:void 0,className:D(`flex items-center justify-center rounded-[10px] p-2`,!p&&`bg-white shadow-[0_0_0_1px_rgb(0_0_0/0.06)]`,d.grow?`min-w-0 flex-initial`:`flex-none`),children:_}):_,!u&&e.name&&(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})]})}function ys({theme:e}){let{mode:t}=M(),[n,r]=(0,N.useState)(1),[i,a]=(0,N.useState)(null),o=fs(e.logoMark||e.logo),s=!!o&&(!!e.logoMark||n<=1.6),c=s?pn(i,cn(e,t)):null;return s?(0,P.jsx)(`span`,{style:c?{background:c}:void 0,className:D(`flex size-9 items-center justify-center rounded-[10px]`,c&&`p-1`),children:(0,P.jsx)(`img`,{src:o,alt:``,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&r(t.naturalWidth/t.naturalHeight),a(ms(t))},className:D(`block size-full object-contain`,e.logoFrame===`circle`?`rounded-full`:`rounded-[8px]`)})}):(0,P.jsxs)(`span`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center`,children:[(0,P.jsx)(`img`,{src:ds,alt:``,className:`block size-9 object-contain`}),o&&!e.logoMark&&(0,P.jsx)(`img`,{src:o,alt:``,className:`hidden`,onLoad:e=>e.currentTarget.naturalHeight&&r(e.currentTarget.naturalWidth/e.currentTarget.naturalHeight)})]})}var bs=`/assets/capgemini-mark-D6aZFnD3.png`,xs=`m 153.2175,21.2782 c 3.4962,0 6.1962,-2.8462 6.2312,-6.225 -0.245,-1.475 -0.7625,-4.2037 -4.585,-4.2037 -4.19,0 -5.5762,5.8487 -8.985,9.6237 -0.2737,2.1438 -2.305,4.0625 -4.8387,4.385 0.62,0.6488 2.0025,1.0013 3.6525,1.0013 3.0175,0 6.67,-0.9088 8.5837,-2.7988 -2.5537,0.035 -4.1937,-1.6062 -4.355,-3.8762 1.245,1.5087 2.6513,2.0937 4.2963,2.0937`,Ss=`m 126.3725,11.972 c 0,-1.86 -0.1125,-3.1 -1.3288,-3.1 -0.5562,0 -0.825,0.1125 -1.3087,0.2725 0.43,6.28 -0.9913,11.8125 -2.7238,11.8125 -2.2712,0 -1.1387,-13.4625 -5.9475,-13.4625 -4.4387,0 -5.0787,10.7475 -5.5812,10.7475 -0.3425,0 -0.395,-2.8225 -0.3763,-4.9763 0.1863,-1.03 0.2888,-1.9575 0.2888,-2.6612 0,-1 -0.41,-2.7288 -2.6813,-1.865 0.079,7.6862 -1.46,12.3287 -3.1937,12.3287 -2.5388,0 -2.5675,-6.9675 -2.5675,-8.8862 0,-1.875 0.1362,-4.38 -2.6513,-3.4913 -0.415,6.7038 -2.1737,11.7625 -3.2812,11.7625 -1.6513,0 -1.3188,-11.5812 -4.8888,-11.5812 -3.2125,0 -4.2037,10.9712 -4.8725,10.9712 -1.1962,0 0.3763,-12.3487 -4.2625,-12.3487 -2.4312,0 -3.3987,4.1212 -4.3512,8.735 -0.185,0.8937 -0.375,0.9237 -0.41,-0.087 -0.024,-0.8588 -0.029,-1.7238 -0.019,-2.5825 1.1663,-4.6388 -0.2587,-6.3525 -2.4075,-5.1175 0.6938,8.56 -3.2375,12.7437 -6.25,12.7437 -1.0887,0 -1.9487,-0.4637 -2.5875,-1.1962 3.6125,-2.2163 5.2188,-4.76 5.2188,-7.2463 0,-2.69 -1.5475,-4.2425 -4.1163,-4.2425 -3.5837,0 -5.59,3.6913 -5.59,6.8313 0,1.6887 0.3175,3.125 0.835,4.3062 -1.2312,0.5863 -2.3925,1.0938 -3.4725,1.5863 -0.098,-3.2275 -0.4587,-6.615 -0.7362,-9.745 -1.91,-0.5275 -2.4663,0.39 -2.6125,2.0887 -0.3425,3.8775 -1.7775,6.285 -3.0475,6.285 -0.9525,0 -1.5375,-1.1625 -1.6063,-2.3975 -0.3562,-6.2162 4.6875,-7.945 7.3288,-7.0412 0.5475,-1.3725 -0.054,-2.3588 -2.4363,-2.3588 -2.8862,0 -5.0437,1.7538 -6.6262,4.0038 -1.0538,1.5 -2.275,2.5637 -3.8963,3.8487 0.044,-0.3662 0.064,-0.7375 0.064,-1.1037 0,-4.38 -2.3738,-6.3038 -4.6388,-6.3038 -1.875,0 -3.0562,1.1225 -3.74,2.8513 -0.1662,-1.7338 -0.5125,-2.48 -1.5187,-2.48 -0.43,0 -1.03,0.1212 -1.67,0.4337 0.2925,0.9675 0.405,3.1113 0.405,4.5175 0,5.2675 -1.5088,7.6313 -2.9588,7.6313 -1.66,0 -1.9237,-6.25 -2.065,-8.6813 -0.2587,-0.098 -0.5325,-0.1512 -0.8112,-0.1512 -1.5038,0 -1.6988,2.0162 -2.07,3.8712 -0.41,2.0563 -1.5913,4.6388 -3.345,4.6388 -1.0588,0 -1.7238,-1.02 -1.8063,-2.8563 -0.1712,-3.725 2.93,-8.14 7.7788,-6.7675 0.6337,-1.4837 -0.3625,-2.6125 -2.3738,-2.6125 -3.545,0 -6.475,2.6513 -7.7537,5.7913 -1.2988,2.8812 -3.57,7.11 -8.1888,7.11 C 6.26,21.7975 3.76,18.95 3.76,12.9787 c 0,-5.1462 3.2462,-10.035 6.7087,-10.035 2.4213,0 2.9838,2.3838 2.7688,4.62 1.255,1.005 3.31,0.067 3.31,-2.4462 0,-1.7338 -1.4063,-4.6738 -5.9513,-4.6738 C 4.9712,0.4437 0,6.055 0,13.4225 0,20.5612 3.6225,24.78 8.75,24.78 c 3.2375,0 6.2887,-1.845 8.3937,-5.2538 0.5325,2.9838 2.5638,4.2388 4.0863,4.2388 2.4662,0 4.0775,-1.5975 4.9562,-3.755 0.5475,2.1625 1.7038,3.765 3.6288,3.765 1.3525,0 2.4112,-0.6888 3.2075,-1.7875 -0.3175,7.5187 -0.7125,12.3137 3.73,11.3725 -0.6875,-2.1388 -0.9075,-6.0313 -0.9075,-9.5275 0,-9.565 1.5775,-12.7138 3.555,-12.7138 1.435,0 1.8987,1.825 1.8987,3.7738 0,1.045 -0.1025,2.2462 -0.3662,3.325 -2.4313,1.5337 -4.37,2.745 -4.37,4.2825 0,1.2162 0.9037,1.3275 1.685,1.3275 1.865,0 4.1112,-1.83 5.3512,-5.2825 1.0838,-0.6588 2.1725,-1.4113 3.2125,-2.4363 -0.034,0.3513 -0.054,0.7025 -0.054,1.0638 0,3.4275 1.4987,5.5037 3.8962,5.5037 1.88,0 3.2863,-1.3337 4.2825,-3.33 0.064,1.1513 0.1025,2.2113 0.1175,3.1825 -3.8087,1.7638 -8.0225,3.55 -8.0225,8.5213 0,2.5725 1.855,4.5062 4.2725,4.5062 5.3075,0 6.5188,-5.6 6.5675,-12.1087 1.7288,-0.7475 3.0125,-1.3238 4.4975,-2.0613 1.2688,1.5925 2.9975,2.3888 4.58,2.3888 2.9925,0 5.2438,-1.5875 7.05,-4.805 0.3175,2.4462 0.9525,4.805 2.2563,4.805 2.3725,0 2.8562,-12.4125 4.6187,-12.4125 1.3525,0 0.245,13.4275 3.8138,13.4275 3.0562,0 3.6275,-11.8163 5.1175,-11.8163 1.055,0 1.1325,10.8013 4.4625,10.8013 1.6362,0 3.4137,-1.9688 4.3012,-6.09 0.42,2.745 1.8025,6.09 4.5075,6.09 1.5775,0 2.935,-1.5975 3.9838,-3.7163 0.2887,2.1825 0.9037,3.7163 2.1,3.7163 3.11,0 3.0075,-12.3838 5.4687,-12.3838 1.9188,0 1.3288,12.3838 5.8988,12.3838 2.1725,0 3.2025,-1.8513 3.8187,-4.18 0.8388,3.4225 2.2013,4.18 3.315,4.18 0.7075,0 1.245,-0.25 1.9488,-1.085 -3.5363,-1.5325 -3.2375,-7.1138 -3.2375,-10.7175 m -74.8438,21.27 c -1.0987,0 -1.68,-1.045 -1.68,-2.2225 0,-3.1788 2.3338,-4.8625 5.205,-6.3125 -0.1275,6.9425 -1.7437,8.535 -3.525,8.535 m 14.2775,-22.51 c 1.0688,0 1.6788,0.9812 1.5713,2.3925 -0.1213,1.655 -1.3275,3.555 -3.4275,5.0437 -1.0938,-3.115 -0.2775,-7.4362 1.8562,-7.4362 M 99.6722,6.035 c 1.0162,-0.034 1.7287,-0.9075 1.7337,-1.9475 0.01,-1.04 -0.6987,-1.8613 -1.7187,-1.8225 -1.02,0.035 -1.85,0.9087 -1.855,1.9487 -0.01,1.04 0.82,1.855 1.84,1.8213 m 25.3325,0.5275 c 0.9275,-0.034 1.685,-0.8638 1.685,-1.855 0,-0.9913 -0.7425,-1.7675 -1.67,-1.7388 -0.9288,0.034 -1.685,0.8688 -1.69,1.86 -0.01,0.9913 0.7475,1.7675 1.675,1.7338 m 34.4387,8.2425 c -0.079,-3.9263 -1.9437,-7.2363 -4.825,-9.8788 -2.1875,-1.9962 -4.785,-3.515 -7.5087,-4.6575 -0.215,-0.092 -0.44,-0.1812 -0.66,-0.2687 -3.3538,4.0187 -14.965,7.0162 -14.965,15.44 0,3.29 2.08,6.3712 5.1312,7.6075 1.7725,0.6687 3.54,0.7025 5.3125,0.1062 1.5775,-0.5175 2.8713,-1.4937 3.95,-2.68 3.4088,-3.775 4.795,-9.6187 8.98,-9.6187 3.8275,0 4.345,2.7237 4.59,4.1987 0,-0.01 0,-0.1075 -0.01,-0.2487`;function Cs({rail:e=!1}){let{mode:t}=M();return e?(0,P.jsx)(`img`,{src:bs,alt:`Capgemini`,"data-tip":`Capgemini`,"data-tip-side":`left`,className:`mb-1 size-8 flex-none object-contain`}):(0,P.jsxs)(`svg`,{viewBox:`-1.06668594 -1.06668594 161.58207188 37.68956988`,role:`img`,"aria-label":`Capgemini`,className:`ml-2 h-8 w-auto max-w-[180px] flex-none overflow-visible`,shapeRendering:`geometricPrecision`,children:[(0,P.jsx)(`path`,{fill:t===`dark`?`#fff`:`#12ABDB`,fillRule:`evenodd`,d:xs}),(0,P.jsx)(`path`,{fill:t===`dark`?`#fff`:`#0070AD`,fillRule:`evenodd`,d:Ss})]})}function ws({item:e}){return e.agent?(0,P.jsx)(dn,{agent:e.agent,px:18,decorative:!0}):(0,P.jsx)(k,{name:ln[e.id]||un[e.id]||`feature`,px:18})}var Ts={id:`settings`,label:`Settings`};function Es(){let e=(e,t,n,r,i)=>({id:e,label:t,meta:n,href:r,words:i,kind:`page`});return[...on.filter(e=>e.item.path[0]!==`settings`).map(t=>e(t.item.id,t.item.label,`${t.category.label} · ${t.area.label}`,en(t.item),[t.item.words,t.item.about].filter(Boolean).join(` `))),...Zt.flatMap(t=>[e(`browse-${t.id}`,t.label,`Category`,nn(t),t.about),...t.areas.map(n=>e(`browse-${t.id}-${n.id}`,n.label,t.label,Qt(t,n),n.about))]),e(`browse`,`ForgeQE`,`Every category`,E(`browse`),`Everything browse all categories home`),e(Ts.id,Ts.label,`Every setting`,E(Ts.id))]}var Ds=Es(),Os=(0,N.lazy)(()=>Ht(()=>import(`./CommandPalette-Dl_DibqU.js`),__vite__mapDeps([14,2,1,3,5,6,8,0,4,7,9,10,11,12,13]))),ks=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),As=()=>ks()?`⌘K`:`Ctrl K`;function js({rail:e=!1}){let{find:t}=(0,N.useContext)(Ps);return e?(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Search (${As()})`,"data-tip":`Search (${As()})`,"data-tip-side":`right`,onClick:t,className:`size-9`,children:(0,P.jsx)(we,{strokeWidth:1.8,"aria-hidden":`true`})}):(0,P.jsxs)(A,{size:`sm`,onClick:t,"aria-keyshortcuts":ks()?`Meta+K`:`Control+K`,className:`w-full justify-start border-transparent bg-surface-strong px-2 hover:bg-line`,children:[(0,P.jsx)(we,{strokeWidth:1.8,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`flex-1 text-left`,children:`Search`}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:As()})]})}var Ms=`flex h-8 short:h-7 items-center gap-2 rounded-[8px] px-2 text-[13px] no-underline`,Ns=e=>e?`bg-(--side-current-bg) font-medium text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:bg-surface-strong hover:text-ink`,Ps=(0,N.createContext)({hidden:!1,open:()=>{},setChat:()=>{},find:()=>{}});function Fs(e){let{setChat:t}=(0,N.useContext)(Ps),n=JSON.stringify(e);(0,N.useEffect)(()=>(t(e),()=>t(null)),[n,t])}var Is=`forgeqe-sidebar`,Ls=()=>{try{return localStorage.getItem(Is)===`closed`}catch{return!1}};function Rs({className:e}){let{open:t}=(0,N.useContext)(Ps);return(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Open the sidebar`,"data-tip":`Open the sidebar`,onClick:t,className:D(`inline-flex md:hidden`,e),children:(0,P.jsx)(i,{strokeWidth:1.8,"aria-hidden":`true`})})}function zs(){return(0,P.jsxs)(`div`,{className:`theme-side sticky top-0 z-20 flex items-center gap-1 px-4 py-2 md:hidden`,children:[(0,P.jsx)(Rs,{}),(0,P.jsx)(`span`,{className:`ml-1 flex min-w-0 flex-1`,children:(0,P.jsx)(ic,{compact:!0})})]})}function Bs({item:e,current:t}){let n=t===e.id;return(0,P.jsxs)(`a`,{href:E(e.id),"aria-current":n?`page`:void 0,className:D(Ms,Ns(n)),children:[(0,P.jsx)(ws,{item:e}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label})]})}function Vs({current:e,rail:t=!1}){let n=!e;return t?(0,P.jsx)(`a`,{href:E(),"aria-label":`New chat`,"data-tip":`New chat`,"data-tip-side":`right`,"aria-current":n?`page`:void 0,className:D(Xs,`mt-2`,n?`bg-(--side-current-bg) text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:(0,P.jsx)(Le,{strokeWidth:1.8,"aria-hidden":`true`,className:`size-[18px]`})}):(0,P.jsxs)(`a`,{href:E(),"aria-current":n?`page`:void 0,className:D(Ms,Ns(n)),children:[(0,P.jsx)(Le,{strokeWidth:1.8,"aria-hidden":`true`,className:`size-[18px]`}),`New chat`]})}function Hs(e){let t=rn(e);if(t.category)return{category:t.category.id,area:t.area?.id};let n=$t(e);return n&&n.item.path.length?{category:n.category.id,area:n.area.id}:{}}var Us=`forgeqe-sidebar-open`;function Ws(e){let t=new Set([...Zt.flatMap(e=>[`c:${e.id}`,...e.areas.map(t=>`a:${e.id}/${t.id}`)])]);try{let n=JSON.parse(e||`[]`);return Array.isArray(n)?[...new Set(n.filter(e=>typeof e==`string`&&t.has(e)))]:[]}catch{return[]}}var Gs=()=>{try{return Ws(localStorage.getItem(Us))}catch{return[]}};function Ks(e){let t=Hs(e);return[t.category&&`c:${t.category}`,t.category&&t.area&&`a:${t.category}/${t.area}`].filter(e=>!!e)}function qs({current:e,route:t,place:n=t,onClose:r,stats:i}){let a=t.join(`/`),o=n.join(`/`),[s,c]=(0,N.useState)(()=>new Set([...Gs(),...Ks(n)]));(0,N.useEffect)(()=>c(e=>Ks(n).every(t=>e.has(t))?e:new Set([...e,...Ks(n)])),[a,o]);let l=e=>t=>c(n=>{let r=new Set(n);t?r.add(e):r.delete(e);try{localStorage.setItem(Us,JSON.stringify([...r]))}catch{}return r}),{pins:u,toggle:d}=sn(),f=$t(n)?.item.id,p=rn(t),m=u.map(e=>on.find(t=>t.item.id===e)).filter(e=>!!e),h=e=>f===e.id&&!(e.id===`chats`&&t[1]),g=e=>(0,P.jsx)(fi,{href:en(e),label:e.label,current:h(e),icon:(0,P.jsx)(k,{name:e.icon,px:18})},e.id),_=e=>(0,P.jsx)(fi,{href:en(e),label:e.label,current:f===e.id,icon:(0,P.jsx)(k,{name:e.icon,px:18}),after:(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Unpin ${e.label}`,"data-tip":`Unpin ${e.label}`,"data-tip-side":`right`,onClick:()=>d(e.id),className:`absolute top-1/2 right-1 z-20 size-6 -translate-y-1/2 text-muted opacity-0 group-hover:opacity-100 hover:text-ink focus-visible:opacity-100`,children:(0,P.jsx)(Ze,{size:13,strokeWidth:1.8,fill:`currentColor`,"aria-hidden":`true`})})},e.id);return(0,P.jsxs)(`nav`,{"aria-label":`ForgeQE`,className:`theme-side flex h-full w-[248px] min-[1440px]:w-[264px] flex-col px-4 py-4 short:py-2`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-10 items-center gap-1 pl-2`,children:[(0,P.jsx)(ic,{}),(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Close the sidebar`,"data-tip":`Close the sidebar`,onClick:r,className:`size-8 flex-none`,children:(0,P.jsx)(qe,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,P.jsx)(`div`,{className:`mt-4 flex flex-col gap-px short:mt-2`,children:(0,P.jsx)(js,{})}),(0,P.jsx)(`div`,{className:`mt-2 flex flex-col gap-px`,children:(0,P.jsx)(Vs,{current:e})}),(0,P.jsx)(`div`,{className:`-mx-4 mt-2 flex min-h-0 flex-1 flex-col overflow-y-auto px-4 pb-6 [mask-image:linear-gradient(to_bottom,black_calc(100%-28px),transparent)]`,children:(0,P.jsxs)(vi,{routeKey:`${a}|${o}`,className:`gap-4 short:gap-2`,children:[(0,P.jsx)(hi,{label:`Pinned`,children:m.length?m.map(e=>_(e.item)):(0,P.jsx)(`span`,{className:`px-2 text-[13px] text-muted`,children:`Star a page on Browse to pin it.`})}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-px`,children:[(0,P.jsx)(`a`,{href:E(`browse`),"aria-current":t[0]===`browse`&&!p.category?`page`:void 0,className:`flex h-7 short:h-6 items-center rounded-[6px] px-2 text-[13px] font-medium text-muted no-underline hover:text-ink`,children:`Browse`}),Zt.map(e=>(0,P.jsx)(_i,{label:e.label,icon:(0,P.jsx)(k,{name:e.icon,px:18}),href:nn(e),hrefLabel:`Open the ${e.label} page`,current:p.category?.id===e.id&&!p.area,lines:ai,open:s.has(`c:${e.id}`),onOpenChange:l(`c:${e.id}`),children:e.areas.map(t=>(0,P.jsx)(gi,{label:t.label,badge:!s.has(`a:${e.id}/${t.id}`)&&(0,P.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:t.items.length}),href:Qt(e,t),hrefLabel:`Open the ${t.label} page`,current:p.category?.id===e.id&&p.area?.id===t.id,open:s.has(`a:${e.id}/${t.id}`),onOpenChange:l(`a:${e.id}/${t.id}`),children:t.items.map(g)},t.id))},e.id))]}),t[0]===`chats`&&t[1]&&(0,P.jsx)(Ys,{uses:i?.uses})]})}),(0,P.jsxs)(`div`,{className:`flex flex-none items-center gap-1 pt-2 short:pt-1`,children:[(0,P.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(Bs,{item:Ts,current:e})}),(0,P.jsx)($s,{}),(0,P.jsx)(tc,{icon:!0})]})]})}var Js=[{id:`knowledge`,label:`Knowledge`,icon:`knowledge-base`,to:E(`knowledge`,`notes`)},{id:`sections`,label:`Document sections`,icon:`wikis`,to:E(`knowledge`,`notes`)},{id:`skills`,label:`Skills`,icon:`feature`,to:E(`skills`)},{id:`systems`,label:`Systems`,icon:`columns`}];function Ys({uses:e}){let t=Js.map(t=>({...t,names:e?.[t.id]||[]}));return(0,P.jsxs)(`div`,{role:`group`,"aria-labelledby":`nav-in-chat`,className:`mt-4 flex flex-col gap-px short:mt-2`,children:[(0,P.jsx)(`span`,{id:`nav-in-chat`,className:`flex h-7 short:h-6 items-center px-2 text-[13px] font-medium text-muted`,children:`In this chat`}),t.every(e=>!e.names.length)?(0,P.jsx)(`span`,{className:`px-2 text-[13px] text-muted`,children:`No knowledge, documents, skills or systems used yet.`}):t.filter(e=>e.names.length).map(t=>{let n=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(k,{name:t.icon,px:18}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:t.names.length})]});return(0,P.jsxs)(`div`,{className:`flex flex-col`,children:[t.to?(0,P.jsx)(`a`,{href:t.to,className:D(Ms,Ns(!1)),children:n}):(0,P.jsx)(`span`,{className:D(Ms,`text-ink-2`),children:n}),(0,P.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0 pl-8`,children:[t.names.map(e=>(0,P.jsx)(`li`,{"data-tip":e,className:`truncate px-2 py-1 text-[13px] text-muted`,children:e},e)),t.id===`sections`&&e?.text&&e.text.whole>e.text.sent&&(0,P.jsxs)(`li`,{"data-tip":`${e.text.sent.toLocaleString()} of ${e.text.whole.toLocaleString()} characters`,className:`truncate px-2 py-1 text-[13px] text-muted`,children:[Math.round((1-e.text.sent/e.text.whole)*100),`% less text than the whole documents`]})]})]},t.id)})]})}var Xs=`flex size-9 flex-none items-center justify-center rounded-[8px] no-underline`;function Zs({item:e,current:t}){let n=t===e.id;return(0,P.jsx)(`a`,{href:E(e.id),"aria-current":n?`page`:void 0,"aria-label":e.label,"data-tip":e.label,"data-tip-side":`right`,className:D(Xs,n?`bg-(--side-current-bg) text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:(0,P.jsx)(ws,{item:e})})}function Qs({current:e,route:t,onOpen:n}){let{theme:r}=M(),{pins:a}=sn(),o=r.name||`ForgeQE`,s=$t(t),c=rn(t).category?.id||(s?.item.path.length?s.category.id:``),l=(e,t,n,r)=>(0,P.jsx)(`a`,{href:e,"aria-current":r?`page`:void 0,"aria-label":t,"data-tip":t,"data-tip-side":`right`,className:D(Xs,r?`bg-(--side-current-bg) text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:(0,P.jsx)(k,{name:n,px:18})},e),u=a.map(e=>on.find(t=>t.item.id===e)).filter(e=>!!e);return(0,P.jsxs)(`nav`,{"aria-label":`ForgeQE`,className:`theme-side flex h-full w-16 flex-col items-center gap-px py-4`,children:[(0,P.jsx)(`a`,{href:E(),"aria-label":`${o}, home`,"data-tip":o,"data-tip-side":`right`,className:`mb-1 flex min-h-10 items-center justify-center no-underline`,children:(0,P.jsx)(ys,{theme:r})}),(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Open the sidebar`,"data-tip":`Open the sidebar`,"data-tip-side":`right`,onClick:n,className:`size-9`,children:(0,P.jsx)(i,{strokeWidth:1.8,"aria-hidden":`true`})}),(0,P.jsx)(js,{rail:!0}),(0,P.jsx)(Vs,{current:e,rail:!0}),(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center gap-px overflow-y-auto`,children:[(0,P.jsxs)(`div`,{role:`group`,"aria-label":`Browse`,className:`flex flex-col items-center gap-px`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`my-2 h-px w-6 bg-line`}),Zt.map(e=>l(nn(e),e.label,e.icon,c===e.id))]}),u.length>0&&(0,P.jsxs)(`div`,{role:`group`,"aria-label":`Pinned`,className:`flex flex-col items-center gap-px`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`my-2 h-px w-6 bg-line`}),u.map(e=>l(en(e.item),e.item.label,e.item.icon,s?.item.id===e.item.id))]})]}),(0,P.jsxs)(`div`,{className:`flex flex-none flex-col items-center gap-px pt-2`,children:[(0,P.jsx)($s,{rail:!0}),(0,P.jsx)(tc,{icon:!0,rail:!0}),(0,P.jsx)(Zs,{item:Ts,current:e})]})]})}function $s({rail:e=!1}){return(0,P.jsx)(`a`,{href:`/help/guide`,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Help`,"data-tip":`Help`,"data-tip-side":e?`right`:void 0,className:D(Xs,`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:(0,P.jsx)(k,{name:ln.help,px:18})})}var ec=[{id:`system`,label:`System`},{id:`light`,label:`Light`},{id:`dark`,label:`Dark`}];function tc({icon:e=!1,rail:t=!1}){let{choice:n,setChoice:r}=M(),i=ec.findIndex(e=>e.id===n),a=ec[i],o=ec[(i+1)%ec.length],s=`Dark/Light: now ${a.label===`System`?`as the computer is`:a.label.toLowerCase()}. Switch to ${o.label===`System`?`as the computer is`:o.label.toLowerCase()}`;return(0,P.jsxs)(`button`,{type:`button`,"aria-label":s,"data-tip":s,"data-tip-side":t?`right`:void 0,onClick:()=>r(o.id),className:D(e?Xs:Ms,`w-full cursor-pointer border-0 bg-transparent text-left text-ink-2 hover:bg-surface-strong hover:text-ink`,e&&`w-auto`),children:[(0,P.jsx)(k,{name:ln.theme,px:18}),!e&&(0,P.jsxs)(`span`,{className:`flex flex-1 items-baseline justify-between gap-2`,children:[`Dark/Light`,(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:a.label===`System`?`Auto`:a.label})]})]})}function nc(e){return[{id:`env`,label:`Environment`},{id:`usage`,label:`Context and tokens`},...e?.commands?.length?[{id:`commands`,label:`Commands · ${e.commands.length}`}]:[],...e?.changes?.length?[{id:`changes`,label:`Changes · ${e.changes.length}`}]:[],...e?.outputs?.length?[{id:`outputs`,label:`Outputs · ${e.outputs.length}`}]:[]]}function rc({stats:e,onOpen:t}){return(0,P.jsxs)(`aside`,{"aria-label":`Workspace`,className:`flex h-full w-14 flex-col items-center gap-1 bg-canvas py-4`,children:[(0,P.jsx)(Cs,{rail:!0}),(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Show the workspace panel`,"data-tip":`Show the workspace panel`,"data-tip-side":`left`,onClick:()=>t(),children:(0,P.jsx)(C,{strokeWidth:1.8,"aria-hidden":`true`})}),(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`my-1 h-px w-6 bg-line`}),nc(e).map(e=>(0,P.jsx)(`button`,{type:`button`,"aria-label":e.label,"data-tip":e.label,"data-tip-side":`left`,onClick:()=>t(e.id),className:D(Xs,`cursor-pointer border-0 bg-transparent text-ink-2 hover:bg-surface-strong hover:text-ink`),children:(0,P.jsx)(ws,{item:e})},e.id)),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(Cr,{rail:!0})]})}function ic({compact:e=!1}){let{theme:t}=M(),n=t.name||`ForgeQE`;return(0,P.jsx)(`a`,{href:E(),"aria-label":`${n}, home`,className:`-ml-2 flex min-h-9 min-w-0 flex-1 items-center gap-2 rounded-[8px] pl-2 text-base font-semibold text-ink no-underline hover:bg-surface-strong hover:text-ink`,children:(0,P.jsx)(vs,{theme:t,compact:e})})}function ac(){let[e,t]=(0,N.useState)(!1);return(0,N.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener(Wt,e),()=>window.removeEventListener(Wt,e)},[]),e?(0,P.jsx)(`p`,{role:`alert`,className:`mx-4 mt-4 mb-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:Pt()}):null}function oc({stats:e,onClose:t,focus:n}){let r=(0,N.useRef)(null);return(0,N.useEffect)(()=>{n&&(r.current?.querySelector(`#panel-${n.id}`))?.scrollIntoView({block:`start`,behavior:window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[n]),(0,P.jsxs)(`aside`,{"aria-label":`Workspace`,className:`flex h-full w-[264px] flex-col bg-canvas`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-4`,children:[(0,P.jsx)(Cs,{}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Close the workspace panel`,"data-tip":`Close the workspace panel`,"data-tip-side":`left`,onClick:t,children:(0,P.jsx)(Ge,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,P.jsx)(`div`,{ref:r,className:`min-h-0 flex-1 overflow-y-auto px-4 pt-1 pb-4`,children:(0,P.jsx)(Jo,{chat:e})}),(0,P.jsx)(`div`,{className:`px-4 py-4`,children:(0,P.jsx)(Cr,{})})]})}var sc=`forgeqe-workspace-panel`,cc=`forgeqe:workspace-fold`,lc=()=>{try{return localStorage.getItem(sc)!==`closed`}catch{return!0}},uc=220;function dc({open:e,side:t,label:n,wideAt:r,onClose:i,className:a,children:o}){let s=(0,N.useRef)(null),c=zt(e,150);(0,N.useEffect)(()=>{let t=s.current;t&&(e&&!t.open?t.showModal():!c&&t.open&&t.close())},[e,c]),(0,N.useEffect)(()=>{if(!e)return;let t=window.matchMedia(r);if(t.matches)return i();let n=()=>t.matches&&i();return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e,r,i]);let l=t===`left`?`aside`:`div`;return(0,P.jsx)(`dialog`,{ref:s,"aria-label":n,onCancel:e=>{e.target===s.current&&(e.preventDefault(),i())},className:D(`drawer fixed inset-0 z-40 m-0 h-auto max-h-none w-auto max-w-none overflow-hidden border-0 bg-transparent p-0 text-ink backdrop:bg-transparent`,!e&&`is-closing`,a),children:c&&(0,P.jsxs)(`div`,{inert:!e||void 0,className:`absolute inset-0`,children:[(0,P.jsx)(`div`,{"aria-hidden":`true`,className:`drawer-dim absolute inset-0 bg-[rgba(17,25,40,0.28)]`,onClick:i}),(0,P.jsx)(l,{className:D(`drawer-box absolute inset-y-0 max-w-[85vw] shadow-menu`,t===`left`?`drawer-left left-0`:`right-0`),children:o})]})})}function fc(e,t,n){let r=(e??``).replace(/\s+/g,` `).trim().slice(0,80);return n||!r?t:`${r} · ${t}`}function pc(e,t,n){(0,N.useEffect)(()=>{let e=document.querySelector(`[data-screen]`);if(!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`h1`),r=fc(n?.textContent,Tt(),!!n?.hasAttribute(`data-app-title`));document.title!==r&&(document.title=r)},r=()=>t||=requestAnimationFrame(n);r();let i=new MutationObserver(r);return i.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{i.disconnect(),t&&cancelAnimationFrame(t)}},[e,t,n])}function mc(e){e.preventDefault();let t=document.querySelector(`[data-screen] main`)??document.querySelector(`[data-screen]`);t&&(t.hasAttribute(`tabindex`)||t.setAttribute(`tabindex`,`-1`),t.focus())}function hc({current:e,route:t=e?[e]:[],children:n}){let[r,i]=(0,N.useState)(Ls),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(lc),[d,f]=(0,N.useState)(!1),p=(0,N.useCallback)(()=>c(!1),[]),m=(0,N.useCallback)(()=>f(!1),[]),[h,g]=(0,N.useState)(!1),[_,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(``),x=t.join(`/`);(0,N.useEffect)(()=>Jt(t),[x]);let{theme:ee}=M();pc(e,x,ee.appName);let S=Hr(t),te=()=>{c(!1),b(``),v(!0),g(!0)},ne=(0,N.useCallback)(e=>{c(!1),b(e),v(!0),g(!0)},[]);(0,N.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),b(``),v(!0),g(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let w=zt(!r,uc),re=zt(l,uc),[T,ie]=(0,N.useState)(null),ae=()=>window.matchMedia(`(min-width: 1600px)`).matches,oe=e=>{u(e);try{localStorage.setItem(sc,e?`open`:`closed`)}catch{}};(0,N.useEffect)(()=>{let e=e=>u(e.detail!==!0&&lc());return window.addEventListener(cc,e),()=>window.removeEventListener(cc,e)},[]),(0,N.useEffect)(()=>{if(!d)return;let e=()=>f(!1);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[d]);let se=e=>{i(e);try{localStorage.setItem(Is,e?`closed`:`open`)}catch{}};(0,N.useEffect)(()=>{if(!s)return;let e=()=>c(!1);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[s]);let ce=()=>window.matchMedia(`(min-width: 768px)`).matches,{setChoice:le}=M(),ue=async(e,t,n)=>e===`theme`?(le(t),`The look is ${t} now.`):e===`talk`?(window.dispatchEvent(new Event(`forgeqe:talk-off`)),`Talk is ending.`):e===`sidebar`?(ce()?se(t===`closed`):c(t===`open`),`The sidebar is ${t}.`):n?(await It.settings(n,{headed:t===`shown`}),`Browser runs in this chat are ${t} now.`):`Browser runs are set per chat: open one first.`,de=e===`settings`||e===`welcome`,fe=e=>{ae()?oe(!0):f(!0),ie(e?{id:e,at:Date.now()}:null)};return(0,P.jsx)(Ps.Provider,{value:{hidden:r,open:()=>ce()?se(!1):c(!0),setChat:o,find:te},children:(0,P.jsx)(ar,{pages:Ds,find:ne,set:ue,children:(0,P.jsx)(br,{children:(0,P.jsxs)(`div`,{className:`flex min-h-(--screen) bg-bg`,children:[(0,P.jsx)(`a`,{href:`#content`,onClick:mc,className:`sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:rounded-[8px] focus:bg-accent focus:px-4 focus:py-2 focus:text-sm focus:font-medium focus:text-accent-ink focus:no-underline`,children:`Skip to content`}),(0,P.jsxs)(`aside`,{style:{viewTransitionName:`app-sidebar`},className:D(`side-box sticky top-0 h-(--screen) flex-none overflow-hidden`,r?`w-16`:`w-[248px] min-[1440px]:w-[264px]`,de?`hidden`:`hidden md:block`),children:[(0,P.jsx)(`div`,{className:D(`side-layer absolute inset-y-0 left-0`,r&&`invisible opacity-0`),children:w&&(0,P.jsx)(qs,{current:e,route:t,place:S,stats:a,onClose:()=>se(!0)})}),(0,P.jsx)(`div`,{className:D(`side-layer absolute inset-y-0 left-0`,!r&&`invisible opacity-0`),children:(0,P.jsx)(Qs,{current:e,route:S,onOpen:()=>se(!1)})})]}),(0,P.jsx)(dc,{open:s,side:`left`,label:`Sidebar`,wideAt:`(min-width: 768px)`,onClose:p,className:`md:hidden`,children:(0,P.jsx)(qs,{current:e,route:t,place:S,stats:a,onClose:()=>c(!1)})}),(0,P.jsxs)(`div`,{"data-screen":!0,className:`relative flex min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(ac,{}),n,(0,P.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Show the workspace panel`,"data-tip":`Show the workspace panel`,onClick:()=>fe(),className:D(`absolute top-2 right-3 z-30 md:hidden`,de&&`hidden`),children:(0,P.jsx)(C,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,P.jsxs)(`div`,{style:{viewTransitionName:`app-panel`},className:D(`side-box sticky top-0 h-(--screen) w-14 flex-none overflow-hidden`,l&&`min-[1600px]:w-[264px]`,de?`hidden`:`hidden md:block`),children:[(0,P.jsx)(`div`,{className:D(`side-layer absolute inset-y-0 right-0 hidden min-[1600px]:block`,!l&&`invisible opacity-0`),children:re&&(0,P.jsx)(oc,{stats:a,focus:T,onClose:()=>oe(!1)})}),(0,P.jsx)(`div`,{className:D(`side-layer absolute inset-y-0 right-0`,l&&`min-[1600px]:invisible min-[1600px]:opacity-0`),children:(0,P.jsx)(rc,{stats:a,onOpen:fe})})]}),_&&(0,P.jsx)(N.Suspense,{fallback:null,children:(0,P.jsx)(Os,{open:h,onClose:()=>g(!1),pages:Ds,query:y})}),(0,P.jsx)(dc,{open:d,side:`right`,label:`Workspace panel`,wideAt:`(min-width: 1600px)`,onClose:m,className:`min-[1600px]:hidden`,children:(0,P.jsx)(oc,{stats:a,focus:T,onClose:()=>f(!1)})}),(0,P.jsx)(wr,{})]})})})})}var gc=`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`,_c=`box-border flex flex-col [--frame-left:max(0px,calc((100cqw_-_1320px)/2))] ml-(--frame-left) mr-auto w-[calc(100%_-_var(--frame-left))] max-w-[1320px] px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`,vc=`[--page-w:100cqw]`,yc=`@container [--wide-w:min(var(--wide-max,100000px),calc(var(--page-w)_-_48px))] md:[--wide-w:min(var(--wide-max,100000px),calc(var(--page-w)_-_96px))] w-(--wide-w) max-w-none self-start ml-[calc((100%_-_var(--wide-w))/2)]`;export{Ri as $,z as A,mr as At,oa as B,wo as C,Nr as Ct,Pa as D,xr as Dt,Va as E,Or as Et,W as F,Sn as Ft,$i as G,ra as H,Oa as I,xn as It,Gi as J,ta as K,sa as L,hn as Lt,pa as M,or as Mt,fa as N,rr as Nt,va as O,Sr as Ot,la as P,F as Pt,Mi as Q,H as R,Do as S,kr as St,Ha as T,Mr as Tt,Ki as U,B as V,na as W,Vi as X,Hi as Y,zi as Z,Ao as _,zr as _t,cc as a,Ci as at,Oo as b,Pr as bt,hc as c,Ei as ct,vs as d,ri as dt,Pi as et,ys as f,ti as ft,So as g,Lr as gt,Co as h,Rr as ht,vc as i,Oi as it,ia as j,_r as jt,G as k,hr as kt,As as l,L as lt,cs as m,ni as mt,_c as n,ji as nt,Rs as o,wi as ot,ns as p,ii as pt,R as q,yc as r,Di as rt,zs as s,Ti as st,gc as t,Ni as tt,Fs as u,Si as ut,xo as v,Br as vt,Ba as w,Fr as wt,To as x,Ar as xt,Eo as y,Ir as yt,aa as z};
|