@capagents/forgeqe 3.3.5 → 3.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/HOW_TO_USE.md +9 -0
  2. package/dist/docs-site/docs/area-operations/index.html +9 -0
  3. package/dist/forgeqe.js +1911 -1910
  4. package/dist/web/assets/{3d-force-graph-KUdc_88B.js → 3d-force-graph-Dzh7nZHB.js} +1 -1
  5. package/dist/web/assets/Agent-TMDBO05H.js +10 -0
  6. package/dist/web/assets/{AgentWork-DmCMV4YL.js → AgentWork-CHC16tCh.js} +1 -1
  7. package/dist/web/assets/{ApiTests-C_L2iJ8s.js → ApiTests-BhmPtlha.js} +3 -3
  8. package/dist/web/assets/{Browse-BjPPdirz.js → Browse-BT4NwFlf.js} +1 -1
  9. package/dist/web/assets/{Chat-DNiUvy2O.js → Chat-5kT-DaOX.js} +3 -3
  10. package/dist/web/assets/{CommandPalette-BBGtkkz4.js → CommandPalette-D2T-HldB.js} +1 -1
  11. package/dist/web/assets/{Compare-CVvpgS-7.js → Compare-CVId7eRu.js} +1 -1
  12. package/dist/web/assets/{Cost-DJnZYyQP.js → Cost-BcGPKNts.js} +1 -1
  13. package/dist/web/assets/{Data-DEWYrB9n.js → Data-BoZOA_H9.js} +1 -1
  14. package/dist/web/assets/{Desktop-Bm6ObXhU.js → Desktop-dYRmoU_-.js} +1 -1
  15. package/dist/web/assets/{DesktopReview-Bcs7E_SB.js → DesktopReview-CfozOqkA.js} +1 -1
  16. package/dist/web/assets/{Evidence-D5fORfDF.js → Evidence-BseJLe3S.js} +1 -1
  17. package/dist/web/assets/{Explore-Dhwu33Xf.js → Explore-2g74_R0C.js} +2 -2
  18. package/dist/web/assets/Features-DgJqPa-3.js +1 -0
  19. package/dist/web/assets/{Flags-DEitGv3r.js → Flags-C9Vli2I6.js} +1 -1
  20. package/dist/web/assets/{Flaky-F5NHbFgI.js → Flaky-BHoLVcnp.js} +1 -1
  21. package/dist/web/assets/{Impact-eg2nHsiv.js → Impact-vNOLMC--.js} +2 -2
  22. package/dist/web/assets/{Jobs-GBUaaYcw.js → Jobs-BXJHiDme.js} +2 -2
  23. package/dist/web/assets/{KindPage-CaXbIzyO.js → KindPage-CAlLQ-wX.js} +2 -2
  24. package/dist/web/assets/{LiveDevice-jFCQ_zeU.js → LiveDevice-DdzQmJat.js} +1 -1
  25. package/dist/web/assets/{Migration-ZhSPJ6QL.js → Migration-D1uvBaBZ.js} +4 -4
  26. package/dist/web/assets/{Mobile-ClrjICJt.js → Mobile-DUW4OwBK.js} +1 -1
  27. package/dist/web/assets/{Observability-CQ7WAuBH.js → Observability-BstgIeKO.js} +1 -1
  28. package/dist/web/assets/{OwnItems-CedxNuRy.js → OwnItems-D-GGL7l6.js} +1 -1
  29. package/dist/web/assets/PageAgent-sAuAp86u.js +1 -0
  30. package/dist/web/assets/{Product-DyhX2TYr.js → Product-BaV0xHXM.js} +2 -2
  31. package/dist/web/assets/{Production-DSDdBODO.js → Production-B2O4o_2w.js} +1 -1
  32. package/dist/web/assets/{Quality-CdrPT4WV.js → Quality-B-4lwa5s.js} +1 -1
  33. package/dist/web/assets/{Readiness-C9qM2rKO.js → Readiness-DYEhtv3L.js} +1 -1
  34. package/dist/web/assets/{Record-C790-f2w.js → Record-DJtJ5lHo.js} +1 -1
  35. package/dist/web/assets/{Regression-PDhRTDKs.js → Regression-Dl74mLPk.js} +2 -2
  36. package/dist/web/assets/{RelationGraph-CBY9FhUu.js → RelationGraph-Icd1HaVO.js} +1 -1
  37. package/dist/web/assets/{Reports-BBRMV5V8.js → Reports-BEgu0hEa.js} +2 -2
  38. package/dist/web/assets/{Requirements-DRz1Yudy.js → Requirements-BGrUE42Y.js} +1 -1
  39. package/dist/web/assets/{Responsive-DZXESkT1.js → Responsive-CE1Mk2v1.js} +2 -2
  40. package/dist/web/assets/{RunDiff-CsND-A6h.js → RunDiff-CL_5y-Qe.js} +1 -1
  41. package/dist/web/assets/{Settings-VqVLvH-Z.js → Settings-COjVzBnC.js} +9 -9
  42. package/dist/web/assets/{Steps-6x6JVBmk.js → Steps-p2mtjaQd.js} +1 -1
  43. package/dist/web/assets/{TestData-hIJO8oL4.js → TestData-B6h_wMZg.js} +1 -1
  44. package/dist/web/assets/{TestManagement-SBq56JNZ.js → TestManagement-CmwX5zHH.js} +3 -3
  45. package/dist/web/assets/{WhatsNew-BwV-yle3.js → WhatsNew-BsUPo-AN.js} +1 -1
  46. package/dist/web/assets/{agentSettingsSheet-CUOx_y4s.js → agentSettingsSheet-BYfhgj6t.js} +1 -1
  47. package/dist/web/assets/{api-BsiuHmJq.js → api-BUoHbp5V.js} +1 -1
  48. package/dist/web/assets/{dataParts-_X5zGtE9.js → dataParts-DbfDDph_.js} +1 -1
  49. package/dist/web/assets/{desktopAppPath-D3mGDKPz.js → desktopAppPath-CRwtH7Mm.js} +1 -1
  50. package/dist/web/assets/{flowTheme-DKuXe5nP.js → flowTheme-DM9ULk-2.js} +1 -1
  51. package/dist/web/assets/{frame-CgBYYtdw.js → frame-DW-Hx3fC.js} +3 -3
  52. package/dist/web/assets/index-CsEmZt6_.js +55 -0
  53. package/dist/web/assets/{markdown-CwgDQU8m.js → markdown-BhteivTy.js} +1 -1
  54. package/dist/web/assets/{nav-B_68FVw_.js → nav-DE7YMNUI.js} +1 -1
  55. package/dist/web/assets/{pageBack-CbyKfisx.js → pageBack-D89f9SN4.js} +1 -1
  56. package/dist/web/assets/{palette-6YAAmgkD.js → palette-DLNRH9CW.js} +1 -1
  57. package/dist/web/assets/{parts-ClnDV-6r.js → parts-CuY97ZCG.js} +1 -1
  58. package/dist/web/assets/{productParts-CUvTBJkC.js → productParts-CiA1iUMC.js} +1 -1
  59. package/dist/web/assets/{qualityParts-BFDaQh7A.js → qualityParts-BSRlONZr.js} +1 -1
  60. package/dist/web/assets/{recordTest-7uIZiqOW.js → recordTest-DQFAYzce.js} +1 -1
  61. package/dist/web/assets/{stepper-C6U4inhc.js → stepper-DbGnuiC8.js} +1 -1
  62. package/dist/web/assets/{wizardParts-fa6KdWVg.js → wizardParts-D6YJXD6A.js} +1 -1
  63. package/dist/web/index.html +7 -7
  64. package/docs/ForgeQE-Static-Analysis-Report-30112026.pdf +0 -0
  65. package/docs/ForgeQE-Static-Analysis-Report-5bbf0da7.html +207 -0
  66. package/docs/user-guide.html +9 -0
  67. package/package.json +1 -1
  68. package/py/forgeqe_engine/persona.py +2 -1
  69. package/dist/web/assets/Agent-d4YX63iA.js +0 -10
  70. package/dist/web/assets/Features-D-HIDQqF.js +0 -1
  71. package/dist/web/assets/PageAgent-CDYs-i-n.js +0 -1
  72. package/dist/web/assets/index-D10waU4_.js +0 -55
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-oDy8sV6H.js";import{F as i,L as a,l as o}from"./preload-helper-BupTYkQW.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{d as u}from"./sectionList-B651VPon.js";import{H as d,Y as f,w as p,y as m}from"./api-BsiuHmJq.js";import{C as h,_ as g,b as _,f as v,g as y,x as b}from"./pageBack-CbyKfisx.js";import{Fr as x,Lr as S,M as C,N as w,Or as T,Pn as E,Q as D,Qn as ee,Rr as O,et as k,in as A,ir as j,jr as te,mn as M,nr as N,or as ne,r as re,st as ie,wr as ae}from"./line-icons-CwCZidXs.js";import{Gt as oe,Kt as se,St as P,at as F,bt as I,dt as ce,gt as L,ht as R,ot as le,qt as z,vt as B,xt as V,yt as H}from"./frame-CgBYYtdw.js";import{t as U}from"./when-BuWCTaKm.js";import{u as ue}from"./nav-B_68FVw_.js";import{n as de}from"./markdown-CwgDQU8m.js";import{H as W,U as G,l as fe,n as pe,t as K}from"./index-D10waU4_.js";import{f as q,l as me,o as he,r as J}from"./dataParts-_X5zGtE9.js";import{t as ge}from"./LiveDevice-jFCQ_zeU.js";import{t as _e}from"./DesktopReview-Bcs7E_SB.js";var Y=e(t(),1),X=l(),ve=[`workflows`,`flows`,`runs`,`devices`],ye={workflows:x,flows:A,runs:E,devices:N},be={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`]},xe={explore:`Explored`,record:`Recorded`,project:`Project`},Se={replay:`Replay`,explore:`Explore`,record:`Recording`,maestro:`Maestro`},Ce=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 m.start(e,{},`mobile`);location.hash=r(`chats`,t)}catch(e){t(e.message)}}function we(){let[e,t]=(0,Y.useState)(null),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(!1),o=(0,Y.useCallback)(()=>{d.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,Y.useEffect)(o,[o]);let s=!!e?.job?.running||!!e?.live.length;return(0,Y.useEffect)(()=>{if(!s)return;let e=se(()=>{d.live().then(({live:e,job:n})=>t(t=>t&&(t.job?.running&&!n?.running&&o(),{...t,live:e,job:n})),()=>{})},1e3);return()=>oe(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 d.stop().then(o)}}function Te({view:e,platform:t,picked:n,set:i}){let a=e.devices.filter(e=>!t||e.platform===t);return e.devices.length?a.length?(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,X.jsx)(W,{checked:n.includes(e.name),onCheckedChange:t=>i(t?[...n,e.name]:n.filter(t=>t!==e.name))}),(0,X.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,X.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.where]})]},e.name))}):(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-warn`,children:[`No device of mobile.devices is `,Z[t??``]??t,`.`]}):(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`The device of mobile.appium and mobile.maestro: add devices in `,(0,X.jsx)(`a`,{href:r(`settings`,`mobile`),children:`Settings, Mobile`}),` to pick them here.`]})}var Ee=(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 De({w:e,page:t,onClose:n}){let{view:r}=t,[l,u]=(0,Y.useState)(r.driver),[f,p]=(0,Y.useState)([]),[m,g]=(0,Y.useState)({}),[_,v]=(0,Y.useState)(``),[y,x]=(0,Y.useState)(r.heal),[S,C]=(0,Y.useState)(!1),w=e?$(r,e.app):void 0;(0,Y.useEffect)(()=>{e&&(u(r.driver),p(Ee(r,w)),g(Object.fromEntries(e.variables.map(e=>[e.name,e.value]))),v(``),x(r.heal),C(!1))},[e]);let D=c(o,`flex flex-col gap-4`),A=l===`maestro`;return(0,X.jsx)(z,{open:!!e,onClose:n,title:e?`Replay ${e.name}`:`Replay`,description:`Runs the workflow's steps on each device with no model, checking its expect steps. Use a test device and a test account.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy||!e||r.devices.length>0&&!f.length,onClick:async()=>{e&&await t.act(()=>d.replay({workflow:e.path,driver:l,...r.devices.length?{devices:f}:{},variables:m,..._?{rows:_}:{},heal:y,updateBaselines:S}))&&n()},"data-tip":`Replay now`,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Replay`]})]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-4 text-body-sm text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,X.jsxs)(`span`,{children:[e.app||`no app`,` · `,s(e.steps,`step`),` · `,s(e.checks,`check`)]})]}),e.checks===0&&(0,X.jsx)(`p`,{className:c(h.warn,`m-0`),children:`It has no checks of the outcome: a replay passes when its steps run. Ask the agent to add expect steps.`}),(0,X.jsx)(J,{label:`Driver`,children:(0,X.jsx)(ce,{label:`Driver`,value:l,onChange:u,options:[{id:`appium`,label:`Appium`},{id:`maestro`,label:`Maestro`}],className:`self-start`})}),(0,X.jsx)(G,{level:3,icon:N,title:`Devices`,className:D,children:(0,X.jsx)(Te,{view:r,platform:w,picked:f,set:p})}),e.variables.length>0&&(0,X.jsx)(G,{level:3,icon:T,title:`Values`,className:D,children:(0,X.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-4`,children:e.variables.map(e=>(0,X.jsx)(J,{label:e.name,children:(0,X.jsx)(i,{value:m[e.name]??``,onChange:t=>g({...m,[e.name]:t.target.value})})},e.name))})}),(0,X.jsx)(G,{level:3,icon:k,title:`Test data`,className:D,children:(0,X.jsx)(J,{label:`Rows`,hint:`Each row replays the workflow once, its columns over the values above.`,children:(0,X.jsxs)(a,{value:_,onChange:e=>v(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`Once, with the values above`}),r.rows.files.map(e=>(0,X.jsxs)(`option`,{value:e,children:[`Each row of `,e]},e))]})})}),(0,X.jsx)(G,{level:3,icon:ee,title:`While it runs`,className:D,children:A?(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Maestro doesn't heal a moved control or compare images: replay on Appium for those.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{on:y,set:x,children:`Heal a step whose control moved`}),(0,X.jsx)(q,{on:S,set:C,children:`Take new image baselines`})]})})]})})}function Oe({open:e,page:t,onClose:n}){let{view:r}=t,[o,s]=(0,Y.useState)(r.apps[0]?.name??``),[l,u]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,g]=(0,Y.useState)(``),_=$(r,o),v=r.devices.filter(e=>!_||e.platform===_);return(0,Y.useEffect)(()=>u(e=>v.some(t=>t.name===e)?e:v.find(e=>e.inUse)?.name??v[0]?.name??``),[o,r.devices]),(0,X.jsx)(z,{open:e,onClose:n,title:`Explore a goal`,description:`MobilePilot carries out the goal in the app through Appium and saves what it did as a workflow with checks, to replay with no model.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy||!f.trim()||!o,onClick:async()=>{await t.act(()=>d.explore({app:o,goal:f.trim(),name:m.trim(),...l?{device:l}:{}}))&&(p(``),g(``),n())},"data-tip":`Start: MobilePilot acts in the app on the device`,children:[(0,X.jsx)(j,{"aria-hidden":`true`}),`Start exploring`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(J,{label:`App`,children:(0,X.jsx)(a,{value:o,onChange:e=>s(e.target.value),children:r.apps.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` (`,Z[e.platform]??e.platform,`)`]},e.name))})}),v.length>0&&(0,X.jsx)(J,{label:`Device`,children:(0,X.jsx)(a,{value:l,onChange:e=>u(e.target.value),children:v.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.where]},e.name))})}),(0,X.jsx)(J,{label:`Goal`,hint:`One line, as you would ask a tester.`,children:(0,X.jsx)(i,{value:f,maxLength:500,placeholder:`Sign in and accept the first delivery`,onChange:e=>p(e.target.value)})}),(0,X.jsx)(J,{label:`Name`,hint:`Optional: the workflow's name.`,children:(0,X.jsx)(i,{value:m,maxLength:80,onChange:e=>g(e.target.value)})}),(0,X.jsxs)(`p`,{className:c(h.warn,`m-0 flex gap-2`),children:[(0,X.jsx)(C,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),`MobilePilot taps and types in `,o||`the app`,` on that device. Use a test device and a test account.`]})]})})}function ke({flows:e,page:t,onClose:n}){let{view:r}=t,[i,a]=(0,Y.useState)([]);return(0,Y.useEffect)(()=>{e&&a(Ee(r))},[e]),(0,X.jsx)(z,{open:!!e,onClose:n,title:e?`Run ${s(e.length,`Maestro flow`)}`:`Run Maestro flows`,description:`Runs your team's flows as they are, after ForgeQE's allowlist check. A flow the check refuses stops the run before any device is used, and the run says why.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy||!e?.length||r.devices.length>0&&!i.length,onClick:async()=>{e&&await t.act(()=>d.maestro(e,r.devices.length?i:void 0))&&n()},children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Run flows`]})]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm text-ink-2`,children:e.map(e=>(0,X.jsx)(`li`,{className:`truncate`,"data-tip":e,children:e},e))}),(0,X.jsxs)(G,{level:3,icon:N,title:`Devices`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,X.jsx)(Te,{view:r,picked:i,set:a}),(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Maestro runs on this computer's devices and TestMu's, not BrowserStack's.`})]})]})})}function Ae({open:e,page:t,onClose:n,onDone:r}){let{view:o}=t,[s,c]=(0,Y.useState)(o.builds[0]??``),[l,u]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1);return(0,X.jsx)(z,{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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy||!s,onClick:async()=>{let e=``;await t.act(async()=>{let t=await d.upload({file:s,...l?{app:l}:{},...f.trim()?{name:f.trim()}:{},virtual:m});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.`:``}`})&&(r(e),n())},children:[(0,X.jsx)(ae,{"aria-hidden":`true`}),`Upload`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[o.builds.length?(0,X.jsx)(J,{label:`File`,hint:`An app build found in the project.`,children:(0,X.jsx)(a,{value:s,onChange:e=>c(e.target.value),children:o.builds.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No .apk, .aab, .ipa or .zip in the project: put the build in the project's folder first.`}),(0,X.jsx)(J,{label:`For app`,hint:`Optional: the id is saved as this app's build.`,children:(0,X.jsxs)(a,{value:l,onChange:e=>u(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`No app`}),o.apps.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,X.jsx)(J,{label:`Name`,hint:`Optional: the name TestMu shows.`,children:(0,X.jsx)(i,{value:f,maxLength:120,onChange:e=>p(e.target.value)})}),(0,X.jsx)(q,{on:m,set:h,children:`For TestMu's emulators and simulators`})]})})}function je({open:e,page:t,onClose:n}){let[r,i]=(0,Y.useState)(!1);return(0,X.jsx)(z,{open:e,onClose:n,title:`Set up Appium`,description:`Installs ForgeQE's pinned Appium and its drivers into its tools folder, once. A run on a device on this computer then starts Appium by itself.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy,onClick:async()=>{await t.act(()=>d.setup(r))&&n()},children:[(0,X.jsx)(S,{"aria-hidden":`true`}),`Set up`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(q,{on:r,set:i,children:`Set it up again from scratch`}),(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`A device cloud needs none of this. Maestro is installed by you: maestro on the PATH, or mobile.maestro.command.`})]})})}function Me({page:e,onReplay:t,onExplore:n,onSteps:i}){let{view:o}=e,[s,l]=(0,Y.useState)(o.apps[0]?.name??``),[u,p]=(0,Y.useState)(`all`),m=e=>$(o,e.app),h=u===`all`?o.workflows:o.workflows.filter(e=>m(e)===u),g=()=>e.act(async()=>{await f.start({kind:`mobile`,app:s}),location.hash=r(`record`)});return(0,X.jsx)(R,{label:`Mobile workflows`,minWidth:760,height:L,resetKey:u,placeholder:`Find a workflow`,empty:u===`all`?`No mobile workflows yet: record one by hand, explore a goal, or keep .yaml files with format: forgeqe-mobile-v1 in the project.`:`None.`,tools:(0,X.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[(0,X.jsx)(v,{value:u,onChange:p,items:[{id:`all`,label:`All`,n:o.workflows.length},{id:`android`,label:`Android`,n:o.workflows.filter(e=>m(e)===`android`).length},{id:`ios`,label:`iOS`,n:o.workflows.filter(e=>m(e)===`ios`).length}]}),(0,X.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[o.apps.length>1&&(0,X.jsx)(a,{size:`sm`,"aria-label":`App to record`,value:s,onChange:e=>l(e.target.value),className:`w-auto`,children:o.apps.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,X.jsxs)(b,{size:`sm`,disabled:e.busy||!s,onClick:()=>void g(),"data-tip":`Record your steps in ${s||`an app`}: no model`,children:[(0,X.jsx)(N,{"aria-hidden":`true`}),`Record by hand`]}),(0,X.jsxs)(b,{size:`sm`,variant:`primary`,disabled:e.busy||!o.apps.length,onClick:n,"data-tip":`MobilePilot carries out a goal and saves it as a workflow`,children:[(0,X.jsx)(j,{"aria-hidden":`true`}),`Explore a goal`]})]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Workflow`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`App`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Platform`}),(0,X.jsx)(`th`,{scope:`col`,className:V,children:`Steps`}),(0,X.jsx)(`th`,{scope:`col`,className:V,children:`Checks`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`From`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:h.map(n=>(0,X.jsxs)(`tr`,{className:P,children:[(0,X.jsx)(`td`,{className:B,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(b,{variant:`link`,size:`inline`,onClick:()=>i(n),className:`self-start text-left`,children:n.name}),(0,X.jsx)(`span`,{className:`max-w-[300px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap`),children:n.app||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap`),children:Z[m(n)??``]??(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:H,children:n.steps}),(0,X.jsx)(`td`,{className:c(H,n.checks===0&&`text-warn`),"data-tip":n.checks===0?`No checks of the outcome: a replay passes when its steps run`:void 0,children:n.checks}),(0,X.jsxs)(`td`,{className:c(B,`whitespace-nowrap`),children:[xe[n.from],(0,X.jsx)(`span`,{className:`block text-body-sm text-muted`,children:U(n.modified)})]}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,X.jsx)(b,{size:`icon`,variant:`icon`,onClick:()=>i(n),"aria-label":`Open ${n.name}`,"data-tip":`Open it: steps, checks, test data, last run`,className:`size-8`,children:(0,X.jsx)(ie,{"aria-hidden":`true`})}),(0,X.jsx)(b,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t(n),"aria-label":`Replay ${n.name}`,"data-tip":`Replay ${n.name}`,className:`size-8`,children:(0,X.jsx)(E,{"aria-hidden":`true`})}),(0,X.jsx)(b,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>void e.act(()=>d.validate(n.path)),"aria-label":`Check ${n.name}`,"data-tip":`Check it without running it`,className:`size-8`,children:(0,X.jsx)(A,{"aria-hidden":`true`})}),(0,X.jsx)(b,{size:`icon`,variant:`icon`,onClick:()=>void Q(`MobilePilot: look at the mobile workflow ${n.path} and tell me what to fix or add (a wait, a dialog to dismiss, checks of the outcome); change it only after showing me the change.`,e.setError),"aria-label":`Improve ${n.name} with the agent`,"data-tip":`Improve it with the agent`,className:`size-8`,children:(0,X.jsx)(te,{"aria-hidden":`true`})})]})})]},n.path))})}function Ne({page:e,onRun:t}){let{view:n}=e,[r,i]=(0,Y.useState)([]),a=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,X.jsx)(R,{label:`Maestro flows`,minWidth:640,placeholder:`Find a flow`,empty:`No Maestro flows found: keep them in .maestro/ at the project's root (.yaml files with appId:).`,height:L,selection:{count:n.flows.filter(e=>r.includes(e.path)).length,onClear:()=>i([]),actions:(0,X.jsxs)(b,{size:`sm`,variant:`primary`,disabled:e.busy||!r.length,onClick:()=>t(r),"data-tip":`Run the flows ticked, after ForgeQE's allowlist check`,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Run selected`]})},head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:c(I,`w-10`),children:(0,X.jsx)(W,{"aria-label":`Select all ${s(n.flows.length,`flow`)}`,checked:n.flows.length>0&&n.flows.every(e=>r.includes(e.path)),onCheckedChange:e=>i(e?n.flows.map(e=>e.path):[])})}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Flow`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`App id`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.flows.map(n=>(0,X.jsxs)(`tr`,{className:P,"data-state":r.includes(n.path)?`selected`:void 0,children:[(0,X.jsx)(`td`,{className:c(B,`w-10`),children:(0,X.jsx)(W,{"aria-label":`Pick ${n.name}`,checked:r.includes(n.path),onCheckedChange:e=>a(n.path,e)})}),(0,X.jsx)(`td`,{className:B,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:n.name}),(0,X.jsx)(`span`,{className:`max-w-[340px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap font-mono text-body-sm`),children:n.appId}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,X.jsx)(b,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t([n.path]),"aria-label":`Run ${n.name}`,"data-tip":`Run ${n.name}`,className:`size-8`,children:(0,X.jsx)(E,{"aria-hidden":`true`})}),(0,X.jsx)(b,{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,X.jsx)(M,{"aria-hidden":`true`})})]})})]},n.path))})}function Pe({page:e}){let{view:t}=e,[n,r]=(0,Y.useState)(`all`),[i,a]=(0,Y.useState)(``),o=t.runs.filter(e=>!e.ok),l=t.runs.filter(Ce),u=t.runs.filter(e=>e.mode===`maestro`),d=n===`failed`?o:n===`heals`?l:n===`maestro`?u:t.runs;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[i&&(0,X.jsx)(`p`,{role:`status`,className:c(h.pass,`m-0`),children:i}),(0,X.jsx)(R,{label:`Mobile runs`,minWidth:720,height:L,resetKey:n,placeholder:`Find a run`,empty:n===`all`?`No mobile runs yet: replay, record or explore a workflow, or run your Maestro flows.`:`None.`,tools:(0,X.jsx)(v,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:t.runs.length},{id:`failed`,label:`Failed`,n:o.length,alert:!0},{id:`heals`,label:`Heals to accept`,n:l.length},{id:`maestro`,label:`Maestro flows`,n:u.length}]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Run`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Result`}),(0,X.jsx)(`th`,{scope:`col`,className:V,children:`Steps`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Heals`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:d.map(t=>(0,X.jsxs)(`tr`,{className:P,children:[(0,X.jsx)(`td`,{className:B,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[Se[t.mode],`: `,t.name]}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:[t.app,U(t.at)].filter(Boolean).join(` · `)}),(t.failed||t.error)&&(0,X.jsx)(`span`,{className:`max-w-[380px] truncate text-body-sm text-fail`,"data-tip":t.failed?t.failed.error:t.error,children:t.failed?`Step ${t.failed.index} (${t.failed.op}): ${t.failed.error||`failed`}`:t.error})]})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap`),children:(0,X.jsx)(y,{tone:t.ok?`pass`:`fail`,children:t.many?`${t.many.passed} of ${t.many.total}`:t.ok?`Passed`:`Failed`})}),(0,X.jsx)(`td`,{className:H,children:t.steps||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap`),children:t.heals?t.healsAccepted?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-pass`,children:[(0,X.jsx)(w,{size:14,"aria-hidden":`true`}),`In the workflow`]}):t.ok?(0,X.jsxs)(b,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(async()=>{let e=await p.acceptHeals(t.dir);a(`Wrote ${s(e.written,`healed step`)} into ${e.workflow}.`)}),"data-tip":`Write the new locators into the workflow`,children:[(0,X.jsx)(S,{"aria-hidden":`true`}),`Accept `,s(t.heals,`heal`)]}):(0,X.jsxs)(`span`,{className:`text-body-sm text-muted`,"data-tip":`The replay failed after healing, so its heals may be wrong`,children:[s(t.heals,`heal`),`, not offered`]}):(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t.report&&(0,X.jsx)(de,{path:t.report,children:`Report`}),!t.ok&&(0,X.jsx)(b,{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,X.jsx)(M,{"aria-hidden":`true`})})]})})]},t.dir))})]})}function Fe({page:e,said:t,onSetup:n,onUpload:i}){let{view:a}=e,s=a.ready,l=(e,t)=>`${t}: ${e?`sign-in set`:`no sign-in`}`,u=[{label:`Appium server`,ok:s.appium,note:`${s.appiumNote} (${s.appiumUrl})`},{label:`Maestro`,ok:s.maestro,note:s.maestroNote},{label:`Device clouds`,ok:s.clouds.testmu||s.clouds.browserstack,note:[l(s.clouds.testmu,`TestMu`),l(s.clouds.browserstack,`BrowserStack`)].join(` · `)},{label:`Healing`,ok:a.heal,note:a.heal?`A moved control is healed with the model (Appium only)`:`mobile.heal is off`}],f=c(o,`flex flex-col`);return(0,X.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] items-start gap-6`,children:[(0,X.jsxs)(G,{id:`mobile-machine`,icon:D,title:`This computer`,divider:!1,children:[(0,X.jsx)(`ul`,{className:c(f,`m-0 list-none divide-y divide-line-soft p-0`),children:u.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[e.ok?(0,X.jsx)(w,{size:16,"aria-label":`Ready`,className:`mt-1 flex-none text-pass`}):(0,X.jsx)(C,{size:16,"aria-label":`Not ready`,className:`mt-1 flex-none text-warn`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.note})]})]},e.label))}),s.checked&&(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Checked `,U(s.checked),`.`]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(b,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(()=>d.doctor()),"data-tip":`Whether the Appium server answers and Maestro is installed`,children:[(0,X.jsx)(A,{"aria-hidden":`true`}),`Check`]}),(0,X.jsxs)(b,{size:`sm`,variant:s.appium?`outline`:`primary`,disabled:e.busy,onClick:n,"data-tip":`Install ForgeQE's pinned Appium and its drivers`,children:[(0,X.jsx)(S,{"aria-hidden":`true`}),`Set up Appium`]})]})]}),(0,X.jsxs)(G,{id:`mobile-devices`,icon:N,title:`Devices`,divider:!1,children:[a.devices.length?(0,X.jsx)(`ul`,{className:c(f,`m-0 list-none divide-y divide-line-soft p-0`),children:a.devices.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.about})]}),(0,X.jsx)(y,{tone:`neutral`,children:e.inUse?`In use`:`Off`})]},e.name))}):(0,X.jsx)(g,{className:`py-4`,children:`No devices listed: runs use the device of mobile.appium and mobile.maestro.`}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Devices are added and changed in `,(0,X.jsx)(`a`,{href:r(`settings`,`mobile`),children:`Settings, Mobile`}),`.`]})]}),(0,X.jsxs)(G,{id:`mobile-apps`,icon:re,title:`Apps`,divider:!1,actions:(0,X.jsxs)(b,{size:`sm`,onClick:i,"data-tip":`Upload an app build to TestMu AI`,children:[(0,X.jsx)(ae,{"aria-hidden":`true`}),`Upload a build`]}),children:[t&&(0,X.jsx)(`p`,{role:`status`,className:c(h.pass,`m-0`),children:t}),a.apps.length?(0,X.jsx)(`ul`,{className:c(f,`m-0 list-none divide-y divide-line-soft p-0`),children:a.apps.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,X.jsx)(_,{icon:N,size:16,className:`mt-1 flex-none text-muted`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[Z[e.platform]??e.platform,e.appId,e.build?`build ${e.build}`:`no build uploaded`].filter(Boolean).join(` · `)})]})]},e.name))}):(0,X.jsxs)(g,{className:`py-4`,children:[`No mobile apps yet: add one in `,(0,X.jsx)(`a`,{href:r(`settings`,`environments`),children:`Settings, Environments`}),`.`]}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Secrets a workflow may type: `,a.secrets.length?a.secrets.join(`, `):`none`,`.`]})]})]})}function Ie({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(Ce).length,o=e.workflows.filter(e=>e.checks===0).length,c=[e.ready.appium&&`Appium`,e.ready.maestro&&`Maestro`].filter(Boolean).join(` · `);return(0,X.jsxs)(le,{label:`Mobile at a glance`,children:[(0,X.jsx)(F,{compact:!0,label:`Workflows`,value:e.workflows.length,note:o?(0,X.jsxs)(`span`,{className:`text-warn`,children:[o,` without checks`]}):`${s(e.apps.length,`app`)}`}),(0,X.jsx)(F,{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 ${U(i.at)}`:`None yet`}),(0,X.jsx)(F,{compact:!0,label:`Heals to accept`,value:a,tone:a?`text-accent-fg`:void 0,note:a?(0,X.jsx)(b,{variant:`link`,size:`inline`,onClick:()=>t(`runs`),children:`Review them`}):`From passed replays`}),(0,X.jsx)(F,{compact:!0,label:`Replay here`,value:c||(e.ready.checked?`Not ready`:`—`),tone:c?`text-pass`:e.ready.checked?`text-warn`:void 0,note:c?`${s(e.devices.filter(e=>e.inUse).length,`device`)} in use`:(0,X.jsx)(b,{variant:`link`,size:`inline`,onClick:()=>t(`devices`),children:e.ready.checked?`Set it up`:`Check it`})})]})}function Le({live:e,job:t,page:n}){let[r,i]=(0,Y.useState)(``),a=e.find(e=>e.id===r)??e[0],o=t&&(t.running||!t.endedAt||Date.now()-Date.parse(t.endedAt)<6e5);return a?(0,X.jsxs)(`section`,{"aria-label":`The device at work`,className:`grid grid-cols-1 items-start gap-6 @[700px]:grid-cols-[minmax(0,300px)_minmax(0,1fr)]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[e.length>1&&(0,X.jsx)(v,{value:a.id,onChange:i,items:e.map(e=>({id:e.id,label:e.device||e.id.split(`/`).at(-1)||`Device`}))}),(0,X.jsx)(ge,{d:a,picture:d.screen})]}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:t&&o?(0,X.jsx)(he,{job:t,onStop:n.stop,words:be}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Started from a chat: its lines are in the chat.`})})]}):o&&t?(0,X.jsx)(he,{job:t,onStop:n.stop,words:be}):null}function Re({sub:e}){let t=we(),{view:i,error:a}=t,o=u(`mobile`),s=(e??``).split(`/`),l=s[0]===`workflow`&&s[1]?n(s[1]):``,f=l?`workflows`:ve.includes(s[0])?s[0]:K,[p,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),T=l&&i?.workflows.find(e=>e.path===l)||null,E=e=>location.hash=e?r(`mobile`,`workflow`,encodeURIComponent(e.path)):r(`mobile`,`workflows`),[D,ee]=(0,Y.useState)(``),O=i?.job??null,k=e=>e===`agent`?r(`mobile`,K):r(`mobile`,e),A=e=>location.hash=k(e),j={workflows:`Workflows${i?` (${i.workflows.length})`:``}`,flows:`Maestro flows${i?` (${i.flows.length})`:``}`,runs:`Runs${i?` (${i.runs.length})`:``}`,devices:`Devices and apps`};return(0,X.jsxs)(pe,{title:ue(`mobile`),page:o,label:`Mobile apps`,current:f,tabHref:k,onPick:A,tabs:ve.map(e=>({id:e,label:j[e],icon:ye[e]})),below:(0,X.jsx)(fe,{page:o}),children:[(0,X.jsx)(`p`,{className:`m-0 text-body-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.`}),a&&(0,X.jsx)(me,{text:a}),!i&&!a&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),i&&T&&(0,X.jsx)(_e,{workflow:T.path,backLabel:`Workflows`,tab:s[2],onTab:e=>location.hash=e===`steps`?r(`mobile`,`workflow`,encodeURIComponent(T.path)):r(`mobile`,`workflow`,encodeURIComponent(T.path),e),onClose:()=>{E(null),t.load()}},T.path),i&&!T&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ie,{view:i,onTab:A}),(0,X.jsx)(Le,{live:i.live,job:O,page:{...t,view:i}}),O?.question&&(0,X.jsxs)(`div`,{className:c(h.info,`flex flex-col gap-2`),children:[(0,X.jsx)(`p`,{className:`m-0 font-medium`,children:O.question.title}),O.question.detail&&(0,X.jsx)(`p`,{className:`m-0 text-ink-2`,children:O.question.detail}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[O.question.options.map(e=>(0,X.jsx)(b,{size:`sm`,onClick:()=>void t.act(()=>d.answer(O.question.id,e.id)),children:e.label},e.id)),(0,X.jsxs)(b,{size:`sm`,variant:`danger`,onClick:()=>void t.act(()=>d.answer(O.question.id,null)),children:[(0,X.jsx)(ne,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})]}),(0,X.jsxs)(`div`,{children:[f===`workflows`&&(0,X.jsx)(Me,{page:{...t,view:i},onReplay:m,onExplore:()=>_(!0),onSteps:E}),f===`flows`&&(0,X.jsx)(Ne,{page:{...t,view:i},onRun:y}),f===`runs`&&(0,X.jsx)(Pe,{page:{...t,view:i}}),f===`devices`&&(0,X.jsx)(Fe,{page:{...t,view:i},said:D,onSetup:()=>w(!0),onUpload:()=>S(!0)})]}),(0,X.jsx)(De,{w:p,page:{...t,view:i},onClose:()=>m(null)}),(0,X.jsx)(Oe,{open:g,page:{...t,view:i},onClose:()=>_(!1)}),(0,X.jsx)(ke,{flows:v,page:{...t,view:i},onClose:()=>y(null)}),(0,X.jsx)(Ae,{open:x,page:{...t,view:i},onClose:()=>S(!1),onDone:ee}),(0,X.jsx)(je,{open:C,page:{...t,view:i},onClose:()=>w(!1)})]})]})}export{Re as Mobile};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-oDy8sV6H.js";import{F as i,L as a,l as o}from"./preload-helper-BupTYkQW.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{d as u}from"./sectionList-B651VPon.js";import{H as d,Y as f,w as p,y as m}from"./api-BUoHbp5V.js";import{C as h,_ as g,b as _,f as v,g as y,x as b}from"./pageBack-D89f9SN4.js";import{Fr as x,Lr as S,M as C,N as w,Or as T,Pn as E,Q as D,Qn as ee,Rr as O,et as k,in as A,ir as j,jr as te,mn as M,nr as N,or as ne,r as re,st as ie,wr as ae}from"./line-icons-CwCZidXs.js";import{Gt as oe,Kt as se,St as P,at as F,bt as I,dt as ce,gt as L,ht as R,ot as le,qt as z,vt as B,xt as V,yt as H}from"./frame-DW-Hx3fC.js";import{t as U}from"./when-BuWCTaKm.js";import{u as ue}from"./nav-DE7YMNUI.js";import{n as de}from"./markdown-BhteivTy.js";import{G as W,K as G,l as fe,n as pe,t as K}from"./index-CsEmZt6_.js";import{f as q,l as me,o as he,r as J}from"./dataParts-DbfDDph_.js";import{t as ge}from"./LiveDevice-DdzQmJat.js";import{t as _e}from"./DesktopReview-CfozOqkA.js";var Y=e(t(),1),X=l(),ve=[`workflows`,`flows`,`runs`,`devices`],ye={workflows:x,flows:A,runs:E,devices:N},be={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`]},xe={explore:`Explored`,record:`Recorded`,project:`Project`},Se={replay:`Replay`,explore:`Explore`,record:`Recording`,maestro:`Maestro`},Ce=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 m.start(e,{},`mobile`);location.hash=r(`chats`,t)}catch(e){t(e.message)}}function we(){let[e,t]=(0,Y.useState)(null),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(!1),o=(0,Y.useCallback)(()=>{d.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,Y.useEffect)(o,[o]);let s=!!e?.job?.running||!!e?.live.length;return(0,Y.useEffect)(()=>{if(!s)return;let e=se(()=>{d.live().then(({live:e,job:n})=>t(t=>t&&(t.job?.running&&!n?.running&&o(),{...t,live:e,job:n})),()=>{})},1e3);return()=>oe(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 d.stop().then(o)}}function Te({view:e,platform:t,picked:n,set:i}){let a=e.devices.filter(e=>!t||e.platform===t);return e.devices.length?a.length?(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,X.jsx)(W,{checked:n.includes(e.name),onCheckedChange:t=>i(t?[...n,e.name]:n.filter(t=>t!==e.name))}),(0,X.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,X.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.where]})]},e.name))}):(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-warn`,children:[`No device of mobile.devices is `,Z[t??``]??t,`.`]}):(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`The device of mobile.appium and mobile.maestro: add devices in `,(0,X.jsx)(`a`,{href:r(`settings`,`mobile`),children:`Settings, Mobile`}),` to pick them here.`]})}var Ee=(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 De({w:e,page:t,onClose:n}){let{view:r}=t,[l,u]=(0,Y.useState)(r.driver),[f,p]=(0,Y.useState)([]),[m,g]=(0,Y.useState)({}),[_,v]=(0,Y.useState)(``),[y,x]=(0,Y.useState)(r.heal),[S,C]=(0,Y.useState)(!1),w=e?$(r,e.app):void 0;(0,Y.useEffect)(()=>{e&&(u(r.driver),p(Ee(r,w)),g(Object.fromEntries(e.variables.map(e=>[e.name,e.value]))),v(``),x(r.heal),C(!1))},[e]);let D=c(o,`flex flex-col gap-4`),A=l===`maestro`;return(0,X.jsx)(z,{open:!!e,onClose:n,title:e?`Replay ${e.name}`:`Replay`,description:`Runs the workflow's steps on each device with no model, checking its expect steps. Use a test device and a test account.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy||!e||r.devices.length>0&&!f.length,onClick:async()=>{e&&await t.act(()=>d.replay({workflow:e.path,driver:l,...r.devices.length?{devices:f}:{},variables:m,..._?{rows:_}:{},heal:y,updateBaselines:S}))&&n()},"data-tip":`Replay now`,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Replay`]})]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-4 text-body-sm text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,X.jsxs)(`span`,{children:[e.app||`no app`,` · `,s(e.steps,`step`),` · `,s(e.checks,`check`)]})]}),e.checks===0&&(0,X.jsx)(`p`,{className:c(h.warn,`m-0`),children:`It has no checks of the outcome: a replay passes when its steps run. Ask the agent to add expect steps.`}),(0,X.jsx)(J,{label:`Driver`,children:(0,X.jsx)(ce,{label:`Driver`,value:l,onChange:u,options:[{id:`appium`,label:`Appium`},{id:`maestro`,label:`Maestro`}],className:`self-start`})}),(0,X.jsx)(G,{level:3,icon:N,title:`Devices`,className:D,children:(0,X.jsx)(Te,{view:r,platform:w,picked:f,set:p})}),e.variables.length>0&&(0,X.jsx)(G,{level:3,icon:T,title:`Values`,className:D,children:(0,X.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-4`,children:e.variables.map(e=>(0,X.jsx)(J,{label:e.name,children:(0,X.jsx)(i,{value:m[e.name]??``,onChange:t=>g({...m,[e.name]:t.target.value})})},e.name))})}),(0,X.jsx)(G,{level:3,icon:k,title:`Test data`,className:D,children:(0,X.jsx)(J,{label:`Rows`,hint:`Each row replays the workflow once, its columns over the values above.`,children:(0,X.jsxs)(a,{value:_,onChange:e=>v(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`Once, with the values above`}),r.rows.files.map(e=>(0,X.jsxs)(`option`,{value:e,children:[`Each row of `,e]},e))]})})}),(0,X.jsx)(G,{level:3,icon:ee,title:`While it runs`,className:D,children:A?(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Maestro doesn't heal a moved control or compare images: replay on Appium for those.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{on:y,set:x,children:`Heal a step whose control moved`}),(0,X.jsx)(q,{on:S,set:C,children:`Take new image baselines`})]})})]})})}function Oe({open:e,page:t,onClose:n}){let{view:r}=t,[o,s]=(0,Y.useState)(r.apps[0]?.name??``),[l,u]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,g]=(0,Y.useState)(``),_=$(r,o),v=r.devices.filter(e=>!_||e.platform===_);return(0,Y.useEffect)(()=>u(e=>v.some(t=>t.name===e)?e:v.find(e=>e.inUse)?.name??v[0]?.name??``),[o,r.devices]),(0,X.jsx)(z,{open:e,onClose:n,title:`Explore a goal`,description:`MobilePilot carries out the goal in the app through Appium and saves what it did as a workflow with checks, to replay with no model.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy||!f.trim()||!o,onClick:async()=>{await t.act(()=>d.explore({app:o,goal:f.trim(),name:m.trim(),...l?{device:l}:{}}))&&(p(``),g(``),n())},"data-tip":`Start: MobilePilot acts in the app on the device`,children:[(0,X.jsx)(j,{"aria-hidden":`true`}),`Start exploring`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(J,{label:`App`,children:(0,X.jsx)(a,{value:o,onChange:e=>s(e.target.value),children:r.apps.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` (`,Z[e.platform]??e.platform,`)`]},e.name))})}),v.length>0&&(0,X.jsx)(J,{label:`Device`,children:(0,X.jsx)(a,{value:l,onChange:e=>u(e.target.value),children:v.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.where]},e.name))})}),(0,X.jsx)(J,{label:`Goal`,hint:`One line, as you would ask a tester.`,children:(0,X.jsx)(i,{value:f,maxLength:500,placeholder:`Sign in and accept the first delivery`,onChange:e=>p(e.target.value)})}),(0,X.jsx)(J,{label:`Name`,hint:`Optional: the workflow's name.`,children:(0,X.jsx)(i,{value:m,maxLength:80,onChange:e=>g(e.target.value)})}),(0,X.jsxs)(`p`,{className:c(h.warn,`m-0 flex gap-2`),children:[(0,X.jsx)(C,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),`MobilePilot taps and types in `,o||`the app`,` on that device. Use a test device and a test account.`]})]})})}function ke({flows:e,page:t,onClose:n}){let{view:r}=t,[i,a]=(0,Y.useState)([]);return(0,Y.useEffect)(()=>{e&&a(Ee(r))},[e]),(0,X.jsx)(z,{open:!!e,onClose:n,title:e?`Run ${s(e.length,`Maestro flow`)}`:`Run Maestro flows`,description:`Runs your team's flows as they are, after ForgeQE's allowlist check. A flow the check refuses stops the run before any device is used, and the run says why.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy||!e?.length||r.devices.length>0&&!i.length,onClick:async()=>{e&&await t.act(()=>d.maestro(e,r.devices.length?i:void 0))&&n()},children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Run flows`]})]}),children:e&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm text-ink-2`,children:e.map(e=>(0,X.jsx)(`li`,{className:`truncate`,"data-tip":e,children:e},e))}),(0,X.jsxs)(G,{level:3,icon:N,title:`Devices`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,X.jsx)(Te,{view:r,picked:i,set:a}),(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Maestro runs on this computer's devices and TestMu's, not BrowserStack's.`})]})]})})}function Ae({open:e,page:t,onClose:n,onDone:r}){let{view:o}=t,[s,c]=(0,Y.useState)(o.builds[0]??``),[l,u]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1);return(0,X.jsx)(z,{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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy||!s,onClick:async()=>{let e=``;await t.act(async()=>{let t=await d.upload({file:s,...l?{app:l}:{},...f.trim()?{name:f.trim()}:{},virtual:m});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.`:``}`})&&(r(e),n())},children:[(0,X.jsx)(ae,{"aria-hidden":`true`}),`Upload`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[o.builds.length?(0,X.jsx)(J,{label:`File`,hint:`An app build found in the project.`,children:(0,X.jsx)(a,{value:s,onChange:e=>c(e.target.value),children:o.builds.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No .apk, .aab, .ipa or .zip in the project: put the build in the project's folder first.`}),(0,X.jsx)(J,{label:`For app`,hint:`Optional: the id is saved as this app's build.`,children:(0,X.jsxs)(a,{value:l,onChange:e=>u(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`No app`}),o.apps.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,X.jsx)(J,{label:`Name`,hint:`Optional: the name TestMu shows.`,children:(0,X.jsx)(i,{value:f,maxLength:120,onChange:e=>p(e.target.value)})}),(0,X.jsx)(q,{on:m,set:h,children:`For TestMu's emulators and simulators`})]})})}function je({open:e,page:t,onClose:n}){let[r,i]=(0,Y.useState)(!1);return(0,X.jsx)(z,{open:e,onClose:n,title:`Set up Appium`,description:`Installs ForgeQE's pinned Appium and its drivers into its tools folder, once. A run on a device on this computer then starts Appium by itself.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(b,{onClick:n,children:[(0,X.jsx)(O,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(b,{variant:`primary`,disabled:t.busy,onClick:async()=>{await t.act(()=>d.setup(r))&&n()},children:[(0,X.jsx)(S,{"aria-hidden":`true`}),`Set up`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsx)(q,{on:r,set:i,children:`Set it up again from scratch`}),(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`A device cloud needs none of this. Maestro is installed by you: maestro on the PATH, or mobile.maestro.command.`})]})})}function Me({page:e,onReplay:t,onExplore:n,onSteps:i}){let{view:o}=e,[s,l]=(0,Y.useState)(o.apps[0]?.name??``),[u,p]=(0,Y.useState)(`all`),m=e=>$(o,e.app),h=u===`all`?o.workflows:o.workflows.filter(e=>m(e)===u),g=()=>e.act(async()=>{await f.start({kind:`mobile`,app:s}),location.hash=r(`record`)});return(0,X.jsx)(R,{label:`Mobile workflows`,minWidth:760,height:L,resetKey:u,placeholder:`Find a workflow`,empty:u===`all`?`No mobile workflows yet: record one by hand, explore a goal, or keep .yaml files with format: forgeqe-mobile-v1 in the project.`:`None.`,tools:(0,X.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[(0,X.jsx)(v,{value:u,onChange:p,items:[{id:`all`,label:`All`,n:o.workflows.length},{id:`android`,label:`Android`,n:o.workflows.filter(e=>m(e)===`android`).length},{id:`ios`,label:`iOS`,n:o.workflows.filter(e=>m(e)===`ios`).length}]}),(0,X.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[o.apps.length>1&&(0,X.jsx)(a,{size:`sm`,"aria-label":`App to record`,value:s,onChange:e=>l(e.target.value),className:`w-auto`,children:o.apps.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,X.jsxs)(b,{size:`sm`,disabled:e.busy||!s,onClick:()=>void g(),"data-tip":`Record your steps in ${s||`an app`}: no model`,children:[(0,X.jsx)(N,{"aria-hidden":`true`}),`Record by hand`]}),(0,X.jsxs)(b,{size:`sm`,variant:`primary`,disabled:e.busy||!o.apps.length,onClick:n,"data-tip":`MobilePilot carries out a goal and saves it as a workflow`,children:[(0,X.jsx)(j,{"aria-hidden":`true`}),`Explore a goal`]})]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Workflow`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`App`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Platform`}),(0,X.jsx)(`th`,{scope:`col`,className:V,children:`Steps`}),(0,X.jsx)(`th`,{scope:`col`,className:V,children:`Checks`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`From`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:h.map(n=>(0,X.jsxs)(`tr`,{className:P,children:[(0,X.jsx)(`td`,{className:B,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(b,{variant:`link`,size:`inline`,onClick:()=>i(n),className:`self-start text-left`,children:n.name}),(0,X.jsx)(`span`,{className:`max-w-[300px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap`),children:n.app||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap`),children:Z[m(n)??``]??(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:H,children:n.steps}),(0,X.jsx)(`td`,{className:c(H,n.checks===0&&`text-warn`),"data-tip":n.checks===0?`No checks of the outcome: a replay passes when its steps run`:void 0,children:n.checks}),(0,X.jsxs)(`td`,{className:c(B,`whitespace-nowrap`),children:[xe[n.from],(0,X.jsx)(`span`,{className:`block text-body-sm text-muted`,children:U(n.modified)})]}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,X.jsx)(b,{size:`icon`,variant:`icon`,onClick:()=>i(n),"aria-label":`Open ${n.name}`,"data-tip":`Open it: steps, checks, test data, last run`,className:`size-8`,children:(0,X.jsx)(ie,{"aria-hidden":`true`})}),(0,X.jsx)(b,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t(n),"aria-label":`Replay ${n.name}`,"data-tip":`Replay ${n.name}`,className:`size-8`,children:(0,X.jsx)(E,{"aria-hidden":`true`})}),(0,X.jsx)(b,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>void e.act(()=>d.validate(n.path)),"aria-label":`Check ${n.name}`,"data-tip":`Check it without running it`,className:`size-8`,children:(0,X.jsx)(A,{"aria-hidden":`true`})}),(0,X.jsx)(b,{size:`icon`,variant:`icon`,onClick:()=>void Q(`MobilePilot: look at the mobile workflow ${n.path} and tell me what to fix or add (a wait, a dialog to dismiss, checks of the outcome); change it only after showing me the change.`,e.setError),"aria-label":`Improve ${n.name} with the agent`,"data-tip":`Improve it with the agent`,className:`size-8`,children:(0,X.jsx)(te,{"aria-hidden":`true`})})]})})]},n.path))})}function Ne({page:e,onRun:t}){let{view:n}=e,[r,i]=(0,Y.useState)([]),a=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,X.jsx)(R,{label:`Maestro flows`,minWidth:640,placeholder:`Find a flow`,empty:`No Maestro flows found: keep them in .maestro/ at the project's root (.yaml files with appId:).`,height:L,selection:{count:n.flows.filter(e=>r.includes(e.path)).length,onClear:()=>i([]),actions:(0,X.jsxs)(b,{size:`sm`,variant:`primary`,disabled:e.busy||!r.length,onClick:()=>t(r),"data-tip":`Run the flows ticked, after ForgeQE's allowlist check`,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Run selected`]})},head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:c(I,`w-10`),children:(0,X.jsx)(W,{"aria-label":`Select all ${s(n.flows.length,`flow`)}`,checked:n.flows.length>0&&n.flows.every(e=>r.includes(e.path)),onCheckedChange:e=>i(e?n.flows.map(e=>e.path):[])})}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Flow`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`App id`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.flows.map(n=>(0,X.jsxs)(`tr`,{className:P,"data-state":r.includes(n.path)?`selected`:void 0,children:[(0,X.jsx)(`td`,{className:c(B,`w-10`),children:(0,X.jsx)(W,{"aria-label":`Pick ${n.name}`,checked:r.includes(n.path),onCheckedChange:e=>a(n.path,e)})}),(0,X.jsx)(`td`,{className:B,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:n.name}),(0,X.jsx)(`span`,{className:`max-w-[340px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap font-mono text-body-sm`),children:n.appId}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,X.jsx)(b,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t([n.path]),"aria-label":`Run ${n.name}`,"data-tip":`Run ${n.name}`,className:`size-8`,children:(0,X.jsx)(E,{"aria-hidden":`true`})}),(0,X.jsx)(b,{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,X.jsx)(M,{"aria-hidden":`true`})})]})})]},n.path))})}function Pe({page:e}){let{view:t}=e,[n,r]=(0,Y.useState)(`all`),[i,a]=(0,Y.useState)(``),o=t.runs.filter(e=>!e.ok),l=t.runs.filter(Ce),u=t.runs.filter(e=>e.mode===`maestro`),d=n===`failed`?o:n===`heals`?l:n===`maestro`?u:t.runs;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[i&&(0,X.jsx)(`p`,{role:`status`,className:c(h.pass,`m-0`),children:i}),(0,X.jsx)(R,{label:`Mobile runs`,minWidth:720,height:L,resetKey:n,placeholder:`Find a run`,empty:n===`all`?`No mobile runs yet: replay, record or explore a workflow, or run your Maestro flows.`:`None.`,tools:(0,X.jsx)(v,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:t.runs.length},{id:`failed`,label:`Failed`,n:o.length,alert:!0},{id:`heals`,label:`Heals to accept`,n:l.length},{id:`maestro`,label:`Maestro flows`,n:u.length}]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Run`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Result`}),(0,X.jsx)(`th`,{scope:`col`,className:V,children:`Steps`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:`Heals`}),(0,X.jsx)(`th`,{scope:`col`,className:I,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:d.map(t=>(0,X.jsxs)(`tr`,{className:P,children:[(0,X.jsx)(`td`,{className:B,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[Se[t.mode],`: `,t.name]}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:[t.app,U(t.at)].filter(Boolean).join(` · `)}),(t.failed||t.error)&&(0,X.jsx)(`span`,{className:`max-w-[380px] truncate text-body-sm text-fail`,"data-tip":t.failed?t.failed.error:t.error,children:t.failed?`Step ${t.failed.index} (${t.failed.op}): ${t.failed.error||`failed`}`:t.error})]})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap`),children:(0,X.jsx)(y,{tone:t.ok?`pass`:`fail`,children:t.many?`${t.many.passed} of ${t.many.total}`:t.ok?`Passed`:`Failed`})}),(0,X.jsx)(`td`,{className:H,children:t.steps||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap`),children:t.heals?t.healsAccepted?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-pass`,children:[(0,X.jsx)(w,{size:14,"aria-hidden":`true`}),`In the workflow`]}):t.ok?(0,X.jsxs)(b,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(async()=>{let e=await p.acceptHeals(t.dir);a(`Wrote ${s(e.written,`healed step`)} into ${e.workflow}.`)}),"data-tip":`Write the new locators into the workflow`,children:[(0,X.jsx)(S,{"aria-hidden":`true`}),`Accept `,s(t.heals,`heal`)]}):(0,X.jsxs)(`span`,{className:`text-body-sm text-muted`,"data-tip":`The replay failed after healing, so its heals may be wrong`,children:[s(t.heals,`heal`),`, not offered`]}):(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:c(B,`whitespace-nowrap text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t.report&&(0,X.jsx)(de,{path:t.report,children:`Report`}),!t.ok&&(0,X.jsx)(b,{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,X.jsx)(M,{"aria-hidden":`true`})})]})})]},t.dir))})]})}function Fe({page:e,said:t,onSetup:n,onUpload:i}){let{view:a}=e,s=a.ready,l=(e,t)=>`${t}: ${e?`sign-in set`:`no sign-in`}`,u=[{label:`Appium server`,ok:s.appium,note:`${s.appiumNote} (${s.appiumUrl})`},{label:`Maestro`,ok:s.maestro,note:s.maestroNote},{label:`Device clouds`,ok:s.clouds.testmu||s.clouds.browserstack,note:[l(s.clouds.testmu,`TestMu`),l(s.clouds.browserstack,`BrowserStack`)].join(` · `)},{label:`Healing`,ok:a.heal,note:a.heal?`A moved control is healed with the model (Appium only)`:`mobile.heal is off`}],f=c(o,`flex flex-col`);return(0,X.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] items-start gap-6`,children:[(0,X.jsxs)(G,{id:`mobile-machine`,icon:D,title:`This computer`,divider:!1,children:[(0,X.jsx)(`ul`,{className:c(f,`m-0 list-none divide-y divide-line-soft p-0`),children:u.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[e.ok?(0,X.jsx)(w,{size:16,"aria-label":`Ready`,className:`mt-1 flex-none text-pass`}):(0,X.jsx)(C,{size:16,"aria-label":`Not ready`,className:`mt-1 flex-none text-warn`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.note})]})]},e.label))}),s.checked&&(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Checked `,U(s.checked),`.`]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(b,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(()=>d.doctor()),"data-tip":`Whether the Appium server answers and Maestro is installed`,children:[(0,X.jsx)(A,{"aria-hidden":`true`}),`Check`]}),(0,X.jsxs)(b,{size:`sm`,variant:s.appium?`outline`:`primary`,disabled:e.busy,onClick:n,"data-tip":`Install ForgeQE's pinned Appium and its drivers`,children:[(0,X.jsx)(S,{"aria-hidden":`true`}),`Set up Appium`]})]})]}),(0,X.jsxs)(G,{id:`mobile-devices`,icon:N,title:`Devices`,divider:!1,children:[a.devices.length?(0,X.jsx)(`ul`,{className:c(f,`m-0 list-none divide-y divide-line-soft p-0`),children:a.devices.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.about})]}),(0,X.jsx)(y,{tone:`neutral`,children:e.inUse?`In use`:`Off`})]},e.name))}):(0,X.jsx)(g,{className:`py-4`,children:`No devices listed: runs use the device of mobile.appium and mobile.maestro.`}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Devices are added and changed in `,(0,X.jsx)(`a`,{href:r(`settings`,`mobile`),children:`Settings, Mobile`}),`.`]})]}),(0,X.jsxs)(G,{id:`mobile-apps`,icon:re,title:`Apps`,divider:!1,actions:(0,X.jsxs)(b,{size:`sm`,onClick:i,"data-tip":`Upload an app build to TestMu AI`,children:[(0,X.jsx)(ae,{"aria-hidden":`true`}),`Upload a build`]}),children:[t&&(0,X.jsx)(`p`,{role:`status`,className:c(h.pass,`m-0`),children:t}),a.apps.length?(0,X.jsx)(`ul`,{className:c(f,`m-0 list-none divide-y divide-line-soft p-0`),children:a.apps.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,X.jsx)(_,{icon:N,size:16,className:`mt-1 flex-none text-muted`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[Z[e.platform]??e.platform,e.appId,e.build?`build ${e.build}`:`no build uploaded`].filter(Boolean).join(` · `)})]})]},e.name))}):(0,X.jsxs)(g,{className:`py-4`,children:[`No mobile apps yet: add one in `,(0,X.jsx)(`a`,{href:r(`settings`,`environments`),children:`Settings, Environments`}),`.`]}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Secrets a workflow may type: `,a.secrets.length?a.secrets.join(`, `):`none`,`.`]})]})]})}function Ie({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(Ce).length,o=e.workflows.filter(e=>e.checks===0).length,c=[e.ready.appium&&`Appium`,e.ready.maestro&&`Maestro`].filter(Boolean).join(` · `);return(0,X.jsxs)(le,{label:`Mobile at a glance`,children:[(0,X.jsx)(F,{compact:!0,label:`Workflows`,value:e.workflows.length,note:o?(0,X.jsxs)(`span`,{className:`text-warn`,children:[o,` without checks`]}):`${s(e.apps.length,`app`)}`}),(0,X.jsx)(F,{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 ${U(i.at)}`:`None yet`}),(0,X.jsx)(F,{compact:!0,label:`Heals to accept`,value:a,tone:a?`text-accent-fg`:void 0,note:a?(0,X.jsx)(b,{variant:`link`,size:`inline`,onClick:()=>t(`runs`),children:`Review them`}):`From passed replays`}),(0,X.jsx)(F,{compact:!0,label:`Replay here`,value:c||(e.ready.checked?`Not ready`:`—`),tone:c?`text-pass`:e.ready.checked?`text-warn`:void 0,note:c?`${s(e.devices.filter(e=>e.inUse).length,`device`)} in use`:(0,X.jsx)(b,{variant:`link`,size:`inline`,onClick:()=>t(`devices`),children:e.ready.checked?`Set it up`:`Check it`})})]})}function Le({live:e,job:t,page:n}){let[r,i]=(0,Y.useState)(``),a=e.find(e=>e.id===r)??e[0],o=t&&(t.running||!t.endedAt||Date.now()-Date.parse(t.endedAt)<6e5);return a?(0,X.jsxs)(`section`,{"aria-label":`The device at work`,className:`grid grid-cols-1 items-start gap-6 @[700px]:grid-cols-[minmax(0,300px)_minmax(0,1fr)]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[e.length>1&&(0,X.jsx)(v,{value:a.id,onChange:i,items:e.map(e=>({id:e.id,label:e.device||e.id.split(`/`).at(-1)||`Device`}))}),(0,X.jsx)(ge,{d:a,picture:d.screen})]}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:t&&o?(0,X.jsx)(he,{job:t,onStop:n.stop,words:be}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Started from a chat: its lines are in the chat.`})})]}):o&&t?(0,X.jsx)(he,{job:t,onStop:n.stop,words:be}):null}function Re({sub:e}){let t=we(),{view:i,error:a}=t,o=u(`mobile`),s=(e??``).split(`/`),l=s[0]===`workflow`&&s[1]?n(s[1]):``,f=l?`workflows`:ve.includes(s[0])?s[0]:K,[p,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),T=l&&i?.workflows.find(e=>e.path===l)||null,E=e=>location.hash=e?r(`mobile`,`workflow`,encodeURIComponent(e.path)):r(`mobile`,`workflows`),[D,ee]=(0,Y.useState)(``),O=i?.job??null,k=e=>e===`agent`?r(`mobile`,K):r(`mobile`,e),A=e=>location.hash=k(e),j={workflows:`Workflows${i?` (${i.workflows.length})`:``}`,flows:`Maestro flows${i?` (${i.flows.length})`:``}`,runs:`Runs${i?` (${i.runs.length})`:``}`,devices:`Devices and apps`};return(0,X.jsxs)(pe,{title:ue(`mobile`),page:o,label:`Mobile apps`,current:f,tabHref:k,onPick:A,tabs:ve.map(e=>({id:e,label:j[e],icon:ye[e]})),below:(0,X.jsx)(fe,{page:o}),children:[(0,X.jsx)(`p`,{className:`m-0 text-body-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.`}),a&&(0,X.jsx)(me,{text:a}),!i&&!a&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),i&&T&&(0,X.jsx)(_e,{workflow:T.path,backLabel:`Workflows`,tab:s[2],onTab:e=>location.hash=e===`steps`?r(`mobile`,`workflow`,encodeURIComponent(T.path)):r(`mobile`,`workflow`,encodeURIComponent(T.path),e),onClose:()=>{E(null),t.load()}},T.path),i&&!T&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ie,{view:i,onTab:A}),(0,X.jsx)(Le,{live:i.live,job:O,page:{...t,view:i}}),O?.question&&(0,X.jsxs)(`div`,{className:c(h.info,`flex flex-col gap-2`),children:[(0,X.jsx)(`p`,{className:`m-0 font-medium`,children:O.question.title}),O.question.detail&&(0,X.jsx)(`p`,{className:`m-0 text-ink-2`,children:O.question.detail}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[O.question.options.map(e=>(0,X.jsx)(b,{size:`sm`,onClick:()=>void t.act(()=>d.answer(O.question.id,e.id)),children:e.label},e.id)),(0,X.jsxs)(b,{size:`sm`,variant:`danger`,onClick:()=>void t.act(()=>d.answer(O.question.id,null)),children:[(0,X.jsx)(ne,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})]}),(0,X.jsxs)(`div`,{children:[f===`workflows`&&(0,X.jsx)(Me,{page:{...t,view:i},onReplay:m,onExplore:()=>_(!0),onSteps:E}),f===`flows`&&(0,X.jsx)(Ne,{page:{...t,view:i},onRun:y}),f===`runs`&&(0,X.jsx)(Pe,{page:{...t,view:i}}),f===`devices`&&(0,X.jsx)(Fe,{page:{...t,view:i},said:D,onSetup:()=>w(!0),onUpload:()=>S(!0)})]}),(0,X.jsx)(De,{w:p,page:{...t,view:i},onClose:()=>m(null)}),(0,X.jsx)(Oe,{open:g,page:{...t,view:i},onClose:()=>_(!1)}),(0,X.jsx)(ke,{flows:v,page:{...t,view:i},onClose:()=>y(null)}),(0,X.jsx)(Ae,{open:x,page:{...t,view:i},onClose:()=>S(!1),onDone:ee}),(0,X.jsx)(je,{open:C,page:{...t,view:i},onClose:()=>w(!1)})]})]})}export{Re as Mobile};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-oDy8sV6H.js";import{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{L as a}from"./palette-6YAAmgkD.js";import{v as o}from"./api-BsiuHmJq.js";import{C as s,S as c,_ as l,f as u,g as d,i as f,n as p,o as m,u as h}from"./pageBack-CbyKfisx.js";import{Kn as g,Lr as _,Pn as v,Q as y,Sr as b,o as x,qt as S,ur as C,xr as w,zt as T}from"./line-icons-CwCZidXs.js";import{B as E,It as D,L as O,ht as k,s as A,t as j}from"./frame-CgBYYtdw.js";import{t as M}from"./when-BuWCTaKm.js";import{u as N}from"./nav-B_68FVw_.js";import{U as P}from"./index-D10waU4_.js";import{_ as F,o as I}from"./qualityParts-BFDaQh7A.js";var L=e(t(),1),R={view:e=>o(`GET`,`/api/observability?days=${e}`)},z=i(),B=12,V=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),H=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function U({series:e}){let[t,n]=(0,L.useState)(-1),r=e.reduce((e,t)=>e+t.sessions,0),i=e.reduce((e,t)=>e+t.problems,0),a=e.reduce((e,t)=>t.sessions>e.sessions?t:e,e[0]),o=t>=0?e[t]:e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-body-sm text-ink-2`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:V(o.day)}),`: `,H(o.sessions,`session`),o.problems?`, ${o.problems} with an error`:``]}),(0,z.jsx)(f,{series:[{values:e.map(e=>e.sessions)}],label:`Sessions a day for the last ${e.length} days: ${r} in all, ${i} with an error; the busiest was ${V(a.day)} with ${a.sessions}.`,hover:t,onHover:n,className:`h-[160px]`,axis:[V(e[0].day),V(e[e.length-1].day)]})]})}function W({rows:e,label:t,empty:n,unit:r,failedWord:i=`failed`}){if(!e.length)return(0,z.jsx)(l,{className:`py-4`,children:n});let a=Math.max(1,e.reduce((e,t)=>e+t.value,0));return(0,z.jsx)(m,{label:t,rows:e.slice(0,B).map(e=>({key:e.key,label:e.label,value:e.value.toLocaleString(),sub:H(e.value,r).replace(/^[\d,.]+\s*/,``),share:e.value/a,note:e.failed?(0,z.jsxs)(`span`,{className:`text-label-sm whitespace-nowrap text-fail tabular-nums`,children:[e.failed,` `,i]}):void 0})),more:e.length>B?`and ${e.length-B} more`:void 0})}var G={passed:`pass`,failed:`fail`,error:`fail`};function K({runs:e}){let t=e.reduce((e,t)=>e+t.count,0);if(!t)return(0,z.jsx)(l,{className:`py-4`,children:`No browser run ended in these days.`});let n=e=>G[e]??`neutral`,r={pass:`bg-pass`,fail:`bg-fail`,neutral:`bg-muted`};return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsx)(h,{label:`Runs by how they ended: ${e.map(e=>`${e.status} ${e.count}`).join(`, `)}, of ${t}.`,parts:e.map(e=>({key:e.status,value:e.count,className:r[n(e.status)]}))}),(0,z.jsx)(`span`,{className:`flex flex-wrap gap-2 text-body-sm`,children:e.map(e=>(0,z.jsxs)(d,{tone:n(e.status),children:[e.status[0].toUpperCase()+e.status.slice(1),` `,e.count]},e.status))})]})}var q=[{id:`7`,label:`Last 7 days`},{id:`30`,label:`Last 30 days`},{id:`90`,label:`Last 90 days`}],J=e=>e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.round(e/6e4)} min`,Y=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;function X({id:e,icon:t,title:n,children:r,note:i,divider:a}){return(0,z.jsx)(P,{id:e,icon:t,title:n,description:i,divider:a,children:r})}function Z(){let[e,t]=(0,L.useState)(30),[i,o]=(0,L.useState)(null),[f,m]=(0,L.useState)(``),h=(0,L.useCallback)(()=>{m(``),R.view(e).then(o,e=>m(e.message))},[e]);(0,L.useEffect)(h,[h]);let P=i&&i.days===e?i:null,B=P?.totals,V=P?[P.source.skipped?`${P.source.skipped} log file${P.source.skipped===1?` was`:`s were`} skipped: a link, or not inside the logs folder.`:``,P.source.truncated?`${P.source.truncated} very long log${P.source.truncated===1?` was`:`s were`} read only in part.`:``,P.source.ledger?``:`Model calls are counted once this project has a forgeqe.yaml: the usage ledger keeps calls by project.`].filter(Boolean):[];return(0,z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,z.jsx)(A,{}),(0,z.jsxs)(`main`,{className:r(j,`@container flex-auto gap-4`),children:[(0,z.jsx)(p,{}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,z.jsx)(D,{pixel:a.observability,size:`lg`}),(0,z.jsx)(`h1`,{className:`m-0 text-headline-lg`,children:N(`observability`)})]}),(0,z.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`ForgeQE's own work on this computer, from its session logs`,P?(0,z.jsxs)(z.Fragment,{children:[` `,`in `,(0,z.jsx)(`code`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:P.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,z.jsx)(`a`,{href:n(`settings`,`observability`),children:`Settings › Observability`}),`. Each session is in the day it started.`]}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,z.jsx)(u,{items:q,value:`${e}`,onChange:e=>t(Number(e))})}),f&&(0,z.jsx)(`p`,{role:`alert`,className:r(s.fail,`m-0`),children:f}),!P&&!f&&(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),P&&B&&!B.sessions&&!B.modelCalls&&(0,z.jsx)(l,{icon:T,title:`No sessions in the last ${e} days`,action:(0,z.jsxs)(`a`,{className:c({size:`sm`}),href:n(`runs`),"data-tip":`Open Runs`,children:[(0,z.jsx)(x,{"aria-hidden":`true`}),`Runs`]}),children:(0,z.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.`})}),P&&B&&(B.sessions>0||B.modelCalls>0)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(I,{label:`Sessions`,value:B.sessions,sub:`${P.from} to ${P.to}`}),(0,z.jsx)(I,{label:`With an error`,value:B.problemSessions,tone:B.problemSessions?`text-fail`:void 0,sub:B.sessions?`${Y(B.problemSessions,B.sessions)} of sessions`:`no session`}),(0,z.jsx)(I,{label:`Failed turns`,value:B.turnsFailed,tone:B.turnsFailed?`text-fail`:void 0,sub:`of ${B.turns} turn${B.turns===1?``:`s`}`}),(0,z.jsx)(I,{label:`Failed runs`,value:B.runsFailed,tone:B.runsFailed?`text-fail`:void 0,sub:`of ${B.runs} browser run${B.runs===1?``:`s`}`}),(0,z.jsx)(I,{label:`Tool errors`,value:B.toolErrors,tone:B.toolErrors?`text-warn`:void 0,sub:`of ${B.toolCalls} call${B.toolCalls===1?``:`s`}, ${Y(B.toolErrors,B.toolCalls)}`}),(0,z.jsx)(I,{label:`Model calls`,value:B.modelCalls,sub:`${E(B.tokens)} tokens`})]}),V.length>0&&(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:V.map(e=>(0,z.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,z.jsx)(S,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),e]},e))}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,z.jsx)(X,{id:`obs-days`,icon:w,title:`Sessions over time`,note:P.turnTime?`A turn took ${J(P.turnTime.p50)} at the median, ${J(P.turnTime.p95)} at the 95th percentile.`:void 0,children:(0,z.jsx)(U,{series:P.series})}),(0,z.jsxs)(`div`,{className:`grid gap-x-6 gap-y-8 pt-6 @3xl:grid-cols-2`,children:[(0,z.jsx)(X,{id:`obs-commands`,icon:C,title:`By command`,divider:!1,children:(0,z.jsx)(W,{rows:P.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,z.jsx)(X,{id:`obs-runs`,icon:v,title:`Browser runs`,divider:!1,children:(0,z.jsx)(K,{runs:P.runs})}),(0,z.jsx)(X,{id:`obs-tools`,icon:_,title:`Tool calls`,divider:!1,children:(0,z.jsx)(W,{rows:P.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,z.jsx)(X,{id:`obs-health`,icon:T,title:`Session health`,divider:!1,note:`The ways a chat has gone wrong before, found by their signature in the logs.`,children:(0,z.jsx)(W,{rows:P.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,z.jsx)(X,{id:`obs-models`,icon:y,title:`Model calls`,children:(0,z.jsx)(k,{label:`Model calls by model`,placeholder:`Find a model`,resetKey:e,empty:P.source.ledger?`No model call in these days.`:`Model calls are counted once this project has a forgeqe.yaml.`,search:P.models.length>8,head:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[34%]`),children:`Model`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Calls`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Tokens`}),(0,z.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Median`}),(0,z.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`95th percentile`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Cost`})]}),children:P.models.map(e=>(0,z.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,z.jsx)(`td`,{className:r(`px-4 py-2`,`max-w-0`),children:(0,z.jsx)(`span`,{"data-tip":e.model,className:`block truncate font-mono text-body-sm`,children:e.model})}),(0,z.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.calls}),(0,z.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-tip":`${E(e.input)} read, ${E(e.output)} written`,"data-sort":e.input+e.output,children:E(e.input+e.output)}),(0,z.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),"data-sort":e.p50??-1,children:e.p50===null?`–`:J(e.p50)}),(0,z.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),"data-sort":e.p95??-1,children:e.p95===null?`–`:J(e.p95)}),(0,z.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.amount??-1,children:e.amount!==void 0&&e.currency?O(e.amount,e.currency):(0,z.jsx)(`span`,{className:`text-muted`,children:`–`})})]},e.model))})}),(0,z.jsx)(X,{id:`obs-problems`,icon:b,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,z.jsx)(k,{label:`Latest problems`,placeholder:`Find a problem or session`,resetKey:e,empty:`No problem in these days.`,search:P.problems.length>8,head:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Problem`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`When`}),(0,z.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Session`})]}),children:P.problems.map((e,t)=>(0,z.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,z.jsx)(`td`,{className:`px-4 py-2`,children:(0,z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(d,{tone:e.severity===`error`?`fail`:`warn`,children:e.severity===`error`?`Error`:`Warning`}),(0,z.jsx)(`span`,{children:e.text}),e.detail&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.detail})]})}),(0,z.jsx)(`td`,{className:r(`px-4 py-2`,`whitespace-nowrap text-muted`),"data-tip":F(e.at),"data-sort":new Date(e.at).getTime()||0,children:M(e.at)}),(0,z.jsx)(`td`,{className:r(`px-4 py-2`,`hidden max-w-[220px] @xl:table-cell`),children:(0,z.jsx)(`a`,{href:n(`runs`,encodeURIComponent(e.session)),"data-tip":`Open this session in Runs`,className:`block truncate font-mono text-body-sm`,children:e.session.replace(/\.log$/,``)})})]},`${e.session}-${e.at}-${t}`))})})]}),(0,z.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[(0,z.jsx)(g,{size:14,"aria-hidden":`true`}),(0,z.jsxs)(`span`,{children:[P.source.read,` session log`,P.source.read===1?``:`s`,` read. `,(0,z.jsx)(`a`,{href:n(`settings`,`observability`),children:`Send these to your collector`}),`.`]})]})]})]})]})}export{Z as Observability};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-oDy8sV6H.js";import{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{L as a}from"./palette-DLNRH9CW.js";import{v as o}from"./api-BUoHbp5V.js";import{C as s,S as c,_ as l,f as u,g as d,i as f,n as p,o as m,u as h}from"./pageBack-D89f9SN4.js";import{Kn as g,Lr as _,Pn as v,Q as y,Sr as b,o as x,qt as S,ur as C,xr as w,zt as T}from"./line-icons-CwCZidXs.js";import{B as E,It as D,L as O,ht as k,s as A,t as j}from"./frame-DW-Hx3fC.js";import{t as M}from"./when-BuWCTaKm.js";import{u as N}from"./nav-DE7YMNUI.js";import{K as P}from"./index-CsEmZt6_.js";import{_ as F,o as I}from"./qualityParts-BSRlONZr.js";var L=e(t(),1),R={view:e=>o(`GET`,`/api/observability?days=${e}`)},z=i(),B=12,V=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),H=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function U({series:e}){let[t,n]=(0,L.useState)(-1),r=e.reduce((e,t)=>e+t.sessions,0),i=e.reduce((e,t)=>e+t.problems,0),a=e.reduce((e,t)=>t.sessions>e.sessions?t:e,e[0]),o=t>=0?e[t]:e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-body-sm text-ink-2`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:V(o.day)}),`: `,H(o.sessions,`session`),o.problems?`, ${o.problems} with an error`:``]}),(0,z.jsx)(f,{series:[{values:e.map(e=>e.sessions)}],label:`Sessions a day for the last ${e.length} days: ${r} in all, ${i} with an error; the busiest was ${V(a.day)} with ${a.sessions}.`,hover:t,onHover:n,className:`h-[160px]`,axis:[V(e[0].day),V(e[e.length-1].day)]})]})}function W({rows:e,label:t,empty:n,unit:r,failedWord:i=`failed`}){if(!e.length)return(0,z.jsx)(l,{className:`py-4`,children:n});let a=Math.max(1,e.reduce((e,t)=>e+t.value,0));return(0,z.jsx)(m,{label:t,rows:e.slice(0,B).map(e=>({key:e.key,label:e.label,value:e.value.toLocaleString(),sub:H(e.value,r).replace(/^[\d,.]+\s*/,``),share:e.value/a,note:e.failed?(0,z.jsxs)(`span`,{className:`text-label-sm whitespace-nowrap text-fail tabular-nums`,children:[e.failed,` `,i]}):void 0})),more:e.length>B?`and ${e.length-B} more`:void 0})}var G={passed:`pass`,failed:`fail`,error:`fail`};function K({runs:e}){let t=e.reduce((e,t)=>e+t.count,0);if(!t)return(0,z.jsx)(l,{className:`py-4`,children:`No browser run ended in these days.`});let n=e=>G[e]??`neutral`,r={pass:`bg-pass`,fail:`bg-fail`,neutral:`bg-muted`};return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsx)(h,{label:`Runs by how they ended: ${e.map(e=>`${e.status} ${e.count}`).join(`, `)}, of ${t}.`,parts:e.map(e=>({key:e.status,value:e.count,className:r[n(e.status)]}))}),(0,z.jsx)(`span`,{className:`flex flex-wrap gap-2 text-body-sm`,children:e.map(e=>(0,z.jsxs)(d,{tone:n(e.status),children:[e.status[0].toUpperCase()+e.status.slice(1),` `,e.count]},e.status))})]})}var q=[{id:`7`,label:`Last 7 days`},{id:`30`,label:`Last 30 days`},{id:`90`,label:`Last 90 days`}],J=e=>e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.round(e/6e4)} min`,Y=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;function X({id:e,icon:t,title:n,children:r,note:i,divider:a}){return(0,z.jsx)(P,{id:e,icon:t,title:n,description:i,divider:a,children:r})}function Z(){let[e,t]=(0,L.useState)(30),[i,o]=(0,L.useState)(null),[f,m]=(0,L.useState)(``),h=(0,L.useCallback)(()=>{m(``),R.view(e).then(o,e=>m(e.message))},[e]);(0,L.useEffect)(h,[h]);let P=i&&i.days===e?i:null,B=P?.totals,V=P?[P.source.skipped?`${P.source.skipped} log file${P.source.skipped===1?` was`:`s were`} skipped: a link, or not inside the logs folder.`:``,P.source.truncated?`${P.source.truncated} very long log${P.source.truncated===1?` was`:`s were`} read only in part.`:``,P.source.ledger?``:`Model calls are counted once this project has a forgeqe.yaml: the usage ledger keeps calls by project.`].filter(Boolean):[];return(0,z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,z.jsx)(A,{}),(0,z.jsxs)(`main`,{className:r(j,`@container flex-auto gap-4`),children:[(0,z.jsx)(p,{}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,z.jsx)(D,{pixel:a.observability,size:`lg`}),(0,z.jsx)(`h1`,{className:`m-0 text-headline-lg`,children:N(`observability`)})]}),(0,z.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`ForgeQE's own work on this computer, from its session logs`,P?(0,z.jsxs)(z.Fragment,{children:[` `,`in `,(0,z.jsx)(`code`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:P.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,z.jsx)(`a`,{href:n(`settings`,`observability`),children:`Settings › Observability`}),`. Each session is in the day it started.`]}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,z.jsx)(u,{items:q,value:`${e}`,onChange:e=>t(Number(e))})}),f&&(0,z.jsx)(`p`,{role:`alert`,className:r(s.fail,`m-0`),children:f}),!P&&!f&&(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),P&&B&&!B.sessions&&!B.modelCalls&&(0,z.jsx)(l,{icon:T,title:`No sessions in the last ${e} days`,action:(0,z.jsxs)(`a`,{className:c({size:`sm`}),href:n(`runs`),"data-tip":`Open Runs`,children:[(0,z.jsx)(x,{"aria-hidden":`true`}),`Runs`]}),children:(0,z.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.`})}),P&&B&&(B.sessions>0||B.modelCalls>0)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(I,{label:`Sessions`,value:B.sessions,sub:`${P.from} to ${P.to}`}),(0,z.jsx)(I,{label:`With an error`,value:B.problemSessions,tone:B.problemSessions?`text-fail`:void 0,sub:B.sessions?`${Y(B.problemSessions,B.sessions)} of sessions`:`no session`}),(0,z.jsx)(I,{label:`Failed turns`,value:B.turnsFailed,tone:B.turnsFailed?`text-fail`:void 0,sub:`of ${B.turns} turn${B.turns===1?``:`s`}`}),(0,z.jsx)(I,{label:`Failed runs`,value:B.runsFailed,tone:B.runsFailed?`text-fail`:void 0,sub:`of ${B.runs} browser run${B.runs===1?``:`s`}`}),(0,z.jsx)(I,{label:`Tool errors`,value:B.toolErrors,tone:B.toolErrors?`text-warn`:void 0,sub:`of ${B.toolCalls} call${B.toolCalls===1?``:`s`}, ${Y(B.toolErrors,B.toolCalls)}`}),(0,z.jsx)(I,{label:`Model calls`,value:B.modelCalls,sub:`${E(B.tokens)} tokens`})]}),V.length>0&&(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:V.map(e=>(0,z.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,z.jsx)(S,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),e]},e))}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,z.jsx)(X,{id:`obs-days`,icon:w,title:`Sessions over time`,note:P.turnTime?`A turn took ${J(P.turnTime.p50)} at the median, ${J(P.turnTime.p95)} at the 95th percentile.`:void 0,children:(0,z.jsx)(U,{series:P.series})}),(0,z.jsxs)(`div`,{className:`grid gap-x-6 gap-y-8 pt-6 @3xl:grid-cols-2`,children:[(0,z.jsx)(X,{id:`obs-commands`,icon:C,title:`By command`,divider:!1,children:(0,z.jsx)(W,{rows:P.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,z.jsx)(X,{id:`obs-runs`,icon:v,title:`Browser runs`,divider:!1,children:(0,z.jsx)(K,{runs:P.runs})}),(0,z.jsx)(X,{id:`obs-tools`,icon:_,title:`Tool calls`,divider:!1,children:(0,z.jsx)(W,{rows:P.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,z.jsx)(X,{id:`obs-health`,icon:T,title:`Session health`,divider:!1,note:`The ways a chat has gone wrong before, found by their signature in the logs.`,children:(0,z.jsx)(W,{rows:P.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,z.jsx)(X,{id:`obs-models`,icon:y,title:`Model calls`,children:(0,z.jsx)(k,{label:`Model calls by model`,placeholder:`Find a model`,resetKey:e,empty:P.source.ledger?`No model call in these days.`:`Model calls are counted once this project has a forgeqe.yaml.`,search:P.models.length>8,head:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[34%]`),children:`Model`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Calls`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Tokens`}),(0,z.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Median`}),(0,z.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`95th percentile`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Cost`})]}),children:P.models.map(e=>(0,z.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,z.jsx)(`td`,{className:r(`px-4 py-2`,`max-w-0`),children:(0,z.jsx)(`span`,{"data-tip":e.model,className:`block truncate font-mono text-body-sm`,children:e.model})}),(0,z.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.calls}),(0,z.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-tip":`${E(e.input)} read, ${E(e.output)} written`,"data-sort":e.input+e.output,children:E(e.input+e.output)}),(0,z.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),"data-sort":e.p50??-1,children:e.p50===null?`–`:J(e.p50)}),(0,z.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @xl:table-cell`),"data-sort":e.p95??-1,children:e.p95===null?`–`:J(e.p95)}),(0,z.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.amount??-1,children:e.amount!==void 0&&e.currency?O(e.amount,e.currency):(0,z.jsx)(`span`,{className:`text-muted`,children:`–`})})]},e.model))})}),(0,z.jsx)(X,{id:`obs-problems`,icon:b,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,z.jsx)(k,{label:`Latest problems`,placeholder:`Find a problem or session`,resetKey:e,empty:`No problem in these days.`,search:P.problems.length>8,head:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Problem`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`When`}),(0,z.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Session`})]}),children:P.problems.map((e,t)=>(0,z.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,z.jsx)(`td`,{className:`px-4 py-2`,children:(0,z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(d,{tone:e.severity===`error`?`fail`:`warn`,children:e.severity===`error`?`Error`:`Warning`}),(0,z.jsx)(`span`,{children:e.text}),e.detail&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.detail})]})}),(0,z.jsx)(`td`,{className:r(`px-4 py-2`,`whitespace-nowrap text-muted`),"data-tip":F(e.at),"data-sort":new Date(e.at).getTime()||0,children:M(e.at)}),(0,z.jsx)(`td`,{className:r(`px-4 py-2`,`hidden max-w-[220px] @xl:table-cell`),children:(0,z.jsx)(`a`,{href:n(`runs`,encodeURIComponent(e.session)),"data-tip":`Open this session in Runs`,className:`block truncate font-mono text-body-sm`,children:e.session.replace(/\.log$/,``)})})]},`${e.session}-${e.at}-${t}`))})})]}),(0,z.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[(0,z.jsx)(g,{size:14,"aria-hidden":`true`}),(0,z.jsxs)(`span`,{children:[P.source.read,` session log`,P.source.read===1?``:`s`,` read. `,(0,z.jsx)(`a`,{href:n(`settings`,`observability`),children:`Send these to your collector`}),`.`]})]})]})]})]})}export{Z as Observability};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-oDy8sV6H.js";import{F as r,H as i,L as a,R as o}from"./preload-helper-BupTYkQW.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{a as u}from"./palette-6YAAmgkD.js";import{ot as d}from"./api-BsiuHmJq.js";import{C as f,_ as p,g as m,x as h}from"./pageBack-CbyKfisx.js";import{Dr as g,Ln as _,er as v,hn as y,o as b,rr as x,vt as S,yr as C}from"./line-icons-CwCZidXs.js";import{It as w,dt as T,qt as E}from"./frame-CgBYYtdw.js";import{f as D}from"./index-D10waU4_.js";var O=e(t(),1),k=l(),A={skills:{one:`skill`,many:`skills`,icon:x,body:`How to do it`,placeholder:`1. Read the failed run's board.
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-oDy8sV6H.js";import{F as r,H as i,L as a,R as o}from"./preload-helper-BupTYkQW.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{a as u}from"./palette-DLNRH9CW.js";import{ot as d}from"./api-BUoHbp5V.js";import{C as f,_ as p,g as m,x as h}from"./pageBack-D89f9SN4.js";import{Dr as g,Ln as _,er as v,hn as y,o as b,rr as x,vt as S,yr as C}from"./line-icons-CwCZidXs.js";import{It as w,dt as T,qt as E}from"./frame-DW-Hx3fC.js";import{f as D}from"./index-CsEmZt6_.js";var O=e(t(),1),k=l(),A={skills:{one:`skill`,many:`skills`,icon:x,body:`How to do it`,placeholder:`1. Read the failed run's board.
2
2
  2. Sort each failure: product bug, test bug or flaky.
3
3
  3. Give the evidence for each.`,describe:{title:`When to use it`,placeholder:`When a check fails and the team must sort why`,required:!0},audience:!1},prompts:{one:`prompt`,many:`prompts`,icon:y,body:`What the agents are told`,placeholder:`Check the API before the pages. Report each failure with the request and the response you saw.`,describe:{title:`What it is for (optional)`,placeholder:`How the team reports`},audience:!0},guardrails:{one:`guardrail set`,many:`guardrails`,icon:v,body:`Rules, one per line`,placeholder:`- Never pay with a real card
4
4
  - Use only qa accounts`,describe:{title:`What they are for (optional)`,placeholder:`Payment safety`},audience:!0},knowledge:{one:`note`,many:`notes`,icon:S,body:`What it says`,placeholder:`A release needs two green passes on qa before sign-off.`,audience:!1}},j={all:`Every agent`,lead:`The lead`,members:`The members`},M=e=>e.split(/\r?\n/).filter(e=>e.trim()&&!e.trim().startsWith(`#`)&&!e.trim().startsWith(`<!--`)).length,N=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+/,``).slice(0,64),P=(e,t)=>({kind:e,team:t,name:``,description:``,for:`all`,body:``}),F=(e,t,n)=>({kind:e,team:t,name:n.name,description:n.description,for:n.for||`all`,body:n.body,old:!0});function I({draft:e,teams:t,taken:n,onClose:i,onSaved:l}){let[u,p]=(0,O.useState)(e),[m,g]=(0,O.useState)(!1),[_,v]=(0,O.useState)(``),[y,b]=(0,O.useState)(!1);(0,O.useEffect)(()=>{p(e),v(``),b(!1)},[e]);let x=u?A[u.kind]:null,S=u?.kind===`skills`&&!u.old&&n.includes(u.name),w=u?.kind===`guardrails`?M(u.body):0,D=u?.kind===`guardrails`&&u.body.split(/\r?\n/).some(e=>e.replace(/^\s*[-*+]\s+/,``).trim().length>300),P=u&&u.team&&u.name&&u.body.trim()&&!S&&!D&&(u.kind!==`guardrails`||w>0&&w<=40)&&(!x?.describe?.required||u.description.trim()),F=t.find(e=>e.id===u?.team)?.name||u?.team,I=async()=>{if(u&&P){g(!0),v(``);try{l(await d.own(u.team,{item:{kind:u.kind,name:u.name,...x?.describe?{description:u.description}:{},...x?.audience?{for:u.for}:{},body:u.body},...u.old?{replace:!0}:{}}),`${u.old?`Changed`:`Added`} ${x.one} ${u.name} for ${F}. The team uses it once a person approves the team again.`)}catch(e){v(e.message)}finally{g(!1)}}},L=async()=>{if(u){if(!y)return b(!0);g(!0),v(``);try{l(await d.own(u.team,{remove:!0,kind:u.kind,name:u.name}),`Removed ${x.one} ${u.name} from ${F}. The team stops using it once a person approves the team again.`)}catch(e){v(e.message)}finally{g(!1)}}};return(0,k.jsx)(E,{wide:!0,open:!!e,onClose:i,title:u?`${u.old?`Change`:`Add`} a team ${x.one}`:``,description:u?`Only ${F?`${F}'s`:`the team's`} agents get it, while they work in the team; no other agent sees it.`:void 0,footer:(0,k.jsxs)(k.Fragment,{children:[u?.old&&(0,k.jsxs)(h,{variant:`ghost`,className:`mr-auto text-fail`,disabled:m,onClick:()=>void L(),children:[(0,k.jsx)(C,{"aria-hidden":`true`}),y?`Remove it for good`:`Remove`]}),(0,k.jsx)(h,{variant:`ghost`,onClick:i,children:`Cancel`}),(0,k.jsx)(h,{variant:`primary`,disabled:m||!P,onClick:()=>void I(),children:m?`Saving…`:`Save`})]}),children:u&&x&&(0,k.jsxs)(`div`,{className:`flex flex-col gap-6 pt-4`,children:[!u.old&&t.length>1&&(0,k.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:`Team`}),(0,k.jsxs)(a,{value:u.team,onChange:e=>p({...u,team:e.target.value}),children:[(0,k.jsx)(`option`,{value:``,children:`Choose a team…`}),t.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,k.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:`Name`}),(0,k.jsx)(r,{value:u.name,disabled:u.old,maxLength:64,placeholder:u.kind===`skills`?`triage-failures`:u.kind===`guardrails`?`payment-safety`:u.kind===`prompts`?`how-we-report`:`release-rules`,onChange:e=>p({...u,name:N(e.target.value)}),"aria-describedby":`own-name-hint`}),(0,k.jsx)(`span`,{id:`own-name-hint`,className:c(`text-body-sm`,S?`text-fail`:`text-muted`),children:S?`ForgeQE already has a skill named ${u.name}: give the team's another name, or pick the shared one in the team's Knowledge.`:u.old?`A name stays as it is: add a new one to rename.`:`Lower-case words joined by dashes.`})]}),x.describe&&(0,k.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:x.describe.title}),(0,k.jsx)(r,{value:u.description,maxLength:400,placeholder:x.describe.placeholder,onChange:e=>p({...u,description:e.target.value.replace(/[\r\n]+/g,` `)})})]}),x.audience&&(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:`For`}),(0,k.jsx)(T,{label:`Whom of the team it is for`,value:u.for,onChange:e=>p({...u,for:e}),options:[`all`,`lead`,`members`].map(e=>({id:e,label:j[e]}))})]}),(0,k.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,k.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2 text-body-sm font-medium text-ink-2`,children:[x.body,u.kind===`guardrails`&&(0,k.jsx)(`span`,{className:c(`font-normal`,w>40||D?`text-fail`:`text-muted`),children:D?`A rule is longer than 300 characters`:`${s(w,`rule`)} of 40`})]}),(0,k.jsx)(o,{rows:u.kind===`guardrails`?8:12,value:u.body,maxLength:39e3,placeholder:x.placeholder,className:u.kind===`knowledge`?void 0:`font-mono text-body-sm`,onChange:e=>p({...u,body:e.target.value})}),u.kind===`guardrails`&&(0,k.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Each line is one rule the team's agents follow. They add to ForgeQE's own limits and never lift one.`}),u.kind===`prompts`&&(0,k.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Guidance for how the team works. It never changes what an agent may do: its limits are kept in code.`})]}),_&&(0,k.jsx)(`p`,{role:`alert`,className:c(f.fail,`m-0`),children:_})]})})}function L({kind:e,item:t,onOpen:n,compact:r=!1}){let a=A[e],o=t.description||t.body.split(`
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{t as n}from"./utils-DJRAScIl.js";import{t as r}from"./jsx-runtime-LKYXHABd.js";import{a as i}from"./palette-DLNRH9CW.js";import{a,i as o}from"./sectionList-B651VPon.js";import{y as s}from"./api-BUoHbp5V.js";import{b as c,x as l}from"./pageBack-D89f9SN4.js";import{Ln as u}from"./line-icons-CwCZidXs.js";import{g as d}from"./frame-DW-Hx3fC.js";import{$ as f,Q as p,X as ee,Z as te,ct as ne,dt as re,et as ie,ft as ae,ht as oe,lt as m,mt as se,ot as ce,st as le,tt as ue,ut as de,z as fe}from"./index-CsEmZt6_.js";import{r as pe}from"./choice-C4-yW2x9.js";import{n as h,t as g}from"./poll-CHpac9Fb.js";var _=e(t(),1),me=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 he(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)(()=>d(a),[a]),f=u.turns.at(-1),p=c===`closed`||c===`failed`;return{chat:r,thread:u,last:f,busy:c===`busy`||c===`starting`||!!f&&!f.outcome&&!p,ended:p,send:async(e,t,a={})=>{if(r&&!p)await s.send(r,e,t);else{let{id:r}=await s.start(e,a,void 0,t);n(r),i(r)}},reset:()=>{n(null),i(null)}}}var v=r(),y=e=>e&&e!==`forgeqe`?o.find(t=>t.agent===e)?.crew:void 0;function b({id:e,agent:t=a,question:r,intro:o,underIntro:d,starters:h,placeholder:g,replyPlaceholder:b,note:x,turnNote:S,track:C,onTurnEnd:ge,ask:w,askSends:_e=!1,draft:T,above:ve,menu:E,compose:D,onNew:ye,className:be}){let O=`${e}-agent-box`,{chat:k,thread:A,last:j,busy:M,ended:N,send:xe,reset:Se}=he(`forgeqe.${e}.chat`),Ce=se(),[P,F]=(0,_.useState)(``),[I,L]=(0,_.useState)(``),[R,z]=(0,_.useState)(!1),B=ue(),V=ae(P,F,O,{chat:k&&!N?k:void 0,code:B.tools.code}),H=m(`${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&&(ge?.(),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 xe(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??_e)&&!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:n(`mx-auto flex w-full max-w-[880px] flex-auto flex-col gap-6`,be),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)(i,{agent:t,px:Ce?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-headline-sm`,children:r}),(0,v.jsx)(`p`,{className:`m-0 text-body-lg text-muted`,children:o}),y(t)&&(0,v.jsx)(oe,{crew:y(t)})]}),d,(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:pe,children:[(0,v.jsx)(c,{icon:e.icon,size:18,className:`mt-1 text-icon`}),(0,v.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,v.jsx)(`span`,{className:`text-body-sm font-medium text-ink`,children:e.title}),(0,v.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.hint})]})]},e.title))})]}):(0,v.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,v.jsx)(`div`,{className:`z-10 flex items-center justify-end bg-canvas md:sticky md:top-[var(--page-head,0px)] md:py-1`,children:(0,v.jsxs)(l,{size:`sm`,variant:`ghost`,onClick:()=>{Se(),V.reset(),G({}),F(``),ye?.()},disabled:M,"data-tip":`Start a new conversation`,children:[(0,v.jsx)(u,{"aria-hidden":`true`}),`New`]})}),A.turns.map(e=>(0,v.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,v.jsx)(re,{text:e.user,scope:{chat:k||void 0}}),(0,v.jsx)(fe,{turn:e.error?{...e,error:me(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-body-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)(ie,{project:B.setup.project}),B.ready&&(0,v.jsx)(f,{c:B})]}),(0,v.jsxs)(`div`,{className:`sticky bottom-0 z-10 flex flex-col gap-2 bg-gradient-to-t from-canvas from-85% to-transparent pt-6 pb-4 [:empty+&]:mt-auto`,children:[ve?.($,Y),(I||V.error)&&(0,v.jsx)(`p`,{className:`m-0 bg-canvas text-body-sm 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)(le,{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)(ee,{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)(ce,{running:H.running,disabled:!P.trim()||R||!B.ready,onClick:()=>void H.start(P)})]}),right:Q?(0,v.jsx)(te,{c:B}):k?(0,v.jsx)(p,{chat:k,thread:A,ended:N,busy:M||R,snap:B.snap,onError:L}):void 0})]})]})}export{b as t};