@capagents/forgeqe 3.2.2 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HOW_TO_USE.md +9 -1
- package/dist/docs-site/docs/area-api/index.html +1 -1
- package/dist/docs-site/docs/get-started/index.html +7 -0
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1836 -1832
- package/dist/web/assets/{3d-force-graph-CTC0tr_c.js → 3d-force-graph-iP39yI0v.js} +1 -1
- package/dist/web/assets/{Agent-wRS-AWzy.js → Agent-COXI7WgW.js} +6 -6
- package/dist/web/assets/{AgentWork-GXWfoD_Z.js → AgentWork-LD5CQxet.js} +1 -1
- package/dist/web/assets/ApiTests-Dpwqmpr1.js +14 -0
- package/dist/web/assets/{Browse-B5RXYaB5.js → Browse-DIcTvI-C.js} +1 -1
- package/dist/web/assets/Chat-DNw_jYbD.js +3 -0
- package/dist/web/assets/{CommandPalette-BipNmH6a.js → CommandPalette-B6QRxOka.js} +1 -1
- package/dist/web/assets/{Compare-FHtKxtLJ.js → Compare-hz0ft2yP.js} +1 -1
- package/dist/web/assets/Cost-C231Bf_A.js +1 -0
- package/dist/web/assets/{Data-Ctg96el3.js → Data-DODs050c.js} +3 -3
- package/dist/web/assets/Desktop-CUV43rdi.js +1 -0
- package/dist/web/assets/DesktopReview-WEIFBq-L.js +2 -0
- package/dist/web/assets/{DeviceScreen-CoArZGyY.js → DeviceScreen-ClPTc5Ot.js} +1 -1
- package/dist/web/assets/{Evidence-D_90W10z.js → Evidence-DhN_bTZ-.js} +1 -1
- package/dist/web/assets/{Explore-CD7Mq4il.js → Explore-CjowiWJe.js} +2 -2
- package/dist/web/assets/{Features-CLHC2bGL.js → Features-BnagyBie.js} +1 -1
- package/dist/web/assets/Flags-DlkY7U4M.js +2 -0
- package/dist/web/assets/{Flaky-Bzt9VcYv.js → Flaky-BkD01mRw.js} +1 -1
- package/dist/web/assets/Impact-BM4_vIEv.js +3 -0
- package/dist/web/assets/Jobs-U9kJUVM9.js +5 -0
- package/dist/web/assets/{KindPage-CJcRnrTe.js → KindPage-BkK5AQw0.js} +3 -3
- package/dist/web/assets/{LiveDevice-BP47IrPa.js → LiveDevice-Bjc2r797.js} +1 -1
- package/dist/web/assets/{Migration-BaVfcEYa.js → Migration-BDDE_0TS.js} +5 -5
- package/dist/web/assets/{Mobile-CLoZlBuq.js → Mobile-D2qAF8X5.js} +1 -1
- package/dist/web/assets/{Observability-CaRIhlKg.js → Observability-CLFC0ze7.js} +1 -1
- package/dist/web/assets/PageAgent-Dz5CuEUe.js +1 -0
- package/dist/web/assets/{Product-BdY0j-z8.js → Product-DkEI-0vu.js} +4 -4
- package/dist/web/assets/Production-CgfLjbSa.js +1 -0
- package/dist/web/assets/Quality-8E667GJi.js +1 -0
- package/dist/web/assets/{Readiness-D4nY3Nr1.js → Readiness-Bbkq2lNV.js} +1 -1
- package/dist/web/assets/Record-JR4HeyTe.js +1 -0
- package/dist/web/assets/{Regression-DhNAgDgD.js → Regression-_9u6qDMk.js} +3 -3
- package/dist/web/assets/{RelationGraph-UXFyQOKO.js → RelationGraph-BnhbeI6t.js} +1 -1
- package/dist/web/assets/{Reports-D4-y2w-2.js → Reports-DxjHb0vA.js} +2 -2
- package/dist/web/assets/Response-BvQV20vS.js +9 -0
- package/dist/web/assets/{Responsive-DljiUZXJ.js → Responsive-DNC31nTr.js} +2 -2
- package/dist/web/assets/{RunDiff-DjUiMBsq.js → RunDiff-BXqh9adv.js} +1 -1
- package/dist/web/assets/Runs-PsPMVpQl.js +2 -0
- package/dist/web/assets/{Settings-CD1RbHXf.js → Settings-DEOCWX5o.js} +15 -15
- package/dist/web/assets/{Steps-DG1WYfYK.js → Steps-C18OGSAM.js} +3 -3
- package/dist/web/assets/{TestCases-BfZzshUI.js → TestCases-MIOqrvt0.js} +1 -1
- package/dist/web/assets/TestData-DtPsGVwq.js +2 -0
- package/dist/web/assets/TestDebt-C8zEVY4j.js +1 -0
- package/dist/web/assets/TestManagement-cXbBFksQ.js +4 -0
- package/dist/web/assets/{WhatsNew-ZorWOqDL.js → WhatsNew-vGPOJXT2.js} +1 -1
- package/dist/web/assets/{dataParts-CeMHTXLx.js → dataParts-D08j24QD.js} +2 -2
- package/dist/web/assets/{desktopAppPath-BVJxel_D.js → desktopAppPath-DyQr1aFk.js} +1 -1
- package/dist/web/assets/{diff-BXu8cULX.js → diff-CVufIkRR.js} +1 -1
- package/dist/web/assets/{highlight-Cd5aQvev.js → highlight-BpaRxd70.js} +1 -1
- package/dist/web/assets/index-FhirFP-O.css +2 -0
- package/dist/web/assets/{index-F95avSUY.js → index-q1r33z9g.js} +12 -12
- package/dist/web/assets/input-ChhA0xMm.js +1 -0
- package/dist/web/assets/{pageBack-BNLSF2VR.js → pageBack-Dhl5PHZE.js} +1 -1
- package/dist/web/assets/{palette-BS9ixqiJ.js → palette-CpGAHix6.js} +1 -1
- package/dist/web/assets/{paletteCommands-DferMQDH.js → paletteCommands-Der7qNEc.js} +1 -1
- package/dist/web/assets/{parts-69Ei7EPi.js → parts-eyvIPENF.js} +1 -1
- package/dist/web/assets/{productParts-PERPm-xD.js → productParts-2Y8IjOa0.js} +1 -1
- package/dist/web/assets/{qualityParts-BRZOCiQs.js → qualityParts-CdoLEG3a.js} +1 -1
- package/dist/web/assets/{recordTest-DVJCNI0y.js → recordTest-vps_1X_-.js} +1 -1
- package/dist/web/assets/{stepper-t0O_8eQo.js → stepper-Cb6rnj2p.js} +1 -1
- package/dist/web/index.html +5 -5
- package/docs/user-guide.html +8 -1
- package/package.json +1 -1
- package/prompts/brain.md +1 -1
- package/py/forgeqe_engine/copilot_gateway.py +81 -2
- package/py/forgeqe_engine/copilot_models.py +37 -1
- package/py/forgeqe_engine/llm.py +10 -1
- package/py/forgeqe_engine/recordsession.py +2 -2
- package/py/forgeqe_engine/webrecord.py +9 -3
- package/py/forgeqe_engine/webrecord_page.py +87 -10
- package/dist/web/assets/ApiTests-BH_mbOVX.js +0 -10
- package/dist/web/assets/Chat-CVF0hHdk.js +0 -3
- package/dist/web/assets/Cost-BDwt86M-.js +0 -1
- package/dist/web/assets/Desktop-B2k0qH7c.js +0 -1
- package/dist/web/assets/DesktopReview-CE65JglI.js +0 -2
- package/dist/web/assets/Flags-FpR9O_13.js +0 -2
- package/dist/web/assets/Impact-BC8w7uQ5.js +0 -3
- package/dist/web/assets/Jobs-DeBncFIN.js +0 -5
- package/dist/web/assets/PageAgent-C_oSStNT.js +0 -1
- package/dist/web/assets/Production-BhDff1v6.js +0 -1
- package/dist/web/assets/Quality-EATW3zGE.js +0 -1
- package/dist/web/assets/Record-CIf6M72U.js +0 -1
- package/dist/web/assets/Response-CpHrRtzJ.js +0 -9
- package/dist/web/assets/Runs-DC0tJWvX.js +0 -2
- package/dist/web/assets/TestData-BoyXYHtp.js +0 -2
- package/dist/web/assets/TestDebt-CX1XT-CA.js +0 -1
- package/dist/web/assets/TestManagement-BTdMN3Bl.js +0 -4
- package/dist/web/assets/index-CgpH1pj9.css +0 -2
- package/dist/web/assets/input-BmJ7dt1C.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{F as t,Fr as n,Hr as r,I as i,Kr as a,Ln as o,Mr as s,Or as c,Vr as l,_n as u,ar as d,lr as f,r as p,rt as m,s as h,sn as g,sr as _,tr as v,tt as y,ut as b,zr as x}from"./route-D8G-pTdk.js";import{l as S}from"./agents-DPabR9dS.js";import{t as C}from"./jsx-runtime-LKYXHABd.js";import{A as w,Et as T,Z as ee,bt as E,j as D,n as O,nt as te,t as k}from"./input-BmJ7dt1C.js";import{E as A,c as j,i as M,l as N,v as ne,w as re}from"./pageBack-BNLSF2VR.js";import{At as P,Dt as F,Ft as ie,Hn as I,In as ae,Ln as oe,Mt as L,Ot as R,Pt as z,Qt as B,Rt as se,Yt as V,d as H,i as ce,jt as U,kt as W,r as le,s as ue,x as de}from"./index-F95avSUY.js";import{f as G,l as fe,o as K,r as q}from"./dataParts-CeMHTXLx.js";import{t as pe}from"./LiveDevice-BP47IrPa.js";import{t as me}from"./DesktopReview-CE65JglI.js";var J=e(a(),1),Y=C(),X=[`workflows`,`flows`,`runs`,`devices`],he={workflows:x,flows:g,runs:o,devices:d},ge={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`]},_e={explore:`Explored`,record:`Recorded`,project:`Project`},ve={replay:`Replay`,explore:`Explore`,record:`Recording`,maestro:`Maestro`},ye=e=>e.mode===`replay`&&e.ok&&e.heals>0&&!e.healsAccepted,Z={android:`Android`,ios:`iOS`};async function Q(e,t){try{let{id:t}=await ee.start(e,{},`mobile`);location.hash=p(`chats`,t)}catch(e){t(e.message)}}function be(){let[e,t]=(0,J.useState)(null),[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(()=>{E.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,J.useEffect)(o,[o]);let s=!!e?.job?.running||!!e?.live.length;return(0,J.useEffect)(()=>{if(!s)return;let e=oe(()=>{E.live().then(({live:e,job:n})=>t(t=>t&&(t.job?.running&&!n?.running&&o(),{...t,live:e,job:n})),()=>{})},1e3);return()=>ae(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 E.stop().then(o)}}function xe({view:e,platform:t,picked:n,set:r}){let i=e.devices.filter(e=>!t||e.platform===t);return e.devices.length?i.length?(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Y.jsx)(H,{checked:n.includes(e.name),onCheckedChange:t=>r(t?[...n,e.name]:n.filter(t=>t!==e.name))}),(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.where]})]},e.name))}):(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`No device of mobile.devices is `,Z[t??``]??t,`.`]}):(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`The device of mobile.appium and mobile.maestro: add devices in `,(0,Y.jsx)(`a`,{href:p(`settings`,`mobile`),children:`Settings, Mobile`}),` to pick them here.`]})}var Se=(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 Ce({w:e,page:t,onClose:n}){let{view:i}=t,[a,c]=(0,J.useState)(i.driver),[l,u]=(0,J.useState)([]),[f,p]=(0,J.useState)({}),[h,g]=(0,J.useState)(``),[_,y]=(0,J.useState)(i.heal),[b,x]=(0,J.useState)(!1),S=e?$(i,e.app):void 0;(0,J.useEffect)(()=>{e&&(c(i.driver),u(Se(i,S)),p(Object.fromEntries(e.variables.map(e=>[e.name,e.value]))),g(``),y(i.heal),x(!1))},[e]);let C=`flex flex-col gap-4 rounded-[12px] card border p-4`,w=a===`maestro`;return(0,Y.jsx)(I,{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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:n,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:t.busy||!e||i.devices.length>0&&!l.length,onClick:async()=>{e&&await t.act(()=>E.replay({workflow:e.path,driver:a,...i.devices.length?{devices:l}:{},variables:f,...h?{rows:h}:{},heal:_,updateBaselines:b}))&&n()},"data-tip":`Replay now`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Replay`]})]}),children:e&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Y.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-4 text-[13px] text-muted`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,Y.jsxs)(`span`,{children:[e.app||`no app`,` · `,D(e.steps,`step`),` · `,D(e.checks,`check`)]})]}),e.checks===0&&(0,Y.jsx)(`p`,{className:`m-0 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:`It has no checks of the outcome: a replay passes when its steps run. Ask the agent to add expect steps.`}),(0,Y.jsx)(q,{label:`Driver`,children:(0,Y.jsx)(se,{label:`Driver`,value:a,onChange:c,options:[{id:`appium`,label:`Appium`},{id:`maestro`,label:`Maestro`}],className:`self-start`})}),(0,Y.jsx)(B,{level:3,icon:d,title:`Devices`,className:C,children:(0,Y.jsx)(xe,{view:i,platform:S,picked:l,set:u})}),e.variables.length>0&&(0,Y.jsx)(B,{level:3,icon:s,title:`Values`,className:C,children:(0,Y.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-4`,children:e.variables.map(e=>(0,Y.jsx)(q,{label:e.name,children:(0,Y.jsx)(k,{value:f[e.name]??``,onChange:t=>p({...f,[e.name]:t.target.value})})},e.name))})}),(0,Y.jsx)(B,{level:3,icon:m,title:`Test data`,className:C,children:(0,Y.jsx)(q,{label:`Rows`,hint:`Each row replays the workflow once, its columns over the values above.`,children:(0,Y.jsxs)(O,{value:h,onChange:e=>g(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`Once, with the values above`}),i.rows.files.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[`Each row of `,e]},e))]})})}),(0,Y.jsx)(B,{level:3,icon:v,title:`While it runs`,className:C,children:w?(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Maestro doesn't heal a moved control or compare images: replay on Appium for those.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{on:_,set:y,children:`Heal a step whose control moved`}),(0,Y.jsx)(G,{on:b,set:x,children:`Take new image baselines`})]})})]})})}function we({open:e,page:n,onClose:i}){let{view:a}=n,[o,s]=(0,J.useState)(a.apps[0]?.name??``),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),m=$(a,o),h=a.devices.filter(e=>!m||e.platform===m);return(0,J.useEffect)(()=>l(e=>h.some(t=>t.name===e)?e:h.find(e=>e.inUse)?.name??h[0]?.name??``),[o,a.devices]),(0,Y.jsx)(I,{open:e,onClose:i,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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:i,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:n.busy||!u.trim()||!o,onClick:async()=>{await n.act(()=>E.explore({app:o,goal:u.trim(),name:f.trim(),...c?{device:c}:{}}))&&(d(``),p(``),i())},"data-tip":`Start: MobilePilot acts in the app on the device`,children:[(0,Y.jsx)(_,{"aria-hidden":`true`}),`Start exploring`]})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Y.jsx)(q,{label:`App`,children:(0,Y.jsx)(O,{value:o,onChange:e=>s(e.target.value),children:a.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` (`,Z[e.platform]??e.platform,`)`]},e.name))})}),h.length>0&&(0,Y.jsx)(q,{label:`Device`,children:(0,Y.jsx)(O,{value:c,onChange:e=>l(e.target.value),children:h.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.where]},e.name))})}),(0,Y.jsx)(q,{label:`Goal`,hint:`One line, as you would ask a tester.`,children:(0,Y.jsx)(k,{value:u,maxLength:500,placeholder:`Sign in and accept the first delivery`,onChange:e=>d(e.target.value)})}),(0,Y.jsx)(q,{label:`Name`,hint:`Optional: the workflow's name.`,children:(0,Y.jsx)(k,{value:f,maxLength:80,onChange:e=>p(e.target.value)})}),(0,Y.jsxs)(`p`,{className:`m-0 flex gap-2 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:[(0,Y.jsx)(t,{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 Te({flows:e,page:t,onClose:n}){let{view:i}=t,[a,s]=(0,J.useState)([]);return(0,J.useEffect)(()=>{e&&s(Se(i))},[e]),(0,Y.jsx)(I,{open:!!e,onClose:n,title:e?`Run ${D(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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:n,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:t.busy||!e?.length||i.devices.length>0&&!a.length,onClick:async()=>{e&&await t.act(()=>E.maestro(e,i.devices.length?a:void 0))&&n()},children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Run flows`]})]}),children:e&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-[13px] text-ink-2`,children:e.map(e=>(0,Y.jsx)(`li`,{className:`truncate`,"data-tip":e,children:e},e))}),(0,Y.jsxs)(B,{level:3,icon:d,title:`Devices`,className:`flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(0,Y.jsx)(xe,{view:i,picked:a,set:s}),(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Maestro runs on this computer's devices and TestMu's, not BrowserStack's.`})]})]})})}function Ee({open:e,page:t,onClose:n,onDone:i}){let{view:a}=t,[o,s]=(0,J.useState)(a.builds[0]??``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(!1);return(0,Y.jsx)(I,{open:e,onClose:n,title:`Upload a build`,description:`Sends an .apk, .aab, .ipa or a .zip of an .app to TestMu AI, so its devices can install it. The build leaves this computer for TestMu's storage.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:n,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:t.busy||!o,onClick:async()=>{let e=``;await t.act(async()=>{let t=await E.upload({file:o,...l?{app:l}:{},...d.trim()?{name:d.trim()}:{},virtual:p});e=t.saved&&t.app?`Uploaded: ${t.app} now installs ${t.id} on TestMu.`:`Uploaded as ${t.id}.${t.app?` ${t.app} comes from env.yaml: set its app: to that id there.`:``}`})&&(i(e),n())},children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Upload`]})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[a.builds.length?(0,Y.jsx)(q,{label:`File`,hint:`An app build found in the project.`,children:(0,Y.jsx)(O,{value:o,onChange:e=>s(e.target.value),children:a.builds.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})}):(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No .apk, .aab, .ipa or .zip in the project: put the build in the project's folder first.`}),(0,Y.jsx)(q,{label:`For app`,hint:`Optional: the id is saved as this app's build.`,children:(0,Y.jsxs)(O,{value:l,onChange:e=>u(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`No app`}),a.apps.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,Y.jsx)(q,{label:`Name`,hint:`Optional: the name TestMu shows.`,children:(0,Y.jsx)(k,{value:d,maxLength:120,onChange:e=>f(e.target.value)})}),(0,Y.jsx)(G,{on:p,set:m,children:`For TestMu's emulators and simulators`})]})})}function De({open:e,page:t,onClose:n}){let[i,a]=(0,J.useState)(!1);return(0,Y.jsx)(I,{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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:n,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:t.busy,onClick:async()=>{await t.act(()=>E.setup(i))&&n()},children:[(0,Y.jsx)(l,{"aria-hidden":`true`}),`Set up`]})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Y.jsx)(G,{on:i,set:a,children:`Set it up again from scratch`}),(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A device cloud needs none of this. Maestro is installed by you: maestro on the PATH, or mobile.maestro.command.`})]})})}function Oe({page:e,onReplay:t,onExplore:r,onSteps:i}){let{view:a}=e,[s,c]=(0,J.useState)(a.apps[0]?.name??``),[l,u]=(0,J.useState)(`all`),f=e=>$(a,e.app),m=l===`all`?a.workflows:a.workflows.filter(e=>f(e)===l),h=()=>e.act(async()=>{await T.start({kind:`mobile`,app:s}),location.hash=p(`record`)});return(0,Y.jsx)(F,{label:`Mobile workflows`,minWidth:760,resetKey:l,placeholder:`Find a workflow`,empty:l===`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,Y.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[(0,Y.jsx)(M,{value:l,onChange:u,items:[{id:`all`,label:`All`,n:a.workflows.length},{id:`android`,label:`Android`,n:a.workflows.filter(e=>f(e)===`android`).length},{id:`ios`,label:`iOS`,n:a.workflows.filter(e=>f(e)===`ios`).length}]}),(0,Y.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[a.apps.length>1&&(0,Y.jsx)(O,{size:`sm`,"aria-label":`App to record`,value:s,onChange:e=>c(e.target.value),className:`w-auto`,children:a.apps.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,Y.jsxs)(A,{size:`sm`,disabled:e.busy||!s,onClick:()=>void h(),"data-tip":`Record your steps in ${s||`an app`}: no model`,children:[(0,Y.jsx)(d,{"aria-hidden":`true`}),`Record by hand`]}),(0,Y.jsxs)(A,{size:`sm`,variant:`primary`,disabled:e.busy||!a.apps.length,onClick:r,"data-tip":`MobilePilot carries out a goal and saves it as a workflow`,children:[(0,Y.jsx)(_,{"aria-hidden":`true`}),`Explore a goal`]})]})]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`Workflow`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`App`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`Platform`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Steps`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Checks`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`From`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:m.map(r=>(0,Y.jsxs)(`tr`,{className:L,children:[(0,Y.jsx)(`td`,{className:R,children:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>i(r),className:`cursor-pointer self-start border-0 bg-transparent p-0 text-left font-medium text-ink hover:text-accent-fg hover:underline`,children:r.name}),(0,Y.jsx)(`span`,{className:`max-w-[300px] truncate font-mono text-[13px] text-muted`,"data-tip":r.path,children:r.path})]})}),(0,Y.jsx)(`td`,{className:w(R,`whitespace-nowrap`),children:r.app||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:w(R,`whitespace-nowrap`),children:Z[f(r)??``]??(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:W,children:r.steps}),(0,Y.jsx)(`td`,{className:w(W,r.checks===0&&`text-warn`),"data-tip":r.checks===0?`No checks of the outcome: a replay passes when its steps run`:void 0,children:r.checks}),(0,Y.jsxs)(`td`,{className:w(R,`whitespace-nowrap`),children:[_e[r.from],(0,Y.jsx)(`span`,{className:`block text-[13px] text-muted`,children:V(r.modified)})]}),(0,Y.jsx)(`td`,{className:w(R,`whitespace-nowrap text-right`),children:(0,Y.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,Y.jsx)(A,{size:`icon`,variant:`icon`,onClick:()=>i(r),"aria-label":`Open ${r.name}`,"data-tip":`Open it: steps, checks, test data, last run`,className:`size-8`,children:(0,Y.jsx)(b,{"aria-hidden":`true`})}),(0,Y.jsx)(A,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t(r),"aria-label":`Replay ${r.name}`,"data-tip":`Replay ${r.name}`,className:`size-8`,children:(0,Y.jsx)(o,{"aria-hidden":`true`})}),(0,Y.jsx)(A,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>void e.act(()=>E.validate(r.path)),"aria-label":`Check ${r.name}`,"data-tip":`Check it without running it`,className:`size-8`,children:(0,Y.jsx)(g,{"aria-hidden":`true`})}),(0,Y.jsx)(A,{size:`icon`,variant:`icon`,onClick:()=>void Q(`MobilePilot: look at the mobile workflow ${r.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 ${r.name} with the agent`,"data-tip":`Improve it with the agent`,className:`size-8`,children:(0,Y.jsx)(n,{"aria-hidden":`true`})})]})})]},r.path))})}function ke({page:e,onRun:t}){let{view:n}=e,[r,i]=(0,J.useState)([]),a=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,Y.jsx)(F,{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:).`,tools:(0,Y.jsx)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:(0,Y.jsxs)(A,{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,Y.jsx)(o,{"aria-hidden":`true`}),`Run selected`,r.length?` (${r.length})`:``]})}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:P,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`Flow`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`App id`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.flows.map(n=>(0,Y.jsxs)(`tr`,{className:L,children:[(0,Y.jsx)(`td`,{className:w(R,`w-10`),children:(0,Y.jsx)(H,{"aria-label":`Pick ${n.name}`,checked:r.includes(n.path),onCheckedChange:e=>a(n.path,e)})}),(0,Y.jsx)(`td`,{className:R,children:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:n.name}),(0,Y.jsx)(`span`,{className:`max-w-[340px] truncate font-mono text-[13px] text-muted`,"data-tip":n.path,children:n.path})]})}),(0,Y.jsx)(`td`,{className:w(R,`whitespace-nowrap font-mono text-[13px]`),children:n.appId}),(0,Y.jsx)(`td`,{className:w(R,`whitespace-nowrap text-right`),children:(0,Y.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,Y.jsx)(A,{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,Y.jsx)(o,{"aria-hidden":`true`})}),(0,Y.jsx)(A,{size:`icon`,variant:`icon`,onClick:()=>void Q(`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,Y.jsx)(u,{"aria-hidden":`true`})})]})})]},n.path))})}function Ae({page:e}){let{view:t}=e,[n,r]=(0,J.useState)(`all`),[a,o]=(0,J.useState)(``),s=t.runs.filter(e=>!e.ok),c=t.runs.filter(ye),d=t.runs.filter(e=>e.mode===`maestro`),f=n===`failed`?s:n===`heals`?c:n===`maestro`?d:t.runs;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-pass-soft px-4 py-2 text-[13px] text-pass`,children:a}),(0,Y.jsx)(F,{label:`Mobile runs`,minWidth:720,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,Y.jsx)(M,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:t.runs.length},{id:`failed`,label:`Failed`,n:s.length,alert:!0},{id:`heals`,label:`Heals to accept`,n:c.length},{id:`maestro`,label:`Maestro flows`,n:d.length}]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`Run`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`Result`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Steps`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:`Heals`}),(0,Y.jsx)(`th`,{scope:`col`,className:P,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:f.map(t=>(0,Y.jsxs)(`tr`,{className:L,children:[(0,Y.jsx)(`td`,{className:R,children:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[ve[t.mode],`: `,t.name]}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:[t.app,V(t.at)].filter(Boolean).join(` · `)}),(t.failed||t.error)&&(0,Y.jsx)(`span`,{className:`max-w-[380px] truncate text-[13px] 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,Y.jsx)(`td`,{className:w(R,`whitespace-nowrap`),children:(0,Y.jsx)(j,{tone:t.ok?`pass`:`fail`,children:t.many?`${t.many.passed} of ${t.many.total}`:t.ok?`Passed`:`Failed`})}),(0,Y.jsx)(`td`,{className:W,children:t.steps||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:w(R,`whitespace-nowrap`),children:t.heals?t.healsAccepted?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[13px] text-pass`,children:[(0,Y.jsx)(i,{size:14,"aria-hidden":`true`}),`In the workflow`]}):t.ok?(0,Y.jsxs)(A,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(async()=>{let e=await te.acceptHeals(t.dir);o(`Wrote ${D(e.written,`healed step`)} into ${e.workflow}.`)}),"data-tip":`Write the new locators into the workflow`,children:[(0,Y.jsx)(l,{"aria-hidden":`true`}),`Accept `,D(t.heals,`heal`)]}):(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,"data-tip":`The replay failed after healing, so its heals may be wrong`,children:[D(t.heals,`heal`),`, not offered`]}):(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:w(R,`whitespace-nowrap text-right`),children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t.report&&(0,Y.jsx)(de,{path:t.report,children:`Report`}),!t.ok&&(0,Y.jsx)(A,{size:`icon`,variant:`icon`,onClick:()=>void Q(`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,Y.jsx)(u,{"aria-hidden":`true`})})]})})]},t.dir))})]})}function je({page:e,said:n,onSetup:r,onUpload:a}){let{view:o}=e,s=o.ready,u=(e,t)=>`${t}: ${e?`sign-in set`:`no sign-in`}`,f=[{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:[u(s.clouds.testmu,`TestMu`),u(s.clouds.browserstack,`BrowserStack`)].join(` · `)},{label:`Healing`,ok:o.heal,note:o.heal?`A moved control is healed with the model (Appium only)`:`mobile.heal is off`}],m=`flex flex-col rounded-[12px] card border`;return(0,Y.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] items-start gap-6`,children:[(0,Y.jsxs)(B,{id:`mobile-machine`,icon:y,title:`This computer`,divider:!1,children:[(0,Y.jsx)(`ul`,{className:w(m,`m-0 list-none divide-y divide-line-soft p-0`),children:f.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[e.ok?(0,Y.jsx)(i,{size:16,"aria-label":`Ready`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(t,{size:16,"aria-label":`Not ready`,className:`mt-1 flex-none text-warn`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]})]},e.label))}),s.checked&&(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Checked `,V(s.checked),`.`]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(A,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(()=>E.doctor()),"data-tip":`Whether the Appium server answers and Maestro is installed`,children:[(0,Y.jsx)(g,{"aria-hidden":`true`}),`Check`]}),(0,Y.jsxs)(A,{size:`sm`,variant:s.appium?`outline`:`primary`,disabled:e.busy,onClick:r,"data-tip":`Install ForgeQE's pinned Appium and its drivers`,children:[(0,Y.jsx)(l,{"aria-hidden":`true`}),`Set up Appium`]})]})]}),(0,Y.jsxs)(B,{id:`mobile-devices`,icon:d,title:`Devices`,divider:!1,children:[o.devices.length?(0,Y.jsx)(`ul`,{className:w(m,`m-0 list-none divide-y divide-line-soft p-0`),children:o.devices.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.about})]}),(0,Y.jsx)(j,{tone:`neutral`,children:e.inUse?`In use`:`Off`})]},e.name))}):(0,Y.jsx)(N,{className:`py-4`,children:`No devices listed: runs use the device of mobile.appium and mobile.maestro.`}),(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Devices are added and changed in `,(0,Y.jsx)(`a`,{href:p(`settings`,`mobile`),children:`Settings, Mobile`}),`.`]})]}),(0,Y.jsxs)(B,{id:`mobile-apps`,icon:h,title:`Apps`,divider:!1,actions:(0,Y.jsxs)(A,{size:`sm`,onClick:a,"data-tip":`Upload an app build to TestMu AI`,children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Upload a build`]}),children:[n&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-pass-soft px-4 py-2 text-[13px] text-pass`,children:n}),o.apps.length?(0,Y.jsx)(`ul`,{className:w(m,`m-0 list-none divide-y divide-line-soft p-0`),children:o.apps.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,Y.jsx)(re,{icon:d,size:16,className:`mt-1 flex-none text-muted`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[Z[e.platform]??e.platform,e.appId,e.build?`build ${e.build}`:`no build uploaded`].filter(Boolean).join(` · `)})]})]},e.name))}):(0,Y.jsxs)(N,{className:`py-4`,children:[`No mobile apps yet: add one in `,(0,Y.jsx)(`a`,{href:p(`settings`,`environments`),children:`Settings, Environments`}),`.`]}),(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Secrets a workflow may type: `,o.secrets.length?o.secrets.join(`, `):`none`,`.`]})]})]})}function Me({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(ye).length,o=e.workflows.filter(e=>e.checks===0).length,s=[e.ready.appium&&`Appium`,e.ready.maestro&&`Maestro`].filter(Boolean).join(` · `);return(0,Y.jsxs)(ie,{label:`Mobile at a glance`,children:[(0,Y.jsx)(z,{compact:!0,label:`Workflows`,value:e.workflows.length,note:o?(0,Y.jsxs)(`span`,{className:`text-warn`,children:[o,` without checks`]}):`${D(e.apps.length,`app`)}`}),(0,Y.jsx)(z,{compact:!0,label:`Replays passed`,value:n.length?`${r} of ${n.length}`:`—`,tone:n.length&&r<n.length?`text-fail`:void 0,note:i?`Last ${V(i.at)}`:`None yet`}),(0,Y.jsx)(z,{compact:!0,label:`Heals to accept`,value:a,tone:a?`text-accent-fg`:void 0,note:a?(0,Y.jsx)(`button`,{type:`button`,onClick:()=>t(`runs`),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Review them`}):`From passed replays`}),(0,Y.jsx)(z,{compact:!0,label:`Replay here`,value:s||(e.ready.checked?`Not ready`:`—`),tone:s?`text-pass`:e.ready.checked?`text-warn`:void 0,note:s?`${D(e.devices.filter(e=>e.inUse).length,`device`)} in use`:(0,Y.jsx)(`button`,{type:`button`,onClick:()=>t(`devices`),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:e.ready.checked?`Set it up`:`Check it`})})]})}function Ne({live:e,job:t,page:n}){let[r,i]=(0,J.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,Y.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,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[e.length>1&&(0,Y.jsx)(M,{value:a.id,onChange:i,items:e.map(e=>({id:e.id,label:e.device||e.id.split(`/`).at(-1)||`Device`}))}),(0,Y.jsx)(pe,{d:a,picture:E.screen})]}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:t&&o?(0,Y.jsx)(K,{job:t,onStop:n.stop,words:ge}):(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Started from a chat: its lines are in the chat.`})})]}):o&&t?(0,Y.jsx)(K,{job:t,onStop:n.stop,words:ge}):null}function Pe({sub:e}){let t=be(),{view:n,error:r}=t,i=S(`mobile`),a=X.includes(e)?e:le,[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(``),C=n?.job??null,w=e=>location.hash=e===`agent`?p(`mobile`):p(`mobile`,e),T={workflows:`Workflows${n?` (${n.workflows.length})`:``}`,flows:`Maestro flows${n?` (${n.flows.length})`:``}`,runs:`Runs${n?` (${n.runs.length})`:``}`,devices:`Devices and apps`};return(0,Y.jsxs)(ce,{title:ne(`mobile`),page:i,label:`Mobile apps`,current:a,onPick:w,tabs:X.map(e=>({id:e,label:T[e],icon:he[e]})),below:(0,Y.jsx)(ue,{page:i}),children:[(0,Y.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Workflows for Android and iOS apps: 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.`}),r&&(0,Y.jsx)(fe,{text:r}),!n&&!r&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&v&&(0,Y.jsx)(me,{workflow:v.path,backLabel:`Workflows`,onClose:()=>{y(null),t.load()}},v.path),n&&!v&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Me,{view:n,onTab:w}),(0,Y.jsx)(Ne,{live:n.live,job:C,page:{...t,view:n}}),C?.question&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-accent-soft p-4 text-[13px]`,children:[(0,Y.jsx)(`p`,{className:`m-0 font-medium`,children:C.question.title}),C.question.detail&&(0,Y.jsx)(`p`,{className:`m-0 text-ink-2`,children:C.question.detail}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[C.question.options.map(e=>(0,Y.jsx)(A,{size:`sm`,onClick:()=>void t.act(()=>E.answer(C.question.id,e.id)),children:e.label},e.id)),(0,Y.jsxs)(A,{size:`sm`,variant:`danger`,onClick:()=>void t.act(()=>E.answer(C.question.id,null)),children:[(0,Y.jsx)(f,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})]}),(0,Y.jsxs)(`div`,{children:[a===`workflows`&&(0,Y.jsx)(Oe,{page:{...t,view:n},onReplay:s,onExplore:()=>l(!0),onSteps:y}),a===`flows`&&(0,Y.jsx)(ke,{page:{...t,view:n},onRun:d}),a===`runs`&&(0,Y.jsx)(Ae,{page:{...t,view:n}}),a===`devices`&&(0,Y.jsx)(je,{page:{...t,view:n},said:b,onSetup:()=>_(!0),onUpload:()=>h(!0)})]}),(0,Y.jsx)(Ce,{w:o,page:{...t,view:n},onClose:()=>s(null)}),(0,Y.jsx)(we,{open:c,page:{...t,view:n},onClose:()=>l(!1)}),(0,Y.jsx)(Te,{flows:u,page:{...t,view:n},onClose:()=>d(null)}),(0,Y.jsx)(Ee,{open:m,page:{...t,view:n},onClose:()=>h(!1),onDone:x}),(0,Y.jsx)(De,{open:g,page:{...t,view:n},onClose:()=>_(!1)})]})]})}export{Pe as Mobile};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{F as t,Fr as n,Hr as r,I as i,Kr as a,Ln as o,Mr as s,Or as c,Vr as l,_n as u,ar as d,lr as f,r as p,rt as m,s as h,sn as g,sr as _,tr as v,tt as y,ut as b,zr as x}from"./route-D8G-pTdk.js";import{l as S}from"./agents-DPabR9dS.js";import{t as C}from"./jsx-runtime-LKYXHABd.js";import{A as w,Et as T,Z as ee,bt as E,j as D,n as O,nt as te,t as k}from"./input-ChhA0xMm.js";import{E as A,c as j,i as M,l as N,v as ne,w as re}from"./pageBack-Dhl5PHZE.js";import{$t as P,At as F,Ft as I,It as ie,Ln as ae,Mt as L,Nt as R,Ot as z,Rn as oe,Un as B,Xt as V,d as H,i as se,jt as U,kt as W,r as ce,s as le,x as ue,zt as de}from"./index-q1r33z9g.js";import{f as G,l as fe,o as K,r as q}from"./dataParts-D08j24QD.js";import{t as pe}from"./LiveDevice-Bjc2r797.js";import{t as me}from"./DesktopReview-WEIFBq-L.js";var J=e(a(),1),Y=C(),X=[`workflows`,`flows`,`runs`,`devices`],he={workflows:x,flows:g,runs:o,devices:d},ge={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`]},_e={explore:`Explored`,record:`Recorded`,project:`Project`},ve={replay:`Replay`,explore:`Explore`,record:`Recording`,maestro:`Maestro`},ye=e=>e.mode===`replay`&&e.ok&&e.heals>0&&!e.healsAccepted,Z={android:`Android`,ios:`iOS`};async function Q(e,t){try{let{id:t}=await ee.start(e,{},`mobile`);location.hash=p(`chats`,t)}catch(e){t(e.message)}}function be(){let[e,t]=(0,J.useState)(null),[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(()=>{E.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,J.useEffect)(o,[o]);let s=!!e?.job?.running||!!e?.live.length;return(0,J.useEffect)(()=>{if(!s)return;let e=oe(()=>{E.live().then(({live:e,job:n})=>t(t=>t&&(t.job?.running&&!n?.running&&o(),{...t,live:e,job:n})),()=>{})},1e3);return()=>ae(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 E.stop().then(o)}}function xe({view:e,platform:t,picked:n,set:r}){let i=e.devices.filter(e=>!t||e.platform===t);return e.devices.length?i.length?(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Y.jsx)(H,{checked:n.includes(e.name),onCheckedChange:t=>r(t?[...n,e.name]:n.filter(t=>t!==e.name))}),(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.where]})]},e.name))}):(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`No device of mobile.devices is `,Z[t??``]??t,`.`]}):(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`The device of mobile.appium and mobile.maestro: add devices in `,(0,Y.jsx)(`a`,{href:p(`settings`,`mobile`),children:`Settings, Mobile`}),` to pick them here.`]})}var Se=(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 Ce({w:e,page:t,onClose:n}){let{view:i}=t,[a,c]=(0,J.useState)(i.driver),[l,u]=(0,J.useState)([]),[f,p]=(0,J.useState)({}),[h,g]=(0,J.useState)(``),[_,y]=(0,J.useState)(i.heal),[b,x]=(0,J.useState)(!1),S=e?$(i,e.app):void 0;(0,J.useEffect)(()=>{e&&(c(i.driver),u(Se(i,S)),p(Object.fromEntries(e.variables.map(e=>[e.name,e.value]))),g(``),y(i.heal),x(!1))},[e]);let C=`flex flex-col gap-4 rounded-[12px] card border p-4`,w=a===`maestro`;return(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:n,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:t.busy||!e||i.devices.length>0&&!l.length,onClick:async()=>{e&&await t.act(()=>E.replay({workflow:e.path,driver:a,...i.devices.length?{devices:l}:{},variables:f,...h?{rows:h}:{},heal:_,updateBaselines:b}))&&n()},"data-tip":`Replay now`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Replay`]})]}),children:e&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Y.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-4 text-[13px] text-muted`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,Y.jsxs)(`span`,{children:[e.app||`no app`,` · `,D(e.steps,`step`),` · `,D(e.checks,`check`)]})]}),e.checks===0&&(0,Y.jsx)(`p`,{className:`m-0 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:`It has no checks of the outcome: a replay passes when its steps run. Ask the agent to add expect steps.`}),(0,Y.jsx)(q,{label:`Driver`,children:(0,Y.jsx)(de,{label:`Driver`,value:a,onChange:c,options:[{id:`appium`,label:`Appium`},{id:`maestro`,label:`Maestro`}],className:`self-start`})}),(0,Y.jsx)(P,{level:3,icon:d,title:`Devices`,className:C,children:(0,Y.jsx)(xe,{view:i,platform:S,picked:l,set:u})}),e.variables.length>0&&(0,Y.jsx)(P,{level:3,icon:s,title:`Values`,className:C,children:(0,Y.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-4`,children:e.variables.map(e=>(0,Y.jsx)(q,{label:e.name,children:(0,Y.jsx)(k,{value:f[e.name]??``,onChange:t=>p({...f,[e.name]:t.target.value})})},e.name))})}),(0,Y.jsx)(P,{level:3,icon:m,title:`Test data`,className:C,children:(0,Y.jsx)(q,{label:`Rows`,hint:`Each row replays the workflow once, its columns over the values above.`,children:(0,Y.jsxs)(O,{value:h,onChange:e=>g(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`Once, with the values above`}),i.rows.files.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[`Each row of `,e]},e))]})})}),(0,Y.jsx)(P,{level:3,icon:v,title:`While it runs`,className:C,children:w?(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Maestro doesn't heal a moved control or compare images: replay on Appium for those.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{on:_,set:y,children:`Heal a step whose control moved`}),(0,Y.jsx)(G,{on:b,set:x,children:`Take new image baselines`})]})})]})})}function we({open:e,page:n,onClose:i}){let{view:a}=n,[o,s]=(0,J.useState)(a.apps[0]?.name??``),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),m=$(a,o),h=a.devices.filter(e=>!m||e.platform===m);return(0,J.useEffect)(()=>l(e=>h.some(t=>t.name===e)?e:h.find(e=>e.inUse)?.name??h[0]?.name??``),[o,a.devices]),(0,Y.jsx)(B,{open:e,onClose:i,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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:i,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:n.busy||!u.trim()||!o,onClick:async()=>{await n.act(()=>E.explore({app:o,goal:u.trim(),name:f.trim(),...c?{device:c}:{}}))&&(d(``),p(``),i())},"data-tip":`Start: MobilePilot acts in the app on the device`,children:[(0,Y.jsx)(_,{"aria-hidden":`true`}),`Start exploring`]})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Y.jsx)(q,{label:`App`,children:(0,Y.jsx)(O,{value:o,onChange:e=>s(e.target.value),children:a.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` (`,Z[e.platform]??e.platform,`)`]},e.name))})}),h.length>0&&(0,Y.jsx)(q,{label:`Device`,children:(0,Y.jsx)(O,{value:c,onChange:e=>l(e.target.value),children:h.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.where]},e.name))})}),(0,Y.jsx)(q,{label:`Goal`,hint:`One line, as you would ask a tester.`,children:(0,Y.jsx)(k,{value:u,maxLength:500,placeholder:`Sign in and accept the first delivery`,onChange:e=>d(e.target.value)})}),(0,Y.jsx)(q,{label:`Name`,hint:`Optional: the workflow's name.`,children:(0,Y.jsx)(k,{value:f,maxLength:80,onChange:e=>p(e.target.value)})}),(0,Y.jsxs)(`p`,{className:`m-0 flex gap-2 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:[(0,Y.jsx)(t,{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 Te({flows:e,page:t,onClose:n}){let{view:i}=t,[a,s]=(0,J.useState)([]);return(0,J.useEffect)(()=>{e&&s(Se(i))},[e]),(0,Y.jsx)(B,{open:!!e,onClose:n,title:e?`Run ${D(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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:n,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:t.busy||!e?.length||i.devices.length>0&&!a.length,onClick:async()=>{e&&await t.act(()=>E.maestro(e,i.devices.length?a:void 0))&&n()},children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Run flows`]})]}),children:e&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-[13px] text-ink-2`,children:e.map(e=>(0,Y.jsx)(`li`,{className:`truncate`,"data-tip":e,children:e},e))}),(0,Y.jsxs)(P,{level:3,icon:d,title:`Devices`,className:`flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(0,Y.jsx)(xe,{view:i,picked:a,set:s}),(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Maestro runs on this computer's devices and TestMu's, not BrowserStack's.`})]})]})})}function Ee({open:e,page:t,onClose:n,onDone:i}){let{view:a}=t,[o,s]=(0,J.useState)(a.builds[0]??``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(!1);return(0,Y.jsx)(B,{open:e,onClose:n,title:`Upload a build`,description:`Sends an .apk, .aab, .ipa or a .zip of an .app to TestMu AI, so its devices can install it. The build leaves this computer for TestMu's storage.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:n,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:t.busy||!o,onClick:async()=>{let e=``;await t.act(async()=>{let t=await E.upload({file:o,...l?{app:l}:{},...d.trim()?{name:d.trim()}:{},virtual:p});e=t.saved&&t.app?`Uploaded: ${t.app} now installs ${t.id} on TestMu.`:`Uploaded as ${t.id}.${t.app?` ${t.app} comes from env.yaml: set its app: to that id there.`:``}`})&&(i(e),n())},children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Upload`]})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[a.builds.length?(0,Y.jsx)(q,{label:`File`,hint:`An app build found in the project.`,children:(0,Y.jsx)(O,{value:o,onChange:e=>s(e.target.value),children:a.builds.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})}):(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No .apk, .aab, .ipa or .zip in the project: put the build in the project's folder first.`}),(0,Y.jsx)(q,{label:`For app`,hint:`Optional: the id is saved as this app's build.`,children:(0,Y.jsxs)(O,{value:l,onChange:e=>u(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`No app`}),a.apps.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,Y.jsx)(q,{label:`Name`,hint:`Optional: the name TestMu shows.`,children:(0,Y.jsx)(k,{value:d,maxLength:120,onChange:e=>f(e.target.value)})}),(0,Y.jsx)(G,{on:p,set:m,children:`For TestMu's emulators and simulators`})]})})}function De({open:e,page:t,onClose:n}){let[i,a]=(0,J.useState)(!1);return(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{onClick:n,children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(A,{variant:`primary`,disabled:t.busy,onClick:async()=>{await t.act(()=>E.setup(i))&&n()},children:[(0,Y.jsx)(l,{"aria-hidden":`true`}),`Set up`]})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Y.jsx)(G,{on:i,set:a,children:`Set it up again from scratch`}),(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A device cloud needs none of this. Maestro is installed by you: maestro on the PATH, or mobile.maestro.command.`})]})})}function Oe({page:e,onReplay:t,onExplore:r,onSteps:i}){let{view:a}=e,[s,c]=(0,J.useState)(a.apps[0]?.name??``),[l,u]=(0,J.useState)(`all`),f=e=>$(a,e.app),m=l===`all`?a.workflows:a.workflows.filter(e=>f(e)===l),h=()=>e.act(async()=>{await T.start({kind:`mobile`,app:s}),location.hash=p(`record`)});return(0,Y.jsx)(z,{label:`Mobile workflows`,minWidth:760,resetKey:l,placeholder:`Find a workflow`,empty:l===`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,Y.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[(0,Y.jsx)(M,{value:l,onChange:u,items:[{id:`all`,label:`All`,n:a.workflows.length},{id:`android`,label:`Android`,n:a.workflows.filter(e=>f(e)===`android`).length},{id:`ios`,label:`iOS`,n:a.workflows.filter(e=>f(e)===`ios`).length}]}),(0,Y.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[a.apps.length>1&&(0,Y.jsx)(O,{size:`sm`,"aria-label":`App to record`,value:s,onChange:e=>c(e.target.value),className:`w-auto`,children:a.apps.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,Y.jsxs)(A,{size:`sm`,disabled:e.busy||!s,onClick:()=>void h(),"data-tip":`Record your steps in ${s||`an app`}: no model`,children:[(0,Y.jsx)(d,{"aria-hidden":`true`}),`Record by hand`]}),(0,Y.jsxs)(A,{size:`sm`,variant:`primary`,disabled:e.busy||!a.apps.length,onClick:r,"data-tip":`MobilePilot carries out a goal and saves it as a workflow`,children:[(0,Y.jsx)(_,{"aria-hidden":`true`}),`Explore a goal`]})]})]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Workflow`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`App`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Platform`}),(0,Y.jsx)(`th`,{scope:`col`,className:L,children:`Steps`}),(0,Y.jsx)(`th`,{scope:`col`,className:L,children:`Checks`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`From`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:m.map(r=>(0,Y.jsxs)(`tr`,{className:R,children:[(0,Y.jsx)(`td`,{className:W,children:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>i(r),className:`cursor-pointer self-start border-0 bg-transparent p-0 text-left font-medium text-ink hover:text-accent-fg hover:underline`,children:r.name}),(0,Y.jsx)(`span`,{className:`max-w-[300px] truncate font-mono text-[13px] text-muted`,"data-tip":r.path,children:r.path})]})}),(0,Y.jsx)(`td`,{className:w(W,`whitespace-nowrap`),children:r.app||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:w(W,`whitespace-nowrap`),children:Z[f(r)??``]??(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:F,children:r.steps}),(0,Y.jsx)(`td`,{className:w(F,r.checks===0&&`text-warn`),"data-tip":r.checks===0?`No checks of the outcome: a replay passes when its steps run`:void 0,children:r.checks}),(0,Y.jsxs)(`td`,{className:w(W,`whitespace-nowrap`),children:[_e[r.from],(0,Y.jsx)(`span`,{className:`block text-[13px] text-muted`,children:V(r.modified)})]}),(0,Y.jsx)(`td`,{className:w(W,`whitespace-nowrap text-right`),children:(0,Y.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,Y.jsx)(A,{size:`icon`,variant:`icon`,onClick:()=>i(r),"aria-label":`Open ${r.name}`,"data-tip":`Open it: steps, checks, test data, last run`,className:`size-8`,children:(0,Y.jsx)(b,{"aria-hidden":`true`})}),(0,Y.jsx)(A,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t(r),"aria-label":`Replay ${r.name}`,"data-tip":`Replay ${r.name}`,className:`size-8`,children:(0,Y.jsx)(o,{"aria-hidden":`true`})}),(0,Y.jsx)(A,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>void e.act(()=>E.validate(r.path)),"aria-label":`Check ${r.name}`,"data-tip":`Check it without running it`,className:`size-8`,children:(0,Y.jsx)(g,{"aria-hidden":`true`})}),(0,Y.jsx)(A,{size:`icon`,variant:`icon`,onClick:()=>void Q(`MobilePilot: look at the mobile workflow ${r.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 ${r.name} with the agent`,"data-tip":`Improve it with the agent`,className:`size-8`,children:(0,Y.jsx)(n,{"aria-hidden":`true`})})]})})]},r.path))})}function ke({page:e,onRun:t}){let{view:n}=e,[r,i]=(0,J.useState)([]),a=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,Y.jsx)(z,{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:).`,tools:(0,Y.jsx)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:(0,Y.jsxs)(A,{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,Y.jsx)(o,{"aria-hidden":`true`}),`Run selected`,r.length?` (${r.length})`:``]})}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:U,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Flow`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`App id`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.flows.map(n=>(0,Y.jsxs)(`tr`,{className:R,children:[(0,Y.jsx)(`td`,{className:w(W,`w-10`),children:(0,Y.jsx)(H,{"aria-label":`Pick ${n.name}`,checked:r.includes(n.path),onCheckedChange:e=>a(n.path,e)})}),(0,Y.jsx)(`td`,{className:W,children:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:n.name}),(0,Y.jsx)(`span`,{className:`max-w-[340px] truncate font-mono text-[13px] text-muted`,"data-tip":n.path,children:n.path})]})}),(0,Y.jsx)(`td`,{className:w(W,`whitespace-nowrap font-mono text-[13px]`),children:n.appId}),(0,Y.jsx)(`td`,{className:w(W,`whitespace-nowrap text-right`),children:(0,Y.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,Y.jsx)(A,{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,Y.jsx)(o,{"aria-hidden":`true`})}),(0,Y.jsx)(A,{size:`icon`,variant:`icon`,onClick:()=>void Q(`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,Y.jsx)(u,{"aria-hidden":`true`})})]})})]},n.path))})}function Ae({page:e}){let{view:t}=e,[n,r]=(0,J.useState)(`all`),[a,o]=(0,J.useState)(``),s=t.runs.filter(e=>!e.ok),c=t.runs.filter(ye),d=t.runs.filter(e=>e.mode===`maestro`),f=n===`failed`?s:n===`heals`?c:n===`maestro`?d:t.runs;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-pass-soft px-4 py-2 text-[13px] text-pass`,children:a}),(0,Y.jsx)(z,{label:`Mobile runs`,minWidth:720,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,Y.jsx)(M,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:t.runs.length},{id:`failed`,label:`Failed`,n:s.length,alert:!0},{id:`heals`,label:`Heals to accept`,n:c.length},{id:`maestro`,label:`Maestro flows`,n:d.length}]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Run`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Result`}),(0,Y.jsx)(`th`,{scope:`col`,className:L,children:`Steps`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:`Heals`}),(0,Y.jsx)(`th`,{scope:`col`,className:U,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:f.map(t=>(0,Y.jsxs)(`tr`,{className:R,children:[(0,Y.jsx)(`td`,{className:W,children:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[ve[t.mode],`: `,t.name]}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:[t.app,V(t.at)].filter(Boolean).join(` · `)}),(t.failed||t.error)&&(0,Y.jsx)(`span`,{className:`max-w-[380px] truncate text-[13px] 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,Y.jsx)(`td`,{className:w(W,`whitespace-nowrap`),children:(0,Y.jsx)(j,{tone:t.ok?`pass`:`fail`,children:t.many?`${t.many.passed} of ${t.many.total}`:t.ok?`Passed`:`Failed`})}),(0,Y.jsx)(`td`,{className:F,children:t.steps||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:w(W,`whitespace-nowrap`),children:t.heals?t.healsAccepted?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[13px] text-pass`,children:[(0,Y.jsx)(i,{size:14,"aria-hidden":`true`}),`In the workflow`]}):t.ok?(0,Y.jsxs)(A,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(async()=>{let e=await te.acceptHeals(t.dir);o(`Wrote ${D(e.written,`healed step`)} into ${e.workflow}.`)}),"data-tip":`Write the new locators into the workflow`,children:[(0,Y.jsx)(l,{"aria-hidden":`true`}),`Accept `,D(t.heals,`heal`)]}):(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,"data-tip":`The replay failed after healing, so its heals may be wrong`,children:[D(t.heals,`heal`),`, not offered`]}):(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:w(W,`whitespace-nowrap text-right`),children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t.report&&(0,Y.jsx)(ue,{path:t.report,children:`Report`}),!t.ok&&(0,Y.jsx)(A,{size:`icon`,variant:`icon`,onClick:()=>void Q(`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,Y.jsx)(u,{"aria-hidden":`true`})})]})})]},t.dir))})]})}function je({page:e,said:n,onSetup:r,onUpload:a}){let{view:o}=e,s=o.ready,u=(e,t)=>`${t}: ${e?`sign-in set`:`no sign-in`}`,f=[{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:[u(s.clouds.testmu,`TestMu`),u(s.clouds.browserstack,`BrowserStack`)].join(` · `)},{label:`Healing`,ok:o.heal,note:o.heal?`A moved control is healed with the model (Appium only)`:`mobile.heal is off`}],m=`flex flex-col rounded-[12px] card border`;return(0,Y.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] items-start gap-6`,children:[(0,Y.jsxs)(P,{id:`mobile-machine`,icon:y,title:`This computer`,divider:!1,children:[(0,Y.jsx)(`ul`,{className:w(m,`m-0 list-none divide-y divide-line-soft p-0`),children:f.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[e.ok?(0,Y.jsx)(i,{size:16,"aria-label":`Ready`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(t,{size:16,"aria-label":`Not ready`,className:`mt-1 flex-none text-warn`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]})]},e.label))}),s.checked&&(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Checked `,V(s.checked),`.`]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(A,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(()=>E.doctor()),"data-tip":`Whether the Appium server answers and Maestro is installed`,children:[(0,Y.jsx)(g,{"aria-hidden":`true`}),`Check`]}),(0,Y.jsxs)(A,{size:`sm`,variant:s.appium?`outline`:`primary`,disabled:e.busy,onClick:r,"data-tip":`Install ForgeQE's pinned Appium and its drivers`,children:[(0,Y.jsx)(l,{"aria-hidden":`true`}),`Set up Appium`]})]})]}),(0,Y.jsxs)(P,{id:`mobile-devices`,icon:d,title:`Devices`,divider:!1,children:[o.devices.length?(0,Y.jsx)(`ul`,{className:w(m,`m-0 list-none divide-y divide-line-soft p-0`),children:o.devices.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.about})]}),(0,Y.jsx)(j,{tone:`neutral`,children:e.inUse?`In use`:`Off`})]},e.name))}):(0,Y.jsx)(N,{className:`py-4`,children:`No devices listed: runs use the device of mobile.appium and mobile.maestro.`}),(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Devices are added and changed in `,(0,Y.jsx)(`a`,{href:p(`settings`,`mobile`),children:`Settings, Mobile`}),`.`]})]}),(0,Y.jsxs)(P,{id:`mobile-apps`,icon:h,title:`Apps`,divider:!1,actions:(0,Y.jsxs)(A,{size:`sm`,onClick:a,"data-tip":`Upload an app build to TestMu AI`,children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Upload a build`]}),children:[n&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-pass-soft px-4 py-2 text-[13px] text-pass`,children:n}),o.apps.length?(0,Y.jsx)(`ul`,{className:w(m,`m-0 list-none divide-y divide-line-soft p-0`),children:o.apps.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,Y.jsx)(re,{icon:d,size:16,className:`mt-1 flex-none text-muted`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[Z[e.platform]??e.platform,e.appId,e.build?`build ${e.build}`:`no build uploaded`].filter(Boolean).join(` · `)})]})]},e.name))}):(0,Y.jsxs)(N,{className:`py-4`,children:[`No mobile apps yet: add one in `,(0,Y.jsx)(`a`,{href:p(`settings`,`environments`),children:`Settings, Environments`}),`.`]}),(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Secrets a workflow may type: `,o.secrets.length?o.secrets.join(`, `):`none`,`.`]})]})]})}function Me({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(ye).length,o=e.workflows.filter(e=>e.checks===0).length,s=[e.ready.appium&&`Appium`,e.ready.maestro&&`Maestro`].filter(Boolean).join(` · `);return(0,Y.jsxs)(ie,{label:`Mobile at a glance`,children:[(0,Y.jsx)(I,{compact:!0,label:`Workflows`,value:e.workflows.length,note:o?(0,Y.jsxs)(`span`,{className:`text-warn`,children:[o,` without checks`]}):`${D(e.apps.length,`app`)}`}),(0,Y.jsx)(I,{compact:!0,label:`Replays passed`,value:n.length?`${r} of ${n.length}`:`—`,tone:n.length&&r<n.length?`text-fail`:void 0,note:i?`Last ${V(i.at)}`:`None yet`}),(0,Y.jsx)(I,{compact:!0,label:`Heals to accept`,value:a,tone:a?`text-accent-fg`:void 0,note:a?(0,Y.jsx)(`button`,{type:`button`,onClick:()=>t(`runs`),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Review them`}):`From passed replays`}),(0,Y.jsx)(I,{compact:!0,label:`Replay here`,value:s||(e.ready.checked?`Not ready`:`—`),tone:s?`text-pass`:e.ready.checked?`text-warn`:void 0,note:s?`${D(e.devices.filter(e=>e.inUse).length,`device`)} in use`:(0,Y.jsx)(`button`,{type:`button`,onClick:()=>t(`devices`),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:e.ready.checked?`Set it up`:`Check it`})})]})}function Ne({live:e,job:t,page:n}){let[r,i]=(0,J.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,Y.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,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[e.length>1&&(0,Y.jsx)(M,{value:a.id,onChange:i,items:e.map(e=>({id:e.id,label:e.device||e.id.split(`/`).at(-1)||`Device`}))}),(0,Y.jsx)(pe,{d:a,picture:E.screen})]}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:t&&o?(0,Y.jsx)(K,{job:t,onStop:n.stop,words:ge}):(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Started from a chat: its lines are in the chat.`})})]}):o&&t?(0,Y.jsx)(K,{job:t,onStop:n.stop,words:ge}):null}function Pe({sub:e}){let t=be(),{view:n,error:r}=t,i=S(`mobile`),a=X.includes(e)?e:ce,[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(``),C=n?.job??null,w=e=>location.hash=e===`agent`?p(`mobile`):p(`mobile`,e),T={workflows:`Workflows${n?` (${n.workflows.length})`:``}`,flows:`Maestro flows${n?` (${n.flows.length})`:``}`,runs:`Runs${n?` (${n.runs.length})`:``}`,devices:`Devices and apps`};return(0,Y.jsxs)(se,{title:ne(`mobile`),page:i,label:`Mobile apps`,current:a,onPick:w,tabs:X.map(e=>({id:e,label:T[e],icon:he[e]})),below:(0,Y.jsx)(le,{page:i}),children:[(0,Y.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Workflows for Android and iOS apps: 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.`}),r&&(0,Y.jsx)(fe,{text:r}),!n&&!r&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&v&&(0,Y.jsx)(me,{workflow:v.path,backLabel:`Workflows`,onClose:()=>{y(null),t.load()}},v.path),n&&!v&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Me,{view:n,onTab:w}),(0,Y.jsx)(Ne,{live:n.live,job:C,page:{...t,view:n}}),C?.question&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-accent-soft p-4 text-[13px]`,children:[(0,Y.jsx)(`p`,{className:`m-0 font-medium`,children:C.question.title}),C.question.detail&&(0,Y.jsx)(`p`,{className:`m-0 text-ink-2`,children:C.question.detail}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[C.question.options.map(e=>(0,Y.jsx)(A,{size:`sm`,onClick:()=>void t.act(()=>E.answer(C.question.id,e.id)),children:e.label},e.id)),(0,Y.jsxs)(A,{size:`sm`,variant:`danger`,onClick:()=>void t.act(()=>E.answer(C.question.id,null)),children:[(0,Y.jsx)(f,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})]}),(0,Y.jsxs)(`div`,{children:[a===`workflows`&&(0,Y.jsx)(Oe,{page:{...t,view:n},onReplay:s,onExplore:()=>l(!0),onSteps:y}),a===`flows`&&(0,Y.jsx)(ke,{page:{...t,view:n},onRun:d}),a===`runs`&&(0,Y.jsx)(Ae,{page:{...t,view:n}}),a===`devices`&&(0,Y.jsx)(je,{page:{...t,view:n},said:b,onSetup:()=>_(!0),onUpload:()=>h(!0)})]}),(0,Y.jsx)(Ce,{w:o,page:{...t,view:n},onClose:()=>s(null)}),(0,Y.jsx)(we,{open:c,page:{...t,view:n},onClose:()=>l(!1)}),(0,Y.jsx)(Te,{flows:u,page:{...t,view:n},onClose:()=>d(null)}),(0,Y.jsx)(Ee,{open:m,page:{...t,view:n},onClose:()=>h(!1),onDone:x}),(0,Y.jsx)(De,{open:g,page:{...t,view:n},onClose:()=>_(!1)})]})]})}export{Pe as Mobile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Er as t,Ht as n,Kr as r,Ln as i,Tr as a,Vr as o,Xt as s,Yn as c,pr as l,r as u,tt as d,u as f}from"./route-D8G-pTdk.js";import{t as p}from"./jsx-runtime-LKYXHABd.js";import{A as m,X as h}from"./input-BmJ7dt1C.js";import{D as g,c as _,i as v,l as y,n as b,v as x}from"./pageBack-BNLSF2VR.js";import{L as S}from"./palette-BS9ixqiJ.js";import{Cn as C,Dt as w,F as T,Qt as E,Yt as D,ft as O,ut as k,z as A}from"./index-F95avSUY.js";import{_ as j,o as M}from"./qualityParts-BRZOCiQs.js";var N=e(r(),1),P={view:e=>h(`GET`,`/api/observability?days=${e}`)},F=p(),I=12,L=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),R=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function z({series:e}){let[t,n]=(0,N.useState)(-1),r=Math.max(1,...e.map(e=>e.sessions)),i=e.reduce((e,t)=>e+t.sessions,0),a=e.reduce((e,t)=>e+t.problems,0),o=e.reduce((e,t)=>t.sessions>e.sessions?t:e,e[0]),s=t>=0?e[t]:e[e.length-1];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-[13px] text-ink-2`,children:[(0,F.jsx)(`span`,{className:`font-medium`,children:L(s.day)}),`: `,R(s.sessions,`session`),s.problems?`, ${s.problems} with an error`:``]}),(0,F.jsx)(`div`,{role:`img`,"aria-label":`Sessions a day for the last ${e.length} days: ${i} in all, ${a} with an error; the busiest was ${L(o.day)} with ${o.sessions}.`,className:`flex h-[160px] items-end gap-1 border-b border-line`,onMouseLeave:()=>n(-1),children:e.map((i,a)=>(0,F.jsx)(`div`,{className:`flex h-full flex-1 cursor-default items-end`,onMouseEnter:()=>n(a),children:(0,F.jsx)(`div`,{className:m(`w-full rounded-t-[4px] transition-[height]`,a===e.length-1||a===t?`bg-accent`:`bg-accent-line`),style:{height:i.sessions>0?`${Math.max(2,i.sessions/r*100)}%`:`0`}})},i.day))}),(0,F.jsxs)(`div`,{"aria-hidden":`true`,className:`flex justify-between text-[13px] text-muted`,children:[(0,F.jsx)(`span`,{children:L(e[0].day)}),(0,F.jsx)(`span`,{children:L(e[e.length-1].day)})]})]})}function B({rows:e,label:t,empty:n,unit:r,failedWord:i=`failed`}){if(!e.length)return(0,F.jsx)(y,{className:`py-4`,children:n});let a=Math.max(1,...e.map(e=>e.value));return(0,F.jsxs)(`ul`,{"aria-label":t,className:`m-0 flex list-none flex-col gap-4 p-0`,children:[e.slice(0,I).map(e=>(0,F.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 text-[13px]`,children:[(0,F.jsx)(`span`,{"data-tip":e.label,className:`min-w-0 truncate font-medium`,children:e.label}),(0,F.jsxs)(`span`,{className:`whitespace-nowrap text-ink-2 tabular-nums`,children:[R(e.value,r),e.failed?(0,F.jsxs)(`span`,{className:`text-fail`,children:[` · `,e.failed,` `,i]}):null]})]}),(0,F.jsx)(`div`,{"aria-hidden":`true`,className:`h-2 rounded-full bg-surface-strong`,children:(0,F.jsx)(`div`,{className:`h-2 rounded-full bg-accent transition-[width] duration-200 ease-out`,style:{width:e.value>0?`${Math.max(1,e.value/a*100)}%`:`0`}})})]},e.key)),e.length>I&&(0,F.jsxs)(`li`,{className:`text-[13px] text-muted`,children:[`and `,e.length-I,` more`]})]})}var V={passed:`pass`,failed:`fail`,error:`fail`};function H({runs:e}){let t=e.reduce((e,t)=>e+t.count,0);if(!t)return(0,F.jsx)(y,{className:`py-4`,children:`No browser run ended in these days.`});let n=e=>V[e]??`neutral`,r={pass:`bg-pass`,fail:`bg-fail`,neutral:`bg-line-strong`};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(`div`,{role:`img`,"aria-label":`Runs by how they ended: ${e.map(e=>`${e.status} ${e.count}`).join(`, `)}, of ${t}.`,className:`flex h-3 gap-1 overflow-hidden rounded-full`,children:e.map(e=>(0,F.jsx)(`span`,{className:r[n(e.status)],style:{flex:e.count}},e.status))}),(0,F.jsx)(`span`,{className:`flex flex-wrap gap-2 text-[13px]`,children:e.map(e=>(0,F.jsxs)(_,{tone:n(e.status),children:[e.status[0].toUpperCase()+e.status.slice(1),` `,e.count]},e.status))})]})}var U=[{id:`7`,label:`Last 7 days`},{id:`30`,label:`Last 30 days`},{id:`90`,label:`Last 90 days`}],W=e=>e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.round(e/6e4)} min`,G=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;function K({id:e,icon:t,title:n,children:r,note:i,divider:a}){return(0,F.jsx)(E,{id:e,icon:t,title:n,description:i,divider:a,children:r})}function q(){let[e,r]=(0,N.useState)(30),[p,h]=(0,N.useState)(null),[E,I]=(0,N.useState)(``),L=(0,N.useCallback)(()=>{I(``),P.view(e).then(h,e=>I(e.message))},[e]);(0,N.useEffect)(L,[L]);let R=p&&p.days===e?p:null,V=R?.totals,q=R?[R.source.skipped?`${R.source.skipped} log file${R.source.skipped===1?` was`:`s were`} skipped: a link, or not inside the logs folder.`:``,R.source.truncated?`${R.source.truncated} very long log${R.source.truncated===1?` was`:`s were`} read only in part.`:``,R.source.ledger?``:`Model calls are counted once this project has a forgeqe.yaml: the usage ledger keeps calls by project.`].filter(Boolean):[];return(0,F.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,F.jsx)(A,{}),(0,F.jsxs)(`main`,{className:m(T,`@container flex-auto gap-4`),children:[(0,F.jsx)(b,{}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,F.jsx)(C,{pixel:S.observability,size:`lg`}),(0,F.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:x(`observability`)})]}),(0,F.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`ForgeQE's own work on this computer, from its session logs`,R?(0,F.jsxs)(F.Fragment,{children:[` `,`in `,(0,F.jsx)(`code`,{className:`font-mono text-[13px] [overflow-wrap:anywhere]`,children:R.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,F.jsx)(`a`,{href:u(`settings`,`observability`),children:`Settings › Observability`}),`. Each session is in the day it started.`]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,F.jsx)(v,{items:U,value:`${e}`,onChange:e=>r(Number(e))})}),E&&(0,F.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:E}),!R&&!E&&(0,F.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),R&&V&&!V.sessions&&!V.modelCalls&&(0,F.jsx)(y,{icon:n,title:`No sessions in the last ${e} days`,action:(0,F.jsxs)(`a`,{className:g({size:`sm`}),href:u(`runs`),"data-tip":`Open Runs`,children:[(0,F.jsx)(f,{"aria-hidden":`true`}),`Runs`]}),children:(0,F.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.`})}),R&&V&&(V.sessions>0||V.modelCalls>0)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,F.jsx)(M,{label:`Sessions`,value:V.sessions,sub:`${R.from} to ${R.to}`}),(0,F.jsx)(M,{label:`With an error`,value:V.problemSessions,tone:V.problemSessions?`text-fail`:void 0,sub:V.sessions?`${G(V.problemSessions,V.sessions)} of sessions`:`no session`}),(0,F.jsx)(M,{label:`Failed turns`,value:V.turnsFailed,tone:V.turnsFailed?`text-fail`:void 0,sub:`of ${V.turns} turn${V.turns===1?``:`s`}`}),(0,F.jsx)(M,{label:`Failed runs`,value:V.runsFailed,tone:V.runsFailed?`text-fail`:void 0,sub:`of ${V.runs} browser run${V.runs===1?``:`s`}`}),(0,F.jsx)(M,{label:`Tool errors`,value:V.toolErrors,tone:V.toolErrors?`text-warn`:void 0,sub:`of ${V.toolCalls} call${V.toolCalls===1?``:`s`}, ${G(V.toolErrors,V.toolCalls)}`}),(0,F.jsx)(M,{label:`Model calls`,value:V.modelCalls,sub:`${O(V.tokens)} tokens`})]}),q.length>0&&(0,F.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:q.map(e=>(0,F.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(s,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),e]},e))}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,F.jsx)(K,{id:`obs-days`,icon:a,title:`Sessions over time`,note:R.turnTime?`A turn took ${W(R.turnTime.p50)} at the median, ${W(R.turnTime.p95)} at the 95th percentile.`:void 0,children:(0,F.jsx)(z,{series:R.series})}),(0,F.jsxs)(`div`,{className:`grid gap-x-6 gap-y-8 border-t border-line pt-6 @3xl:grid-cols-2`,children:[(0,F.jsx)(K,{id:`obs-commands`,icon:l,title:`By command`,divider:!1,children:(0,F.jsx)(B,{rows:R.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,F.jsx)(K,{id:`obs-runs`,icon:i,title:`Browser runs`,divider:!1,children:(0,F.jsx)(H,{runs:R.runs})}),(0,F.jsx)(K,{id:`obs-tools`,icon:o,title:`Tool calls`,divider:!1,children:(0,F.jsx)(B,{rows:R.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,F.jsx)(K,{id:`obs-health`,icon:n,title:`Session health`,divider:!1,note:`The ways a chat has gone wrong before, found by their signature in the logs.`,children:(0,F.jsx)(B,{rows:R.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,F.jsx)(K,{id:`obs-models`,icon:d,title:`Model calls`,children:(0,F.jsx)(w,{label:`Model calls by model`,placeholder:`Find a model`,resetKey:e,empty:R.source.ledger?`No model call in these days.`:`Model calls are counted once this project has a forgeqe.yaml.`,search:R.models.length>8,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Model`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Calls`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Tokens`}),(0,F.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Median`}),(0,F.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`95th percentile`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Cost`})]}),children:R.models.map(e=>(0,F.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,F.jsx)(`td`,{className:m(`px-4 py-2`,`max-w-0`),children:(0,F.jsx)(`span`,{"data-tip":e.model,className:`block truncate font-mono text-[13px]`,children:e.model})}),(0,F.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.calls}),(0,F.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-tip":`${O(e.input)} read, ${O(e.output)} written`,children:O(e.input+e.output)}),(0,F.jsx)(`td`,{className:m(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),children:e.p50===null?`–`:W(e.p50)}),(0,F.jsx)(`td`,{className:m(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),children:e.p95===null?`–`:W(e.p95)}),(0,F.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.amount!==void 0&&e.currency?k(e.amount,e.currency):(0,F.jsx)(`span`,{className:`text-muted`,children:`–`})})]},e.model))})}),(0,F.jsx)(K,{id:`obs-problems`,icon:t,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,F.jsx)(w,{label:`Latest problems`,placeholder:`Find a problem or session`,resetKey:e,empty:`No problem in these days.`,search:R.problems.length>8,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Problem`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`When`}),(0,F.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Session`})]}),children:R.problems.map((e,t)=>(0,F.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,F.jsx)(`td`,{className:`px-4 py-2`,children:(0,F.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(_,{tone:e.severity===`error`?`fail`:`warn`,children:e.severity===`error`?`Error`:`Warning`}),(0,F.jsx)(`span`,{children:e.text}),e.detail&&(0,F.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.detail})]})}),(0,F.jsx)(`td`,{className:m(`px-4 py-2`,`whitespace-nowrap text-muted`),"data-tip":j(e.at),children:D(e.at)}),(0,F.jsx)(`td`,{className:m(`px-4 py-2`,`hidden max-w-[220px] @xl:table-cell`),children:(0,F.jsx)(`a`,{href:u(`runs`,encodeURIComponent(e.session)),"data-tip":`Open this session in Runs`,className:`block truncate font-mono text-[13px]`,children:e.session.replace(/\.log$/,``)})})]},`${e.session}-${e.at}-${t}`))})})]}),(0,F.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[(0,F.jsx)(c,{size:14,"aria-hidden":`true`}),(0,F.jsxs)(`span`,{children:[R.source.read,` session log`,R.source.read===1?``:`s`,` read. `,(0,F.jsx)(`a`,{href:u(`settings`,`observability`),children:`Send these to your collector`}),`.`]})]})]})]})]})}export{q as Observability};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Er as t,Ht as n,Kr as r,Ln as i,Tr as a,Vr as o,Xt as s,Yn as c,pr as l,r as u,tt as d,u as f}from"./route-D8G-pTdk.js";import{t as p}from"./jsx-runtime-LKYXHABd.js";import{A as m,X as h}from"./input-ChhA0xMm.js";import{D as g,c as _,i as v,l as y,n as b,v as x}from"./pageBack-Dhl5PHZE.js";import{L as S}from"./palette-CpGAHix6.js";import{$t as C,F as w,Ot as T,Xt as E,dt as D,pt as O,wn as k,z as A}from"./index-q1r33z9g.js";import{_ as j,o as M}from"./qualityParts-CdoLEG3a.js";var N=e(r(),1),P={view:e=>h(`GET`,`/api/observability?days=${e}`)},F=p(),I=12,L=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),R=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function z({series:e}){let[t,n]=(0,N.useState)(-1),r=Math.max(1,...e.map(e=>e.sessions)),i=e.reduce((e,t)=>e+t.sessions,0),a=e.reduce((e,t)=>e+t.problems,0),o=e.reduce((e,t)=>t.sessions>e.sessions?t:e,e[0]),s=t>=0?e[t]:e[e.length-1];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-[13px] text-ink-2`,children:[(0,F.jsx)(`span`,{className:`font-medium`,children:L(s.day)}),`: `,R(s.sessions,`session`),s.problems?`, ${s.problems} with an error`:``]}),(0,F.jsx)(`div`,{role:`img`,"aria-label":`Sessions a day for the last ${e.length} days: ${i} in all, ${a} with an error; the busiest was ${L(o.day)} with ${o.sessions}.`,className:`flex h-[160px] items-end gap-1 border-b border-line`,onMouseLeave:()=>n(-1),children:e.map((i,a)=>(0,F.jsx)(`div`,{className:`flex h-full flex-1 cursor-default items-end`,onMouseEnter:()=>n(a),children:(0,F.jsx)(`div`,{className:m(`w-full rounded-t-[4px] transition-[height]`,a===e.length-1||a===t?`bg-accent`:`bg-accent-line`),style:{height:i.sessions>0?`${Math.max(2,i.sessions/r*100)}%`:`0`}})},i.day))}),(0,F.jsxs)(`div`,{"aria-hidden":`true`,className:`flex justify-between text-[13px] text-muted`,children:[(0,F.jsx)(`span`,{children:L(e[0].day)}),(0,F.jsx)(`span`,{children:L(e[e.length-1].day)})]})]})}function B({rows:e,label:t,empty:n,unit:r,failedWord:i=`failed`}){if(!e.length)return(0,F.jsx)(y,{className:`py-4`,children:n});let a=Math.max(1,...e.map(e=>e.value));return(0,F.jsxs)(`ul`,{"aria-label":t,className:`m-0 flex list-none flex-col gap-4 p-0`,children:[e.slice(0,I).map(e=>(0,F.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 text-[13px]`,children:[(0,F.jsx)(`span`,{"data-tip":e.label,className:`min-w-0 truncate font-medium`,children:e.label}),(0,F.jsxs)(`span`,{className:`whitespace-nowrap text-ink-2 tabular-nums`,children:[R(e.value,r),e.failed?(0,F.jsxs)(`span`,{className:`text-fail`,children:[` · `,e.failed,` `,i]}):null]})]}),(0,F.jsx)(`div`,{"aria-hidden":`true`,className:`h-2 rounded-full bg-surface-strong`,children:(0,F.jsx)(`div`,{className:`h-2 rounded-full bg-accent transition-[width] duration-200 ease-out`,style:{width:e.value>0?`${Math.max(1,e.value/a*100)}%`:`0`}})})]},e.key)),e.length>I&&(0,F.jsxs)(`li`,{className:`text-[13px] text-muted`,children:[`and `,e.length-I,` more`]})]})}var V={passed:`pass`,failed:`fail`,error:`fail`};function H({runs:e}){let t=e.reduce((e,t)=>e+t.count,0);if(!t)return(0,F.jsx)(y,{className:`py-4`,children:`No browser run ended in these days.`});let n=e=>V[e]??`neutral`,r={pass:`bg-pass`,fail:`bg-fail`,neutral:`bg-line-strong`};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(`div`,{role:`img`,"aria-label":`Runs by how they ended: ${e.map(e=>`${e.status} ${e.count}`).join(`, `)}, of ${t}.`,className:`flex h-3 gap-1 overflow-hidden rounded-full`,children:e.map(e=>(0,F.jsx)(`span`,{className:r[n(e.status)],style:{flex:e.count}},e.status))}),(0,F.jsx)(`span`,{className:`flex flex-wrap gap-2 text-[13px]`,children:e.map(e=>(0,F.jsxs)(_,{tone:n(e.status),children:[e.status[0].toUpperCase()+e.status.slice(1),` `,e.count]},e.status))})]})}var U=[{id:`7`,label:`Last 7 days`},{id:`30`,label:`Last 30 days`},{id:`90`,label:`Last 90 days`}],W=e=>e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.round(e/6e4)} min`,G=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;function K({id:e,icon:t,title:n,children:r,note:i,divider:a}){return(0,F.jsx)(C,{id:e,icon:t,title:n,description:i,divider:a,children:r})}function q(){let[e,r]=(0,N.useState)(30),[p,h]=(0,N.useState)(null),[C,I]=(0,N.useState)(``),L=(0,N.useCallback)(()=>{I(``),P.view(e).then(h,e=>I(e.message))},[e]);(0,N.useEffect)(L,[L]);let R=p&&p.days===e?p:null,V=R?.totals,q=R?[R.source.skipped?`${R.source.skipped} log file${R.source.skipped===1?` was`:`s were`} skipped: a link, or not inside the logs folder.`:``,R.source.truncated?`${R.source.truncated} very long log${R.source.truncated===1?` was`:`s were`} read only in part.`:``,R.source.ledger?``:`Model calls are counted once this project has a forgeqe.yaml: the usage ledger keeps calls by project.`].filter(Boolean):[];return(0,F.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,F.jsx)(A,{}),(0,F.jsxs)(`main`,{className:m(w,`@container flex-auto gap-4`),children:[(0,F.jsx)(b,{}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,F.jsx)(k,{pixel:S.observability,size:`lg`}),(0,F.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:x(`observability`)})]}),(0,F.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`ForgeQE's own work on this computer, from its session logs`,R?(0,F.jsxs)(F.Fragment,{children:[` `,`in `,(0,F.jsx)(`code`,{className:`font-mono text-[13px] [overflow-wrap:anywhere]`,children:R.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,F.jsx)(`a`,{href:u(`settings`,`observability`),children:`Settings › Observability`}),`. Each session is in the day it started.`]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,F.jsx)(v,{items:U,value:`${e}`,onChange:e=>r(Number(e))})}),C&&(0,F.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:C}),!R&&!C&&(0,F.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),R&&V&&!V.sessions&&!V.modelCalls&&(0,F.jsx)(y,{icon:n,title:`No sessions in the last ${e} days`,action:(0,F.jsxs)(`a`,{className:g({size:`sm`}),href:u(`runs`),"data-tip":`Open Runs`,children:[(0,F.jsx)(f,{"aria-hidden":`true`}),`Runs`]}),children:(0,F.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.`})}),R&&V&&(V.sessions>0||V.modelCalls>0)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,F.jsx)(M,{label:`Sessions`,value:V.sessions,sub:`${R.from} to ${R.to}`}),(0,F.jsx)(M,{label:`With an error`,value:V.problemSessions,tone:V.problemSessions?`text-fail`:void 0,sub:V.sessions?`${G(V.problemSessions,V.sessions)} of sessions`:`no session`}),(0,F.jsx)(M,{label:`Failed turns`,value:V.turnsFailed,tone:V.turnsFailed?`text-fail`:void 0,sub:`of ${V.turns} turn${V.turns===1?``:`s`}`}),(0,F.jsx)(M,{label:`Failed runs`,value:V.runsFailed,tone:V.runsFailed?`text-fail`:void 0,sub:`of ${V.runs} browser run${V.runs===1?``:`s`}`}),(0,F.jsx)(M,{label:`Tool errors`,value:V.toolErrors,tone:V.toolErrors?`text-warn`:void 0,sub:`of ${V.toolCalls} call${V.toolCalls===1?``:`s`}, ${G(V.toolErrors,V.toolCalls)}`}),(0,F.jsx)(M,{label:`Model calls`,value:V.modelCalls,sub:`${O(V.tokens)} tokens`})]}),q.length>0&&(0,F.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:q.map(e=>(0,F.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(s,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),e]},e))}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,F.jsx)(K,{id:`obs-days`,icon:a,title:`Sessions over time`,note:R.turnTime?`A turn took ${W(R.turnTime.p50)} at the median, ${W(R.turnTime.p95)} at the 95th percentile.`:void 0,children:(0,F.jsx)(z,{series:R.series})}),(0,F.jsxs)(`div`,{className:`grid gap-x-6 gap-y-8 border-t border-line pt-6 @3xl:grid-cols-2`,children:[(0,F.jsx)(K,{id:`obs-commands`,icon:l,title:`By command`,divider:!1,children:(0,F.jsx)(B,{rows:R.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,F.jsx)(K,{id:`obs-runs`,icon:i,title:`Browser runs`,divider:!1,children:(0,F.jsx)(H,{runs:R.runs})}),(0,F.jsx)(K,{id:`obs-tools`,icon:o,title:`Tool calls`,divider:!1,children:(0,F.jsx)(B,{rows:R.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,F.jsx)(K,{id:`obs-health`,icon:n,title:`Session health`,divider:!1,note:`The ways a chat has gone wrong before, found by their signature in the logs.`,children:(0,F.jsx)(B,{rows:R.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,F.jsx)(K,{id:`obs-models`,icon:d,title:`Model calls`,children:(0,F.jsx)(T,{label:`Model calls by model`,placeholder:`Find a model`,resetKey:e,empty:R.source.ledger?`No model call in these days.`:`Model calls are counted once this project has a forgeqe.yaml.`,search:R.models.length>8,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Model`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Calls`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Tokens`}),(0,F.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Median`}),(0,F.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`95th percentile`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Cost`})]}),children:R.models.map(e=>(0,F.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,F.jsx)(`td`,{className:m(`px-4 py-2`,`max-w-0`),children:(0,F.jsx)(`span`,{"data-tip":e.model,className:`block truncate font-mono text-[13px]`,children:e.model})}),(0,F.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.calls}),(0,F.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-tip":`${O(e.input)} read, ${O(e.output)} written`,children:O(e.input+e.output)}),(0,F.jsx)(`td`,{className:m(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),children:e.p50===null?`–`:W(e.p50)}),(0,F.jsx)(`td`,{className:m(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),children:e.p95===null?`–`:W(e.p95)}),(0,F.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.amount!==void 0&&e.currency?D(e.amount,e.currency):(0,F.jsx)(`span`,{className:`text-muted`,children:`–`})})]},e.model))})}),(0,F.jsx)(K,{id:`obs-problems`,icon:t,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,F.jsx)(T,{label:`Latest problems`,placeholder:`Find a problem or session`,resetKey:e,empty:`No problem in these days.`,search:R.problems.length>8,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Problem`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`When`}),(0,F.jsx)(`th`,{scope:`col`,className:m(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Session`})]}),children:R.problems.map((e,t)=>(0,F.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,F.jsx)(`td`,{className:`px-4 py-2`,children:(0,F.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(_,{tone:e.severity===`error`?`fail`:`warn`,children:e.severity===`error`?`Error`:`Warning`}),(0,F.jsx)(`span`,{children:e.text}),e.detail&&(0,F.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.detail})]})}),(0,F.jsx)(`td`,{className:m(`px-4 py-2`,`whitespace-nowrap text-muted`),"data-tip":j(e.at),children:E(e.at)}),(0,F.jsx)(`td`,{className:m(`px-4 py-2`,`hidden max-w-[220px] @xl:table-cell`),children:(0,F.jsx)(`a`,{href:u(`runs`,encodeURIComponent(e.session)),"data-tip":`Open this session in Runs`,className:`block truncate font-mono text-[13px]`,children:e.session.replace(/\.log$/,``)})})]},`${e.session}-${e.at}-${t}`))})})]}),(0,F.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[(0,F.jsx)(c,{size:14,"aria-hidden":`true`}),(0,F.jsxs)(`span`,{children:[R.source.read,` session log`,R.source.read===1?``:`s`,` read. `,(0,F.jsx)(`a`,{href:u(`settings`,`observability`),children:`Send these to your collector`}),`.`]})]})]})]})]})}export{q as Observability};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Bn as t,Kr as n}from"./route-D8G-pTdk.js";import{n as r,r as i}from"./agents-DPabR9dS.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{A as o,Z as s}from"./input-ChhA0xMm.js";import{E as c,w as l}from"./pageBack-Dhl5PHZE.js";import{a as u}from"./palette-CpGAHix6.js";import{Bn as d,Fn as f,Gn as ee,K as p,Mn as m,Nn as te,Pn as ne,Vn as re,Wn as ie,an as ae,cn as oe,in as se,ln as ce,on as le,sn as ue,zn as de}from"./index-q1r33z9g.js";import{n as fe}from"./Response-BvQV20vS.js";import{n as h,t as g}from"./poll-CHpac9Fb.js";var _=e(n(),1),pe=e=>e&&/^No model in llms\.json/.test(e)?`No model is set up for the agent yet: add one in Settings, Models (or sign in to GitHub Copilot there), then send this again.`:e;function me(e){let t=()=>{try{return localStorage.getItem(e)}catch{return null}},n=t=>{try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}},[r,i]=(0,_.useState)(t),[a,o]=(0,_.useState)([]),[c,l]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!r){o([]),l(null);return}let e=!1,t=0,a=0;return o([]),(async()=>{for(;!e;)try{let n=await s.events(r,t,t>0);if(e||(a=0,l(n.state),n.events.length&&(t=n.events.at(-1).n,o(e=>[...e,...n.events])),(n.state===`closed`||n.state===`failed`)&&!n.events.length))return}catch(t){if(e)return;let r=t.status??0,o=g(++a,r,t.message);if(o.giveUp&&r===404){n(null),i(null);return}if(o.giveUp)return;await h(o.waitMs)}})(),()=>{e=!0}},[r]);let u=(0,_.useMemo)(()=>p(a),[a]),d=u.turns.at(-1),f=c===`closed`||c===`failed`;return{chat:r,thread:u,last:d,busy:c===`busy`||c===`starting`||!!d&&!d.outcome&&!f,ended:f,send:async(e,t,a={})=>{if(r&&!f)await s.send(r,e);else{let{id:r}=await s.start(`${t}\n${e}`,a);n(r),i(r)}},reset:()=>{n(null),i(null)}}}var v=a(),y=e=>e&&e!==`forgeqe`?r.find(t=>t.agent===e)?.crew:void 0;function b({id:e,agent:n=i,question:r,intro:a,underIntro:p,starters:h,placeholder:g,replyPlaceholder:b,note:x,turnNote:S,track:C,onTurnEnd:he,ask:w,askSends:ge=!1,draft:T,above:_e,menu:E,compose:D,onNew:ve,className:ye}){let O=`${e}-agent-box`,{chat:k,thread:A,last:j,busy:M,ended:N,send:be,reset:xe}=me(`forgeqe.${e}.chat`),Se=ie(),[P,F]=(0,_.useState)(``),[I,L]=(0,_.useState)(``),[R,z]=(0,_.useState)(!1),B=ce(),V=re(P,F,O,{chat:k&&!N?k:void 0,code:B.tools.code}),H=f(`${e}-agent`,e=>{F(e),ne(O)}),U=(0,_.useRef)(new Map),[W,G]=(0,_.useState)({}),K=j?.id,q=j?.outcome;(0,_.useEffect)(()=>{K&&q&&(he?.(),C&&C.after().then(e=>{let t=[...e].filter(([e,t])=>U.current.get(e)!==t).map(([e])=>e);t.length&&(G(e=>({...e,[K]:t})),C.onMade?.(t))},()=>{}))},[K,q]);let J=async e=>{if(!B.ready)return;let t=D?D.add(e.trim()):e.trim();if(!(R||!t&&!V.hasFiles)){z(!0),L(``);try{C&&(U.current=await C.now());let e=await V.wrap(t);if(!e.trim())return;let n=S?S():``;await be(k&&!N&&n?`${n}\n${e}`:e,n?`${x()}\n${n}`:x(),B.choice),F(``),V.reset({keep:!0}),D?.clear()}catch(e){L(e.message)}finally{z(!1)}}},Y=e=>{F(e),setTimeout(()=>document.getElementById(O)?.focus(),0)},X=(0,_.useRef)(0);(0,_.useEffect)(()=>{w&&w.n!==X.current&&(X.current=w.n,(w.send??ge)&&!M?J(w.text):Y(w.text))},[w?.n]);let Z=(0,_.useRef)(0);(0,_.useEffect)(()=>{T&&T.n!==Z.current&&(Z.current=T.n,T.ifEmpty&&P.trim()||Y(T.text))},[T?.n]);let Q=!k||!A.turns.length,$=A.turns.flatMap(e=>W[e.id]||[]).at(-1);return(0,v.jsxs)(`div`,{className:o(`mx-auto flex w-full max-w-[880px] flex-auto flex-col gap-6`,ye),children:[Q?(0,v.jsxs)(`div`,{className:`flex flex-col items-center gap-4 pt-2 text-center short:gap-4 short:pt-0`,children:[(0,v.jsx)(u,{agent:n,px:Se?72:112,working:R||M,className:`mb-1`}),(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,v.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:r}),(0,v.jsx)(`p`,{className:`m-0 text-[16px] text-muted`,children:a}),y(n)&&(0,v.jsx)(ee,{crew:y(n)})]}),p,(0,v.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:h.map(e=>(0,v.jsxs)(`button`,{type:`button`,onClick:()=>e.onPick?e.onPick():e.send?void J(e.text):Y(e.text),className:`flex cursor-pointer items-start gap-4 rounded-[12px] card border px-4 py-2 text-left hover:border-line-strong hover:bg-surface-muted`,children:[(0,v.jsx)(l,{icon:e.icon,size:18,className:`mt-1 text-accent-fg`}),(0,v.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,v.jsx)(`span`,{className:`text-[13px] font-medium text-ink`,children:e.title}),(0,v.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.hint})]})]},e.title))})]}):(0,v.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,v.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,v.jsxs)(c,{size:`sm`,variant:`ghost`,onClick:()=>{xe(),V.reset(),G({}),F(``),ve?.()},disabled:M,"data-tip":`Start a new conversation`,children:[(0,v.jsx)(t,{"aria-hidden":`true`}),`New`]})}),A.turns.map(e=>(0,v.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,v.jsx)(d,{text:e.user,scope:{chat:k||void 0}}),(0,v.jsx)(fe,{turn:e.error?{...e,error:pe(e.error)}:e,live:!N,onAnswer:(e,t)=>void s.answer(k,e,t).catch(e=>L(e.message)),onProceed:(e,t)=>void s.proceed(k,e,t).catch(e=>L(e.message))}),C&&(W[e.id]||[]).map(e=>(0,v.jsx)(`div`,{children:C.card(e,{busy:M,send:e=>void J(e),error:L})},e))]},e.id)),A.fatal&&(0,v.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:A.fatal})]}),(0,v.jsxs)(`div`,{className:`mt-auto flex flex-col empty:hidden`,children:[!B.ready&&B.setup&&(0,v.jsx)(oe,{project:B.setup.project}),B.ready&&(0,v.jsx)(ue,{c:B})]}),(0,v.jsxs)(`div`,{className:`sticky bottom-0 z-10 flex flex-col gap-2 bg-gradient-to-t from-bg from-85% to-transparent pt-6 pb-4 [:empty+&]:mt-auto`,children:[_e?.($,Y),(I||V.error)&&(0,v.jsx)(`p`,{className:`m-0 bg-bg text-[13px] text-fail [overflow-wrap:anywhere]`,children:I||V.error}),(0,v.jsx)(de,{id:O,label:`Ask the agent`,value:P,onChange:F,onSend:()=>void J(P),onStop:()=>k&&void s.stop(k),busy:M,disabled:R||H.running||!B.ready,canSend:!!P.trim()||V.hasFiles||!!D?.has,onEdit:V.onEdit,onKey:V.onKeyDown,onFiles:V.onFiles,dropping:V.dropping,drop:V.drop,mentions:V.mentions,combo:V.combo,placeholder:Q?g:b?b($):`Reply, or ask for the next thing…`,top:(0,v.jsxs)(v.Fragment,{children:[V.chips,H.state&&(0,v.jsx)(te,{state:H.state,onStop:()=>void H.stop(),onUndo:H.undo,onClose:H.close})]}),left:(0,v.jsxs)(v.Fragment,{children:[V.fileInput,(0,v.jsx)(se,{attach:{pick:V.pick},...E?{before:E}:{},...Q?{choice:B}:k?{started:{chat:k,thread:A,ended:N,snap:B.snap,onError:L}}:{}}),(0,v.jsx)(m,{running:H.running,disabled:!P.trim()||R||!B.ready,onClick:()=>void H.start(P)})]}),right:Q?(0,v.jsx)(ae,{c:B}):k?(0,v.jsx)(le,{chat:k,thread:A,ended:N,busy:M||R,snap:B.snap,onError:L}):void 0})]})]})}export{b as t};
|