@capagents/forgeqe 3.4.4 → 3.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/forgeqe.js +1930 -1930
  2. package/dist/web/assets/{3d-force-graph-DwblDu4y.js → 3d-force-graph-Bv0L0GYY.js} +1 -1
  3. package/dist/web/assets/{Agent-C8WdS1HB.js → Agent-CxEcSdpb.js} +1 -1
  4. package/dist/web/assets/{AgentWork-C1Qa_Ftb.js → AgentWork-pz5zDHe7.js} +1 -1
  5. package/dist/web/assets/{ApiTests-u4tzlJaD.js → ApiTests-Cvuu_jpF.js} +1 -1
  6. package/dist/web/assets/{Browse-B0ZTvpo2.js → Browse-CugNbc8C.js} +1 -1
  7. package/dist/web/assets/{Chat-B73XMxdf.js → Chat-Tqqg4JUL.js} +1 -1
  8. package/dist/web/assets/{CommandPalette-D7ld-tbJ.js → CommandPalette-DvSYdMC_.js} +1 -1
  9. package/dist/web/assets/{Compare-CxGjAZW0.js → Compare-CVdloZNm.js} +1 -1
  10. package/dist/web/assets/{Cost-BeVu3Z6g.js → Cost-Bm4Dqpwr.js} +1 -1
  11. package/dist/web/assets/{Data-BPyCT0eP.js → Data-CGjaHLjI.js} +1 -1
  12. package/dist/web/assets/{Desktop-qPGc2OWb.js → Desktop-BbTWto2U.js} +1 -1
  13. package/dist/web/assets/{DesktopReview-CVoC6bQY.js → DesktopReview-Cw2ODskw.js} +1 -1
  14. package/dist/web/assets/{Evidence-CtUiUCa6.js → Evidence-DjY7OEs8.js} +1 -1
  15. package/dist/web/assets/{Explore-BvjAhqyo.js → Explore-BB-c2iyf.js} +1 -1
  16. package/dist/web/assets/{Features-CmQCxEJX.js → Features-DLJ0o5mQ.js} +1 -1
  17. package/dist/web/assets/{Flags-asj8tiKy.js → Flags-BF4LF0Sn.js} +1 -1
  18. package/dist/web/assets/{Flaky-ChYK151U.js → Flaky-DKEWWH_N.js} +1 -1
  19. package/dist/web/assets/{Impact-B1-B2oHr.js → Impact-BYfBT4ng.js} +1 -1
  20. package/dist/web/assets/{Jobs-CZ2k5hGk.js → Jobs-DwPYSmQp.js} +1 -1
  21. package/dist/web/assets/{KindPage-CDfvpDXP.js → KindPage-CNSIw8EU.js} +1 -1
  22. package/dist/web/assets/{LiveDevice-B33XU61P.js → LiveDevice-Bzz5k4my.js} +1 -1
  23. package/dist/web/assets/{Migration-BBM_Sce0.js → Migration-B8FRhxpQ.js} +1 -1
  24. package/dist/web/assets/{Mobile-BzufjlBb.js → Mobile-DDg3lrvO.js} +1 -1
  25. package/dist/web/assets/{Observability-qcx5vrNO.js → Observability-S_GxyR80.js} +1 -1
  26. package/dist/web/assets/{OwnItems-BkoHG_xw.js → OwnItems-CGD8lZsA.js} +1 -1
  27. package/dist/web/assets/{PageAgent-Do62EBze.js → PageAgent-CUicHm1M.js} +1 -1
  28. package/dist/web/assets/{Product-9ImZUA2B.js → Product-D0HVqFU9.js} +2 -2
  29. package/dist/web/assets/{Production-B6uigaYJ.js → Production-D4qoP1EY.js} +1 -1
  30. package/dist/web/assets/{Quality-Cw6qhXyl.js → Quality-BeNUMygb.js} +1 -1
  31. package/dist/web/assets/{Readiness-D8WMgQmd.js → Readiness-BKh3XR-d.js} +1 -1
  32. package/dist/web/assets/Record-CEY5wJ5f.js +1 -0
  33. package/dist/web/assets/{Regression-BLlXnCW2.js → Regression-DVQujWFy.js} +1 -1
  34. package/dist/web/assets/{RelationGraph-BxJgWpp6.js → RelationGraph-5GEqITmu.js} +1 -1
  35. package/dist/web/assets/{Reports-ZNS4Vjz8.js → Reports-C7R9gb02.js} +1 -1
  36. package/dist/web/assets/{Requirements-CtQLSXK2.js → Requirements-FCu-HkXc.js} +1 -1
  37. package/dist/web/assets/{Responsive-KaTTxiwX.js → Responsive-DwXdPKww.js} +1 -1
  38. package/dist/web/assets/{RunDiff-CpvrxBX1.js → RunDiff-UU3jCTyW.js} +1 -1
  39. package/dist/web/assets/{Settings-C5CTbhlT.js → Settings-BkjUlPMQ.js} +3 -3
  40. package/dist/web/assets/{SiteScan-CUMCTEY9.js → SiteScan-CNCGcPQX.js} +1 -1
  41. package/dist/web/assets/{Steps-C440M1Y_.js → Steps-CYDb_3OH.js} +1 -1
  42. package/dist/web/assets/{TestData-7rivojlz.js → TestData-CE5vC330.js} +1 -1
  43. package/dist/web/assets/{TestManagement-Dj5JHPIU.js → TestManagement-CxcJI04K.js} +1 -1
  44. package/dist/web/assets/{WhatsNew-xAi2Rzo3.js → WhatsNew-CIg0ienp.js} +1 -1
  45. package/dist/web/assets/{agentSettingsSheet-D12LwTAe.js → agentSettingsSheet-CLWVrbZy.js} +1 -1
  46. package/dist/web/assets/api-D1PU4zye.js +1 -0
  47. package/dist/web/assets/{dataParts-CVXmPBpU.js → dataParts-uqmYw8V2.js} +1 -1
  48. package/dist/web/assets/{desktopAppPath-D_PfQisd.js → desktopAppPath-DUEjQMmN.js} +1 -1
  49. package/dist/web/assets/{flowTheme-bdKXfQiL.js → flowTheme-ZJk8bNiH.js} +1 -1
  50. package/dist/web/assets/{frame-BC1vOowF.js → frame-D0MS2ZMz.js} +3 -3
  51. package/dist/web/assets/{index-BoFziUZw.js → index-F8zkXd19.js} +4 -4
  52. package/dist/web/assets/{nav--1SY7-OO.js → nav-CkrE6JFU.js} +1 -1
  53. package/dist/web/assets/{pageBack-DDAAmq4R.js → pageBack-DfGBh1Hs.js} +1 -1
  54. package/dist/web/assets/{palette-C8W4Fd5n.js → palette-dAh9kV3S.js} +1 -1
  55. package/dist/web/assets/{parts-uc6us_OU.js → parts-DqfD-6Qb.js} +1 -1
  56. package/dist/web/assets/{productParts-CAgJEF8_.js → productParts-CCceBbIo.js} +1 -1
  57. package/dist/web/assets/{qualityParts-BF3Yb7Zl.js → qualityParts-DcRvGy-_.js} +1 -1
  58. package/dist/web/assets/{recordTest-KjXCSP7c.js → recordTest-DN3Kl6PB.js} +1 -1
  59. package/dist/web/assets/{stepper-CZL9ueYn.js → stepper-DiPQQ2l6.js} +1 -1
  60. package/dist/web/assets/{wizardParts-Pzx0nTZ0.js → wizardParts-CnCYTsR0.js} +1 -1
  61. package/dist/web/index.html +6 -6
  62. package/package.json +1 -1
  63. package/dist/web/assets/Record-DCcHfH7u.js +0 -1
  64. package/dist/web/assets/api-CorvgyDj.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,P as a,c as o}from"./surface-c1kG1KPS.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{d as u}from"./sectionList-B6NF3ZMb.js";import{T as d,U as f,X as p,b as m}from"./api-CorvgyDj.js";import{A as h,F as g,L as _,O as v,P as y,T as b,g as x,i as S,k as C}from"./pageBack-DDAAmq4R.js";import{$ as w,Er as T,Gr as E,Hr as D,Lr as O,M as k,N as A,Pr as j,Rn as M,Sn as ee,U as N,Un as te,Wr as P,cn as F,cr as ne,ct as re,fn as ie,kr as ae,lt as oe,nn as se,nr as ce,or as I,r as le,tt as ue,ur as de,vn as fe,vr as pe,wn as me,z as he}from"./line-icons-Cwj9OmCz.js";import{G as ge,Ht as _e,J as L,Vt as ve,W as R,Z as z,Zt as B,ct as V,dt as H,it as ye,lt as U,ot as W,rt as be,ut as xe}from"./frame-BC1vOowF.js";import{u as Se}from"./nav--1SY7-OO.js";import{J as G,K,V as Ce,l as we,n as Te,t as Ee}from"./index-BoFziUZw.js";import{f as q,l as De,o as Oe,r as J}from"./dataParts-CVXmPBpU.js";import{t as ke}from"./LiveDevice-B33XU61P.js";import{t as Ae}from"./DesktopReview-CVoC6bQY.js";var Y=e(t(),1),X=l(),je=[`workflows`,`flows`,`runs`,`devices`],Me={workflows:D,flows:F,runs:M,devices:I},Ne={replay:[`Replaying the workflow`,`Replayed the workflow`,`working`],explore:[`Exploring the app`,`Explored the app`,`thinking`],maestro:[`Running the Maestro flows`,`Ran the Maestro flows`,`working`],validate:[`Checking the workflow`,`Checked the workflow`,`searching`],setup:[`Setting up Appium`,`Set up Appium`,`working`]},Pe={explore:`Explored`,record:`Recorded`,project:`Project`},Fe={replay:`Replay`,explore:`Explore`,record:`Recording`,maestro:`Maestro`},Ie=e=>e.mode===`replay`&&e.ok&&e.heals>0&&!e.healsAccepted,Z={android:`Android`,ios:`iOS`};async function Le(e,t){try{let{id:t}=await m.start(e,{},`mobile`);location.hash=r(`chats`,t)}catch(e){t(e.message)}}function Re(){let[e,t]=(0,Y.useState)(null),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(!1),o=(0,Y.useCallback)(()=>{f.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,Y.useEffect)(o,[o]);let s=!!e?.job?.running||!!e?.live.length;return(0,Y.useEffect)(()=>{if(!s)return;let e=_e(()=>{f.live().then(({live:e,job:n})=>t(t=>t&&(t.job?.running&&!n?.running&&o(),{...t,live:e,job:n})),()=>{})},1e3);return()=>ve(e)},[s,o]),{view:e,error:n,setError:r,busy:i||!!e?.job?.running,act:async e=>{a(!0),r(``);try{return await e(),o(),!0}catch(e){return r(e.message),!1}finally{a(!1)}},load:o,stop:()=>void f.stop().then(o)}}function ze({view:e,platform:t,picked:n,set:i}){let a=e.devices.filter(e=>!t||e.platform===t);return e.devices.length?a.length?(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,X.jsx)(K,{checked:n.includes(e.name),onCheckedChange:t=>i(t?[...n,e.name]:n.filter(t=>t!==e.name))}),(0,X.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,X.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.where]})]},e.name))}):(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-warn`,children:[`No device of mobile.devices is `,Z[t??``]??t,`.`]}):(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`The device of mobile.appium and mobile.maestro: add devices in `,(0,X.jsx)(`a`,{href:r(`settings`,`mobile`),children:`Settings, Mobile`}),` to pick them here.`]})}var Q={emulator:`this computer's emulators`,device:`phones plugged into this computer`,testmu:`TestMu AI`,browserstack:`BrowserStack`};function Be({place:e,listing:t,loading:n,error:r}){let i=e===`testmu`||e===`browserstack`;return n?(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-muted`,children:[(0,X.jsx)(ie,{size:14,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),i?`Connecting to ${Q[e]}…`:`Looking for devices…`]}):r||t&&!t.ready?(0,X.jsxs)(`span`,{className:`flex items-start gap-2 text-fail`,children:[(0,X.jsx)(he,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,X.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r||t?.problem})]}):t?(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-ink-2`,children:[(0,X.jsx)(A,{size:14,"aria-hidden":`true`,className:`flex-none text-pass`}),i?`Connected to ${Q[e]} · ${s(t.devices.length,`device`)}`:`${s(t.devices.length,`device`)} on ${Q[e]}`]}):null}function Ve({app:e,start:t,picked:n,set:r,page:i}){let[a,o]=(0,Y.useState)(t),[l,u]=(0,Y.useState)(null),[d,m]=(0,Y.useState)(``),[h,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(0),[S,C]=(0,Y.useState)(``),[w,E]=(0,Y.useState)([]);(0,Y.useEffect)(()=>{if(!e)return;let t=!0;return y(!0),m(``),u(null),p.mobileDevices(a,e,b>0).then(e=>t&&u(e),e=>t&&m(e.message)).finally(()=>t&&y(!1)),()=>{t=!1}},[a,e,b]);let D=l?.devices??[],O=S.trim().toLowerCase(),k=O?D.filter(e=>e.label.toLowerCase().includes(O)):D,A=n.filter(e=>e.startsWith(`${a}-`)).length;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{id:`replay-place`,className:`text-body-sm font-medium`,children:`Devices of`}),(0,X.jsx)(L,{labelledBy:`replay-place`,value:a,onChange:o,className:`self-start`,options:[{id:`emulator`,label:`Emulator`,icon:(0,X.jsx)(me,{size:14,"aria-hidden":`true`})},{id:`device`,label:`Real device`,icon:(0,X.jsx)(pe,{size:14,"aria-hidden":`true`})},{id:`testmu`,label:`TestMu AI`,icon:(0,X.jsx)(N,{size:14,"aria-hidden":`true`})},{id:`browserstack`,label:`BrowserStack`,icon:(0,X.jsx)(N,{size:14,"aria-hidden":`true`})}]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`p`,{role:`status`,className:`m-0 min-w-0 flex-1 text-body-sm`,children:(0,X.jsx)(Be,{place:a,listing:l,loading:h,error:d})}),(0,X.jsxs)(g,{size:`sm`,disabled:h,onClick:()=>x(e=>e+1),"data-tip":`Ask again`,children:[(0,X.jsx)(te,{"aria-hidden":`true`}),`Refresh`]})]}),l&&!l.build.ok&&(0,X.jsxs)(`p`,{role:`alert`,className:c(_.warn,`m-0 flex items-start gap-2`),children:[(0,X.jsx)(T,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,X.jsx)(`span`,{children:l.build.note})]}),D.length>6&&(0,X.jsx)(`div`,{className:`flex`,children:(0,X.jsx)(v,{id:`replay-device-search`,label:`Find a device`,value:S,onChange:C,placeholder:`Galaxy, Pixel, 14…`,className:`max-w-none flex-1`})}),D.length>0&&(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Devices of ${Q[a]}`,className:`flex flex-col gap-2`,children:[k.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,X.jsx)(K,{checked:n.includes(e.id),onCheckedChange:t=>r(t?[...n,e.id]:n.filter(t=>t!==e.id))}),(0,X.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,X.jsxs)(`span`,{className:`text-muted`,children:[`· `,[e.version?`${e.platform===`ios`?`iOS`:`Android`} ${e.version}`:``,e.type===`virtual`?`emulator`:``].filter(Boolean).join(` · `)]})]},e.id)),!k.length&&(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No device matches “`,S.trim(),`”.`]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`mr-auto text-body-sm text-muted`,children:n.length?`${s(n.length,`device`)} picked${A===n.length?``:`, ${A} here`}: each runs as a session of its own`:`None picked`}),(0,X.jsxs)(g,{size:`sm`,disabled:i.busy||!n.length,onClick:async()=>{let t=[];await i.act(async()=>t=(await f.keepDevices(e,n)).kept)&&E(t)},"data-tip":`Add them to Settings, Mobile, to pick them by name later`,children:[(0,X.jsx)(ce,{"aria-hidden":`true`}),`Keep in Settings`]})]}),w.length>0&&(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:[`Kept in Settings as `,w.join(`, `),`.`]})]})}function He(e,t){let n=t.recordedOn?.split(` · `).pop()??e.devices[0]?.where;return n===`TestMu AI`||n===`TestMu`?`testmu`:n===`BrowserStack`?`browserstack`:`emulator`}var Ue=(e,t)=>e.devices.filter(e=>e.inUse&&(!t||e.platform===t)).map(e=>e.name),$=(e,t)=>e.apps.find(e=>e.name===t)?.platform;function We({w:e,page:t,onClose:n}){let{view:r}=t,[l,u]=(0,Y.useState)(r.driver),[d,p]=(0,Y.useState)(`settings`),[m,h]=(0,Y.useState)([]),[v,y]=(0,Y.useState)([]),[b,x]=(0,Y.useState)({}),[S,C]=(0,Y.useState)(``),[w,T]=(0,Y.useState)(r.heal),[D,O]=(0,Y.useState)(!1),k=e?$(r,e.app):void 0;(0,Y.useEffect)(()=>{e&&(u(r.driver),p(e.recordedOn?`recorded`:`settings`),h(Ue(r,k)),y([]),x(Object.fromEntries(e.variables.map(e=>[e.name,e.value]))),C(``),T(r.heal),O(!1))},[e]);let A=c(o,`flex flex-col gap-4`),ee=l===`maestro`;return(0,X.jsx)(B,{open:!!e,onClose:n,title:e?`Replay ${e.name}`:`Replay`,description:`Runs the workflow's steps on each device with no model, checking its expect steps. Use a test device and a test account.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy||!e||d===`settings`&&r.devices.length>0&&!m.length||d===`pick`&&!v.length,onClick:async()=>{e&&await t.act(()=>f.replay({workflow:e.path,driver:l,...d===`settings`&&r.devices.length?{devices:m}:d===`pick`?{picks:v}:{},variables:b,...S?{rows:S}:{},heal:w,updateBaselines:D}))&&n()},"data-tip":`Replay now`,children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Replay`]})]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-4 text-body-sm text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,X.jsxs)(`span`,{children:[e.app||`no app`,` · `,s(e.steps,`step`),` · `,s(e.checks,`check`)]})]}),e.checks===0&&(0,X.jsx)(`p`,{className:c(_.warn,`m-0`),children:`It has no checks of the outcome: a replay passes when its steps run. Ask the agent to add expect steps.`}),(0,X.jsx)(J,{label:`Driver`,children:(0,X.jsx)(L,{label:`Driver`,value:l,onChange:u,options:[{id:`appium`,label:`Appium`},{id:`maestro`,label:`Maestro`}],className:`self-start`})}),(0,X.jsxs)(G,{level:3,icon:I,title:`Devices`,className:A,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{id:`replay-on`,className:`text-body-sm font-medium`,children:`Replay on`}),(0,X.jsx)(L,{labelledBy:`replay-on`,value:d,onChange:p,className:`self-start`,options:[...e.recordedOn?[{id:`recorded`,label:`Where it was recorded`}]:[],{id:`settings`,label:`Settings' devices`},{id:`pick`,label:`Pick now`}]})]}),d===`recorded`&&(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:e.recordedOn}),d===`settings`&&(0,X.jsx)(ze,{view:r,platform:k,picked:m,set:h}),d===`pick`&&(0,X.jsx)(Ve,{app:e.app,start:He(r,e),picked:v,set:y,page:t})]}),e.variables.length>0&&(0,X.jsx)(G,{level:3,icon:j,title:`Values`,className:A,children:(0,X.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-4`,children:e.variables.map(e=>(0,X.jsx)(J,{label:e.name,children:(0,X.jsx)(a,{value:b[e.name]??``,onChange:t=>x({...b,[e.name]:t.target.value})})},e.name))})}),(0,X.jsx)(G,{level:3,icon:ue,title:`Test data`,className:A,children:(0,X.jsx)(J,{label:`Rows`,hint:`Each row replays the workflow once, its columns over the values above.`,children:(0,X.jsxs)(i,{value:S,onChange:e=>C(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`Once, with the values above`}),r.rows.files.map(e=>(0,X.jsxs)(`option`,{value:e,children:[`Each row of `,e]},e))]})})}),(0,X.jsx)(G,{level:3,icon:ce,title:`While it runs`,className:A,children:ee?(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Maestro doesn't heal a moved control or compare images: replay on Appium for those.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{on:w,set:T,children:`Heal a step whose control moved`}),(0,X.jsx)(q,{on:D,set:O,children:`Take new image baselines`})]})})]})})}function Ge({open:e,page:t,onClose:n}){let{view:r}=t,[o,s]=(0,Y.useState)(r.apps[0]?.name??``),[l,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(``),v=$(r,o),y=r.devices.filter(e=>!v||e.platform===v);return(0,Y.useEffect)(()=>u(e=>y.some(t=>t.name===e)?e:y.find(e=>e.inUse)?.name??y[0]?.name??``),[o,r.devices]),(0,X.jsx)(B,{open:e,onClose:n,title:`Explore a goal`,description:`MobilePilot carries out the goal in the app through Appium and saves what it did as a workflow with checks, to replay with no model.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy||!d.trim()||!o,onClick:async()=>{await t.act(()=>f.explore({app:o,goal:d.trim(),name:m.trim(),...l?{device:l}:{}}))&&(p(``),h(``),n())},"data-tip":`Start: MobilePilot acts in the app on the device`,children:[(0,X.jsx)(ne,{"aria-hidden":`true`}),`Start exploring`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(J,{label:`App`,children:(0,X.jsx)(i,{value:o,onChange:e=>s(e.target.value),children:r.apps.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` (`,Z[e.platform]??e.platform,`)`]},e.name))})}),y.length>0&&(0,X.jsx)(J,{label:`Device`,children:(0,X.jsx)(i,{value:l,onChange:e=>u(e.target.value),children:y.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.where]},e.name))})}),(0,X.jsx)(J,{label:`Goal`,hint:`One line, as you would ask a tester.`,children:(0,X.jsx)(a,{value:d,maxLength:500,placeholder:`Sign in and accept the first delivery`,onChange:e=>p(e.target.value)})}),(0,X.jsx)(J,{label:`Name`,hint:`Optional: the workflow's name.`,children:(0,X.jsx)(a,{value:m,maxLength:80,onChange:e=>h(e.target.value)})}),(0,X.jsxs)(`p`,{className:c(_.warn,`m-0 flex gap-2`),children:[(0,X.jsx)(k,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),`MobilePilot taps and types in `,o||`the app`,` on that device. Use a test device and a test account.`]})]})})}function Ke({flows:e,page:t,onClose:n}){let{view:r}=t,[i,a]=(0,Y.useState)([]);return(0,Y.useEffect)(()=>{e&&a(Ue(r))},[e]),(0,X.jsx)(B,{open:!!e,onClose:n,title:e?`Run ${s(e.length,`Maestro flow`)}`:`Run Maestro flows`,description:`Runs your team's flows as they are, after ForgeQE's allowlist check. A flow the check refuses stops the run before any device is used, and the run says why.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy||!e?.length||r.devices.length>0&&!i.length,onClick:async()=>{e&&await t.act(()=>f.maestro(e,r.devices.length?i:void 0))&&n()},children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Run flows`]})]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm text-ink-2`,children:e.map(e=>(0,X.jsx)(`li`,{className:`truncate`,"data-tip":e,children:e},e))}),(0,X.jsxs)(G,{level:3,icon:I,title:`Devices`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,X.jsx)(ze,{view:r,picked:i,set:a}),(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Maestro runs on this computer's devices and TestMu's, not BrowserStack's.`})]})]})})}function qe({open:e,page:t,onClose:n,onDone:r}){let{view:o}=t,[s,c]=(0,Y.useState)(o.builds[0]??``),[l,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(`testmu`),y=_===`browserstack`?`BrowserStack`:`TestMu AI`;return(0,X.jsx)(B,{open:e,onClose:n,title:`Upload a build`,description:`Sends an .apk, .aab, .ipa or a .zip of an .app to ${y}, so its devices can install it. The build leaves this computer for ${y}'s storage.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy||!s,onClick:async()=>{let e=``;await t.act(async()=>{let t=await f.upload({file:s,cloud:_,...l?{app:l}:{},...d.trim()?{name:d.trim()}:{},..._===`testmu`?{virtual:m}:{}});e=t.saved&&t.app?`Uploaded: ${t.app} now installs ${t.id} on ${y}.`:`Uploaded to ${y} as ${t.id}.${t.app?` ${t.app} comes from env.yaml: set its ${_===`browserstack`?`browserstack_app`:`testmu_app`}: to that id there.`:``}`})&&(r(e),n())},children:[(0,X.jsx)(ae,{"aria-hidden":`true`}),`Upload`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(J,{label:`Cloud`,children:(0,X.jsx)(L,{label:`Cloud`,value:_,onChange:v,options:[{id:`testmu`,label:`TestMu AI`},{id:`browserstack`,label:`BrowserStack`}],className:`self-start`})}),o.builds.length?(0,X.jsx)(J,{label:`File`,hint:`An app build found in the project.`,children:(0,X.jsx)(i,{value:s,onChange:e=>c(e.target.value),children:o.builds.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No .apk, .aab, .ipa or .zip in the project: put the build in the project's folder first.`}),(0,X.jsx)(J,{label:`For app`,hint:`Optional: the id is saved as this app's build on ${y}; other places keep their own.`,children:(0,X.jsxs)(i,{value:l,onChange:e=>u(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`No app`}),o.apps.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,X.jsx)(J,{label:`Name`,hint:`Optional: the name ${y} shows.`,children:(0,X.jsx)(a,{value:d,maxLength:120,onChange:e=>p(e.target.value)})}),_===`testmu`&&(0,X.jsx)(q,{on:m,set:h,children:`For TestMu's emulators and simulators`})]})})}function Je({open:e,page:t,onClose:n}){let[r,i]=(0,Y.useState)(!1);return(0,X.jsx)(B,{open:e,onClose:n,title:`Set up Appium`,description:`Installs ForgeQE's pinned Appium and its drivers into its tools folder, once. A run on a device on this computer then starts Appium by itself.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy,onClick:async()=>{await t.act(()=>f.setup(r))&&n()},children:[(0,X.jsx)(P,{"aria-hidden":`true`}),`Set up`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(q,{on:r,set:i,children:`Set it up again from scratch`}),(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`A device cloud needs none of this. Maestro is installed by you: maestro on the PATH, or mobile.maestro.command.`})]})})}function Ye({page:e,onReplay:t,onExplore:n,onSteps:a}){let{view:o}=e,[s,l]=(0,Y.useState)(o.apps[0]?.name??``),[u,d]=(0,Y.useState)(`all`),m=e=>$(o,e.app),h=u===`all`?o.workflows:o.workflows.filter(e=>m(e)===u),_=()=>e.act(async()=>{await p.start({kind:`mobile`,app:s}),location.hash=r(`record`)});return(0,X.jsx)(be,{label:`Mobile workflows`,minWidth:760,height:ye,resetKey:u,placeholder:`Find a workflow`,empty:u===`all`?`No mobile workflows yet: record one by hand, explore a goal, or keep .yaml files with format: forgeqe-mobile-v1 in the project.`:`None.`,tools:(0,X.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[(0,X.jsx)(b,{value:u,onChange:d,items:[{id:`all`,label:`All`,n:o.workflows.length},{id:`android`,label:`Android`,n:o.workflows.filter(e=>m(e)===`android`).length},{id:`ios`,label:`iOS`,n:o.workflows.filter(e=>m(e)===`ios`).length}]}),(0,X.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[o.apps.length>1&&(0,X.jsx)(i,{size:`sm`,"aria-label":`App to record`,value:s,onChange:e=>l(e.target.value),className:`w-auto`,children:o.apps.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,X.jsxs)(g,{size:`sm`,disabled:e.busy||!s,onClick:()=>void _(),"data-tip":`Record your steps in ${s||`an app`}: no model`,children:[(0,X.jsx)(I,{"aria-hidden":`true`}),`Record by hand`]}),(0,X.jsxs)(g,{size:`sm`,variant:`primary`,disabled:e.busy||!o.apps.length,onClick:n,"data-tip":`MobilePilot carries out a goal and saves it as a workflow`,children:[(0,X.jsx)(ne,{"aria-hidden":`true`}),`Explore a goal`]})]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Workflow`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`App`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Platform`}),(0,X.jsx)(`th`,{scope:`col`,className:xe,children:`Steps`}),(0,X.jsx)(`th`,{scope:`col`,className:xe,children:`Checks`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`From`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:h.map(n=>(0,X.jsxs)(`tr`,{className:H,children:[(0,X.jsx)(`td`,{className:W,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>a(n),className:`self-start text-left`,children:n.name}),(0,X.jsx)(`span`,{className:`max-w-[300px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap`),children:n.app||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap`),children:Z[m(n)??``]??(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:V,children:n.steps}),(0,X.jsx)(`td`,{className:c(V,n.checks===0&&`text-warn`),"data-tip":n.checks===0?`No checks of the outcome: a replay passes when its steps run`:void 0,children:n.checks}),(0,X.jsxs)(`td`,{className:c(W,`whitespace-nowrap`),children:[Pe[n.from],(0,X.jsx)(`span`,{className:`block text-body-sm text-muted`,children:z(n.modified)})]}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>a(n),"aria-label":`Open ${n.name}`,"data-tip":`Open it: steps, checks, test data, last run`,className:`size-8`,children:(0,X.jsx)(oe,{"aria-hidden":`true`})}),(0,X.jsx)(g,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t(n),"aria-label":`Replay ${n.name}`,"data-tip":`Replay ${n.name}`,className:`size-8`,children:(0,X.jsx)(M,{"aria-hidden":`true`})}),(0,X.jsx)(g,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>void e.act(()=>f.validate(n.path)),"aria-label":`Check ${n.name}`,"data-tip":`Check it without running it`,className:`size-8`,children:(0,X.jsx)(F,{"aria-hidden":`true`})}),(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>void Le(`MobilePilot: look at the mobile workflow ${n.path} and tell me what to fix or add (a wait, a dialog to dismiss, checks of the outcome); change it only after showing me the change.`,e.setError),"aria-label":`Improve ${n.name} with the agent`,"data-tip":`Improve it with the agent`,className:`size-8`,children:(0,X.jsx)(O,{"aria-hidden":`true`})})]})})]},n.path))})}function Xe({page:e,onRun:t}){let{view:n}=e,[r,i]=(0,Y.useState)([]),a=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,X.jsx)(be,{label:`Maestro flows`,minWidth:640,placeholder:`Find a flow`,empty:`No Maestro flows found: keep them in .maestro/ at the project's root (.yaml files with appId:).`,height:ye,selection:{count:n.flows.filter(e=>r.includes(e.path)).length,onClear:()=>i([]),actions:(0,X.jsxs)(g,{size:`sm`,variant:`primary`,disabled:e.busy||!r.length,onClick:()=>t(r),"data-tip":`Run the flows ticked, after ForgeQE's allowlist check`,children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Run selected`]})},head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:c(U,`w-10`),children:(0,X.jsx)(K,{"aria-label":`Select all ${s(n.flows.length,`flow`)}`,checked:n.flows.length>0&&n.flows.every(e=>r.includes(e.path)),onCheckedChange:e=>i(e?n.flows.map(e=>e.path):[])})}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Flow`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`App id`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.flows.map(n=>(0,X.jsxs)(`tr`,{className:H,"data-state":r.includes(n.path)?`selected`:void 0,children:[(0,X.jsx)(`td`,{className:c(W,`w-10`),children:(0,X.jsx)(K,{"aria-label":`Pick ${n.name}`,checked:r.includes(n.path),onCheckedChange:e=>a(n.path,e)})}),(0,X.jsx)(`td`,{className:W,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:n.name}),(0,X.jsx)(`span`,{className:`max-w-[340px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap font-mono text-body-sm`),children:n.appId}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,X.jsx)(g,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t([n.path]),"aria-label":`Run ${n.name}`,"data-tip":`Run ${n.name}`,className:`size-8`,children:(0,X.jsx)(M,{"aria-hidden":`true`})}),(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>void Le(`MobilePilot: read the Maestro flow ${n.path}, tell me what it checks and what it misses.`,e.setError),"aria-label":`Ask the agent about ${n.name}`,"data-tip":`Ask the agent about it`,className:`size-8`,children:(0,X.jsx)(fe,{"aria-hidden":`true`})})]})})]},n.path))})}var Ze=/^https:\/\/(app-automate\.browserstack\.com\/dashboard\/v2\/sessions|appautomation\.lambdatest\.com\/test\?testID=)[\w=-]{8,80}$/,Qe=e=>e.includes(`browserstack`)?`BrowserStack`:`TestMu AI`;function $e({run:e,onClose:t}){let n=e?.devices??[],r=[...new Map(n.flatMap(e=>e.steps.map(e=>[e.index,e.op])).reverse()).entries()].sort((e,t)=>e[0]-t[0]);return(0,X.jsx)(B,{open:!!e,onClose:t,title:e?`${e.name} on ${s(n.length,`device`)}`:`Devices`,description:`${e?`${n.filter(e=>e.ok).length} of ${n.length} devices passed. `:``}Each step's result on each device; a session page has the device's video and logs.`,footer:(0,X.jsxs)(g,{onClick:t,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Close`]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(`table`,{className:`border-separate border-spacing-1.5 text-left`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Each step's result on each device`}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-2 text-body-sm font-medium text-muted`,children:`Step`}),n.map(e=>(0,X.jsx)(`th`,{scope:`col`,className:`px-2 text-body-sm font-medium whitespace-nowrap text-muted`,children:e.device},e.device))]})}),(0,X.jsx)(`tbody`,{children:r.map(([e,t])=>(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{scope:`row`,className:`px-2 text-body-sm font-normal whitespace-nowrap text-ink-2`,children:[e,` `,t]}),n.map(t=>{let n=t.steps.find(t=>t.index===e);return(0,X.jsx)(`td`,{className:`px-2 text-center`,children:n?n.ok?(0,X.jsx)(A,{size:14,"aria-label":`Passed`,className:`inline text-pass`}):(0,X.jsx)(he,{size:14,"aria-label":`Failed: ${n.error||`failed`}`,className:`inline text-fail`}):(0,X.jsx)(ee,{size:14,"aria-label":`Not reached`,className:`inline text-muted`})},t.device)})]},e))})]})}),(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:n.map(e=>{let t=e.steps.find(e=>!e.ok),n=e.ok?``:t?`Step ${t.index} (${t.op}): ${t.error||`failed`}`:e.error||`Failed`,r=e.session&&Ze.test(e.session)?e.session:void 0;return(0,X.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.device}),(0,X.jsx)(C,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passed`:`Failed`}),e.report&&(0,X.jsx)(S,{path:e.report,children:`Report`}),r&&(0,X.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-body-sm text-accent-fg hover:underline`,children:[`Session on `,Qe(r),(0,X.jsx)(re,{size:14,"aria-hidden":`true`})]})]}),n&&(0,X.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:n})]},e.device)})})]})})}function et({page:e}){let{view:t}=e,[n,r]=(0,Y.useState)(`all`),[i,a]=(0,Y.useState)(``),[o,l]=(0,Y.useState)(null),u=t.runs.filter(e=>!e.ok),f=t.runs.filter(Ie),p=t.runs.filter(e=>e.mode===`maestro`),m=n===`failed`?u:n===`heals`?f:n===`maestro`?p:t.runs;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[i&&(0,X.jsx)(`p`,{role:`status`,className:c(_.pass,`m-0`),children:i}),(0,X.jsx)(be,{label:`Mobile runs`,minWidth:720,height:ye,resetKey:n,placeholder:`Find a run`,empty:n===`all`?`No mobile runs yet: replay, record or explore a workflow, or run your Maestro flows.`:`None.`,tools:(0,X.jsx)(b,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:t.runs.length},{id:`failed`,label:`Failed`,n:u.length,alert:!0},{id:`heals`,label:`Heals to accept`,n:f.length},{id:`maestro`,label:`Maestro flows`,n:p.length}]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Run`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Result`}),(0,X.jsx)(`th`,{scope:`col`,className:xe,children:`Steps`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Heals`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:m.map(t=>(0,X.jsxs)(`tr`,{className:H,children:[(0,X.jsx)(`td`,{className:W,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[Fe[t.mode],`: `,t.name]}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:[t.app,z(t.at)].filter(Boolean).join(` · `)}),(t.failed||t.error)&&(0,X.jsx)(`span`,{className:`max-w-[380px] truncate text-body-sm text-fail`,"data-tip":t.failed?t.failed.error:t.error,children:t.failed?`Step ${t.failed.index} (${t.failed.op}): ${t.failed.error||`failed`}`:t.error})]})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap`),children:(0,X.jsx)(C,{tone:t.ok?`pass`:`fail`,children:t.many?`${t.many.passed} of ${t.many.total}`:t.ok?`Passed`:`Failed`})}),(0,X.jsx)(`td`,{className:V,children:t.steps||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap`),children:t.heals?t.healsAccepted?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-pass`,children:[(0,X.jsx)(A,{size:14,"aria-hidden":`true`}),`In the workflow`]}):t.ok?(0,X.jsxs)(g,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(async()=>{let e=await d.acceptHeals(t.dir);a(`Wrote ${s(e.written,`healed step`)} into ${e.workflow}.`)}),"data-tip":`Write the new locators into the workflow`,children:[(0,X.jsx)(P,{"aria-hidden":`true`}),`Accept `,s(t.heals,`heal`)]}):(0,X.jsxs)(`span`,{className:`text-body-sm text-muted`,"data-tip":`The replay failed after healing, so its heals may be wrong`,children:[s(t.heals,`heal`),`, not offered`]}):(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t.report&&(0,X.jsx)(S,{path:t.report,children:`Report`}),t.devices&&t.devices.length>0&&(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>l(t),"aria-label":`See each device`,"data-tip":`See each device`,className:`size-8`,children:(0,X.jsx)(se,{"aria-hidden":`true`})}),!t.ok&&(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>void Le(`MobilePilot: the mobile ${t.mode} ${t.dir} failed${t.workflow?` (workflow ${t.workflow})`:``}. Read its report, tell me why, and offer a fix.`,e.setError),"aria-label":`Ask the agent why it failed`,"data-tip":`Ask the agent why it failed`,className:`size-8`,children:(0,X.jsx)(fe,{"aria-hidden":`true`})})]})})]},t.dir))}),(0,X.jsx)($e,{run:o,onClose:()=>l(null)})]})}function tt({page:e,said:t,onSetup:n,onUpload:i}){let{view:a}=e,s=a.ready,l=(e,t)=>`${t}: ${e?`sign-in set`:`no sign-in`}`,u=[{label:`Appium server`,ok:s.appium,note:`${s.appiumNote} (${s.appiumUrl})`},{label:`Maestro`,ok:s.maestro,note:s.maestroNote},{label:`Device clouds`,ok:s.clouds.testmu||s.clouds.browserstack,note:[l(s.clouds.testmu,`TestMu`),l(s.clouds.browserstack,`BrowserStack`)].join(` · `)},{label:`Healing`,ok:a.heal,note:a.heal?`A moved control is healed with the model (Appium only)`:`mobile.heal is off`}],d=c(o,`flex flex-col`);return(0,X.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] items-start gap-6`,children:[(0,X.jsxs)(G,{id:`mobile-machine`,icon:w,title:`This computer`,divider:!1,children:[(0,X.jsx)(`ul`,{className:c(d,`m-0 list-none divide-y divide-line-soft p-0`),children:u.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[e.ok?(0,X.jsx)(A,{size:16,"aria-label":`Ready`,className:`mt-1 flex-none text-pass`}):(0,X.jsx)(k,{size:16,"aria-label":`Not ready`,className:`mt-1 flex-none text-warn`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.note})]})]},e.label))}),s.checked&&(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Checked `,z(s.checked),`.`]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(g,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(()=>f.doctor()),"data-tip":`Whether the Appium server answers and Maestro is installed`,children:[(0,X.jsx)(F,{"aria-hidden":`true`}),`Check`]}),(0,X.jsxs)(g,{size:`sm`,variant:s.appium?`outline`:`primary`,disabled:e.busy,onClick:n,"data-tip":`Install ForgeQE's pinned Appium and its drivers`,children:[(0,X.jsx)(P,{"aria-hidden":`true`}),`Set up Appium`]})]})]}),(0,X.jsxs)(G,{id:`mobile-devices`,icon:I,title:`Devices`,divider:!1,children:[a.devices.length?(0,X.jsx)(`ul`,{className:c(d,`m-0 list-none divide-y divide-line-soft p-0`),children:a.devices.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.about})]}),(0,X.jsx)(C,{tone:`neutral`,children:e.inUse?`In use`:`Off`})]},e.name))}):(0,X.jsx)(h,{className:`py-4`,children:`No devices listed: runs use the device of mobile.appium and mobile.maestro.`}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Devices are added and changed in `,(0,X.jsx)(`a`,{href:r(`settings`,`mobile`),children:`Settings, Mobile`}),`.`]})]}),(0,X.jsxs)(G,{id:`mobile-apps`,icon:le,title:`Apps`,divider:!1,actions:(0,X.jsxs)(g,{size:`sm`,onClick:i,"data-tip":`Upload an app build to TestMu AI or BrowserStack`,children:[(0,X.jsx)(ae,{"aria-hidden":`true`}),`Upload a build`]}),children:[t&&(0,X.jsx)(`p`,{role:`status`,className:c(_.pass,`m-0`),children:t}),a.apps.length?(0,X.jsx)(`ul`,{className:c(d,`m-0 list-none divide-y divide-line-soft p-0`),children:a.apps.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,X.jsx)(y,{icon:I,size:16,className:`mt-1 flex-none text-muted`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[Z[e.platform]??e.platform,e.appId,e.build?`TestMu AI build ${e.build}`:``,e.browserstackBuild?`BrowserStack build ${e.browserstackBuild}`:``,e.build||e.browserstackBuild?``:`no build uploaded`].filter(Boolean).join(` · `)})]})]},e.name))}):(0,X.jsxs)(h,{className:`py-4`,children:[`No mobile apps yet: add one in `,(0,X.jsx)(`a`,{href:r(`settings`,`environments`),children:`Settings, Environments`}),`.`]}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Secrets a workflow may type: `,a.secrets.length?a.secrets.join(`, `):`none`,`.`]})]})]})}function nt({view:e,onTab:t}){let n=e.runs.filter(e=>e.mode===`replay`||e.mode===`maestro`),r=n.filter(e=>e.ok).length,i=n[0],a=e.runs.filter(Ie).length,o=e.workflows.filter(e=>e.checks===0).length,c=[e.ready.appium&&`Appium`,e.ready.maestro&&`Maestro`].filter(Boolean).join(` · `);return(0,X.jsxs)(ge,{label:`Mobile at a glance`,children:[(0,X.jsx)(R,{compact:!0,label:`Workflows`,value:e.workflows.length,note:o?(0,X.jsxs)(`span`,{className:`text-warn`,children:[o,` without checks`]}):`${s(e.apps.length,`app`)}`}),(0,X.jsx)(R,{compact:!0,label:`Replays passed`,value:n.length?`${r} of ${n.length}`:(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:`None yet`}),tone:n.length&&r<n.length?`text-fail`:void 0,...i?{note:`Last ${z(i.at)}`}:{}}),(0,X.jsx)(R,{compact:!0,label:`Heals to accept`,value:a,tone:a?`text-accent-fg`:void 0,note:a?(0,X.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>t(`runs`),children:`Review them`}):`From passed replays`}),(0,X.jsx)(R,{compact:!0,label:`Replay here`,value:c||(e.ready.checked?`Not ready`:(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not checked`})),tone:c?`text-pass`:e.ready.checked?`text-warn`:void 0,note:c?`${s(e.devices.filter(e=>e.inUse).length,`device`)} in use`:(0,X.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>t(`devices`),children:e.ready.checked?`Set it up`:`Check it`})})]})}function rt({live:e,job:t,page:n}){let[r,i]=(0,Y.useState)(``),a=e.find(e=>e.id===r)??e[0],o=t&&(t.running||!t.endedAt||Date.now()-Date.parse(t.endedAt)<6e5);return a?(0,X.jsxs)(`section`,{"aria-label":`The device at work`,className:`grid grid-cols-1 items-start gap-6 @[700px]:grid-cols-[minmax(0,300px)_minmax(0,1fr)]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[e.length>1&&(0,X.jsx)(b,{value:a.id,onChange:i,items:e.map(e=>({id:e.id,label:e.device||e.id.split(`/`).at(-1)||`Device`}))}),(0,X.jsx)(ke,{d:a,picture:f.screen})]}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:t&&o?(0,X.jsx)(Oe,{job:t,onStop:n.stop,words:Ne}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Started from a chat: its lines are in the chat.`})})]}):o&&t?(0,X.jsx)(Oe,{job:t,onStop:n.stop,words:Ne}):null}function it({sub:e}){let t=Re(),{view:i,error:a}=t,o=u(`mobile`),s=(e??``).split(`/`),l=s[0]===`workflow`&&s[1]?n(s[1]):``,d=l?`workflows`:je.includes(s[0])?s[0]:Ee,[p,m]=(0,Y.useState)(null),[h,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),E=l&&i?.workflows.find(e=>e.path===l)||null,D=e=>location.hash=e?r(`mobile`,`workflow`,encodeURIComponent(e.path)):r(`mobile`,`workflows`),[O,k]=(0,Y.useState)(``),A=i?.job??null,j=e=>e===`agent`?r(`mobile`,Ee):r(`mobile`,e),M=e=>location.hash=j(e),ee={workflows:`Workflows`,flows:`Maestro flows`,runs:`Runs`,devices:`Devices and apps`},N=i?{workflows:i.workflows.length,flows:i.flows.length,runs:i.runs.length}:{};return(0,X.jsxs)(Te,{title:Se(`mobile`),page:o,label:`Mobile apps`,current:d,tabHref:j,onPick:M,tabs:je.map(e=>({id:e,label:ee[e],icon:Me[e],...N[e]===void 0?{}:{n:N[e]}})),below:(0,X.jsx)(we,{page:o}),children:[(0,X.jsx)(Ce,{more:(0,X.jsx)(X.Fragment,{children:`Explore a goal with MobilePilot or record your steps by hand, then replay them on Appium or Maestro with no model, and run your team's own Maestro flows.`}),children:`Test your Android and iOS apps with workflows that replay on their own.`}),a&&(0,X.jsx)(De,{text:a}),!i&&!a&&(0,X.jsx)(x,{shape:`rows`}),i&&E&&(0,X.jsx)(Ae,{workflow:E.path,backLabel:`Workflows`,tab:s[2],onTab:e=>location.hash=e===`steps`?r(`mobile`,`workflow`,encodeURIComponent(E.path)):r(`mobile`,`workflow`,encodeURIComponent(E.path),e),onClose:()=>{D(null),t.load()}},E.path),i&&!E&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nt,{view:i,onTab:M}),(0,X.jsx)(rt,{live:i.live,job:A,page:{...t,view:i}}),A?.question&&(0,X.jsxs)(`div`,{className:c(_.info,`flex flex-col gap-2`),children:[(0,X.jsx)(`p`,{className:`m-0 font-medium`,children:A.question.title}),A.question.detail&&(0,X.jsx)(`p`,{className:`m-0 text-ink-2`,children:A.question.detail}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[A.question.options.map(e=>(0,X.jsx)(g,{size:`sm`,onClick:()=>void t.act(()=>f.answer(A.question.id,e.id)),children:e.label},e.id)),(0,X.jsxs)(g,{size:`sm`,variant:`danger`,onClick:()=>void t.act(()=>f.answer(A.question.id,null)),children:[(0,X.jsx)(de,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})]}),(0,X.jsxs)(`div`,{children:[d===`workflows`&&(0,X.jsx)(Ye,{page:{...t,view:i},onReplay:m,onExplore:()=>v(!0),onSteps:D}),d===`flows`&&(0,X.jsx)(Xe,{page:{...t,view:i},onRun:b}),d===`runs`&&(0,X.jsx)(et,{page:{...t,view:i}}),d===`devices`&&(0,X.jsx)(tt,{page:{...t,view:i},said:O,onSetup:()=>T(!0),onUpload:()=>C(!0)})]}),(0,X.jsx)(We,{w:p,page:{...t,view:i},onClose:()=>m(null)}),(0,X.jsx)(Ge,{open:h,page:{...t,view:i},onClose:()=>v(!1)}),(0,X.jsx)(Ke,{flows:y,page:{...t,view:i},onClose:()=>b(null)}),(0,X.jsx)(qe,{open:S,page:{...t,view:i},onClose:()=>C(!1),onDone:k}),(0,X.jsx)(Je,{open:w,page:{...t,view:i},onClose:()=>T(!1)})]})]})}export{it as Mobile};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,P as a,c as o}from"./surface-c1kG1KPS.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{d as u}from"./sectionList-B6NF3ZMb.js";import{T as d,U as f,X as p,b as m}from"./api-D1PU4zye.js";import{A as h,F as g,L as _,O as v,P as y,T as b,g as x,i as S,k as C}from"./pageBack-DfGBh1Hs.js";import{$ as w,Er as T,Gr as E,Hr as D,Lr as O,M as k,N as A,Pr as j,Rn as M,Sn as ee,U as N,Un as te,Wr as P,cn as F,cr as ne,ct as re,fn as ie,kr as ae,lt as oe,nn as se,nr as ce,or as I,r as le,tt as ue,ur as de,vn as fe,vr as pe,wn as me,z as he}from"./line-icons-Cwj9OmCz.js";import{G as ge,Ht as _e,J as L,Vt as ve,W as R,Z as z,Zt as B,ct as V,dt as H,it as ye,lt as U,ot as W,rt as be,ut as xe}from"./frame-D0MS2ZMz.js";import{u as Se}from"./nav-CkrE6JFU.js";import{J as G,K,V as Ce,l as we,n as Te,t as Ee}from"./index-F8zkXd19.js";import{f as q,l as De,o as Oe,r as J}from"./dataParts-uqmYw8V2.js";import{t as ke}from"./LiveDevice-Bzz5k4my.js";import{t as Ae}from"./DesktopReview-Cw2ODskw.js";var Y=e(t(),1),X=l(),je=[`workflows`,`flows`,`runs`,`devices`],Me={workflows:D,flows:F,runs:M,devices:I},Ne={replay:[`Replaying the workflow`,`Replayed the workflow`,`working`],explore:[`Exploring the app`,`Explored the app`,`thinking`],maestro:[`Running the Maestro flows`,`Ran the Maestro flows`,`working`],validate:[`Checking the workflow`,`Checked the workflow`,`searching`],setup:[`Setting up Appium`,`Set up Appium`,`working`]},Pe={explore:`Explored`,record:`Recorded`,project:`Project`},Fe={replay:`Replay`,explore:`Explore`,record:`Recording`,maestro:`Maestro`},Ie=e=>e.mode===`replay`&&e.ok&&e.heals>0&&!e.healsAccepted,Z={android:`Android`,ios:`iOS`};async function Le(e,t){try{let{id:t}=await m.start(e,{},`mobile`);location.hash=r(`chats`,t)}catch(e){t(e.message)}}function Re(){let[e,t]=(0,Y.useState)(null),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(!1),o=(0,Y.useCallback)(()=>{f.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,Y.useEffect)(o,[o]);let s=!!e?.job?.running||!!e?.live.length;return(0,Y.useEffect)(()=>{if(!s)return;let e=_e(()=>{f.live().then(({live:e,job:n})=>t(t=>t&&(t.job?.running&&!n?.running&&o(),{...t,live:e,job:n})),()=>{})},1e3);return()=>ve(e)},[s,o]),{view:e,error:n,setError:r,busy:i||!!e?.job?.running,act:async e=>{a(!0),r(``);try{return await e(),o(),!0}catch(e){return r(e.message),!1}finally{a(!1)}},load:o,stop:()=>void f.stop().then(o)}}function ze({view:e,platform:t,picked:n,set:i}){let a=e.devices.filter(e=>!t||e.platform===t);return e.devices.length?a.length?(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,X.jsx)(K,{checked:n.includes(e.name),onCheckedChange:t=>i(t?[...n,e.name]:n.filter(t=>t!==e.name))}),(0,X.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,X.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.where]})]},e.name))}):(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-warn`,children:[`No device of mobile.devices is `,Z[t??``]??t,`.`]}):(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`The device of mobile.appium and mobile.maestro: add devices in `,(0,X.jsx)(`a`,{href:r(`settings`,`mobile`),children:`Settings, Mobile`}),` to pick them here.`]})}var Q={emulator:`this computer's emulators`,device:`phones plugged into this computer`,testmu:`TestMu AI`,browserstack:`BrowserStack`};function Be({place:e,listing:t,loading:n,error:r}){let i=e===`testmu`||e===`browserstack`;return n?(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-muted`,children:[(0,X.jsx)(ie,{size:14,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),i?`Connecting to ${Q[e]}…`:`Looking for devices…`]}):r||t&&!t.ready?(0,X.jsxs)(`span`,{className:`flex items-start gap-2 text-fail`,children:[(0,X.jsx)(he,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,X.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r||t?.problem})]}):t?(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-ink-2`,children:[(0,X.jsx)(A,{size:14,"aria-hidden":`true`,className:`flex-none text-pass`}),i?`Connected to ${Q[e]} · ${s(t.devices.length,`device`)}`:`${s(t.devices.length,`device`)} on ${Q[e]}`]}):null}function Ve({app:e,start:t,picked:n,set:r,page:i}){let[a,o]=(0,Y.useState)(t),[l,u]=(0,Y.useState)(null),[d,m]=(0,Y.useState)(``),[h,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(0),[S,C]=(0,Y.useState)(``),[w,E]=(0,Y.useState)([]);(0,Y.useEffect)(()=>{if(!e)return;let t=!0;return y(!0),m(``),u(null),p.mobileDevices(a,e,b>0).then(e=>t&&u(e),e=>t&&m(e.message)).finally(()=>t&&y(!1)),()=>{t=!1}},[a,e,b]);let D=l?.devices??[],O=S.trim().toLowerCase(),k=O?D.filter(e=>e.label.toLowerCase().includes(O)):D,A=n.filter(e=>e.startsWith(`${a}-`)).length;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{id:`replay-place`,className:`text-body-sm font-medium`,children:`Devices of`}),(0,X.jsx)(L,{labelledBy:`replay-place`,value:a,onChange:o,className:`self-start`,options:[{id:`emulator`,label:`Emulator`,icon:(0,X.jsx)(me,{size:14,"aria-hidden":`true`})},{id:`device`,label:`Real device`,icon:(0,X.jsx)(pe,{size:14,"aria-hidden":`true`})},{id:`testmu`,label:`TestMu AI`,icon:(0,X.jsx)(N,{size:14,"aria-hidden":`true`})},{id:`browserstack`,label:`BrowserStack`,icon:(0,X.jsx)(N,{size:14,"aria-hidden":`true`})}]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`p`,{role:`status`,className:`m-0 min-w-0 flex-1 text-body-sm`,children:(0,X.jsx)(Be,{place:a,listing:l,loading:h,error:d})}),(0,X.jsxs)(g,{size:`sm`,disabled:h,onClick:()=>x(e=>e+1),"data-tip":`Ask again`,children:[(0,X.jsx)(te,{"aria-hidden":`true`}),`Refresh`]})]}),l&&!l.build.ok&&(0,X.jsxs)(`p`,{role:`alert`,className:c(_.warn,`m-0 flex items-start gap-2`),children:[(0,X.jsx)(T,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,X.jsx)(`span`,{children:l.build.note})]}),D.length>6&&(0,X.jsx)(`div`,{className:`flex`,children:(0,X.jsx)(v,{id:`replay-device-search`,label:`Find a device`,value:S,onChange:C,placeholder:`Galaxy, Pixel, 14…`,className:`max-w-none flex-1`})}),D.length>0&&(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Devices of ${Q[a]}`,className:`flex flex-col gap-2`,children:[k.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,X.jsx)(K,{checked:n.includes(e.id),onCheckedChange:t=>r(t?[...n,e.id]:n.filter(t=>t!==e.id))}),(0,X.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,X.jsxs)(`span`,{className:`text-muted`,children:[`· `,[e.version?`${e.platform===`ios`?`iOS`:`Android`} ${e.version}`:``,e.type===`virtual`?`emulator`:``].filter(Boolean).join(` · `)]})]},e.id)),!k.length&&(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No device matches “`,S.trim(),`”.`]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`mr-auto text-body-sm text-muted`,children:n.length?`${s(n.length,`device`)} picked${A===n.length?``:`, ${A} here`}: each runs as a session of its own`:`None picked`}),(0,X.jsxs)(g,{size:`sm`,disabled:i.busy||!n.length,onClick:async()=>{let t=[];await i.act(async()=>t=(await f.keepDevices(e,n)).kept)&&E(t)},"data-tip":`Add them to Settings, Mobile, to pick them by name later`,children:[(0,X.jsx)(ce,{"aria-hidden":`true`}),`Keep in Settings`]})]}),w.length>0&&(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:[`Kept in Settings as `,w.join(`, `),`.`]})]})}function He(e,t){let n=t.recordedOn?.split(` · `).pop()??e.devices[0]?.where;return n===`TestMu AI`||n===`TestMu`?`testmu`:n===`BrowserStack`?`browserstack`:`emulator`}var Ue=(e,t)=>e.devices.filter(e=>e.inUse&&(!t||e.platform===t)).map(e=>e.name),$=(e,t)=>e.apps.find(e=>e.name===t)?.platform;function We({w:e,page:t,onClose:n}){let{view:r}=t,[l,u]=(0,Y.useState)(r.driver),[d,p]=(0,Y.useState)(`settings`),[m,h]=(0,Y.useState)([]),[v,y]=(0,Y.useState)([]),[b,x]=(0,Y.useState)({}),[S,C]=(0,Y.useState)(``),[w,T]=(0,Y.useState)(r.heal),[D,O]=(0,Y.useState)(!1),k=e?$(r,e.app):void 0;(0,Y.useEffect)(()=>{e&&(u(r.driver),p(e.recordedOn?`recorded`:`settings`),h(Ue(r,k)),y([]),x(Object.fromEntries(e.variables.map(e=>[e.name,e.value]))),C(``),T(r.heal),O(!1))},[e]);let A=c(o,`flex flex-col gap-4`),ee=l===`maestro`;return(0,X.jsx)(B,{open:!!e,onClose:n,title:e?`Replay ${e.name}`:`Replay`,description:`Runs the workflow's steps on each device with no model, checking its expect steps. Use a test device and a test account.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy||!e||d===`settings`&&r.devices.length>0&&!m.length||d===`pick`&&!v.length,onClick:async()=>{e&&await t.act(()=>f.replay({workflow:e.path,driver:l,...d===`settings`&&r.devices.length?{devices:m}:d===`pick`?{picks:v}:{},variables:b,...S?{rows:S}:{},heal:w,updateBaselines:D}))&&n()},"data-tip":`Replay now`,children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Replay`]})]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-4 text-body-sm text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,X.jsxs)(`span`,{children:[e.app||`no app`,` · `,s(e.steps,`step`),` · `,s(e.checks,`check`)]})]}),e.checks===0&&(0,X.jsx)(`p`,{className:c(_.warn,`m-0`),children:`It has no checks of the outcome: a replay passes when its steps run. Ask the agent to add expect steps.`}),(0,X.jsx)(J,{label:`Driver`,children:(0,X.jsx)(L,{label:`Driver`,value:l,onChange:u,options:[{id:`appium`,label:`Appium`},{id:`maestro`,label:`Maestro`}],className:`self-start`})}),(0,X.jsxs)(G,{level:3,icon:I,title:`Devices`,className:A,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{id:`replay-on`,className:`text-body-sm font-medium`,children:`Replay on`}),(0,X.jsx)(L,{labelledBy:`replay-on`,value:d,onChange:p,className:`self-start`,options:[...e.recordedOn?[{id:`recorded`,label:`Where it was recorded`}]:[],{id:`settings`,label:`Settings' devices`},{id:`pick`,label:`Pick now`}]})]}),d===`recorded`&&(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:e.recordedOn}),d===`settings`&&(0,X.jsx)(ze,{view:r,platform:k,picked:m,set:h}),d===`pick`&&(0,X.jsx)(Ve,{app:e.app,start:He(r,e),picked:v,set:y,page:t})]}),e.variables.length>0&&(0,X.jsx)(G,{level:3,icon:j,title:`Values`,className:A,children:(0,X.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-4`,children:e.variables.map(e=>(0,X.jsx)(J,{label:e.name,children:(0,X.jsx)(a,{value:b[e.name]??``,onChange:t=>x({...b,[e.name]:t.target.value})})},e.name))})}),(0,X.jsx)(G,{level:3,icon:ue,title:`Test data`,className:A,children:(0,X.jsx)(J,{label:`Rows`,hint:`Each row replays the workflow once, its columns over the values above.`,children:(0,X.jsxs)(i,{value:S,onChange:e=>C(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`Once, with the values above`}),r.rows.files.map(e=>(0,X.jsxs)(`option`,{value:e,children:[`Each row of `,e]},e))]})})}),(0,X.jsx)(G,{level:3,icon:ce,title:`While it runs`,className:A,children:ee?(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Maestro doesn't heal a moved control or compare images: replay on Appium for those.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{on:w,set:T,children:`Heal a step whose control moved`}),(0,X.jsx)(q,{on:D,set:O,children:`Take new image baselines`})]})})]})})}function Ge({open:e,page:t,onClose:n}){let{view:r}=t,[o,s]=(0,Y.useState)(r.apps[0]?.name??``),[l,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(``),v=$(r,o),y=r.devices.filter(e=>!v||e.platform===v);return(0,Y.useEffect)(()=>u(e=>y.some(t=>t.name===e)?e:y.find(e=>e.inUse)?.name??y[0]?.name??``),[o,r.devices]),(0,X.jsx)(B,{open:e,onClose:n,title:`Explore a goal`,description:`MobilePilot carries out the goal in the app through Appium and saves what it did as a workflow with checks, to replay with no model.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy||!d.trim()||!o,onClick:async()=>{await t.act(()=>f.explore({app:o,goal:d.trim(),name:m.trim(),...l?{device:l}:{}}))&&(p(``),h(``),n())},"data-tip":`Start: MobilePilot acts in the app on the device`,children:[(0,X.jsx)(ne,{"aria-hidden":`true`}),`Start exploring`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(J,{label:`App`,children:(0,X.jsx)(i,{value:o,onChange:e=>s(e.target.value),children:r.apps.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` (`,Z[e.platform]??e.platform,`)`]},e.name))})}),y.length>0&&(0,X.jsx)(J,{label:`Device`,children:(0,X.jsx)(i,{value:l,onChange:e=>u(e.target.value),children:y.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.where]},e.name))})}),(0,X.jsx)(J,{label:`Goal`,hint:`One line, as you would ask a tester.`,children:(0,X.jsx)(a,{value:d,maxLength:500,placeholder:`Sign in and accept the first delivery`,onChange:e=>p(e.target.value)})}),(0,X.jsx)(J,{label:`Name`,hint:`Optional: the workflow's name.`,children:(0,X.jsx)(a,{value:m,maxLength:80,onChange:e=>h(e.target.value)})}),(0,X.jsxs)(`p`,{className:c(_.warn,`m-0 flex gap-2`),children:[(0,X.jsx)(k,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),`MobilePilot taps and types in `,o||`the app`,` on that device. Use a test device and a test account.`]})]})})}function Ke({flows:e,page:t,onClose:n}){let{view:r}=t,[i,a]=(0,Y.useState)([]);return(0,Y.useEffect)(()=>{e&&a(Ue(r))},[e]),(0,X.jsx)(B,{open:!!e,onClose:n,title:e?`Run ${s(e.length,`Maestro flow`)}`:`Run Maestro flows`,description:`Runs your team's flows as they are, after ForgeQE's allowlist check. A flow the check refuses stops the run before any device is used, and the run says why.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy||!e?.length||r.devices.length>0&&!i.length,onClick:async()=>{e&&await t.act(()=>f.maestro(e,r.devices.length?i:void 0))&&n()},children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Run flows`]})]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm text-ink-2`,children:e.map(e=>(0,X.jsx)(`li`,{className:`truncate`,"data-tip":e,children:e},e))}),(0,X.jsxs)(G,{level:3,icon:I,title:`Devices`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,X.jsx)(ze,{view:r,picked:i,set:a}),(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Maestro runs on this computer's devices and TestMu's, not BrowserStack's.`})]})]})})}function qe({open:e,page:t,onClose:n,onDone:r}){let{view:o}=t,[s,c]=(0,Y.useState)(o.builds[0]??``),[l,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(`testmu`),y=_===`browserstack`?`BrowserStack`:`TestMu AI`;return(0,X.jsx)(B,{open:e,onClose:n,title:`Upload a build`,description:`Sends an .apk, .aab, .ipa or a .zip of an .app to ${y}, so its devices can install it. The build leaves this computer for ${y}'s storage.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy||!s,onClick:async()=>{let e=``;await t.act(async()=>{let t=await f.upload({file:s,cloud:_,...l?{app:l}:{},...d.trim()?{name:d.trim()}:{},..._===`testmu`?{virtual:m}:{}});e=t.saved&&t.app?`Uploaded: ${t.app} now installs ${t.id} on ${y}.`:`Uploaded to ${y} as ${t.id}.${t.app?` ${t.app} comes from env.yaml: set its ${_===`browserstack`?`browserstack_app`:`testmu_app`}: to that id there.`:``}`})&&(r(e),n())},children:[(0,X.jsx)(ae,{"aria-hidden":`true`}),`Upload`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(J,{label:`Cloud`,children:(0,X.jsx)(L,{label:`Cloud`,value:_,onChange:v,options:[{id:`testmu`,label:`TestMu AI`},{id:`browserstack`,label:`BrowserStack`}],className:`self-start`})}),o.builds.length?(0,X.jsx)(J,{label:`File`,hint:`An app build found in the project.`,children:(0,X.jsx)(i,{value:s,onChange:e=>c(e.target.value),children:o.builds.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No .apk, .aab, .ipa or .zip in the project: put the build in the project's folder first.`}),(0,X.jsx)(J,{label:`For app`,hint:`Optional: the id is saved as this app's build on ${y}; other places keep their own.`,children:(0,X.jsxs)(i,{value:l,onChange:e=>u(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`No app`}),o.apps.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,X.jsx)(J,{label:`Name`,hint:`Optional: the name ${y} shows.`,children:(0,X.jsx)(a,{value:d,maxLength:120,onChange:e=>p(e.target.value)})}),_===`testmu`&&(0,X.jsx)(q,{on:m,set:h,children:`For TestMu's emulators and simulators`})]})})}function Je({open:e,page:t,onClose:n}){let[r,i]=(0,Y.useState)(!1);return(0,X.jsx)(B,{open:e,onClose:n,title:`Set up Appium`,description:`Installs ForgeQE's pinned Appium and its drivers into its tools folder, once. A run on a device on this computer then starts Appium by itself.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{onClick:n,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(g,{variant:`primary`,disabled:t.busy,onClick:async()=>{await t.act(()=>f.setup(r))&&n()},children:[(0,X.jsx)(P,{"aria-hidden":`true`}),`Set up`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(q,{on:r,set:i,children:`Set it up again from scratch`}),(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`A device cloud needs none of this. Maestro is installed by you: maestro on the PATH, or mobile.maestro.command.`})]})})}function Ye({page:e,onReplay:t,onExplore:n,onSteps:a}){let{view:o}=e,[s,l]=(0,Y.useState)(o.apps[0]?.name??``),[u,d]=(0,Y.useState)(`all`),m=e=>$(o,e.app),h=u===`all`?o.workflows:o.workflows.filter(e=>m(e)===u),_=()=>e.act(async()=>{await p.start({kind:`mobile`,app:s}),location.hash=r(`record`)});return(0,X.jsx)(be,{label:`Mobile workflows`,minWidth:760,height:ye,resetKey:u,placeholder:`Find a workflow`,empty:u===`all`?`No mobile workflows yet: record one by hand, explore a goal, or keep .yaml files with format: forgeqe-mobile-v1 in the project.`:`None.`,tools:(0,X.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[(0,X.jsx)(b,{value:u,onChange:d,items:[{id:`all`,label:`All`,n:o.workflows.length},{id:`android`,label:`Android`,n:o.workflows.filter(e=>m(e)===`android`).length},{id:`ios`,label:`iOS`,n:o.workflows.filter(e=>m(e)===`ios`).length}]}),(0,X.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[o.apps.length>1&&(0,X.jsx)(i,{size:`sm`,"aria-label":`App to record`,value:s,onChange:e=>l(e.target.value),className:`w-auto`,children:o.apps.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,X.jsxs)(g,{size:`sm`,disabled:e.busy||!s,onClick:()=>void _(),"data-tip":`Record your steps in ${s||`an app`}: no model`,children:[(0,X.jsx)(I,{"aria-hidden":`true`}),`Record by hand`]}),(0,X.jsxs)(g,{size:`sm`,variant:`primary`,disabled:e.busy||!o.apps.length,onClick:n,"data-tip":`MobilePilot carries out a goal and saves it as a workflow`,children:[(0,X.jsx)(ne,{"aria-hidden":`true`}),`Explore a goal`]})]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Workflow`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`App`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Platform`}),(0,X.jsx)(`th`,{scope:`col`,className:xe,children:`Steps`}),(0,X.jsx)(`th`,{scope:`col`,className:xe,children:`Checks`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`From`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:h.map(n=>(0,X.jsxs)(`tr`,{className:H,children:[(0,X.jsx)(`td`,{className:W,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>a(n),className:`self-start text-left`,children:n.name}),(0,X.jsx)(`span`,{className:`max-w-[300px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap`),children:n.app||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap`),children:Z[m(n)??``]??(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:V,children:n.steps}),(0,X.jsx)(`td`,{className:c(V,n.checks===0&&`text-warn`),"data-tip":n.checks===0?`No checks of the outcome: a replay passes when its steps run`:void 0,children:n.checks}),(0,X.jsxs)(`td`,{className:c(W,`whitespace-nowrap`),children:[Pe[n.from],(0,X.jsx)(`span`,{className:`block text-body-sm text-muted`,children:z(n.modified)})]}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>a(n),"aria-label":`Open ${n.name}`,"data-tip":`Open it: steps, checks, test data, last run`,className:`size-8`,children:(0,X.jsx)(oe,{"aria-hidden":`true`})}),(0,X.jsx)(g,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t(n),"aria-label":`Replay ${n.name}`,"data-tip":`Replay ${n.name}`,className:`size-8`,children:(0,X.jsx)(M,{"aria-hidden":`true`})}),(0,X.jsx)(g,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>void e.act(()=>f.validate(n.path)),"aria-label":`Check ${n.name}`,"data-tip":`Check it without running it`,className:`size-8`,children:(0,X.jsx)(F,{"aria-hidden":`true`})}),(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>void Le(`MobilePilot: look at the mobile workflow ${n.path} and tell me what to fix or add (a wait, a dialog to dismiss, checks of the outcome); change it only after showing me the change.`,e.setError),"aria-label":`Improve ${n.name} with the agent`,"data-tip":`Improve it with the agent`,className:`size-8`,children:(0,X.jsx)(O,{"aria-hidden":`true`})})]})})]},n.path))})}function Xe({page:e,onRun:t}){let{view:n}=e,[r,i]=(0,Y.useState)([]),a=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,X.jsx)(be,{label:`Maestro flows`,minWidth:640,placeholder:`Find a flow`,empty:`No Maestro flows found: keep them in .maestro/ at the project's root (.yaml files with appId:).`,height:ye,selection:{count:n.flows.filter(e=>r.includes(e.path)).length,onClear:()=>i([]),actions:(0,X.jsxs)(g,{size:`sm`,variant:`primary`,disabled:e.busy||!r.length,onClick:()=>t(r),"data-tip":`Run the flows ticked, after ForgeQE's allowlist check`,children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Run selected`]})},head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:c(U,`w-10`),children:(0,X.jsx)(K,{"aria-label":`Select all ${s(n.flows.length,`flow`)}`,checked:n.flows.length>0&&n.flows.every(e=>r.includes(e.path)),onCheckedChange:e=>i(e?n.flows.map(e=>e.path):[])})}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Flow`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`App id`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.flows.map(n=>(0,X.jsxs)(`tr`,{className:H,"data-state":r.includes(n.path)?`selected`:void 0,children:[(0,X.jsx)(`td`,{className:c(W,`w-10`),children:(0,X.jsx)(K,{"aria-label":`Pick ${n.name}`,checked:r.includes(n.path),onCheckedChange:e=>a(n.path,e)})}),(0,X.jsx)(`td`,{className:W,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:n.name}),(0,X.jsx)(`span`,{className:`max-w-[340px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap font-mono text-body-sm`),children:n.appId}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,X.jsx)(g,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t([n.path]),"aria-label":`Run ${n.name}`,"data-tip":`Run ${n.name}`,className:`size-8`,children:(0,X.jsx)(M,{"aria-hidden":`true`})}),(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>void Le(`MobilePilot: read the Maestro flow ${n.path}, tell me what it checks and what it misses.`,e.setError),"aria-label":`Ask the agent about ${n.name}`,"data-tip":`Ask the agent about it`,className:`size-8`,children:(0,X.jsx)(fe,{"aria-hidden":`true`})})]})})]},n.path))})}var Ze=/^https:\/\/(app-automate\.browserstack\.com\/dashboard\/v2\/sessions|appautomation\.lambdatest\.com\/test\?testID=)[\w=-]{8,80}$/,Qe=e=>e.includes(`browserstack`)?`BrowserStack`:`TestMu AI`;function $e({run:e,onClose:t}){let n=e?.devices??[],r=[...new Map(n.flatMap(e=>e.steps.map(e=>[e.index,e.op])).reverse()).entries()].sort((e,t)=>e[0]-t[0]);return(0,X.jsx)(B,{open:!!e,onClose:t,title:e?`${e.name} on ${s(n.length,`device`)}`:`Devices`,description:`${e?`${n.filter(e=>e.ok).length} of ${n.length} devices passed. `:``}Each step's result on each device; a session page has the device's video and logs.`,footer:(0,X.jsxs)(g,{onClick:t,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Close`]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(`table`,{className:`border-separate border-spacing-1.5 text-left`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Each step's result on each device`}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-2 text-body-sm font-medium text-muted`,children:`Step`}),n.map(e=>(0,X.jsx)(`th`,{scope:`col`,className:`px-2 text-body-sm font-medium whitespace-nowrap text-muted`,children:e.device},e.device))]})}),(0,X.jsx)(`tbody`,{children:r.map(([e,t])=>(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{scope:`row`,className:`px-2 text-body-sm font-normal whitespace-nowrap text-ink-2`,children:[e,` `,t]}),n.map(t=>{let n=t.steps.find(t=>t.index===e);return(0,X.jsx)(`td`,{className:`px-2 text-center`,children:n?n.ok?(0,X.jsx)(A,{size:14,"aria-label":`Passed`,className:`inline text-pass`}):(0,X.jsx)(he,{size:14,"aria-label":`Failed: ${n.error||`failed`}`,className:`inline text-fail`}):(0,X.jsx)(ee,{size:14,"aria-label":`Not reached`,className:`inline text-muted`})},t.device)})]},e))})]})}),(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:n.map(e=>{let t=e.steps.find(e=>!e.ok),n=e.ok?``:t?`Step ${t.index} (${t.op}): ${t.error||`failed`}`:e.error||`Failed`,r=e.session&&Ze.test(e.session)?e.session:void 0;return(0,X.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.device}),(0,X.jsx)(C,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passed`:`Failed`}),e.report&&(0,X.jsx)(S,{path:e.report,children:`Report`}),r&&(0,X.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-body-sm text-accent-fg hover:underline`,children:[`Session on `,Qe(r),(0,X.jsx)(re,{size:14,"aria-hidden":`true`})]})]}),n&&(0,X.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:n})]},e.device)})})]})})}function et({page:e}){let{view:t}=e,[n,r]=(0,Y.useState)(`all`),[i,a]=(0,Y.useState)(``),[o,l]=(0,Y.useState)(null),u=t.runs.filter(e=>!e.ok),f=t.runs.filter(Ie),p=t.runs.filter(e=>e.mode===`maestro`),m=n===`failed`?u:n===`heals`?f:n===`maestro`?p:t.runs;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[i&&(0,X.jsx)(`p`,{role:`status`,className:c(_.pass,`m-0`),children:i}),(0,X.jsx)(be,{label:`Mobile runs`,minWidth:720,height:ye,resetKey:n,placeholder:`Find a run`,empty:n===`all`?`No mobile runs yet: replay, record or explore a workflow, or run your Maestro flows.`:`None.`,tools:(0,X.jsx)(b,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:t.runs.length},{id:`failed`,label:`Failed`,n:u.length,alert:!0},{id:`heals`,label:`Heals to accept`,n:f.length},{id:`maestro`,label:`Maestro flows`,n:p.length}]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Run`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Result`}),(0,X.jsx)(`th`,{scope:`col`,className:xe,children:`Steps`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:`Heals`}),(0,X.jsx)(`th`,{scope:`col`,className:U,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:m.map(t=>(0,X.jsxs)(`tr`,{className:H,children:[(0,X.jsx)(`td`,{className:W,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[Fe[t.mode],`: `,t.name]}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:[t.app,z(t.at)].filter(Boolean).join(` · `)}),(t.failed||t.error)&&(0,X.jsx)(`span`,{className:`max-w-[380px] truncate text-body-sm text-fail`,"data-tip":t.failed?t.failed.error:t.error,children:t.failed?`Step ${t.failed.index} (${t.failed.op}): ${t.failed.error||`failed`}`:t.error})]})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap`),children:(0,X.jsx)(C,{tone:t.ok?`pass`:`fail`,children:t.many?`${t.many.passed} of ${t.many.total}`:t.ok?`Passed`:`Failed`})}),(0,X.jsx)(`td`,{className:V,children:t.steps||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap`),children:t.heals?t.healsAccepted?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-pass`,children:[(0,X.jsx)(A,{size:14,"aria-hidden":`true`}),`In the workflow`]}):t.ok?(0,X.jsxs)(g,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(async()=>{let e=await d.acceptHeals(t.dir);a(`Wrote ${s(e.written,`healed step`)} into ${e.workflow}.`)}),"data-tip":`Write the new locators into the workflow`,children:[(0,X.jsx)(P,{"aria-hidden":`true`}),`Accept `,s(t.heals,`heal`)]}):(0,X.jsxs)(`span`,{className:`text-body-sm text-muted`,"data-tip":`The replay failed after healing, so its heals may be wrong`,children:[s(t.heals,`heal`),`, not offered`]}):(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(W,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t.report&&(0,X.jsx)(S,{path:t.report,children:`Report`}),t.devices&&t.devices.length>0&&(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>l(t),"aria-label":`See each device`,"data-tip":`See each device`,className:`size-8`,children:(0,X.jsx)(se,{"aria-hidden":`true`})}),!t.ok&&(0,X.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>void Le(`MobilePilot: the mobile ${t.mode} ${t.dir} failed${t.workflow?` (workflow ${t.workflow})`:``}. Read its report, tell me why, and offer a fix.`,e.setError),"aria-label":`Ask the agent why it failed`,"data-tip":`Ask the agent why it failed`,className:`size-8`,children:(0,X.jsx)(fe,{"aria-hidden":`true`})})]})})]},t.dir))}),(0,X.jsx)($e,{run:o,onClose:()=>l(null)})]})}function tt({page:e,said:t,onSetup:n,onUpload:i}){let{view:a}=e,s=a.ready,l=(e,t)=>`${t}: ${e?`sign-in set`:`no sign-in`}`,u=[{label:`Appium server`,ok:s.appium,note:`${s.appiumNote} (${s.appiumUrl})`},{label:`Maestro`,ok:s.maestro,note:s.maestroNote},{label:`Device clouds`,ok:s.clouds.testmu||s.clouds.browserstack,note:[l(s.clouds.testmu,`TestMu`),l(s.clouds.browserstack,`BrowserStack`)].join(` · `)},{label:`Healing`,ok:a.heal,note:a.heal?`A moved control is healed with the model (Appium only)`:`mobile.heal is off`}],d=c(o,`flex flex-col`);return(0,X.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] items-start gap-6`,children:[(0,X.jsxs)(G,{id:`mobile-machine`,icon:w,title:`This computer`,divider:!1,children:[(0,X.jsx)(`ul`,{className:c(d,`m-0 list-none divide-y divide-line-soft p-0`),children:u.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[e.ok?(0,X.jsx)(A,{size:16,"aria-label":`Ready`,className:`mt-1 flex-none text-pass`}):(0,X.jsx)(k,{size:16,"aria-label":`Not ready`,className:`mt-1 flex-none text-warn`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.note})]})]},e.label))}),s.checked&&(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Checked `,z(s.checked),`.`]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(g,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(()=>f.doctor()),"data-tip":`Whether the Appium server answers and Maestro is installed`,children:[(0,X.jsx)(F,{"aria-hidden":`true`}),`Check`]}),(0,X.jsxs)(g,{size:`sm`,variant:s.appium?`outline`:`primary`,disabled:e.busy,onClick:n,"data-tip":`Install ForgeQE's pinned Appium and its drivers`,children:[(0,X.jsx)(P,{"aria-hidden":`true`}),`Set up Appium`]})]})]}),(0,X.jsxs)(G,{id:`mobile-devices`,icon:I,title:`Devices`,divider:!1,children:[a.devices.length?(0,X.jsx)(`ul`,{className:c(d,`m-0 list-none divide-y divide-line-soft p-0`),children:a.devices.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.about})]}),(0,X.jsx)(C,{tone:`neutral`,children:e.inUse?`In use`:`Off`})]},e.name))}):(0,X.jsx)(h,{className:`py-4`,children:`No devices listed: runs use the device of mobile.appium and mobile.maestro.`}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Devices are added and changed in `,(0,X.jsx)(`a`,{href:r(`settings`,`mobile`),children:`Settings, Mobile`}),`.`]})]}),(0,X.jsxs)(G,{id:`mobile-apps`,icon:le,title:`Apps`,divider:!1,actions:(0,X.jsxs)(g,{size:`sm`,onClick:i,"data-tip":`Upload an app build to TestMu AI or BrowserStack`,children:[(0,X.jsx)(ae,{"aria-hidden":`true`}),`Upload a build`]}),children:[t&&(0,X.jsx)(`p`,{role:`status`,className:c(_.pass,`m-0`),children:t}),a.apps.length?(0,X.jsx)(`ul`,{className:c(d,`m-0 list-none divide-y divide-line-soft p-0`),children:a.apps.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,X.jsx)(y,{icon:I,size:16,className:`mt-1 flex-none text-muted`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[Z[e.platform]??e.platform,e.appId,e.build?`TestMu AI build ${e.build}`:``,e.browserstackBuild?`BrowserStack build ${e.browserstackBuild}`:``,e.build||e.browserstackBuild?``:`no build uploaded`].filter(Boolean).join(` · `)})]})]},e.name))}):(0,X.jsxs)(h,{className:`py-4`,children:[`No mobile apps yet: add one in `,(0,X.jsx)(`a`,{href:r(`settings`,`environments`),children:`Settings, Environments`}),`.`]}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Secrets a workflow may type: `,a.secrets.length?a.secrets.join(`, `):`none`,`.`]})]})]})}function nt({view:e,onTab:t}){let n=e.runs.filter(e=>e.mode===`replay`||e.mode===`maestro`),r=n.filter(e=>e.ok).length,i=n[0],a=e.runs.filter(Ie).length,o=e.workflows.filter(e=>e.checks===0).length,c=[e.ready.appium&&`Appium`,e.ready.maestro&&`Maestro`].filter(Boolean).join(` · `);return(0,X.jsxs)(ge,{label:`Mobile at a glance`,children:[(0,X.jsx)(R,{compact:!0,label:`Workflows`,value:e.workflows.length,note:o?(0,X.jsxs)(`span`,{className:`text-warn`,children:[o,` without checks`]}):`${s(e.apps.length,`app`)}`}),(0,X.jsx)(R,{compact:!0,label:`Replays passed`,value:n.length?`${r} of ${n.length}`:(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:`None yet`}),tone:n.length&&r<n.length?`text-fail`:void 0,...i?{note:`Last ${z(i.at)}`}:{}}),(0,X.jsx)(R,{compact:!0,label:`Heals to accept`,value:a,tone:a?`text-accent-fg`:void 0,note:a?(0,X.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>t(`runs`),children:`Review them`}):`From passed replays`}),(0,X.jsx)(R,{compact:!0,label:`Replay here`,value:c||(e.ready.checked?`Not ready`:(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not checked`})),tone:c?`text-pass`:e.ready.checked?`text-warn`:void 0,note:c?`${s(e.devices.filter(e=>e.inUse).length,`device`)} in use`:(0,X.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>t(`devices`),children:e.ready.checked?`Set it up`:`Check it`})})]})}function rt({live:e,job:t,page:n}){let[r,i]=(0,Y.useState)(``),a=e.find(e=>e.id===r)??e[0],o=t&&(t.running||!t.endedAt||Date.now()-Date.parse(t.endedAt)<6e5);return a?(0,X.jsxs)(`section`,{"aria-label":`The device at work`,className:`grid grid-cols-1 items-start gap-6 @[700px]:grid-cols-[minmax(0,300px)_minmax(0,1fr)]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[e.length>1&&(0,X.jsx)(b,{value:a.id,onChange:i,items:e.map(e=>({id:e.id,label:e.device||e.id.split(`/`).at(-1)||`Device`}))}),(0,X.jsx)(ke,{d:a,picture:f.screen})]}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:t&&o?(0,X.jsx)(Oe,{job:t,onStop:n.stop,words:Ne}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Started from a chat: its lines are in the chat.`})})]}):o&&t?(0,X.jsx)(Oe,{job:t,onStop:n.stop,words:Ne}):null}function it({sub:e}){let t=Re(),{view:i,error:a}=t,o=u(`mobile`),s=(e??``).split(`/`),l=s[0]===`workflow`&&s[1]?n(s[1]):``,d=l?`workflows`:je.includes(s[0])?s[0]:Ee,[p,m]=(0,Y.useState)(null),[h,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),E=l&&i?.workflows.find(e=>e.path===l)||null,D=e=>location.hash=e?r(`mobile`,`workflow`,encodeURIComponent(e.path)):r(`mobile`,`workflows`),[O,k]=(0,Y.useState)(``),A=i?.job??null,j=e=>e===`agent`?r(`mobile`,Ee):r(`mobile`,e),M=e=>location.hash=j(e),ee={workflows:`Workflows`,flows:`Maestro flows`,runs:`Runs`,devices:`Devices and apps`},N=i?{workflows:i.workflows.length,flows:i.flows.length,runs:i.runs.length}:{};return(0,X.jsxs)(Te,{title:Se(`mobile`),page:o,label:`Mobile apps`,current:d,tabHref:j,onPick:M,tabs:je.map(e=>({id:e,label:ee[e],icon:Me[e],...N[e]===void 0?{}:{n:N[e]}})),below:(0,X.jsx)(we,{page:o}),children:[(0,X.jsx)(Ce,{more:(0,X.jsx)(X.Fragment,{children:`Explore a goal with MobilePilot or record your steps by hand, then replay them on Appium or Maestro with no model, and run your team's own Maestro flows.`}),children:`Test your Android and iOS apps with workflows that replay on their own.`}),a&&(0,X.jsx)(De,{text:a}),!i&&!a&&(0,X.jsx)(x,{shape:`rows`}),i&&E&&(0,X.jsx)(Ae,{workflow:E.path,backLabel:`Workflows`,tab:s[2],onTab:e=>location.hash=e===`steps`?r(`mobile`,`workflow`,encodeURIComponent(E.path)):r(`mobile`,`workflow`,encodeURIComponent(E.path),e),onClose:()=>{D(null),t.load()}},E.path),i&&!E&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nt,{view:i,onTab:M}),(0,X.jsx)(rt,{live:i.live,job:A,page:{...t,view:i}}),A?.question&&(0,X.jsxs)(`div`,{className:c(_.info,`flex flex-col gap-2`),children:[(0,X.jsx)(`p`,{className:`m-0 font-medium`,children:A.question.title}),A.question.detail&&(0,X.jsx)(`p`,{className:`m-0 text-ink-2`,children:A.question.detail}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[A.question.options.map(e=>(0,X.jsx)(g,{size:`sm`,onClick:()=>void t.act(()=>f.answer(A.question.id,e.id)),children:e.label},e.id)),(0,X.jsxs)(g,{size:`sm`,variant:`danger`,onClick:()=>void t.act(()=>f.answer(A.question.id,null)),children:[(0,X.jsx)(de,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})]}),(0,X.jsxs)(`div`,{children:[d===`workflows`&&(0,X.jsx)(Ye,{page:{...t,view:i},onReplay:m,onExplore:()=>v(!0),onSteps:D}),d===`flows`&&(0,X.jsx)(Xe,{page:{...t,view:i},onRun:b}),d===`runs`&&(0,X.jsx)(et,{page:{...t,view:i}}),d===`devices`&&(0,X.jsx)(tt,{page:{...t,view:i},said:O,onSetup:()=>T(!0),onUpload:()=>C(!0)})]}),(0,X.jsx)(We,{w:p,page:{...t,view:i},onClose:()=>m(null)}),(0,X.jsx)(Ge,{open:h,page:{...t,view:i},onClose:()=>v(!1)}),(0,X.jsx)(Ke,{flows:y,page:{...t,view:i},onClose:()=>b(null)}),(0,X.jsx)(qe,{open:S,page:{...t,view:i},onClose:()=>C(!1),onDone:k}),(0,X.jsx)(Je,{open:w,page:{...t,view:i},onClose:()=>T(!1)})]})]})}export{it as Mobile};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{I as a}from"./palette-C8W4Fd5n.js";import{v as o}from"./api-CorvgyDj.js";import{A as s,C as c,I as l,L as u,T as d,_ as f,g as p,k as m,n as h,y as g}from"./pageBack-DDAAmq4R.js";import{$ as _,Er as v,Rn as y,Tr as b,Ut as x,Wr as S,Xn as C,Zt as w,mr as T,o as E}from"./line-icons-Cwj9OmCz.js";import{At as D,B as O,L as k,Z as A,rt as j,s as M,t as N}from"./frame-BC1vOowF.js";import{u as P}from"./nav--1SY7-OO.js";import{B as F,J as I,V as L,z as R}from"./index-BoFziUZw.js";import{d as z}from"./qualityParts-BF3Yb7Zl.js";var B=e(t(),1),V={view:e=>o(`GET`,`/api/observability?days=${e}`)},H=i(),U=12,W=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),G=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function K({series:e}){let[t,n]=(0,B.useState)(-1),r=e.reduce((e,t)=>e+t.sessions,0),i=e.reduce((e,t)=>e+t.problems,0),a=e.reduce((e,t)=>t.sessions>e.sessions?t:e,e[0]),o=t>=0?e[t]:e[e.length-1];return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-body-sm text-ink-2`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:W(o.day)}),`: `,G(o.sessions,`session`),o.problems?`, ${o.problems} with an error`:``]}),(0,H.jsx)(f,{series:[{values:e.map(e=>e.sessions)}],label:`Sessions a day for the last ${e.length} days: ${r} in all, ${i} with an error; the busiest was ${W(a.day)} with ${a.sessions}.`,hover:t,onHover:n,className:`h-[160px]`,axis:[W(e[0].day),W(e[e.length-1].day)]})]})}function q({rows:e,label:t,empty:n,unit:r,failedWord:i=`failed`}){if(!e.length)return(0,H.jsx)(s,{className:`py-4`,children:n});let a=Math.max(1,e.reduce((e,t)=>e+t.value,0));return(0,H.jsx)(g,{label:t,rows:e.slice(0,U).map(e=>({key:e.key,label:e.label,value:e.value.toLocaleString(),sub:G(e.value,r).replace(/^[\d,.]+\s*/,``),share:e.value/a,note:e.failed?(0,H.jsxs)(`span`,{className:`text-label-sm whitespace-nowrap text-fail tabular-nums`,children:[e.failed,` `,i]}):void 0})),more:e.length>U?`and ${e.length-U} more`:void 0})}var J={passed:`pass`,failed:`fail`,error:`fail`};function Y({runs:e}){let t=e.reduce((e,t)=>e+t.count,0);if(!t)return(0,H.jsx)(s,{className:`py-4`,children:`No browser run ended in these days.`});let n=e=>J[e]??`neutral`,r={pass:`bg-pass`,fail:`bg-fail`,neutral:`bg-muted`};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(c,{label:`Runs by how they ended: ${e.map(e=>`${e.status} ${e.count}`).join(`, `)}, of ${t}.`,parts:e.map(e=>({key:e.status,value:e.count,className:r[n(e.status)]}))}),(0,H.jsx)(`span`,{className:`flex flex-wrap gap-2 text-body-sm`,children:e.map(e=>(0,H.jsxs)(m,{tone:n(e.status),children:[e.status[0].toUpperCase()+e.status.slice(1),` `,e.count]},e.status))})]})}var X=[{id:`7`,label:`Last 7 days`},{id:`30`,label:`Last 30 days`},{id:`90`,label:`Last 90 days`}],Z=e=>e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.round(e/6e4)} min`,Q=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;function $({id:e,icon:t,title:n,children:r,note:i,divider:a}){return(0,H.jsx)(I,{id:e,icon:t,title:n,description:i,divider:a,children:r})}function ee(){let[e,t]=(0,B.useState)(30),[i,o]=(0,B.useState)(null),[c,f]=(0,B.useState)(``),g=(0,B.useCallback)(()=>{f(``),V.view(e).then(o,e=>f(e.message))},[e]);(0,B.useEffect)(g,[g]);let I=i&&i.days===e?i:null,U=I?.totals,W=I?[I.source.skipped?`${I.source.skipped} log file${I.source.skipped===1?` was`:`s were`} skipped: a link, or not inside the logs folder.`:``,I.source.truncated?`${I.source.truncated} very long log${I.source.truncated===1?` was`:`s were`} read only in part.`:``,I.source.ledger?``:`Model calls are counted once this project has a forgeqe.yaml: the usage ledger keeps calls by project.`].filter(Boolean):[];return(0,H.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,H.jsx)(M,{}),(0,H.jsxs)(`main`,{className:r(N,`@container flex-auto gap-4`),children:[(0,H.jsx)(h,{}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,H.jsx)(D,{pixel:a.observability,size:`lg`,head:!0}),(0,H.jsx)(`h1`,{className:`m-0 text-headline-md`,children:P(`observability`)})]}),(0,H.jsx)(L,{more:(0,H.jsxs)(H.Fragment,{children:[`Read from ForgeQE's session logs`,I?(0,H.jsxs)(H.Fragment,{children:[` `,`in `,(0,H.jsx)(`code`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:I.source.logs})]}):``,` `,`and this project's model calls. These are the numbers the OpenTelemetry export sends, counted here whether it is on or not: send them to your own collector in`,` `,(0,H.jsx)(`a`,{href:n(`settings`,`observability`),children:`Settings › Observability`}),`. Each session is in the day it started.`]}),children:`See how ForgeQE's own chats, runs and tools went on this computer.`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,H.jsx)(d,{items:X,value:`${e}`,onChange:e=>t(Number(e))})}),c&&(0,H.jsx)(`p`,{role:`alert`,className:r(u.fail,`m-0`),children:c}),!I&&!c&&(0,H.jsx)(p,{shape:`detail`}),I&&U&&!U.sessions&&!U.modelCalls&&(0,H.jsx)(s,{page:!0,icon:x,title:`No sessions in the last ${e} days`,action:(0,H.jsxs)(`a`,{className:l({size:`sm`}),href:n(`runs`),"data-tip":`Open Runs`,children:[(0,H.jsx)(E,{"aria-hidden":`true`}),`Runs`]}),children:(0,H.jsx)(`span`,{className:`text-ink-2`,children:`Every ForgeQE chat, run and suite writes a session log. Start one, and how it went shows here.`})}),I&&U&&(U.sessions>0||U.modelCalls>0)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(R,{label:`ForgeQE's work in these days`,children:[(0,H.jsx)(F,{tip:`${I.from} to ${I.to}`,dot:`neutral`,value:U.sessions,label:U.sessions===1?`session`:`sessions`}),(0,H.jsx)(F,{tip:U.sessions?`${Q(U.problemSessions,U.sessions)} of sessions`:void 0,dot:U.problemSessions?`fail`:`pass`,value:U.problemSessions,label:`with an error`}),(0,H.jsx)(F,{dot:U.turnsFailed?`fail`:`pass`,value:U.turnsFailed,label:`failed of ${U.turns} turn${U.turns===1?``:`s`}`}),(0,H.jsx)(F,{dot:U.runsFailed?`fail`:`pass`,value:U.runsFailed,label:`failed of ${U.runs} browser run${U.runs===1?``:`s`}`}),(0,H.jsx)(F,{tip:Q(U.toolErrors,U.toolCalls),dot:U.toolErrors?`warn`:`pass`,value:U.toolErrors,label:`tool errors of ${U.toolCalls} call${U.toolCalls===1?``:`s`}`}),(0,H.jsx)(F,{tip:`${O(U.tokens)} tokens`,dot:`neutral`,value:U.modelCalls,label:`model calls`})]}),W.length>0&&(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:W.map(e=>(0,H.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(w,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),e]},e))}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsx)($,{id:`obs-days`,icon:b,title:`Sessions over time`,note:I.turnTime?`A turn took ${Z(I.turnTime.p50)} at the median, ${Z(I.turnTime.p95)} at the 95th percentile.`:void 0,children:(0,H.jsx)(K,{series:I.series})}),(0,H.jsxs)(`div`,{className:`grid gap-x-6 gap-y-8 pt-6 @3xl:grid-cols-2`,children:[(0,H.jsx)($,{id:`obs-commands`,icon:T,title:`By command`,divider:!1,children:(0,H.jsx)(q,{rows:I.commands.map(e=>({key:e.command,label:`forgeqe ${e.command}`,value:e.sessions,failed:e.problems})),label:`Sessions by command`,empty:`No session in these days.`,unit:`session`,failedWord:`with an error`})}),(0,H.jsx)($,{id:`obs-runs`,icon:y,title:`Browser runs`,divider:!1,children:(0,H.jsx)(Y,{runs:I.runs})}),(0,H.jsx)($,{id:`obs-tools`,icon:S,title:`Tool calls`,divider:!1,children:(0,H.jsx)(q,{rows:I.tools.map(e=>({key:e.tool,label:e.tool===`system_tool`?`Other systems' tools`:e.tool,value:e.calls,failed:e.errors})),label:`Tool calls by tool`,empty:`No tool call in these days.`,unit:`call`})}),(0,H.jsx)($,{id:`obs-health`,icon:x,title:`Session health`,divider:!1,note:`The ways a chat has gone wrong before, found by their signature in the logs.`,children:(0,H.jsx)(q,{rows:I.health.map(e=>({key:e.kind,label:e.text,value:e.count})),label:`Session health findings`,empty:`No known kind of trouble in these days.`,unit:`time`})})]}),(0,H.jsx)($,{id:`obs-models`,icon:_,title:`Model calls`,children:(0,H.jsx)(j,{label:`Model calls by model`,placeholder:`Find a model`,resetKey:e,empty:I.source.ledger?`No model call in these days.`:`Model calls are counted once this project has a forgeqe.yaml.`,search:I.models.length>8,head:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Model`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Calls`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Tokens`}),(0,H.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Median`}),(0,H.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`95th percentile`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Cost`})]}),children:I.models.map(e=>(0,H.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,H.jsx)(`td`,{className:r(`px-4 py-2`,`max-w-0`),children:(0,H.jsx)(`span`,{"data-tip":e.model,className:`block truncate font-mono text-body-sm`,children:e.model})}),(0,H.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.calls}),(0,H.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-tip":`${O(e.input)} read, ${O(e.output)} written`,"data-sort":e.input+e.output,children:O(e.input+e.output)}),(0,H.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),"data-sort":e.p50??-1,children:e.p50===null?`–`:Z(e.p50)}),(0,H.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),"data-sort":e.p95??-1,children:e.p95===null?`–`:Z(e.p95)}),(0,H.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.amount??-1,children:e.amount!==void 0&&e.currency?k(e.amount,e.currency):(0,H.jsx)(`span`,{className:`text-muted`,children:`–`})})]},e.model))})}),(0,H.jsx)($,{id:`obs-problems`,icon:v,title:`Latest problems`,note:`Errors and warnings, as the export sends them as log records: in ForgeQE's words, never what the model, the page or a person wrote.`,children:(0,H.jsx)(j,{label:`Latest problems`,placeholder:`Find a problem or session`,resetKey:e,empty:`No problem in these days.`,search:I.problems.length>8,head:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Problem`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`When`}),(0,H.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Session`})]}),children:I.problems.map((e,t)=>(0,H.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,H.jsx)(`td`,{className:`px-4 py-2`,children:(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(m,{tone:e.severity===`error`?`fail`:`warn`,children:e.severity===`error`?`Error`:`Warning`}),(0,H.jsx)(`span`,{children:e.text}),e.detail&&(0,H.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.detail})]})}),(0,H.jsx)(`td`,{className:r(`px-4 py-2`,`whitespace-nowrap text-muted`),"data-tip":z(e.at),"data-sort":new Date(e.at).getTime()||0,children:A(e.at)}),(0,H.jsx)(`td`,{className:r(`px-4 py-2`,`hidden max-w-[220px] @xl:table-cell`),children:(0,H.jsx)(`a`,{href:n(`runs`,encodeURIComponent(e.session)),"data-tip":`Open this session in Runs`,className:`block truncate font-mono text-body-sm`,children:e.session.replace(/\.log$/,``)})})]},`${e.session}-${e.at}-${t}`))})})]}),(0,H.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[(0,H.jsx)(C,{size:14,"aria-hidden":`true`}),(0,H.jsxs)(`span`,{children:[I.source.read,` session log`,I.source.read===1?``:`s`,` read. `,(0,H.jsx)(`a`,{href:n(`settings`,`observability`),children:`Send these to your collector`}),`.`]})]})]})]})]})}export{ee as Observability};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{I as a}from"./palette-dAh9kV3S.js";import{v as o}from"./api-D1PU4zye.js";import{A as s,C as c,I as l,L as u,T as d,_ as f,g as p,k as m,n as h,y as g}from"./pageBack-DfGBh1Hs.js";import{$ as _,Er as v,Rn as y,Tr as b,Ut as x,Wr as S,Xn as C,Zt as w,mr as T,o as E}from"./line-icons-Cwj9OmCz.js";import{At as D,B as O,L as k,Z as A,rt as j,s as M,t as N}from"./frame-D0MS2ZMz.js";import{u as P}from"./nav-CkrE6JFU.js";import{B as F,J as I,V as L,z as R}from"./index-F8zkXd19.js";import{d as z}from"./qualityParts-DcRvGy-_.js";var B=e(t(),1),V={view:e=>o(`GET`,`/api/observability?days=${e}`)},H=i(),U=12,W=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),G=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function K({series:e}){let[t,n]=(0,B.useState)(-1),r=e.reduce((e,t)=>e+t.sessions,0),i=e.reduce((e,t)=>e+t.problems,0),a=e.reduce((e,t)=>t.sessions>e.sessions?t:e,e[0]),o=t>=0?e[t]:e[e.length-1];return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-body-sm text-ink-2`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:W(o.day)}),`: `,G(o.sessions,`session`),o.problems?`, ${o.problems} with an error`:``]}),(0,H.jsx)(f,{series:[{values:e.map(e=>e.sessions)}],label:`Sessions a day for the last ${e.length} days: ${r} in all, ${i} with an error; the busiest was ${W(a.day)} with ${a.sessions}.`,hover:t,onHover:n,className:`h-[160px]`,axis:[W(e[0].day),W(e[e.length-1].day)]})]})}function q({rows:e,label:t,empty:n,unit:r,failedWord:i=`failed`}){if(!e.length)return(0,H.jsx)(s,{className:`py-4`,children:n});let a=Math.max(1,e.reduce((e,t)=>e+t.value,0));return(0,H.jsx)(g,{label:t,rows:e.slice(0,U).map(e=>({key:e.key,label:e.label,value:e.value.toLocaleString(),sub:G(e.value,r).replace(/^[\d,.]+\s*/,``),share:e.value/a,note:e.failed?(0,H.jsxs)(`span`,{className:`text-label-sm whitespace-nowrap text-fail tabular-nums`,children:[e.failed,` `,i]}):void 0})),more:e.length>U?`and ${e.length-U} more`:void 0})}var J={passed:`pass`,failed:`fail`,error:`fail`};function Y({runs:e}){let t=e.reduce((e,t)=>e+t.count,0);if(!t)return(0,H.jsx)(s,{className:`py-4`,children:`No browser run ended in these days.`});let n=e=>J[e]??`neutral`,r={pass:`bg-pass`,fail:`bg-fail`,neutral:`bg-muted`};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(c,{label:`Runs by how they ended: ${e.map(e=>`${e.status} ${e.count}`).join(`, `)}, of ${t}.`,parts:e.map(e=>({key:e.status,value:e.count,className:r[n(e.status)]}))}),(0,H.jsx)(`span`,{className:`flex flex-wrap gap-2 text-body-sm`,children:e.map(e=>(0,H.jsxs)(m,{tone:n(e.status),children:[e.status[0].toUpperCase()+e.status.slice(1),` `,e.count]},e.status))})]})}var X=[{id:`7`,label:`Last 7 days`},{id:`30`,label:`Last 30 days`},{id:`90`,label:`Last 90 days`}],Z=e=>e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.round(e/6e4)} min`,Q=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;function $({id:e,icon:t,title:n,children:r,note:i,divider:a}){return(0,H.jsx)(I,{id:e,icon:t,title:n,description:i,divider:a,children:r})}function ee(){let[e,t]=(0,B.useState)(30),[i,o]=(0,B.useState)(null),[c,f]=(0,B.useState)(``),g=(0,B.useCallback)(()=>{f(``),V.view(e).then(o,e=>f(e.message))},[e]);(0,B.useEffect)(g,[g]);let I=i&&i.days===e?i:null,U=I?.totals,W=I?[I.source.skipped?`${I.source.skipped} log file${I.source.skipped===1?` was`:`s were`} skipped: a link, or not inside the logs folder.`:``,I.source.truncated?`${I.source.truncated} very long log${I.source.truncated===1?` was`:`s were`} read only in part.`:``,I.source.ledger?``:`Model calls are counted once this project has a forgeqe.yaml: the usage ledger keeps calls by project.`].filter(Boolean):[];return(0,H.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,H.jsx)(M,{}),(0,H.jsxs)(`main`,{className:r(N,`@container flex-auto gap-4`),children:[(0,H.jsx)(h,{}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,H.jsx)(D,{pixel:a.observability,size:`lg`,head:!0}),(0,H.jsx)(`h1`,{className:`m-0 text-headline-md`,children:P(`observability`)})]}),(0,H.jsx)(L,{more:(0,H.jsxs)(H.Fragment,{children:[`Read from ForgeQE's session logs`,I?(0,H.jsxs)(H.Fragment,{children:[` `,`in `,(0,H.jsx)(`code`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:I.source.logs})]}):``,` `,`and this project's model calls. These are the numbers the OpenTelemetry export sends, counted here whether it is on or not: send them to your own collector in`,` `,(0,H.jsx)(`a`,{href:n(`settings`,`observability`),children:`Settings › Observability`}),`. Each session is in the day it started.`]}),children:`See how ForgeQE's own chats, runs and tools went on this computer.`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,H.jsx)(d,{items:X,value:`${e}`,onChange:e=>t(Number(e))})}),c&&(0,H.jsx)(`p`,{role:`alert`,className:r(u.fail,`m-0`),children:c}),!I&&!c&&(0,H.jsx)(p,{shape:`detail`}),I&&U&&!U.sessions&&!U.modelCalls&&(0,H.jsx)(s,{page:!0,icon:x,title:`No sessions in the last ${e} days`,action:(0,H.jsxs)(`a`,{className:l({size:`sm`}),href:n(`runs`),"data-tip":`Open Runs`,children:[(0,H.jsx)(E,{"aria-hidden":`true`}),`Runs`]}),children:(0,H.jsx)(`span`,{className:`text-ink-2`,children:`Every ForgeQE chat, run and suite writes a session log. Start one, and how it went shows here.`})}),I&&U&&(U.sessions>0||U.modelCalls>0)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(R,{label:`ForgeQE's work in these days`,children:[(0,H.jsx)(F,{tip:`${I.from} to ${I.to}`,dot:`neutral`,value:U.sessions,label:U.sessions===1?`session`:`sessions`}),(0,H.jsx)(F,{tip:U.sessions?`${Q(U.problemSessions,U.sessions)} of sessions`:void 0,dot:U.problemSessions?`fail`:`pass`,value:U.problemSessions,label:`with an error`}),(0,H.jsx)(F,{dot:U.turnsFailed?`fail`:`pass`,value:U.turnsFailed,label:`failed of ${U.turns} turn${U.turns===1?``:`s`}`}),(0,H.jsx)(F,{dot:U.runsFailed?`fail`:`pass`,value:U.runsFailed,label:`failed of ${U.runs} browser run${U.runs===1?``:`s`}`}),(0,H.jsx)(F,{tip:Q(U.toolErrors,U.toolCalls),dot:U.toolErrors?`warn`:`pass`,value:U.toolErrors,label:`tool errors of ${U.toolCalls} call${U.toolCalls===1?``:`s`}`}),(0,H.jsx)(F,{tip:`${O(U.tokens)} tokens`,dot:`neutral`,value:U.modelCalls,label:`model calls`})]}),W.length>0&&(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:W.map(e=>(0,H.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(w,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),e]},e))}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsx)($,{id:`obs-days`,icon:b,title:`Sessions over time`,note:I.turnTime?`A turn took ${Z(I.turnTime.p50)} at the median, ${Z(I.turnTime.p95)} at the 95th percentile.`:void 0,children:(0,H.jsx)(K,{series:I.series})}),(0,H.jsxs)(`div`,{className:`grid gap-x-6 gap-y-8 pt-6 @3xl:grid-cols-2`,children:[(0,H.jsx)($,{id:`obs-commands`,icon:T,title:`By command`,divider:!1,children:(0,H.jsx)(q,{rows:I.commands.map(e=>({key:e.command,label:`forgeqe ${e.command}`,value:e.sessions,failed:e.problems})),label:`Sessions by command`,empty:`No session in these days.`,unit:`session`,failedWord:`with an error`})}),(0,H.jsx)($,{id:`obs-runs`,icon:y,title:`Browser runs`,divider:!1,children:(0,H.jsx)(Y,{runs:I.runs})}),(0,H.jsx)($,{id:`obs-tools`,icon:S,title:`Tool calls`,divider:!1,children:(0,H.jsx)(q,{rows:I.tools.map(e=>({key:e.tool,label:e.tool===`system_tool`?`Other systems' tools`:e.tool,value:e.calls,failed:e.errors})),label:`Tool calls by tool`,empty:`No tool call in these days.`,unit:`call`})}),(0,H.jsx)($,{id:`obs-health`,icon:x,title:`Session health`,divider:!1,note:`The ways a chat has gone wrong before, found by their signature in the logs.`,children:(0,H.jsx)(q,{rows:I.health.map(e=>({key:e.kind,label:e.text,value:e.count})),label:`Session health findings`,empty:`No known kind of trouble in these days.`,unit:`time`})})]}),(0,H.jsx)($,{id:`obs-models`,icon:_,title:`Model calls`,children:(0,H.jsx)(j,{label:`Model calls by model`,placeholder:`Find a model`,resetKey:e,empty:I.source.ledger?`No model call in these days.`:`Model calls are counted once this project has a forgeqe.yaml.`,search:I.models.length>8,head:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Model`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Calls`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Tokens`}),(0,H.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Median`}),(0,H.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`95th percentile`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Cost`})]}),children:I.models.map(e=>(0,H.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,H.jsx)(`td`,{className:r(`px-4 py-2`,`max-w-0`),children:(0,H.jsx)(`span`,{"data-tip":e.model,className:`block truncate font-mono text-body-sm`,children:e.model})}),(0,H.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.calls}),(0,H.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-tip":`${O(e.input)} read, ${O(e.output)} written`,"data-sort":e.input+e.output,children:O(e.input+e.output)}),(0,H.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),"data-sort":e.p50??-1,children:e.p50===null?`–`:Z(e.p50)}),(0,H.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),"data-sort":e.p95??-1,children:e.p95===null?`–`:Z(e.p95)}),(0,H.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.amount??-1,children:e.amount!==void 0&&e.currency?k(e.amount,e.currency):(0,H.jsx)(`span`,{className:`text-muted`,children:`–`})})]},e.model))})}),(0,H.jsx)($,{id:`obs-problems`,icon:v,title:`Latest problems`,note:`Errors and warnings, as the export sends them as log records: in ForgeQE's words, never what the model, the page or a person wrote.`,children:(0,H.jsx)(j,{label:`Latest problems`,placeholder:`Find a problem or session`,resetKey:e,empty:`No problem in these days.`,search:I.problems.length>8,head:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Problem`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`When`}),(0,H.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Session`})]}),children:I.problems.map((e,t)=>(0,H.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,H.jsx)(`td`,{className:`px-4 py-2`,children:(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(m,{tone:e.severity===`error`?`fail`:`warn`,children:e.severity===`error`?`Error`:`Warning`}),(0,H.jsx)(`span`,{children:e.text}),e.detail&&(0,H.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.detail})]})}),(0,H.jsx)(`td`,{className:r(`px-4 py-2`,`whitespace-nowrap text-muted`),"data-tip":z(e.at),"data-sort":new Date(e.at).getTime()||0,children:A(e.at)}),(0,H.jsx)(`td`,{className:r(`px-4 py-2`,`hidden max-w-[220px] @xl:table-cell`),children:(0,H.jsx)(`a`,{href:n(`runs`,encodeURIComponent(e.session)),"data-tip":`Open this session in Runs`,className:`block truncate font-mono text-body-sm`,children:e.session.replace(/\.log$/,``)})})]},`${e.session}-${e.at}-${t}`))})})]}),(0,H.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[(0,H.jsx)(C,{size:14,"aria-hidden":`true`}),(0,H.jsxs)(`span`,{children:[I.source.read,` session log`,I.source.read===1?``:`s`,` read. `,(0,H.jsx)(`a`,{href:n(`settings`,`observability`),children:`Send these to your collector`}),`.`]})]})]})]})]})}export{ee as Observability};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{I as r,L as i,P as a,V as o}from"./surface-c1kG1KPS.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{r as u}from"./palette-C8W4Fd5n.js";import{ct as d}from"./api-CorvgyDj.js";import{A as f,F as p,L as m,k as h}from"./pageBack-DDAAmq4R.js";import{Cr as g,Nr as _,Vn as v,ir as y,o as b,sr as x,xt as S,yn as C}from"./line-icons-Cwj9OmCz.js";import{At as w,J as T,Zt as E}from"./frame-BC1vOowF.js";import{f as D}from"./index-BoFziUZw.js";var O=e(t(),1),k=l(),A={skills:{one:`skill`,many:`skills`,icon:x,body:`How to do it`,placeholder:`1. Read the failed run's board.
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{I as r,L as i,P as a,V as o}from"./surface-c1kG1KPS.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{r as u}from"./palette-dAh9kV3S.js";import{ct as d}from"./api-D1PU4zye.js";import{A as f,F as p,L as m,k as h}from"./pageBack-DfGBh1Hs.js";import{Cr as g,Nr as _,Vn as v,ir as y,o as b,sr as x,xt as S,yn as C}from"./line-icons-Cwj9OmCz.js";import{At as w,J as T,Zt as E}from"./frame-D0MS2ZMz.js";import{f as D}from"./index-F8zkXd19.js";var O=e(t(),1),k=l(),A={skills:{one:`skill`,many:`skills`,icon:x,body:`How to do it`,placeholder:`1. Read the failed run's board.
2
2
  2. Sort each failure: product bug, test bug or flaky.
3
3
  3. Give the evidence for each.`,describe:{title:`When to use it`,placeholder:`When a check fails and the team must sort why`,required:!0},audience:!1},prompts:{one:`prompt`,many:`prompts`,icon:C,body:`What the agents are told`,placeholder:`Check the API before the pages. Report each failure with the request and the response you saw.`,describe:{title:`What it is for (optional)`,placeholder:`How the team reports`},audience:!0},guardrails:{one:`guardrail set`,many:`guardrails`,icon:y,body:`Rules, one per line`,placeholder:`- Never pay with a real card
4
4
  - Use only qa accounts`,describe:{title:`What they are for (optional)`,placeholder:`Payment safety`},audience:!0},knowledge:{one:`note`,many:`notes`,icon:S,body:`What it says`,placeholder:`A release needs two green passes on qa before sign-off.`,audience:!1}},j={all:`Every agent`,lead:`The lead`,members:`The members`},M=e=>e.split(/\r?\n/).filter(e=>e.trim()&&!e.trim().startsWith(`#`)&&!e.trim().startsWith(`<!--`)).length,N=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+/,``).slice(0,64),P=(e,t)=>({kind:e,team:t,name:``,description:``,for:`all`,body:``}),F=(e,t,n)=>({kind:e,team:t,name:n.name,description:n.description,for:n.for||`all`,body:n.body,old:!0});function I({draft:e,teams:t,taken:n,onClose:o,onSaved:l}){let[u,f]=(0,O.useState)(e),[h,_]=(0,O.useState)(!1),[v,y]=(0,O.useState)(``),[b,x]=(0,O.useState)(!1);(0,O.useEffect)(()=>{f(e),y(``),x(!1)},[e]);let S=u?A[u.kind]:null,C=u?.kind===`skills`&&!u.old&&n.includes(u.name),w=u?.kind===`guardrails`?M(u.body):0,D=u?.kind===`guardrails`&&u.body.split(/\r?\n/).some(e=>e.replace(/^\s*[-*+]\s+/,``).trim().length>300),P=u&&u.team&&u.name&&u.body.trim()&&!C&&!D&&(u.kind!==`guardrails`||w>0&&w<=40)&&(!S?.describe?.required||u.description.trim()),F=t.find(e=>e.id===u?.team)?.name||u?.team,I=async()=>{if(u&&P){_(!0),y(``);try{l(await d.own(u.team,{item:{kind:u.kind,name:u.name,...S?.describe?{description:u.description}:{},...S?.audience?{for:u.for}:{},body:u.body},...u.old?{replace:!0}:{}}),`${u.old?`Changed`:`Added`} ${S.one} ${u.name} for ${F}. The team uses it once a person approves the team again.`)}catch(e){y(e.message)}finally{_(!1)}}},L=async()=>{if(u){if(!b)return x(!0);_(!0),y(``);try{l(await d.own(u.team,{remove:!0,kind:u.kind,name:u.name}),`Removed ${S.one} ${u.name} from ${F}. The team stops using it once a person approves the team again.`)}catch(e){y(e.message)}finally{_(!1)}}};return(0,k.jsx)(E,{wide:!0,open:!!e,onClose:o,title:u?`${u.old?`Change`:`Add`} a team ${S.one}`:``,description:u?`Only ${F?`${F}'s`:`the team's`} agents get it, while they work in the team; no other agent sees it.`:void 0,footer:(0,k.jsxs)(k.Fragment,{children:[u?.old&&(0,k.jsxs)(p,{variant:b?`destructive`:`danger`,className:`mr-auto`,disabled:h,onClick:()=>void L(),children:[(0,k.jsx)(g,{"aria-hidden":`true`}),b?`Remove it for good`:`Remove`]}),(0,k.jsx)(p,{variant:`outline`,onClick:o,children:`Cancel`}),(0,k.jsx)(p,{variant:`primary`,disabled:h||!P,onClick:()=>void I(),children:h?`Saving…`:`Save`})]}),children:u&&S&&(0,k.jsxs)(`div`,{className:`flex flex-col gap-6 pt-4`,children:[!u.old&&t.length>1&&(0,k.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:`Team`}),(0,k.jsxs)(r,{value:u.team,onChange:e=>f({...u,team:e.target.value}),children:[(0,k.jsx)(`option`,{value:``,children:`Choose a team…`}),t.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,k.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:`Name`}),(0,k.jsx)(a,{value:u.name,disabled:u.old,maxLength:64,placeholder:u.kind===`skills`?`triage-failures`:u.kind===`guardrails`?`payment-safety`:u.kind===`prompts`?`how-we-report`:`release-rules`,onChange:e=>f({...u,name:N(e.target.value)}),"aria-describedby":`own-name-hint`}),(0,k.jsx)(`span`,{id:`own-name-hint`,className:c(`text-body-sm`,C?`text-fail`:`text-muted`),children:C?`ForgeQE already has a skill named ${u.name}: give the team's another name, or pick the shared one in the team's Knowledge.`:u.old?`A name stays as it is: add a new one to rename.`:`Lower-case words joined by dashes.`})]}),S.describe&&(0,k.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:S.describe.title}),(0,k.jsx)(a,{value:u.description,maxLength:400,placeholder:S.describe.placeholder,onChange:e=>f({...u,description:e.target.value.replace(/[\r\n]+/g,` `)})})]}),S.audience&&(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:`For`}),(0,k.jsx)(T,{label:`Whom of the team it is for`,value:u.for,onChange:e=>f({...u,for:e}),options:[`all`,`lead`,`members`].map(e=>({id:e,label:j[e]}))})]}),(0,k.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,k.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2 text-body-sm font-medium text-ink-2`,children:[S.body,u.kind===`guardrails`&&(0,k.jsx)(`span`,{className:c(`font-normal`,w>40||D?`text-fail`:`text-muted`),children:D?`A rule is longer than 300 characters`:`${s(w,`rule`)} of 40`})]}),(0,k.jsx)(i,{rows:u.kind===`guardrails`?8:12,value:u.body,maxLength:39e3,placeholder:S.placeholder,className:u.kind===`knowledge`?void 0:`font-mono text-body-sm`,onChange:e=>f({...u,body:e.target.value})}),u.kind===`guardrails`&&(0,k.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Each line is one rule the team's agents follow. They add to ForgeQE's own limits and never lift one.`}),u.kind===`prompts`&&(0,k.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Guidance for how the team works. It never changes what an agent may do: its limits are kept in code.`})]}),v&&(0,k.jsx)(`p`,{role:`alert`,className:c(m.fail,`m-0`),children:v})]})})}function L({kind:e,item:t,onOpen:n,compact:r=!1}){let i=A[e],a=t.description||t.body.split(`
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{t as n}from"./utils-DJRAScIl.js";import{t as r}from"./jsx-runtime-LKYXHABd.js";import{r as ee}from"./palette-C8W4Fd5n.js";import{a as te,i}from"./sectionList-B6NF3ZMb.js";import{b as a}from"./api-CorvgyDj.js";import{F as ne,P as o}from"./pageBack-DDAAmq4R.js";import{Vn as s}from"./line-icons-Cwj9OmCz.js";import{Ct as c,Gt as l,Kt as u,Qt as d,St as re,Ut as ie,bt as ae,d as oe,f as se,g as ce,vt as le,xt as ue,yt as de}from"./frame-BC1vOowF.js";import{$ as fe,Q as pe,et as me,nt as f,tt as he}from"./index-BoFziUZw.js";import{r as p}from"./choice-W0qOx_1k.js";var m=e(t(),1),h=r(),g=e=>e&&e!==`forgeqe`?i.find(t=>t.agent===e)?.crew:void 0;function _({id:e,agent:t=te,question:r,intro:i,underIntro:_,starters:ge,placeholder:_e,replyPlaceholder:v,note:y,turnNote:b,track:x,onTurnEnd:ve,ask:S,askSends:ye=!1,draft:C,above:be,menu:w,compose:T,onNew:E,className:D}){let O=`${e}-agent-box`,{chat:k,thread:A,last:j,busy:M,ended:N,send:xe,reset:Se}=se(`forgeqe.${e}.chat`),Ce=d(),[P,F]=(0,m.useState)(``),[I,L]=(0,m.useState)(``),[R,z]=(0,m.useState)(!1),B=c(),V=u(P,F,O,{chat:k&&!N?k:void 0,code:B.tools.code}),H=he(`${e}-agent`,e=>{F(e),me(O)}),U=(0,m.useRef)(new Map),[W,G]=(0,m.useState)({}),K=j?.id,q=j?.outcome;(0,m.useEffect)(()=>{K&&q&&(ve?.(),x&&x.after().then(e=>{let t=[...e].filter(([e,t])=>U.current.get(e)!==t).map(([e])=>e);t.length&&(G(e=>({...e,[K]:t})),x.onMade?.(t))},()=>{}))},[K,q]);let J=async e=>{if(!B.ready)return;let t=T?T.add(e.trim()):e.trim();if(!(R||!t&&!V.hasFiles)){z(!0),L(``);try{x&&(U.current=await x.now());let e=await V.wrap(t);if(!e.trim())return;let n=b?b():``;await xe(e,n?`${y()}\n${n}`:y(),B.choice),F(``),V.reset({keep:!0}),T?.clear()}catch(e){L(e.message)}finally{z(!1)}}},Y=e=>{F(e),setTimeout(()=>document.getElementById(O)?.focus(),0)},X=(0,m.useRef)(0);(0,m.useEffect)(()=>{S&&S.n!==X.current&&(X.current=S.n,(S.send??ye)&&!M?J(S.text):Y(S.text))},[S?.n]);let Z=(0,m.useRef)(0);(0,m.useEffect)(()=>{C&&C.n!==Z.current&&(Z.current=C.n,C.ifEmpty&&P.trim()||Y(C.text))},[C?.n]);let Q=!k||!A.turns.length,$=A.turns.flatMap(e=>W[e.id]||[]).at(-1);return(0,h.jsxs)(`div`,{className:n(`mx-auto flex w-full max-w-[880px] flex-auto flex-col gap-6`,D),children:[Q?(0,h.jsxs)(`div`,{className:`flex flex-col items-center gap-4 pt-2 text-center short:gap-4 short:pt-0`,children:[(0,h.jsx)(ee,{agent:t,px:Ce?72:112,working:R||M,className:`mb-1`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 text-headline-sm`,children:r}),(0,h.jsx)(`p`,{className:`m-0 text-body-lg text-muted`,children:i}),g(t)&&(0,h.jsx)(f,{crew:g(t)})]}),_,(0,h.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:ge.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>e.onPick?e.onPick():e.send?void J(e.text):Y(e.text),className:p,children:[(0,h.jsx)(o,{icon:e.icon,size:18,className:`mt-1 text-icon`}),(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-body-sm font-medium text-ink`,children:e.title}),(0,h.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.hint})]})]},e.title))})]}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsx)(`div`,{className:`z-10 flex items-center justify-end bg-canvas md:sticky md:top-[var(--page-head,0px)] md:py-1`,children:(0,h.jsxs)(ne,{size:`sm`,variant:`ghost`,onClick:()=>{Se(),V.reset(),G({}),F(``),E?.()},disabled:M,"data-tip":`Start a new conversation`,children:[(0,h.jsx)(s,{"aria-hidden":`true`}),`New`]})}),A.turns.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(l,{text:e.user,scope:{chat:k||void 0}}),(0,h.jsx)(ce,{turn:e.error?{...e,error:oe(e.error)}:e,live:!N,onAnswer:(e,t)=>void a.answer(k,e,t).catch(e=>L(e.message)),onProceed:(e,t)=>void a.proceed(k,e,t).catch(e=>L(e.message))}),x&&(W[e.id]||[]).map(e=>(0,h.jsx)(`div`,{children:x.card(e,{busy:M,send:e=>void J(e),error:L})},e))]},e.id)),A.fatal&&(0,h.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:A.fatal})]}),(0,h.jsxs)(`div`,{className:`mt-auto flex flex-col empty:hidden`,children:[!B.ready&&B.setup&&(0,h.jsx)(re,{project:B.setup.project}),B.ready&&(0,h.jsx)(ue,{c:B})]}),(0,h.jsxs)(`div`,{className:`sticky bottom-0 z-10 flex flex-col gap-2 bg-gradient-to-t from-canvas from-85% to-transparent pt-6 pb-4 [:empty+&]:mt-auto`,children:[be?.($,Y),(I||V.error)&&(0,h.jsx)(`p`,{className:`m-0 bg-canvas text-body-sm text-fail [overflow-wrap:anywhere]`,children:I||V.error}),(0,h.jsx)(ie,{id:O,label:`Ask the agent`,value:P,onChange:F,onSend:()=>void J(P),onStop:()=>k&&void a.stop(k),busy:M,disabled:R||H.running||!B.ready,canSend:!!P.trim()||V.hasFiles||!!T?.has,onEdit:V.onEdit,onKey:V.onKeyDown,onFiles:V.onFiles,dropping:V.dropping,drop:V.drop,mentions:V.mentions,combo:V.combo,placeholder:Q?_e:v?v($):`Reply, or ask for the next thing…`,top:(0,h.jsxs)(h.Fragment,{children:[V.chips,H.state&&(0,h.jsx)(fe,{state:H.state,onStop:()=>void H.stop(),onUndo:H.undo,onClose:H.close})]}),left:(0,h.jsxs)(h.Fragment,{children:[V.fileInput,(0,h.jsx)(le,{attach:{pick:V.pick},...w?{before:w}:{},...Q?{choice:B}:k?{started:{chat:k,thread:A,ended:N,snap:B.snap,onError:L}}:{}}),(0,h.jsx)(pe,{running:H.running,disabled:!P.trim()||R||!B.ready,onClick:()=>void H.start(P)})]}),right:Q?(0,h.jsx)(de,{c:B}):k?(0,h.jsx)(ae,{chat:k,thread:A,ended:N,busy:M||R,snap:B.snap,onError:L}):void 0})]})]})}export{_ as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{t as n}from"./utils-DJRAScIl.js";import{t as r}from"./jsx-runtime-LKYXHABd.js";import{r as ee}from"./palette-dAh9kV3S.js";import{a as te,i}from"./sectionList-B6NF3ZMb.js";import{b as a}from"./api-D1PU4zye.js";import{F as ne,P as o}from"./pageBack-DfGBh1Hs.js";import{Vn as s}from"./line-icons-Cwj9OmCz.js";import{Ct as c,Gt as l,Kt as u,Qt as d,St as re,Ut as ie,bt as ae,d as oe,f as se,g as ce,vt as le,xt as ue,yt as de}from"./frame-D0MS2ZMz.js";import{$ as fe,Q as pe,et as me,nt as f,tt as he}from"./index-F8zkXd19.js";import{r as p}from"./choice-W0qOx_1k.js";var m=e(t(),1),h=r(),g=e=>e&&e!==`forgeqe`?i.find(t=>t.agent===e)?.crew:void 0;function _({id:e,agent:t=te,question:r,intro:i,underIntro:_,starters:ge,placeholder:_e,replyPlaceholder:v,note:y,turnNote:b,track:x,onTurnEnd:ve,ask:S,askSends:ye=!1,draft:C,above:be,menu:w,compose:T,onNew:E,className:D}){let O=`${e}-agent-box`,{chat:k,thread:A,last:j,busy:M,ended:N,send:xe,reset:Se}=se(`forgeqe.${e}.chat`),Ce=d(),[P,F]=(0,m.useState)(``),[I,L]=(0,m.useState)(``),[R,z]=(0,m.useState)(!1),B=c(),V=u(P,F,O,{chat:k&&!N?k:void 0,code:B.tools.code}),H=he(`${e}-agent`,e=>{F(e),me(O)}),U=(0,m.useRef)(new Map),[W,G]=(0,m.useState)({}),K=j?.id,q=j?.outcome;(0,m.useEffect)(()=>{K&&q&&(ve?.(),x&&x.after().then(e=>{let t=[...e].filter(([e,t])=>U.current.get(e)!==t).map(([e])=>e);t.length&&(G(e=>({...e,[K]:t})),x.onMade?.(t))},()=>{}))},[K,q]);let J=async e=>{if(!B.ready)return;let t=T?T.add(e.trim()):e.trim();if(!(R||!t&&!V.hasFiles)){z(!0),L(``);try{x&&(U.current=await x.now());let e=await V.wrap(t);if(!e.trim())return;let n=b?b():``;await xe(e,n?`${y()}\n${n}`:y(),B.choice),F(``),V.reset({keep:!0}),T?.clear()}catch(e){L(e.message)}finally{z(!1)}}},Y=e=>{F(e),setTimeout(()=>document.getElementById(O)?.focus(),0)},X=(0,m.useRef)(0);(0,m.useEffect)(()=>{S&&S.n!==X.current&&(X.current=S.n,(S.send??ye)&&!M?J(S.text):Y(S.text))},[S?.n]);let Z=(0,m.useRef)(0);(0,m.useEffect)(()=>{C&&C.n!==Z.current&&(Z.current=C.n,C.ifEmpty&&P.trim()||Y(C.text))},[C?.n]);let Q=!k||!A.turns.length,$=A.turns.flatMap(e=>W[e.id]||[]).at(-1);return(0,h.jsxs)(`div`,{className:n(`mx-auto flex w-full max-w-[880px] flex-auto flex-col gap-6`,D),children:[Q?(0,h.jsxs)(`div`,{className:`flex flex-col items-center gap-4 pt-2 text-center short:gap-4 short:pt-0`,children:[(0,h.jsx)(ee,{agent:t,px:Ce?72:112,working:R||M,className:`mb-1`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 text-headline-sm`,children:r}),(0,h.jsx)(`p`,{className:`m-0 text-body-lg text-muted`,children:i}),g(t)&&(0,h.jsx)(f,{crew:g(t)})]}),_,(0,h.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:ge.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>e.onPick?e.onPick():e.send?void J(e.text):Y(e.text),className:p,children:[(0,h.jsx)(o,{icon:e.icon,size:18,className:`mt-1 text-icon`}),(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-body-sm font-medium text-ink`,children:e.title}),(0,h.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.hint})]})]},e.title))})]}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsx)(`div`,{className:`z-10 flex items-center justify-end bg-canvas md:sticky md:top-[var(--page-head,0px)] md:py-1`,children:(0,h.jsxs)(ne,{size:`sm`,variant:`ghost`,onClick:()=>{Se(),V.reset(),G({}),F(``),E?.()},disabled:M,"data-tip":`Start a new conversation`,children:[(0,h.jsx)(s,{"aria-hidden":`true`}),`New`]})}),A.turns.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(l,{text:e.user,scope:{chat:k||void 0}}),(0,h.jsx)(ce,{turn:e.error?{...e,error:oe(e.error)}:e,live:!N,onAnswer:(e,t)=>void a.answer(k,e,t).catch(e=>L(e.message)),onProceed:(e,t)=>void a.proceed(k,e,t).catch(e=>L(e.message))}),x&&(W[e.id]||[]).map(e=>(0,h.jsx)(`div`,{children:x.card(e,{busy:M,send:e=>void J(e),error:L})},e))]},e.id)),A.fatal&&(0,h.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:A.fatal})]}),(0,h.jsxs)(`div`,{className:`mt-auto flex flex-col empty:hidden`,children:[!B.ready&&B.setup&&(0,h.jsx)(re,{project:B.setup.project}),B.ready&&(0,h.jsx)(ue,{c:B})]}),(0,h.jsxs)(`div`,{className:`sticky bottom-0 z-10 flex flex-col gap-2 bg-gradient-to-t from-canvas from-85% to-transparent pt-6 pb-4 [:empty+&]:mt-auto`,children:[be?.($,Y),(I||V.error)&&(0,h.jsx)(`p`,{className:`m-0 bg-canvas text-body-sm text-fail [overflow-wrap:anywhere]`,children:I||V.error}),(0,h.jsx)(ie,{id:O,label:`Ask the agent`,value:P,onChange:F,onSend:()=>void J(P),onStop:()=>k&&void a.stop(k),busy:M,disabled:R||H.running||!B.ready,canSend:!!P.trim()||V.hasFiles||!!T?.has,onEdit:V.onEdit,onKey:V.onKeyDown,onFiles:V.onFiles,dropping:V.dropping,drop:V.drop,mentions:V.mentions,combo:V.combo,placeholder:Q?_e:v?v($):`Reply, or ask for the next thing…`,top:(0,h.jsxs)(h.Fragment,{children:[V.chips,H.state&&(0,h.jsx)(fe,{state:H.state,onStop:()=>void H.stop(),onUndo:H.undo,onClose:H.close})]}),left:(0,h.jsxs)(h.Fragment,{children:[V.fileInput,(0,h.jsx)(le,{attach:{pick:V.pick},...w?{before:w}:{},...Q?{choice:B}:k?{started:{chat:k,thread:A,ended:N,snap:B.snap,onError:L}}:{}}),(0,h.jsx)(pe,{running:H.running,disabled:!P.trim()||R||!B.ready,onClick:()=>void H.start(P)})]}),right:Q?(0,h.jsx)(de,{c:B}):k?(0,h.jsx)(ae,{chat:k,thread:A,ended:N,busy:M||R,snap:B.snap,onError:L}):void 0})]})]})}export{_ as t};