@humwick/server 0.130.3 → 0.130.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/openapi.json +103 -1
- package/package.json +6 -6
- package/public/assets/{MessageBubble-Bq9kr21N.js → MessageBubble-BOkmEvgZ.js} +2 -2
- package/public/assets/{PlanGraphPanel-Dqiroy06.js → PlanGraphPanel-BkaDJp0r.js} +2 -2
- package/public/assets/{TraceView-DYU962-H.js → TraceView-B99Uu2yT.js} +2 -2
- package/public/assets/{VaultDecisionCard-DhPfzioE.js → VaultDecisionCard-DUIfTTFF.js} +2 -2
- package/public/assets/{activity-DzCcQTee.js → activity-ZIX0N1El.js} +2 -2
- package/public/assets/{agent-lineage-SgDt9i3T.js → agent-lineage-kq9TPYFw.js} +2 -2
- package/public/assets/agent-liveness-DSQY1Aa_.js +2 -0
- package/public/assets/{agent-name-CcY3Aijy.js → agent-name-C_7F4DFR.js} +2 -2
- package/public/assets/{agent-profiles-cxtRBn6O.js → agent-profiles-BNOcrGcY.js} +2 -2
- package/public/assets/{agent-project-badge-DGYbIhaI.js → agent-project-badge-B6yAh70a.js} +2 -2
- package/public/assets/{agent-tools-DHbftV0N.js → agent-tools-CcrhmOzF.js} +2 -2
- package/public/assets/{agent-type-icon-CY113sp-.js → agent-type-icon-CXSLrKiq.js} +2 -2
- package/public/assets/{agents-BPzY7IlQ.js → agents-DIZG97_X.js} +2 -2
- package/public/assets/{analytics-DENFPv_a.js → analytics-rasmoPjR.js} +2 -2
- package/public/assets/{artifact-viewer-KRvSc7sl.js → artifact-viewer-tBpTrEPb.js} +2 -2
- package/public/assets/{artifacts-C9gSmL3s.js → artifacts-BNkrynP1.js} +2 -2
- package/public/assets/{artifacts-DT-HkI5O.js → artifacts-Bjq-ZyBA.js} +2 -2
- package/public/assets/{automation-BsmjQhKD.js → automation-Cx422L3L.js} +2 -2
- package/public/assets/{backlog-8NYH_62t.js → backlog-RuFQ8PUu.js} +2 -2
- package/public/assets/{busy-health-D3hwvYb4.js → busy-health-BvNQ9g5x.js} +2 -2
- package/public/assets/{channels-DCJ5WL7O.js → channels-DNbKAS0I.js} +2 -2
- package/public/assets/{chat-DAIl357U.js → chat-Bp3Fx73h.js} +2 -2
- package/public/assets/{code-preview-CzrZfr9U.js → code-preview-KIRZA6cz.js} +2 -2
- package/public/assets/{connectors-xTxtlyou.js → connectors-k7vO4vvc.js} +2 -2
- package/public/assets/{cosmos-BpebFLK2.js → cosmos-BuVoq1aw.js} +2 -2
- package/public/assets/{crate-agent-BHvI5wXC.js → crate-agent-irqlt4NH.js} +2 -2
- package/public/assets/{dependency-graph-DGT0o3wJ.js → dependency-graph-D_rurNBz.js} +2 -2
- package/public/assets/{deploys-hqWOHSHE.js → deploys-yzZqIpxE.js} +2 -2
- package/public/assets/{display-CDeH4I8T.js → display-BemJG1f_.js} +2 -2
- package/public/assets/{files-BTeGVmTg.js → files-DXWcrxOz.js} +2 -2
- package/public/assets/{fleet-DgXtNgCa.js → fleet-TEuOCZXE.js} +2 -2
- package/public/assets/{fleet-metrics-BHEt5yc_.js → fleet-metrics-BGoDAFI-.js} +2 -2
- package/public/assets/{formatted-body-impl-CAe664Z8.js → formatted-body-impl-BB9eq9nN.js} +2 -2
- package/public/assets/{formatted-body-MLtodyPp.js → formatted-body-qy2nTD_1.js} +3 -3
- package/public/assets/{host-providers-dialog-mapF4Fj9.js → host-providers-dialog-BGPHxuwT.js} +2 -2
- package/public/assets/{index-CqqgOI5R.js → index-BC5XZc0z.js} +5 -5
- package/public/assets/{index-MYAIwYTX.css → index-D8Rp9pz2.css} +1 -1
- package/public/assets/{insights-DNyf7IzF.js → insights-C-KQG0h-.js} +2 -2
- package/public/assets/{integrations-DlYOHq7T.js → integrations-ClPRPyKU.js} +2 -2
- package/public/assets/{issue-ref-chip-CeWBNWn7.js → issue-ref-chip-DbH8J9Ak.js} +2 -2
- package/public/assets/{log-viewer-Cib8nqdE.js → log-viewer-PH4zVn24.js} +2 -2
- package/public/assets/{maintenance-DSn1cPm7.js → maintenance-5lV43uTL.js} +2 -2
- package/public/assets/{managed-agents-C3CkM81m.js → managed-agents-BdgU35aX.js} +2 -2
- package/public/assets/{markdown-preview-W4VQQPAv.js → markdown-preview-DNT4OUwQ.js} +3 -3
- package/public/assets/{markdown-preview-impl-CMsTdhjq.js → markdown-preview-impl-CnCcPy0A.js} +2 -2
- package/public/assets/{memory-BV17qtO4.js → memory--GgWH1gH.js} +2 -2
- package/public/assets/{messages-Bm_1AqSA.js → messages-CzFl_97O.js} +2 -2
- package/public/assets/{orchestrators-Dg-vfP09.js → orchestrators-CVvJVkzv.js} +2 -2
- package/public/assets/overview-DsrZvE86.js +2 -0
- package/public/assets/{pairs-8o9nuG3V.js → pairs-D2d0d2py.js} +2 -2
- package/public/assets/{profile-icon-BsRyBMea.js → profile-icon-_SMuSbYF.js} +2 -2
- package/public/assets/{project-profile-instructions-DETKFn_E.js → project-profile-instructions-Apn15y43.js} +2 -2
- package/public/assets/{projects-M_m6AHws.js → projects-D3B6kto5.js} +2 -2
- package/public/assets/{prompt-settings-C_mNCgeL.js → prompt-settings-DnPB6Ez6.js} +2 -2
- package/public/assets/provider-display-bWwiuedV.js +2 -0
- package/public/assets/{registry-DDHHHE5N.js → registry-D790cIhN.js} +2 -2
- package/public/assets/{run-card-Dt4I4jaP.js → run-card-BCro-Odj.js} +2 -2
- package/public/assets/{secrets-BkVwxI5O.js → secrets-CVXvfvbU.js} +2 -2
- package/public/assets/{service-access-settings-Crq-6a-B.js → service-access-settings-D3Xxqb9w.js} +2 -2
- package/public/assets/{settings-CYcavMFu.js → settings-CoUC7Jci.js} +2 -2
- package/public/assets/{shipping-H6gzEeZB.js → shipping-D_Lp9n_J.js} +2 -2
- package/public/assets/{stats-BJVeWkpV.js → stats-CXiNjB9S.js} +2 -2
- package/public/assets/{status-dot-BcHyw1Vw.js → status-dot-C703YIy1.js} +2 -2
- package/public/assets/store-BgDALGIX.js +9 -0
- package/public/assets/{tasks-qJjlQPpx.js → tasks-DO0WpJCx.js} +2 -2
- package/public/assets/{teams-Cd5Sk1uX.js → teams-FGkdi_tL.js} +2 -2
- package/public/assets/{terminal-viewer-CpY5_m7W.js → terminal-viewer-Dh8dSC7e.js} +3 -3
- package/public/assets/{terminal-viewer-impl-DI_2llFR.js → terminal-viewer-impl-B5Zriip3.js} +2 -2
- package/public/assets/{use-agent-terminal-0yJA_buM.js → use-agent-terminal-CRUVDvLC.js} +2 -2
- package/public/assets/{use-decisions-uJXHf34W.js → use-decisions-CoaqRh4l.js} +2 -2
- package/public/assets/{use-project-list-CpWl6eHQ.js → use-project-list-X-BgT53X.js} +2 -2
- package/public/assets/{use-selectors-BdxBW8mL.js → use-selectors-0X_UZkk-.js} +2 -2
- package/public/assets/{user-avatar-3IndfpOc.js → user-avatar-CkLhVBGu.js} +2 -2
- package/public/assets/{versioned-prompt-editor-CIVg7XB1.js → versioned-prompt-editor-BkTi7eim.js} +2 -2
- package/public/assets/{work-queue-B9rnLwHZ.js → work-queue-DDOLEyKo.js} +2 -2
- package/public/assets/{workflow-marker-X8wxyhzC.js → workflow-marker-CzOsB8BM.js} +2 -2
- package/public/assets/{workflows-o5YyMFW7.js → workflows-DJilvmRM.js} +2 -2
- package/public/assets/{workspaces-CzEGoAng.js → workspaces-CHcfbLR3.js} +2 -2
- package/public/cosmos.html +4 -4
- package/public/index.html +29 -29
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/src/adapters/claude-api.ts +1 -1
- package/runner/src/provider-setup.ts +2 -2
- package/src/auth/login-link.ts +35 -0
- package/src/cli/index.ts +7 -1
- package/src/cli/init.ts +53 -0
- package/src/cli/orchestrator.ts +1 -7
- package/src/cli/setup.ts +6 -4
- package/src/db/spawn-delegation.ts +2 -1
- package/src/db/workflow-execution.ts +3 -3
- package/src/dev.ts +4 -13
- package/src/init.ts +299 -0
- package/src/invite-link.ts +16 -9
- package/src/routes/auth.ts +30 -2
- package/src/routes/host-providers.ts +18 -0
- package/src/routes/index.ts +5 -2
- package/src/routes/orchestrator-bootstrap.ts +2 -0
- package/src/routes/secrets-backup.ts +2 -3
- package/src/routes/secrets-import.ts +2 -3
- package/src/routes/secrets-vault.ts +5 -7
- package/src/runtime-install.ts +30 -0
- package/src/server.ts +4 -4
- package/src/services/auth-context.ts +6 -0
- package/src/services/provider-api-key.ts +73 -0
- package/src/setup.ts +47 -8
- package/src/utils.ts +7 -0
- package/public/assets/agent-liveness-Bq-s73jW.js +0 -2
- package/public/assets/overview-DcYCrvlr.js +0 -2
- package/public/assets/provider-display-BEeLXC_D.js +0 -2
- package/public/assets/store-DKPDIZBe.js +0 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-
|
|
2
|
-
//# sourceMappingURL=crate-agent-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-BgDALGIX.js";import{o as i,r as a}from"./provider-display-bWwiuedV.js";import{f as o,s}from"./display-BemJG1f_.js";import{a as c,n as l,t as u}from"./popover-8w1TWKMG.js";import{t as d}from"./bot-B0NpDNhr.js";import{t as f}from"./workflow-marker-CzOsB8BM.js";import{n as p}from"./agent-name-C_7F4DFR.js";import{t as m}from"./provider-brand-icon-_67JR7Zh.js";import{n as h,t as g}from"./profile-icon-_SMuSbYF.js";var _=e(t(),1),v=n(),y={},b=e=>e.stopPropagation();function x({agent:e}){let t=r(e=>e.providerCatalog),[n,o]=(0,_.useState)(!1),f=(0,_.useRef)(``),p=s(e),h=e.providerCapabilities?.model,g=[i(h,t)?.label,h?.effort].filter(Boolean).join(` · `)||`Model not reported`,y=e=>t=>{t.pointerType===`mouse`&&o(e)};return(0,v.jsxs)(u,{open:n,onOpenChange:o,children:[(0,v.jsx)(c,{asChild:!0,children:(0,v.jsx)(`button`,{type:`button`,"data-testid":`shipping-card-model`,"aria-label":`${a(p)}: ${g}`,className:`grid h-6 w-6 shrink-0 place-items-center rounded hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,onPointerDown:e=>{f.current=e.pointerType},onPointerEnter:y(!0),onPointerLeave:y(!1),onClick:e=>{b(e),f.current===`mouse`&&e.preventDefault()},children:(0,v.jsx)(m,{provider:p,fallback:d,className:`h-3.5 w-3.5`})})}),(0,v.jsxs)(l,{side:`top`,className:`w-auto max-w-xs flex-row items-center gap-1.5 px-2 py-1 text-xs`,onClick:b,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,v.jsx)(`span`,{className:`text-muted-foreground`,children:a(p)}),(0,v.jsx)(`span`,{className:`font-medium`,"data-testid":`shipping-card-model-summary`,children:g})]})]})}function S({holder:e,prefix:t,workflowMarker:n=!0}){let i=r(e=>e.openAgentDetail),{agent:a,id:s,live:c}=e;return(0,v.jsxs)(`span`,{"data-testid":`shipping-card-agent`,"data-live":c,className:`flex min-w-0 items-center gap-1`,children:[(0,v.jsx)(g,{profile:h(a),className:`w-4 shrink-0 text-sm`}),a&&(0,v.jsx)(x,{agent:a}),n&&(0,v.jsx)(f,{agent:a}),t&&(0,v.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:t}),a?(0,v.jsx)(`button`,{type:`button`,className:`min-h-6 truncate rounded text-left font-medium underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,title:a.id,onClick:e=>{b(e),i(a)},children:o(a)}):(0,v.jsx)(`span`,{className:`flex min-w-0 text-muted-foreground`,title:`${s}: no longer registered`,children:(0,v.jsx)(p,{target:s,agentsById:y})}),!c&&(0,v.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`offline`})]})}export{S as t};
|
|
2
|
+
//# sourceMappingURL=crate-agent-irqlt4NH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-
|
|
2
|
-
//# sourceMappingURL=dependency-graph-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-BgDALGIX.js";import{t as i}from"./api-CIIVBtAV.js";import{t as a}from"./waypoints-CIzINtLT.js";import{t as o}from"./badge-DqJRtj_p.js";var s=e(t(),1),c=n(),l=208,u=78,d=56,f=16,p=16,m={open:`bg-tone-info`,claimed:`bg-tone-purple`,in_progress:`bg-tone-purple`,validating:`bg-tone-warning`,blocked:`bg-tone-yellow`,orphaned:`bg-tone-neutral`,done:`bg-tone-success`,failed:`bg-tone-danger`,canceled:`bg-tone-neutral`},h={low:`bg-tone-neutral/10 text-tone-neutral-fg`,medium:`bg-tone-info/10 text-tone-info-fg`,high:`bg-tone-orange/10 text-tone-orange-fg`,urgent:`bg-tone-danger/10 text-tone-danger-fg`},g={depends_on:{stroke:`#38bdf8`,label:`Depends on`,arrow:!0},parent:{stroke:`#a78bfa`,dash:`6 4`,label:`Parent / epic`,arrow:!0},related:{stroke:`#71717a`,dash:`1.5 3.5`,label:`Related`,arrow:!1}};function _(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(e.map((e,t)=>[e.id,t])),i=new Map,a=new Map(e.map(e=>[e.id,0]));for(let e of t)e.kind!==`related`&&(!n.has(e.from)||!n.has(e.to)||(i.set(e.from,[...i.get(e.from)??[],e.to]),a.set(e.to,(a.get(e.to)??0)+1)));let o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>(a.get(e.id)??0)===0).map(e=>e.id),c=new Set;for(;s.length;){let e=s.shift();c.add(e);let t=o.get(e)??0;for(let n of i.get(e)??[])o.set(n,Math.max(o.get(n)??0,t+1)),a.set(n,(a.get(n)??0)-1),(a.get(n)??0)===0&&s.push(n)}let m=Math.max(0,...Array.from(o.values()))+1;for(let t of e)c.has(t.id)||o.set(t.id,m++);let h=new Map;for(let t of e){let e=o.get(t.id)??0;h.set(e,[...h.get(e)??[],t])}let g=[...h.entries()].sort(([e],[t])=>e-t),_=Math.max(1,...g.map(([,e])=>e.length)),v=[];g.forEach(([e,t],n)=>{let i=[...t].sort((e,t)=>(r.get(e.id)??0)-(r.get(t.id)??0)),a=(_-i.length)*94/2;i.forEach((t,r)=>{v.push({node:t,layer:e,x:p+n*264,y:p+a+r*94})})});let y=g.length;return{nodes:v,width:Math.max(320,p*2+y*l+Math.max(0,y-1)*d),height:Math.max(110,p*2+_*u+Math.max(0,_-1)*f)}}function v(e,t){let n=e.x+l,r=e.y+u/2,i=t.x,a=t.y+u/2,o=n+Math.max(20,(i-n)/2);return`M ${n} ${r} C ${o} ${r}, ${o} ${a}, ${i} ${a}`}function y(e,t){return`M ${e.x+l/2} ${e.y+u/2} L ${t.x+l/2} ${t.y+u/2}`}function b(){let e=r(e=>e.graphNodes),t=r(e=>e.graphEdges),n=r(e=>e.graphTotal),d=r(e=>e.graphMaxNodes),f=r(e=>e.graphTruncated),p=r(e=>e.graphLoading),b=r(e=>e.graphError),x=r(e=>e.graphProjectFilter),S=r(e=>e.setGraphProjectFilter),C=r(e=>e.openTaskDetailById),[w,T]=(0,s.useState)([]);(0,s.useEffect)(()=>{let e=!1;return i(`GET`,`/projects`).then(t=>{e||T(t.projects??[])}).catch(()=>{e||T([])}),()=>{e=!0}},[]);let E=(0,s.useMemo)(()=>{let t=w.map(e=>({value:e.id,label:e.title||e.slug||e.issueRepo||e.id}));for(let n of e)n.projectId&&!t.some(e=>e.value===n.projectId)&&t.push({value:n.projectId,label:n.projectId});return t.sort((e,t)=>e.label.localeCompare(t.label))},[e,w]),D=(0,s.useMemo)(()=>_(e,t),[e,t]),O=(0,s.useMemo)(()=>new Map(D.nodes.map(e=>[e.node.id,e])),[D]),k=(0,s.useMemo)(()=>{let e={depends_on:0,parent:0,related:0};for(let n of t)e[n.kind]+=1;return e},[t]);return(0,c.jsxs)(`div`,{className:`space-y-4`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(a,{className:`w-5 h-5 text-muted-foreground`}),(0,c.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Dependencies`}),(0,c.jsx)(o,{variant:`secondary`,children:e.length})]}),(0,c.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:(0,c.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:x,onChange:e=>S(e.target.value),children:[(0,c.jsx)(`option`,{value:``,children:`All projects`}),E.map(e=>(0,c.jsx)(`option`,{value:e.value,children:e.label},e.value))]})})]}),(0,c.jsx)(`div`,{className:`flex items-center gap-4 flex-wrap text-xs text-muted-foreground`,children:Object.keys(g).map(e=>(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,c.jsx)(`svg`,{width:`20`,height:`8`,className:`shrink-0`,children:(0,c.jsx)(`line`,{x1:`0`,y1:`4`,x2:`20`,y2:`4`,stroke:g[e].stroke,strokeWidth:2,strokeDasharray:g[e].dash})}),(0,c.jsxs)(`span`,{children:[g[e].label,` (`,k[e],`)`]})]},e))}),b&&(0,c.jsx)(`div`,{className:`text-sm text-tone-danger-fg`,children:b}),f&&(0,c.jsxs)(`div`,{className:`text-sm text-tone-yellow-fg`,children:[`Showing `,d,` of `,n,` tasks — narrow with a project filter to see the rest.`]}),e.length===0&&!p&&(0,c.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No tasks to graph`}),e.length>0&&(0,c.jsx)(`div`,{className:`h-[calc(100dvh-16rem)] overflow-auto rounded-md border border-border`,children:(0,c.jsxs)(`div`,{className:`relative`,style:{width:D.width,height:D.height},children:[(0,c.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0`,width:D.width,height:D.height,"aria-hidden":`true`,children:[(0,c.jsx)(`defs`,{children:Object.keys(g).filter(e=>g[e].arrow).map(e=>(0,c.jsx)(`marker`,{id:`task-graph-arrow-${e}`,viewBox:`0 0 8 8`,refX:`6.5`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,c.jsx)(`path`,{d:`M0 0 L8 4 L0 8 z`,fill:g[e].stroke})},e))}),t.map(e=>{let t=O.get(e.from),n=O.get(e.to);if(!t||!n)return null;let r=g[e.kind];return(0,c.jsx)(`path`,{d:e.kind===`related`?y(t,n):v(t,n),stroke:r.stroke,strokeOpacity:.7,strokeWidth:e.kind===`related`?1.5:2,strokeDasharray:r.dash,fill:`none`,strokeLinecap:`round`,markerEnd:r.arrow?`url(#task-graph-arrow-${e.kind})`:void 0},`${e.kind}-${e.from}-${e.to}`)})]}),D.nodes.map(({node:e,x:t,y:n})=>(0,c.jsxs)(`button`,{type:`button`,onClick:()=>C(e.id),className:`group absolute flex flex-col justify-between rounded-md border bg-background/95 p-2 text-left shadow-sm transition-all hover:-translate-y-px hover:border-foreground/30 hover:shadow-md`,style:{left:t,top:n,width:l,height:u},title:e.title,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,c.jsxs)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:[`T`,e.id]}),e.priority&&(0,c.jsx)(o,{variant:`secondary`,className:`text-[10px] px-1 py-0 ${h[e.priority]??`bg-tone-neutral/10 text-tone-neutral-fg`}`,children:e.priority})]}),(0,c.jsx)(`div`,{className:`truncate text-xs font-medium leading-tight`,children:e.title}),(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,c.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${m[e.status]??`bg-tone-neutral`}`}),(0,c.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.status})]})]},e.id))]})})]})}export{b as DependencyGraphView};
|
|
2
|
+
//# sourceMappingURL=dependency-graph-D_rurNBz.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Ct as i,t as a}from"./store-DKPDIZBe.js";import{M as o}from"./provider-display-BEeLXC_D.js";import{et as s,v as c}from"./display-CDeH4I8T.js";import{t as l}from"./api-CIIVBtAV.js";import{t as u}from"./scroll-area-CIN4KQse.js";import{t as d}from"./circle-check-CkUkN96J.js";import{t as f}from"./issue-ref-chip-CeWBNWn7.js";import{t as p}from"./circle-x-CZ0erS7Q.js";import{t as m}from"./clock-3-BH47318N.js";import{t as h}from"./git-commit-horizontal-DS1pJ_SS.js";import{t as g}from"./loader-circle-BfPd4kOD.js";import{t as _}from"./refresh-cw-CfpvQcUn.js";import{t as v}from"./rocket-BmO1qSu-.js";import{t as y}from"./triangle-alert-BBNhfgMi.js";import{t as b}from"./button-Do6Z3vvn.js";import{t as x}from"./badge-DqJRtj_p.js";import{t as S}from"./task-chip-CYj0mpoL.js";import{o as C,r as w,t as T}from"./card-C4QJ4hCW.js";var E=e(n(),1),D=r(),O=`cd-watcher`,k={succeeded:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,pending:`bg-tone-info/10 text-tone-info-fg border-tone-info/30`,failed:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`,"rolled-back":`bg-tone-orange/10 text-tone-orange-fg border-tone-orange/30`},A={upgraded:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,succeeded:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,pending:`bg-tone-info/10 text-tone-info-fg border-tone-info/30`,skipped:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`,failed:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`,"timed-out":`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`};function j(e){return e?e.slice(0,12):`—`}function M(e,t,n){let r=(t??n)-e;return r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${Math.floor(r/6e4)}m ${Math.round(r%6e4/1e3)}s`}function N({convergence:e,loading:t,onRefresh:n}){return(0,D.jsx)(T,{children:(0,D.jsxs)(w,{className:`flex flex-wrap items-center gap-3 py-3`,children:[t&&!e?(0,D.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Loading fleet convergence…`}):e?.configured?e.targetSha?e.converged?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{className:`h-4 w-4 text-tone-success-fg`}),(0,D.jsx)(`span`,{className:`text-sm font-medium text-tone-success-fg`,children:`Fleet converged`}),(0,D.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.expectedCount,` host`,e.expectedCount===1?``:`s`,` on `,(0,D.jsx)(`span`,{className:`font-mono`,children:j(e.targetSha)})]})]}):e.stranded.length===0&&e.versionOnlyConfirmed.length>0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{className:`h-4 w-4 text-tone-warning-fg`}),(0,D.jsxs)(`span`,{className:`text-sm font-medium text-tone-warning-fg`,children:[e.versionOnlyConfirmed.length,` host`,e.versionOnlyConfirmed.length===1?``:`s`,` confirmed by version only (gitSha unattested)`]}),(0,D.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.versionOnlyConfirmed.map(t=>(0,D.jsxs)(x,{variant:`outline`,className:`text-[10px] bg-tone-warning/10 text-tone-warning-fg border-tone-warning/30`,title:`running ${t.version??`a matching version`} — not proven to be at ${j(e.targetSha)} specifically`,children:[t.id,t.version?` @ v${t.version}`:``]},t.id))})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{className:`h-4 w-4 text-tone-danger-fg`}),(0,D.jsxs)(`span`,{className:`text-sm font-medium text-tone-danger-fg`,children:[e.stranded.length,` host`,e.stranded.length===1?``:`s`,` stranded on `,(0,D.jsx)(`span`,{className:`font-mono`,children:j(e.targetSha)})]}),(0,D.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.stranded.map(e=>(0,D.jsxs)(x,{variant:`outline`,className:`text-[10px] bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`,title:[e.gitSha?`attesting ${e.gitSha}`:`never attested a SHA`,e.deferred?.reason].filter(Boolean).join(` — `),children:[e.id,e.gitSha?` @ ${j(e.gitSha)}`:` (unattested)`,e.deferred?` · draining since ${c(e.deferred.since)}`:``,e.lag?` · ${Math.floor(e.lag.ageMs/6e4)}m behind`:``,e.lag?.alarm?` · deploy lag alarm`:``]},e.id))})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No successful deploy yet — nothing to converge on`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`AGENT_RELAY_CD_FLEET is not configured — no convergence target`})]}),(0,D.jsx)(b,{"aria-label":`Refresh fleet convergence`,variant:`outline`,size:`sm`,className:`ml-auto h-7`,onClick:n,children:(0,D.jsx)(_,{className:`h-3.5 w-3.5`})})]})})}function P({host:e}){return(0,D.jsxs)(x,{variant:`outline`,className:t(`text-[10px]`,A[e.status]??`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`),title:e.reason,children:[e.id,`: `,e.status,e.toVersion?` (${e.toVersion})`:``]})}function F({changes:e,defaultOpen:t,now:n}){let r=a(e=>e.openTaskDetailById),i=e.tasks??[],o=e.unmatchedCommits??[],s=i.length===0&&o.length===0;return(0,D.jsxs)(`details`,{open:t,className:`rounded-md border border-border/60 px-2 py-1.5`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground`,children:[(0,D.jsx)(`span`,{children:`What shipped`}),e.state===`pending`?(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-normal italic text-muted-foreground`,children:[(0,D.jsx)(g,{className:`h-3 w-3 animate-spin`}),` computing…`]}):(0,D.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[i.length,` task`,i.length===1?``:`s`,o.length>0?`, ${o.length} other commit${o.length===1?``:`s`}`:``]})]}),(0,D.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[s&&e.state===`ready`&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`no tracked changes`}),i.map(e=>(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,D.jsx)(S,{id:e.id,title:e.label,onClick:()=>r(e.id)}),(e.issues??[]).map(e=>(0,D.jsx)(f,{issueRef:e,now:n,compact:!0},e.id))]},e.id)),o.length>0&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[i.length>0&&(0,D.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`unattributed commits:`}),o.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,D.jsx)(h,{className:`h-3 w-3 shrink-0`}),(0,D.jsx)(`span`,{className:`font-mono`,children:j(e.sha)}),(0,D.jsx)(`span`,{className:`truncate`,children:e.subject})]},e.sha))]})]})]})}function I({deploy:e,now:n,defaultOpen:r}){let i=e.initiatedBy===O;return(0,D.jsxs)(T,{children:[(0,D.jsxs)(C,{className:`pb-2`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(h,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,D.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:j(e.commitSha)}),e.version&&(0,D.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,e.version]}),(0,D.jsxs)(x,{variant:`outline`,className:t(`text-[10px]`,k[e.status]??``),children:[e.status===`succeeded`&&(0,D.jsx)(d,{className:`mr-1 h-3 w-3`}),e.status===`failed`&&(0,D.jsx)(p,{className:`mr-1 h-3 w-3`}),e.status===`pending`&&(0,D.jsx)(m,{className:`mr-1 h-3 w-3`}),e.status]}),(0,D.jsx)(x,{variant:`secondary`,className:`text-[10px]`,title:e.initiatedBy,children:i?`Automated`:`Manual`}),(0,D.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,title:c(e.startedAt),children:s(n,e.startedAt)})]}),e.previousSha&&(0,D.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`what changed:`,` `,(0,D.jsxs)(`span`,{className:`font-mono`,children:[j(e.previousSha),`..`,j(e.commitSha)]})]})]}),(0,D.jsxs)(w,{className:`space-y-2 pt-0`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.hosts.length===0?(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`no hosts recorded`}):e.hosts.map(e=>(0,D.jsx)(P,{host:e},e.id))}),(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,D.jsxs)(`span`,{children:[`started `,c(e.startedAt)]}),(0,D.jsx)(`span`,{children:e.finishedAt?`finished ${c(e.finishedAt)}`:`in progress`}),(0,D.jsxs)(`span`,{children:[`duration `,M(e.startedAt,e.finishedAt,n)]})]}),e.changes&&(0,D.jsx)(F,{changes:e.changes,defaultOpen:r,now:n})]})]})}function L(){let e=i(),[t,n]=(0,E.useState)([]),[r,a]=(0,E.useState)(null),[s,c]=(0,E.useState)(!0),[d,f]=(0,E.useState)(null);async function p(){f(null);try{let[e,t]=await Promise.all([l(`GET`,`/deploys?limit=50`),l(`GET`,`/fleet/convergence`)]);n(e.deploys),a(t)}catch(e){f(o(e))}finally{c(!1)}}return(0,E.useEffect)(()=>{p()},[]),(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,D.jsx)(v,{className:`h-5 w-5 text-muted-foreground`}),(0,D.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Deploys`}),(0,D.jsx)(x,{variant:`secondary`,children:t.length})]}),(0,D.jsxs)(b,{size:`sm`,variant:`outline`,onClick:()=>void p(),children:[(0,D.jsx)(_,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),d&&(0,D.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:d}),(0,D.jsx)(N,{convergence:r,loading:s,onRefresh:()=>void p()}),(0,D.jsx)(u,{className:`h-[calc(100dvh-14rem)]`,children:s&&t.length===0?(0,D.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Loading…`}):t.length===0?(0,D.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:`No deploys recorded yet`}):(0,D.jsx)(`div`,{className:`space-y-3`,children:t.map((t,n)=>(0,D.jsx)(I,{deploy:t,now:e,defaultOpen:n===0},t.id))})})]})}export{L as DeploysView};
|
|
2
|
-
//# sourceMappingURL=deploys-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Ct as i,t as a}from"./store-BgDALGIX.js";import{M as o}from"./provider-display-bWwiuedV.js";import{et as s,v as c}from"./display-BemJG1f_.js";import{t as l}from"./api-CIIVBtAV.js";import{t as u}from"./scroll-area-CIN4KQse.js";import{t as d}from"./circle-check-CkUkN96J.js";import{t as f}from"./issue-ref-chip-DbH8J9Ak.js";import{t as p}from"./circle-x-CZ0erS7Q.js";import{t as m}from"./clock-3-BH47318N.js";import{t as h}from"./git-commit-horizontal-DS1pJ_SS.js";import{t as g}from"./loader-circle-BfPd4kOD.js";import{t as _}from"./refresh-cw-CfpvQcUn.js";import{t as v}from"./rocket-BmO1qSu-.js";import{t as y}from"./triangle-alert-BBNhfgMi.js";import{t as b}from"./button-Do6Z3vvn.js";import{t as x}from"./badge-DqJRtj_p.js";import{t as S}from"./task-chip-CYj0mpoL.js";import{o as C,r as w,t as T}from"./card-C4QJ4hCW.js";var E=e(n(),1),D=r(),O=`cd-watcher`,k={succeeded:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,pending:`bg-tone-info/10 text-tone-info-fg border-tone-info/30`,failed:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`,"rolled-back":`bg-tone-orange/10 text-tone-orange-fg border-tone-orange/30`},A={upgraded:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,succeeded:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,pending:`bg-tone-info/10 text-tone-info-fg border-tone-info/30`,skipped:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`,failed:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`,"timed-out":`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`};function j(e){return e?e.slice(0,12):`—`}function M(e,t,n){let r=(t??n)-e;return r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${Math.floor(r/6e4)}m ${Math.round(r%6e4/1e3)}s`}function N({convergence:e,loading:t,onRefresh:n}){return(0,D.jsx)(T,{children:(0,D.jsxs)(w,{className:`flex flex-wrap items-center gap-3 py-3`,children:[t&&!e?(0,D.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Loading fleet convergence…`}):e?.configured?e.targetSha?e.converged?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{className:`h-4 w-4 text-tone-success-fg`}),(0,D.jsx)(`span`,{className:`text-sm font-medium text-tone-success-fg`,children:`Fleet converged`}),(0,D.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.expectedCount,` host`,e.expectedCount===1?``:`s`,` on `,(0,D.jsx)(`span`,{className:`font-mono`,children:j(e.targetSha)})]})]}):e.stranded.length===0&&e.versionOnlyConfirmed.length>0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{className:`h-4 w-4 text-tone-warning-fg`}),(0,D.jsxs)(`span`,{className:`text-sm font-medium text-tone-warning-fg`,children:[e.versionOnlyConfirmed.length,` host`,e.versionOnlyConfirmed.length===1?``:`s`,` confirmed by version only (gitSha unattested)`]}),(0,D.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.versionOnlyConfirmed.map(t=>(0,D.jsxs)(x,{variant:`outline`,className:`text-[10px] bg-tone-warning/10 text-tone-warning-fg border-tone-warning/30`,title:`running ${t.version??`a matching version`} — not proven to be at ${j(e.targetSha)} specifically`,children:[t.id,t.version?` @ v${t.version}`:``]},t.id))})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{className:`h-4 w-4 text-tone-danger-fg`}),(0,D.jsxs)(`span`,{className:`text-sm font-medium text-tone-danger-fg`,children:[e.stranded.length,` host`,e.stranded.length===1?``:`s`,` stranded on `,(0,D.jsx)(`span`,{className:`font-mono`,children:j(e.targetSha)})]}),(0,D.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.stranded.map(e=>(0,D.jsxs)(x,{variant:`outline`,className:`text-[10px] bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`,title:[e.gitSha?`attesting ${e.gitSha}`:`never attested a SHA`,e.deferred?.reason].filter(Boolean).join(` — `),children:[e.id,e.gitSha?` @ ${j(e.gitSha)}`:` (unattested)`,e.deferred?` · draining since ${c(e.deferred.since)}`:``,e.lag?` · ${Math.floor(e.lag.ageMs/6e4)}m behind`:``,e.lag?.alarm?` · deploy lag alarm`:``]},e.id))})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No successful deploy yet — nothing to converge on`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`AGENT_RELAY_CD_FLEET is not configured — no convergence target`})]}),(0,D.jsx)(b,{"aria-label":`Refresh fleet convergence`,variant:`outline`,size:`sm`,className:`ml-auto h-7`,onClick:n,children:(0,D.jsx)(_,{className:`h-3.5 w-3.5`})})]})})}function P({host:e}){return(0,D.jsxs)(x,{variant:`outline`,className:t(`text-[10px]`,A[e.status]??`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`),title:e.reason,children:[e.id,`: `,e.status,e.toVersion?` (${e.toVersion})`:``]})}function F({changes:e,defaultOpen:t,now:n}){let r=a(e=>e.openTaskDetailById),i=e.tasks??[],o=e.unmatchedCommits??[],s=i.length===0&&o.length===0;return(0,D.jsxs)(`details`,{open:t,className:`rounded-md border border-border/60 px-2 py-1.5`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground`,children:[(0,D.jsx)(`span`,{children:`What shipped`}),e.state===`pending`?(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-normal italic text-muted-foreground`,children:[(0,D.jsx)(g,{className:`h-3 w-3 animate-spin`}),` computing…`]}):(0,D.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[i.length,` task`,i.length===1?``:`s`,o.length>0?`, ${o.length} other commit${o.length===1?``:`s`}`:``]})]}),(0,D.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[s&&e.state===`ready`&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`no tracked changes`}),i.map(e=>(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,D.jsx)(S,{id:e.id,title:e.label,onClick:()=>r(e.id)}),(e.issues??[]).map(e=>(0,D.jsx)(f,{issueRef:e,now:n,compact:!0},e.id))]},e.id)),o.length>0&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[i.length>0&&(0,D.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`unattributed commits:`}),o.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,D.jsx)(h,{className:`h-3 w-3 shrink-0`}),(0,D.jsx)(`span`,{className:`font-mono`,children:j(e.sha)}),(0,D.jsx)(`span`,{className:`truncate`,children:e.subject})]},e.sha))]})]})]})}function I({deploy:e,now:n,defaultOpen:r}){let i=e.initiatedBy===O;return(0,D.jsxs)(T,{children:[(0,D.jsxs)(C,{className:`pb-2`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(h,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,D.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:j(e.commitSha)}),e.version&&(0,D.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,e.version]}),(0,D.jsxs)(x,{variant:`outline`,className:t(`text-[10px]`,k[e.status]??``),children:[e.status===`succeeded`&&(0,D.jsx)(d,{className:`mr-1 h-3 w-3`}),e.status===`failed`&&(0,D.jsx)(p,{className:`mr-1 h-3 w-3`}),e.status===`pending`&&(0,D.jsx)(m,{className:`mr-1 h-3 w-3`}),e.status]}),(0,D.jsx)(x,{variant:`secondary`,className:`text-[10px]`,title:e.initiatedBy,children:i?`Automated`:`Manual`}),(0,D.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,title:c(e.startedAt),children:s(n,e.startedAt)})]}),e.previousSha&&(0,D.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`what changed:`,` `,(0,D.jsxs)(`span`,{className:`font-mono`,children:[j(e.previousSha),`..`,j(e.commitSha)]})]})]}),(0,D.jsxs)(w,{className:`space-y-2 pt-0`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.hosts.length===0?(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`no hosts recorded`}):e.hosts.map(e=>(0,D.jsx)(P,{host:e},e.id))}),(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,D.jsxs)(`span`,{children:[`started `,c(e.startedAt)]}),(0,D.jsx)(`span`,{children:e.finishedAt?`finished ${c(e.finishedAt)}`:`in progress`}),(0,D.jsxs)(`span`,{children:[`duration `,M(e.startedAt,e.finishedAt,n)]})]}),e.changes&&(0,D.jsx)(F,{changes:e.changes,defaultOpen:r,now:n})]})]})}function L(){let e=i(),[t,n]=(0,E.useState)([]),[r,a]=(0,E.useState)(null),[s,c]=(0,E.useState)(!0),[d,f]=(0,E.useState)(null);async function p(){f(null);try{let[e,t]=await Promise.all([l(`GET`,`/deploys?limit=50`),l(`GET`,`/fleet/convergence`)]);n(e.deploys),a(t)}catch(e){f(o(e))}finally{c(!1)}}return(0,E.useEffect)(()=>{p()},[]),(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,D.jsx)(v,{className:`h-5 w-5 text-muted-foreground`}),(0,D.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Deploys`}),(0,D.jsx)(x,{variant:`secondary`,children:t.length})]}),(0,D.jsxs)(b,{size:`sm`,variant:`outline`,onClick:()=>void p(),children:[(0,D.jsx)(_,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),d&&(0,D.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:d}),(0,D.jsx)(N,{convergence:r,loading:s,onRefresh:()=>void p()}),(0,D.jsx)(u,{className:`h-[calc(100dvh-14rem)]`,children:s&&t.length===0?(0,D.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Loading…`}):t.length===0?(0,D.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:`No deploys recorded yet`}):(0,D.jsx)(`div`,{className:`space-y-3`,children:t.map((t,n)=>(0,D.jsx)(I,{deploy:t,now:e,defaultOpen:n===0},t.id))})})]})}export{L as DeploysView};
|
|
2
|
+
//# sourceMappingURL=deploys-yzZqIpxE.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{C as e,E as t,N as n,O as r,i,k as a,r as o,t as s,w as c}from"./provider-display-
|
|
1
|
+
import{C as e,E as t,N as n,O as r,i,k as a,r as o,t as s,w as c}from"./provider-display-bWwiuedV.js";var l=`provider-submit-unconfirmed`,u=t,d=u,f=5e3,p=15e3,m=3e4,ee=1e3,te=1200,ne=`(max-width: 767px)`,re=new Set([`done`,`failed`,`canceled`]),ie=new Set([`open`,`blocked`]),ae={online:0,idle:0,busy:2,offline:3},oe={idle:0,online:0,busy:2,offline:4},h={from:``,to:``,body:``,channel:``,subject:``,claimable:!1},g={toMode:`agent`,to:``,body:``,channel:``,subject:``,claimable:!1},_={pairId:``,from:``,body:``,subject:``},se={requesterId:``,targetId:``,objective:``},ce={user:`User`,system:`Server`,channel:`MessagesSquare`,agent:`Bot`},le={user:`Human operator`,system:`System`,channel:`Channel`,agent:`Agent`};({...ce,...Object.fromEntries(s().map(e=>[e,`Bot`]))}),{...le,...Object.fromEntries(s().map(e=>[e,`${o(e)} agent`]))};var v=[{key:`overview`,label:`Overview`,icon:`LayoutDashboard`},{key:`chat`,label:`Chat`,icon:`MessageCircle`},{key:`agents`,label:`Agents`,icon:`Bot`},{key:`managed`,label:`Managed Agents`,icon:`Workflow`,adminOnly:!0},{key:`teams`,label:`Teams`,icon:`Users`},{key:`profiles`,label:`Agent Profiles`,icon:`UserCog`},{key:`orchestrators`,label:`Orchestrators`,icon:`Server`,adminOnly:!0},{key:`fleet`,label:`Fleet`,icon:`HardDrive`,adminOnly:!0},{key:`deploys`,label:`Deploys`,icon:`Rocket`,adminOnly:!0},{key:`shipping`,label:`Shipping`,icon:`Truck`},{key:`workflows`,label:`Workflows`,icon:`Route`},{key:`workspaces`,label:`Workspaces`,icon:`GitBranch`},{key:`files`,label:`Files`,icon:`FolderTree`},{key:`artifacts`,label:`Artifacts`,icon:`Paperclip`,adminOnly:!0},{key:`channels`,label:`Channels`,icon:`MessagesSquare`},{key:`connectors`,label:`Connectors`,icon:`Plug`,adminOnly:!0},{key:`integrations`,label:`Integrations`,icon:`PlugZap`,adminOnly:!0},{key:`security`,label:`Security`,icon:`Shield`,adminOnly:!0},{key:`secrets`,label:`Secrets`,icon:`KeyRound`},{key:`memory`,label:`Memory`,icon:`BrainCircuit`},{key:`activity`,label:`Activity`,icon:`Activity`,adminOnly:!0},{key:`pairs`,label:`Pairs`,icon:`Link`,adminOnly:!0},{key:`messages`,label:`Messages`,icon:`Mail`},{key:`work`,label:`Work Queue`,icon:`ListChecks`},{key:`tasks`,label:`Tasks`,icon:`ClipboardList`},{key:`backlog`,label:`Backlog`,icon:`ListOrdered`},{key:`dependencies`,label:`Dependencies`,icon:`Waypoints`},{key:`automation`,label:`Automation`,icon:`CalendarClock`,adminOnly:!0},{key:`analytics`,label:`Analytics`,icon:`AreaChart`,adminOnly:!0},{key:`insights`,label:`Insights`,icon:`Lightbulb`,adminOnly:!0},{key:`projects`,label:`Projects`,icon:`Boxes`,adminOnly:!0},{key:`prompts`,label:`Prompts`,icon:`FileText`},{key:`kernel`,label:`Kernel`,icon:`Cpu`,adminOnly:!0},{key:`registry`,label:`Registry`,icon:`PackagePlus`,adminOnly:!0},{key:`maintenance`,label:`Maintenance`,icon:`Wrench`,adminOnly:!0},{key:`agent-tools`,label:`Agent Tools`,icon:`Globe`},{key:`settings`,label:`Settings`,icon:`Settings`}],ue=new Set(v.filter(e=>e.adminOnly).map(e=>e.key)),de=[{href:`cosmos.html`,label:`Cosmos`,icon:`Orbit`}],fe={critical:`text-tone-danger-fg bg-tone-danger/10`,warning:`text-tone-yellow-fg bg-tone-yellow/10`,info:`text-tone-info-fg bg-tone-info/10`},pe={active:`bg-tone-success/20 text-tone-success-fg`,pending:`bg-tone-yellow/20 text-tone-yellow-fg`,ended:`bg-tone-neutral/20 text-tone-neutral-fg`,rejected:`bg-tone-danger/20 text-tone-danger-fg`,expired:`bg-tone-danger/20 text-tone-danger-fg`};function me(e){let t=typeof e==`number`?e:new Date(e||0).getTime();return Number.isFinite(t)?t:0}var he=[`lifecycle.`,`commands.`,`capabilities.`],y={"+1":`👍`,":+1:":`👍`,thumbsup:`👍`,":thumbsup:":`👍`,"thumbs-up":`👍`,":thumbs-up:":`👍`,thumbs_up:`👍`,":thumbs_up:":`👍`,thumb_up:`👍`,":thumb_up:":`👍`,like:`👍`,":like:":`👍`,heart:`❤️`,":heart:":`❤️`,redheart:`❤️`,red_heart:`❤️`,":red_heart:":`❤️`,check:`✅`,":check:":`✅`,checkmark:`✅`,":checkmark:":`✅`,white_check_mark:`✅`,":white_check_mark:":`✅`,eyes:`👀`,":eyes:":`👀`};function b(e){let t=e.trim();return y[t.toLowerCase()]??t}function x(e){return e.filter(e=>!he.some(t=>e.startsWith(t)))}function S(e,t=2){if(!e)return``;let n=e.replace(/\/+$/,``).split(`/`);return n.length<=t?e:n.slice(-t).join(`/`)}function C(e){return e.trim().replace(/\\/g,`/`).replace(/\/+$/,``)||`/`}function w(e,t){if(!e?.trim()||!t?.trim())return!1;let n=C(e),r=C(t);return r===`/`?n.startsWith(`/`):n===`/`?!1:n===r||n.startsWith(r+`/`)}function T(e){return e?.meta?.builtin===!0||r(e?.id)||e?.id===`system`}function E(e){let t=e?.meta?.channelBinding;return n(t)&&t.type===`channel`}function D(e){if(E(e))return!0;let t=e?.meta?.policyName;return typeof t==`string`&&!!t&&e?.meta?.profile===`social-media`}function O(e){return e?.kind?e.kind===`channel`||e.kind===`provider`&&D(e):e?.meta?.kind===`channel`}function k(e){return T(e)||O(e)}function A(e){if(r(e?.id))return`user`;if(e?.id===`system`)return`system`;if(O(e))return`channel`;let t=s(),n=typeof e?.meta?.provider==`string`?e.meta.provider.toLowerCase():void 0;if(n&&t.includes(n))return n;let i=[...e?.tags||[],e?.meta?.client,e?.meta?.runtime,e?.meta?.agentType].filter(e=>typeof e==`string`).map(e=>e.toLowerCase());for(let e of t)if(i.some(t=>t.includes(e)))return e;return`agent`}function j(e,t){if(!t?.lastSeen||t.status===`offline`||r(t.id)||t.id===`system`)return!1;let i=t.meta?.transport;if(n(i)&&i.connected===!0)return!1;let a=new Date(t.lastSeen).getTime();return Number.isFinite(a)?e-a>6e4:!1}function M(e,t){if(!e||T(e)||O(e)||t===`resume`)return!1;if(t===`interrupt`)return e.providerCapabilities?.liveSession?.interrupt===!0&&e.status===`busy`;if(t===`releaseSubmitHold`)return J(e)?.reason===l;if(F(e)&&(t===`restart`||t===`compact`||t===`clearContext`)&&!P(e))return!1;let n=e.providerCapabilities?.lifecycle;if(n){if(t===`restart`)return n.restartHard===!0;if(t===`shutdown`)return n.shutdownHard===!0;if(t===`reconnect`)return n.reconnect===!0}return t===`compact`?e.providerCapabilities?.context?.compact===!0:t===`clearContext`?e.providerCapabilities?.context?.clear===!0:e.meta?.runnerManaged===!0&&(t===`restart`||t===`shutdown`)}function N(e,t){let n=e?.providerCapabilities?.terminal;return n?.attach?.create===!0?n.attach.write===!0:t?!!n?.live?.write:!1}function P(e){return typeof e.meta?.tmuxSession==`string`&&e.meta.tmuxSession.trim().length>0}function F(e){return(typeof e?.meta?.provider==`string`?i(e.meta.provider):void 0)?.capabilityDefaults?.terminal?.mode===`live`}function I(e){return M(e,`restart`)||M(e,`shutdown`)||M(e,`reconnect`)||M(e,`compact`)||M(e,`clearContext`)}function L(e){return!!(e&&!T(e)&&!O(e)&&!I(e)&&(e.status===`offline`||e.status===`stale`))}function R(e,t){if(e.status!==`offline`)return!1;let n=typeof e.meta?.policyName==`string`?e.meta.policyName:``;if(!n)return!1;let r=t.find(e=>e.policy.name===n);return!!(r?.state.agentId&&r.state.agentId!==e.id)}function ge(e,t,n=[]){let r=e.filter(e=>!R(e,n));return t?r:r.filter(e=>!k(e))}function z(e){return e?e.id===c?`Claude app connector`:e.label||e.name||e.id.slice(-12):`?`}function B(e,t){let n=a(e);return n?t[n]:void 0}function _e(e,t){let n=B(e,t);return n?.displayName?.trim()||n?.handle?.trim()||`User`}var V=[`text-tone-sky-fg`,`text-tone-warning-fg`,`text-tone-success-fg`,`text-tone-violet-fg`,`text-tone-rose-fg`,`text-tone-cyan-fg`];function ve(e){let t=a(e)||``,n=0;for(let e=0;e<t.length;e++)n=n*31+t.charCodeAt(e)>>>0;return V[n%V.length]}function H(e,t){if(t[e])return t[e];if(!e.startsWith(`coordinator:`))return;let n=e.slice(12),r;for(let e of Object.values(t))if(!(e.teamId!==n||e.meta?.profile!==`coordinator`)){if(e.status!==`offline`)return e;r??=e}return r}function ye(e,t){if(!e)return`?`;if(e===`broadcast`)return`broadcast`;if(e.startsWith(`tag:`))return`#`+e.slice(4);if(e.startsWith(`cap:`))return e.slice(4);if(e.startsWith(`label:`))return e.slice(6);if(e.startsWith(`coordinator:`)){let n=H(e,t);return n?z(n):`coordinator:${e.slice(12).slice(-8)}`}if(e.startsWith(`team:`)){let n=e.slice(5),r=Object.values(t).find(e=>e.teamId===n);return r?`team:${z(r)}`:`team:${n.slice(-8)}`}let n=t[e];return n?z(n):e.slice(-8)}function U(e){if(!e)return``;let t=e.payload||{},n=t.message;if(n&&typeof n==`object`&&typeof n.text==`string`&&n.text.trim())return n.text;let r=t.interaction;if(r&&typeof r==`object`){let e=typeof r.title==`string`?r.title.trim():``,t=typeof r.description==`string`?r.description.trim():``;if(e&&t)return e+`
|
|
2
2
|
`+t;if(e)return e;if(t)return t}let i=t.reaction;if(i&&typeof i==`object`){let e=typeof i.name==`string`?i.name:``,t=typeof i.emoji==`string`?i.emoji:``,n=typeof i.value==`string`?i.value:``;return[`Reaction`,b(t||e||n)].filter(Boolean).join(`: `)}let a=t.activity;return a&&typeof a==`object`?[typeof a.kind==`string`?a.kind:`activity`,typeof a.state==`string`?a.state:``].filter(Boolean).join(` `):typeof t.text==`string`&&t.text.trim()?t.text:typeof t.message==`string`&&t.message.trim()?t.message:xe(e.body||``)??(e.body||``)}function be(e){if(!e?.payload)return!1;let t=e.payload.event;return e.payload.reactionNotification===!0||t?.type===`message.reaction`}function W(e){if(!e)return null;let t=e.trim();if(!t.startsWith(`{`))return null;try{let e=JSON.parse(t);if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=typeof e.text==`string`?e.text:typeof e.message==`string`?e.message:null;if(!n?.trim())return null;let r=new Set([`text`,`message`]);return{text:n,meta:Object.entries(e).filter(([e,t])=>!r.has(e)&&(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)).map(([e,t])=>[e,String(t)]),raw:e}}catch{return null}}function xe(e){return W(e)?.text??null}function Se(e){let t=e?.subject||U(e)||``;return t.length>90?t.slice(0,90)+`...`:t}function Ce(e){return r(e.from)&&e.to?e.to:r(e.to)&&e.from?e.from:``}function G(e){return r(e.to)&&!r(e.from)}function K(e){if(e.kind!==`session`)return!1;let t=e.payload?.session?.type;return t===`reasoning`||t===`tool`}function q(t){return t.kind===`session`&&e(t.payload)}function we(e,t){let n=e.trim(),r=t.trim();return r?n===r||n.startsWith(`${r}\n\n`)||n.endsWith(`\n\n${r}`)||n.includes(`\n\n${r}\n\n`):!1}function Te(e,t,n){if(!G(n)||!q(n)||(n.readBy||[]).includes(n.to))return!1;let r=Number(e[t]||0);return n.id>(Number.isFinite(r)?r:0)}function Ee(e){return(e.kind??`claim`)===`claim`&&ie.has(e.status)&&!e.claimedBy}function De(e){return!!(e.claimable&&!e.claimedBy&&!(e.kind===`task`&&Number.isSafeInteger(e.payload?.taskId)))}function Oe(e,t){return!e||!t?!1:e===`broadcast`||e===t.id?!0:e.startsWith(`tag:`)?(t.tags||[]).includes(e.slice(4)):e.startsWith(`cap:`)?(t.capabilities||[]).includes(e.slice(4)):e.startsWith(`label:`)?t.label===e.slice(6):e.startsWith(`team:`)?t.teamId===e.slice(5):!1}function ke(e,t){return e?t.from===e||t.to===e||t.resolvedToAgent===e:!1}function Ae(e,t){if(!e||!t)return!1;let n=[t.id,t.type,...t.topicChannels||[]].filter(Boolean);if(e.channel&&n.includes(e.channel))return!0;let r=e.payload?.channel;if(r&&typeof r==`object`){let e=[r.agentId,r.provider,r.accountId].filter(Boolean);if(e.includes(t.id)||e.includes(t.type)||t.accountId&&e.includes(t.accountId))return!0}return!!(t.agentId&&(e.from===t.agentId||e.to===t.agentId))}function J(e){let t=e?.meta?.providerState;return!n(t)||typeof t.state!=`string`?null:{state:t.state,reason:typeof t.reason==`string`?t.reason:void 0,label:typeof t.label==`string`&&t.label?t.label:t.state,recommendedAction:typeof t.recommendedAction==`string`?t.recommendedAction:void 0,message:typeof t.message==`string`?t.message:void 0,source:typeof t.source==`string`?t.source:void 0,raw:t.raw,updatedAt:typeof t.updatedAt==`number`?t.updatedAt:void 0,pendingApproval:je(t.pendingApproval)}}function je(e){if(!n(e)||typeof e.id!=`string`)return;let t=Array.isArray(e.choices)?e.choices.filter(n).map(e=>({id:e.id,label:typeof e.label==`string`?e.label:String(e.id||``)})).filter(e=>(e.id===`approve`||e.id===`approve-session`||e.id===`deny`||e.id===`abort`)&&!!e.label):[],r=Array.isArray(e.questions)?e.questions.filter(n).map(e=>({question:typeof e.question==`string`?e.question:``,header:typeof e.header==`string`?e.header:void 0,multiSelect:e.multiSelect===!0,options:Array.isArray(e.options)?e.options.filter(n).map(e=>({label:typeof e.label==`string`?e.label:String(e.label??``),description:typeof e.description==`string`?e.description:void 0})).filter(e=>!!e.label):[]})).filter(e=>!!e.question&&e.options.length>0):void 0;return{id:e.id,provider:typeof e.provider==`string`?e.provider:void 0,kind:typeof e.kind==`string`?e.kind:void 0,title:typeof e.title==`string`&&e.title?e.title:`Permission request`,body:typeof e.body==`string`?e.body:``,choices:t,...r&&r.length?{questions:r}:{},...typeof e.reasoningSettled==`boolean`?{reasoningSettled:e.reasoningSettled}:{}}}function Y(e){let t=J(e);return t?.state===`blocked`?t:null}function Me(e){return e?.meta?.providerState}function Ne(e){return!!e?.id}function Pe(e){return Ne(Y(e)?.pendingApproval)}function X(e){let t=e?.meta?.activeSubagents;if(!Array.isArray(t)){let t=typeof e?.meta?.activeSubagentCount==`number`?e.meta.activeSubagentCount:0;return t>0?Array.from({length:t},(e,t)=>({id:`subagent-${t+1}`,label:`Subagent ${t+1}`})):[]}return t.filter(n).map((e,t)=>{let n=typeof e.id==`string`&&e.id?e.id:`subagent-${t+1}`,r=typeof e.role==`string`&&e.role?e.role:void 0;return{id:n,label:typeof e.label==`string`&&e.label?e.label:r||n,role:r,startedAt:typeof e.startedAt==`number`?e.startedAt:void 0}})}function Z(e){let t=e?.meta?.activeWork;if(!Array.isArray(t))return null;let r=t.find(e=>n(e)&&e.kind===`background-script`);return!r||!n(r)?null:typeof r.label==`string`&&r.label?r.label:`background script`}function Fe(e,t,n,r){let i=typeof t?.meta?.lifecycleAction==`string`?t.meta.lifecycleAction:``,a=j(e,t),o=t?.status!==`offline`&&!t?.ready&&a,s=t?.status!==`offline`&&!t?.ready&&!a,c=n.unread>0&&t?.status!==`busy`,l=Y(t),u=Ie(t,n,r);if(t?.status===`offline`)return{label:`offline`,tone:`secondary`,icon:`PlugZap`,stale:!1,reconnecting:!1,badges:u};if(i.startsWith(`finalizing-`))return{label:`wrapping up (${i.slice(11)})`,tone:`warning`,icon:`Hourglass`,stale:a,reconnecting:o,badges:u};if(i===`kill-failed`)return{label:`kill failed`,tone:`danger`,icon:`AlertCircle`,stale:a,reconnecting:o,badges:u};if(i===`shutting-down`)return{label:`shutting down`,tone:`warning`,icon:`Power`,stale:a,reconnecting:o,badges:u};if(i===`killing`)return{label:`killing`,tone:`danger`,icon:`Power`,stale:a,reconnecting:o,badges:u};if(i===`restarting`)return{label:`restarting`,tone:`warning`,icon:`RefreshCw`,stale:a,reconnecting:o,badges:u};if(t?.status===`stale`)return{label:`stale`,tone:`danger`,icon:`RefreshCw`,stale:!0,reconnecting:!0,badges:u};if(o)return{label:`reconnecting`,tone:`danger`,icon:`RefreshCw`,stale:a,reconnecting:o,badges:u};if(s)return{label:`online, not ready`,tone:`warning`,icon:`Loader`,stale:a,reconnecting:o,badges:u};if(l)return{label:`blocked: ${l.label}`,tone:`danger`,icon:`AlertCircle`,stale:a,reconnecting:o,badges:u};if(t?.status===`busy`){let e=Array.isArray(t?.meta?.busyReasons)?t.meta.busyReasons:[];return Z(t)&&!e.includes(`provider-turn`)&&!e.includes(`subagent`)?{label:`running background work`,tone:`warning`,icon:`Play`,stale:a,reconnecting:o,badges:u}:{label:`busy in turn`,tone:`warning`,icon:`Play`,stale:a,reconnecting:o,badges:u}}return r?.status===`active`?{label:`paired`,tone:`success`,icon:`Link`,stale:a,reconnecting:o,badges:u}:c?{label:`idle, unread`,tone:`danger`,icon:`Bell`,stale:a,reconnecting:o,badges:u}:{label:t?.status===`idle`?`idle`:`ready`,tone:`success`,icon:`CircleCheck`,stale:a,reconnecting:o,badges:u}}function Ie(e,t,n){let r=[],i=Y(e),a=X(e).length;i&&r.push({label:i.reason?`blocked: ${i.reason}`:`blocked`,className:`bg-tone-danger/20 text-tone-danger-fg`}),a&&r.push({label:a===1?`1 subagent`:a+` subagents`,className:`bg-tone-cyan/20 text-tone-cyan-fg`});let o=Z(e);return o&&r.push({label:o,className:`bg-tone-indigo/20 text-tone-indigo-fg`}),n?.status===`active`&&r.push({label:`paired`,className:`bg-tone-success/20 text-tone-success-fg`}),n?.status===`pending`&&r.push({label:`pair invite`,className:`bg-tone-yellow/20 text-tone-yellow-fg`}),t.needsHumanResponse&&r.push({label:`needs response`,className:`bg-tone-warning/20 text-tone-warning-fg`}),t.unread&&r.push({label:t.unread+` unread`,className:`bg-tone-danger/20 text-tone-danger-fg`}),t.claimableTasks&&r.push({label:t.claimableTasks+` claimable`,className:`bg-tone-orange/20 text-tone-orange-fg`}),r}function Le(){return{unread:0,needsHumanResponse:!1,pendingPairInvite:!1,claimableTasks:0,total:0,score:0}}function Q(e){return!e||e.status===`offline`?!1:e.targetHealth?.status===`ok`?!0:e.targetHealth?.status===`error`||e.targetHealth?.status===`warning`?!1:e.ready}function Re(e){return e?e.targetHealth?.status===`error`?{label:`target broken`,tone:`danger`,icon:`AlertTriangle`,badges:[]}:e.targetHealth?.status===`warning`?{label:`target warning`,tone:`warning`,icon:`AlertCircle`,badges:[]}:e.status===`offline`?{label:`offline`,tone:`secondary`,icon:`PlugZap`,badges:[]}:e.status===`busy`?{label:`busy`,tone:`warning`,icon:`Activity`,badges:[]}:Q(e)?{label:`ready`,tone:`success`,icon:`CircleCheck`,badges:[]}:{label:`not ready`,tone:`warning`,icon:`Loader`,badges:[]}:{label:`unknown`,tone:`secondary`,icon:`PlugZap`,badges:[]}}function ze(e){let t=e?.runtime||{};return t.status===`error`?{label:`error`,tone:`danger`,icon:`AlertTriangle`,badges:[]}:t.status===`warn`?{label:`warning`,tone:`warning`,icon:`AlertCircle`,badges:[]}:t.running?{label:`running`,tone:`success`,icon:`CircleCheck`,badges:[]}:t.enabled===!1?{label:`disabled`,tone:`secondary`,icon:`Pause`,badges:[]}:t.status===`ok`?{label:`ok`,tone:`success`,icon:`CircleCheck`,badges:[]}:{label:`unknown`,tone:`secondary`,icon:`HelpCircle`,badges:[]}}function Be(e){let t=e?.taskStats||{};return(t.waitingTasks||0)>0?{label:`waiting`,tone:`warning`,icon:`AlertCircle`,badges:[]}:(t.openTasks||0)>0?{label:`active`,tone:`info`,icon:`Activity`,badges:[]}:e?.configured?e.observed?{label:`quiet`,tone:`success`,icon:`CircleCheck`,badges:[]}:{label:`configured`,tone:`primary`,icon:`PlugZap`,badges:[]}:{label:`observed only`,tone:`secondary`,icon:`Eye`,badges:[]}}function Ve(e){let t=e?.health;return!t||t.status===`ok`?e?.version||e?.package?.version?`compatible`:`unknown version`:t.status===`upgrade-required`?`upgrade required`:t.status===`restart-required`?`restart required`:t.status===`unknown`?`unknown contract`:(t.issues||[]).some(e=>e.code===`protocol-mismatch`)?`protocol mismatch`:(t.issues||[]).some(e=>e.code===`package-drift`)?`package drift`:t.restartRequired?`restart required`:t.status}function He(e){let t=e?.health?.status;return t===`upgrade-required`?`text-tone-danger-fg bg-tone-danger/10`:t===`warn`||t===`restart-required`?`text-tone-yellow-fg bg-tone-yellow/10`:t===`unknown`?`text-tone-neutral-fg bg-tone-neutral/10`:`text-tone-success-fg bg-tone-success/10`}function $(e,t){let n=new Date(t).getTime();if(!Number.isFinite(n))return``;let r=Math.max(0,(e-n)/1e3);return r<60?Math.floor(r)+`s`:r<3600?Math.floor(r/60)+`m`:r<86400?Math.floor(r/3600)+`h`:Math.floor(r/86400)+`d`}function Ue(e,t){if(!t)return``;let n=$(e,t);return n&&n+` ago`}function We(e){return e===void 0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function Ge(e){return`M${e}`}function Ke(e){return e?new Date(e).toLocaleString():``}function qe(e){return String(e||`export`).replace(/[^a-z0-9._-]+/gi,`-`).replace(/^-+|-+$/g,``).slice(0,80)||`export`}function Je(e){return e.filter(e=>e.status!==`ok`).map(e=>{let t={name:e.name,status:e.status,detail:e.detail||e.name,impact:Ye(e),subjects:e.subjects||[],actions:[{label:`Inspect logs`,icon:`FileSearch`,copy:`humwick daemon logs`},{label:`Restart daemon`,icon:`RefreshCw`,copy:`humwick daemon restart`},{label:`Copy env`,icon:`Copy`,copy:`humwick doctor`}]};return e.name===`stale-live-agents`?t.actions.unshift({label:`Run reaper`,icon:`Eraser`,api:`POST`,path:`/system/reap`},{label:`Show stale`,icon:`Filter`,view:`agents`,preset:`offline_stale`}):e.name===`channel-delivery-targets`?t.actions.unshift({label:`Open channels`,icon:`MessagesSquare`,view:`channels`},{label:`Run reaper`,icon:`Eraser`,api:`POST`,path:`/system/reap`}):[`expired-message-claims`,`expired-task-claims`,`offline-claimed-tasks`].includes(e.name)&&t.actions.unshift({label:`Run reaper`,icon:`Eraser`,api:`POST`,path:`/system/reap`},{label:`Open work`,icon:`ListChecks`,view:`work`}),t})}function Ye(e){return{database:`Relay persistence is unavailable; messages, state, and audit writes may fail.`,"stale-live-agents":`Agents may look online even though their heartbeat has stopped.`,"expired-message-claims":`Claimable messages may be stuck until the reaper releases expired claims.`,"expired-task-claims":`Tasks can appear owned by agents that no longer hold a live lease.`,"offline-claimed-tasks":`Offline agents are still shown as owners for active work.`,"channel-delivery-targets":`Inbound channel messages may be accepted but routed to no live delivery agent.`}[e.name]||`Relay health is degraded for this check.`}function Xe(e){return{success:`text-tone-success-fg`,warning:`text-tone-yellow-fg`,danger:`text-tone-danger-fg`,info:`text-tone-info-fg`,primary:`text-tone-info-fg`,secondary:`text-tone-neutral-fg`}[e]||`text-tone-neutral-fg`}function Ze(e,t){return!e||e.status===`offline`?`bg-tone-neutral opacity-50`:typeof e.meta?.lifecycleAction==`string`&&e.meta.lifecycleAction.startsWith(`finalizing-`)?`bg-tone-warning/20 ring-2 ring-inset ring-tone-warning`:e.meta?.lifecycleAction===`shutting-down`||e.meta?.lifecycleAction===`restarting`?`bg-tone-yellow/20 ring-2 ring-inset ring-tone-yellow`:e.meta?.lifecycleAction===`killing`?`bg-tone-danger/20 ring-2 ring-inset ring-tone-danger`:e.meta?.lifecycleAction===`kill-failed`?`bg-tone-danger`:Y(e)?`bg-tone-danger shadow-[0_0_6px_var(--color-tone-danger)]`:e.status===`busy`?`bg-tone-yellow`:t&&j(t,e)?`bg-tone-danger`:e.ready?`bg-tone-success shadow-[0_0_6px_var(--color-tone-success)]`:`bg-tone-success/20 ring-2 ring-inset ring-tone-success`}function Qe(e,t,n){if(typeof document>`u`||typeof URL>`u`||typeof Blob>`u`)return;let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}export{H as $,G as A,b as B,Ce as C,fe as Ct,O as D,q as E,U as F,Y as G,Ve as H,ke as I,B as J,J as K,Ae as L,K as M,k as N,De as O,Te as P,Ze as Q,Se as R,_e as S,m as St,j as T,W as U,He as V,w as W,qe as X,we as Y,S as Z,Ge as _,f as _t,Fe as a,ue as at,Je as b,pe as bt,Q as c,re as ct,Oe as d,se as dt,Ue as et,z as f,_ as ft,Le as g,d as gt,$ as h,p as ht,Pe as i,ge as it,be as j,Ee as k,Re as l,h as lt,Qe as m,u as mt,L as n,Xe as nt,M as o,te as ot,ye as p,de as pt,Me as q,N as r,x as rt,A as s,oe as st,X as t,me as tt,ze as u,g as ut,Ke as v,ne as vt,Be as w,ae as wt,ve as x,ee as xt,We as y,v as yt,C as z};
|
|
3
|
-
//# sourceMappingURL=display-
|
|
3
|
+
//# sourceMappingURL=display-BemJG1f_.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-BgDALGIX.js";import{M as a}from"./provider-display-bWwiuedV.js";import{y as o}from"./display-BemJG1f_.js";import{t as s}from"./switch-DuCA7mrB.js";import{n as c}from"./list-todo-9qT0fgxZ.js";import{n as l,t as u}from"./markdown-preview-DNT4OUwQ.js";import{t as d}from"./folder-tree-BG3Y9nqH.js";import{t as f}from"./git-branch-yxhV0m8E.js";import{t as p}from"./loader-circle-BfPd4kOD.js";import{t as m}from"./plus-D5Ek4e2S.js";import{t as h}from"./refresh-cw-CfpvQcUn.js";import{t as g}from"./x-Bge17hWJ.js";import{t as _}from"./zoomable-image-B3Og53nj.js";import{t as v}from"./button-Do6Z3vvn.js";import{t as y}from"./badge-DqJRtj_p.js";import{t as b}from"./copy-button-CjOj4HEf.js";import{t as x}from"./input-CsTB6jIx.js";import{n as S,t as C}from"./code-preview-KIRZA6cz.js";var w=t(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),T=t(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),E=t(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),D=t(`corner-down-right`,[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),O=t(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),k=t(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),A=t(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),j=t(`mail-open`,[[`path`,{d:`M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z`,key:`1jhwl8`}],[`path`,{d:`m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10`,key:`1qfld7`}]]),M=t(`mail-x`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9`,key:`1j9vog`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m17 17 4 4`,key:`1b3523`}],[`path`,{d:`m21 17-4 4`,key:`uinynz`}]]),N=t(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),P=t(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),F=t(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),I=t(`telescope`,[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]),L=t(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),R=e(n(),1),z=r(),B=`humwick:file-git-status`;function ee(){try{return window.localStorage.getItem(B)!==`off`}catch{return!0}}function te(e){try{window.localStorage.setItem(B,e?`on`:`off`)}catch{}}function V(e){switch(e){case`staged`:return{dot:`bg-tone-success`,text:`text-tone-success-fg`,label:`Staged`};case`unstaged`:return{dot:`bg-tone-warning`,text:`text-tone-warning-fg`,label:`Modified (unstaged)`};case`staged-unstaged`:return{dot:`bg-tone-warning`,text:`text-tone-success-fg`,label:`Staged + unstaged changes`};case`untracked`:return{dot:`bg-tone-sky`,text:`text-tone-sky-fg`,label:`Untracked`};default:return null}}function H(e,t,n){let r=`/orchestrators/${encodeURIComponent(e)}/files/list?path=${encodeURIComponent(t)}`;return n?`${r}&git=1`:r}function U({status:e}){let t=V(e);return t?(0,z.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${t.dot}`,title:t.label}):null}function W(e,t){let n=t.replace(/\/+$/,``);return e===n?`/`:e.startsWith(n+`/`)?e.slice(n.length+1):e}function G(e,t){let n=e.toLowerCase();return n.endsWith(`.md`)||n.endsWith(`.mdx`)||n.endsWith(`.markdown`)||t===`text/markdown`}function K(e,t,n){return G(e,t)?`markdown`:S(e,t,void 0,n)?`code`:null}function q(e){return`humwick:file-view-mode:${e}`}function J(e){try{let t=window.localStorage.getItem(q(e));return t===`raw`||t===`rendered`?t:`rendered`}catch{return`rendered`}}function Y(e,t){try{window.localStorage.setItem(q(e),t)}catch{}}function ne(e,t){let n=W(e,t);if(n===`/`)return[{label:`/`,path:t}];let r=n.split(`/`).filter(Boolean),i=[{label:`/`,path:t}];for(let e=0;e<r.length;e++)i.push({label:r[e],path:`${t.replace(/\/+$/,``)}/${r.slice(0,e+1).join(`/`)}`});return i}function X(e,t){let n=i(e=>e.apiCall),[r,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``);return(0,R.useEffect)(()=>{if(!e||!t){o(null),u(``);return}let r=!1;return c(!0),u(``),n(`GET`,`/orchestrators/${encodeURIComponent(e)}/files/read?path=${encodeURIComponent(t)}`).then(e=>{r||o(e)}).catch(e=>{r||(o(null),u(a(e)))}).finally(()=>{r||c(!1)}),()=>{r=!0}},[n,e,t]),{file:r,loading:s,error:l}}function Z(e,t,n=!1){let r=i(e=>e.apiCall),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``);return(0,R.useEffect)(()=>{if(!e||!t){s(null),d(``);return}let i=!1;return l(!0),d(``),r(`GET`,H(e,t,n)).then(e=>{i||s(e)}).catch(e=>{i||(s(null),d(a(e)))}).finally(()=>{i||l(!1)}),()=>{i=!0}},[r,e,t,n]),{listing:o,loading:c,error:u}}function re({content:e,line:t,lineRef:n}){return(0,z.jsx)(`div`,{className:`w-full py-2 font-mono text-xs leading-5`,children:e.split(`
|
|
2
2
|
`).map((e,r)=>{let i=r+1,a=i===t;return(0,z.jsxs)(`div`,{ref:a?n:void 0,className:`grid grid-cols-[2.5rem_minmax(0,1fr)] px-1 sm:grid-cols-[4rem_minmax(0,1fr)] sm:px-2 ${a?`bg-primary/15`:``}`,children:[(0,z.jsx)(`div`,{className:`select-none pr-2 text-right text-muted-foreground sm:pr-3`,children:i}),(0,z.jsx)(`pre`,{className:`overflow-hidden whitespace-pre-wrap break-words`,children:e||` `})]},i)})})}function ie({orchestratorId:e,selectedPath:t,onReadError:n,git:r=!1}){let{listing:i,loading:a,error:s}=Z(e,t,r);return(0,R.useEffect)(()=>{n(s)},[s,n]),t?a?(0,z.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,z.jsx)(p,{className:`h-4 w-4 animate-spin`}),`Loading directory`]}):s?(0,z.jsx)(`div`,{className:`h-full bg-muted/20`}):i?(0,z.jsxs)(`div`,{className:`h-full overflow-auto bg-muted/20`,children:[(0,z.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,z.jsx)(k,{className:`h-3.5 w-3.5 text-tone-info-fg`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,z.jsxs)(y,{variant:`outline`,className:`text-[10px]`,children:[i.entries.length,` items`]})]}),(0,z.jsxs)(`div`,{className:`divide-y divide-border/60`,children:[i.entries.map(e=>{let t=e.type===`directory`?k:l,n=V(e.gitStatus);return(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[(0,z.jsx)(t,{className:`h-4 w-4 shrink-0 ${e.type===`directory`?`text-tone-info-fg`:`text-muted-foreground`}`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs ${n?.text??``}`,children:e.name}),e.symlink&&(0,z.jsx)(c,{className:`h-3 w-3 shrink-0 text-muted-foreground/60`}),(0,z.jsx)(U,{status:e.gitStatus}),e.type!==`directory`&&(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:o(e.size)})]},e.path)}),i.entries.length===0&&(0,z.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:`No files`})]})]}):null:(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a directory to preview`})}function Q({orchestratorId:e,selectedPath:t,line:n,onReadError:r}){let{file:i,loading:a,error:s}=X(e,t),c=(0,R.useRef)(null),[d,f]=(0,R.useState)(`raw`);(0,R.useEffect)(()=>{r(s)},[s,r]),(0,R.useEffect)(()=>{n>0&&c.current?.scrollIntoView({block:`center`})},[i,n]),(0,R.useEffect)(()=>{if(!i||i.encoding===`binary`)return;if(n>0){f(`raw`);return}let e=K(i.path,i.mediaType,i.content);f(e?J(e):`raw`)},[i?.path,i?.encoding,i?.mediaType,i?.content,n]);function m(e,t){f(e),t&&Y(t,e)}if(!t)return(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a file to preview`});if(a)return(0,z.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,z.jsx)(p,{className:`h-4 w-4 animate-spin`}),`Loading file`]});if(s)return(0,z.jsx)(`div`,{className:`h-full bg-muted/20`});if(!i)return null;if(i.encoding===`base64`)return(0,z.jsxs)(`div`,{className:`flex h-full flex-col bg-muted/20`,children:[(0,z.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,z.jsx)(l,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,z.jsx)(b,{value:i.path,label:`Copy path`,copiedLabel:`Copied path`,size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`}),(0,z.jsx)(y,{variant:`outline`,className:`text-[10px]`,children:o(i.size)})]}),(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,z.jsx)(_,{src:`data:${i.mediaType};base64,${i.content??``}`,alt:i.name,className:`max-h-full max-w-full object-contain`,style:{imageRendering:i.mediaType===`image/svg+xml`?`auto`:void 0}})})]});if(i.encoding===`binary`)return(0,z.jsxs)(`div`,{className:`p-4 text-sm`,children:[(0,z.jsx)(`div`,{className:`font-medium`,children:i.name}),(0,z.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:i.truncated?`File too large to preview.`:`Binary file preview is not available.`}),(0,z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,z.jsx)(y,{variant:`secondary`,children:i.mediaType}),(0,z.jsx)(y,{variant:`outline`,children:o(i.size)})]})]});let h=i.content??``,g=G(i.path,i.mediaType),v=!g&&S(i.path,i.mediaType,void 0,h),x=g||v,w=g?`markdown`:v?`code`:null;return(0,z.jsxs)(`div`,{className:`h-full overflow-auto bg-muted/20`,children:[(0,z.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,z.jsx)(l,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,z.jsx)(b,{value:i.path,label:`Copy path`,copiedLabel:`Copied path`,size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`}),i.truncated&&(0,z.jsx)(y,{variant:`secondary`,className:`text-[10px]`,children:`truncated`}),(0,z.jsx)(y,{variant:`outline`,className:`text-[10px]`,children:o(i.size)}),x&&(0,z.jsxs)(`div`,{className:`flex shrink-0 rounded-md border border-border bg-muted/40 p-0.5`,children:[(0,z.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-[10px] font-medium ${d===`raw`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>m(`raw`,w),children:`Raw`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-[10px] font-medium ${d===`rendered`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>m(`rendered`,w),children:g?`Rendered`:`Highlighted`})]})]}),d===`rendered`&&g&&(0,z.jsx)(u,{content:h,path:i.path}),d===`rendered`&&v&&(0,z.jsx)(C,{content:h,path:i.path,mediaType:i.mediaType}),d===`raw`&&(0,z.jsx)(re,{content:h,line:n,lineRef:c})]})}function $({overlay:e=!1}){let t=i(e=>e.apiCall),n=i(e=>e.orchestrators),r=i(e=>e.fileOrchestratorId),u=i(e=>e.filePath),_=i(e=>e.fileSelectedPath),y=i(e=>e.fileSelectedLine),b=i(e=>e.set),S=i(e=>e.closeFileOverlay),C=i(e=>e.openOrchestratorSpawnAt),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)(u),[A,j]=(0,R.useState)(!1),[M,N]=(0,R.useState)(``),[P,F]=(0,R.useState)(``),[I,L]=(0,R.useState)(ee),B=(0,R.useMemo)(()=>n.filter(e=>e.status===`online`),[n]),W=n.find(e=>e.id===r)||B[0];(0,R.useEffect)(()=>{if(!W)return;let e={};r||(e.fileOrchestratorId=W.id),u||(e.filePath=W.baseDir),Object.keys(e).length&&b(e)},[r,u,W,b]),(0,R.useEffect)(()=>D(u),[u]);async function G(e=u){if(!(!W||!e)){j(!0),N(``);try{let n=await t(`GET`,H(W.id,e,I));T(n),b({filePath:n.path}),D(n.path),F(``)}catch(e){N(a(e))}finally{j(!1)}}}(0,R.useEffect)(()=>{G(u)},[W?.id,u,I]);function K(e){L(e),te(e)}function q(e){let t=n.find(t=>t.id===e);b({fileOrchestratorId:e,filePath:t?.baseDir||``,fileSelectedPath:``,fileSelectedLine:0})}function J(e){F(``),e.type===`directory`?b({filePath:e.path,fileSelectedPath:``,fileSelectedLine:0}):b({fileSelectedPath:e.path,fileSelectedLine:0})}function Y(){if(!W)return;let t=E.trim()||u||W.baseDir;e&&S(),C({orchestratorId:W.id,cwd:t})}let X=w?ne(w.path,w.baseDir):[],Z=M||P;return(0,z.jsxs)(`div`,{className:e?`flex h-full flex-col`:`flex h-[calc(100dvh-5rem)] flex-col gap-3 md:gap-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${_?`hidden md:flex`:``}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,z.jsx)(d,{className:`h-5 w-5 text-primary`}),`Files`]}),(0,z.jsxs)(`select`,{value:W?.id||``,onChange:e=>q(e.target.value),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[B.length===0&&(0,z.jsx)(`option`,{value:``,children:`No online orchestrators`}),B.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.hostname||e.id},e.id))]}),e&&(0,z.jsx)(v,{size:`icon`,variant:`ghost`,className:`ml-auto h-8 w-8`,onClick:S,title:`Close`,children:(0,z.jsx)(g,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${_?`hidden md:flex`:``}`,children:[(0,z.jsx)(x,{value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&b({filePath:E,fileSelectedPath:``,fileSelectedLine:0})},className:`min-w-0 flex-1 basis-full font-mono text-xs sm:basis-auto`,placeholder:W?.baseDir||`Path`}),(0,z.jsxs)(v,{size:`sm`,variant:`outline`,className:`gap-1`,onClick:()=>G(E),disabled:A||!W,children:[A?(0,z.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):(0,z.jsx)(h,{className:`h-3.5 w-3.5`}),`Open`]}),(0,z.jsxs)(v,{size:`sm`,className:`gap-1`,onClick:Y,disabled:!W,children:[(0,z.jsx)(m,{className:`h-3.5 w-3.5`}),(0,z.jsx)(`span`,{className:`sm:hidden`,children:`Spawn`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:`Spawn from here`})]}),(0,z.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,title:`Show git status colors`,children:[(0,z.jsx)(f,{className:`h-3.5 w-3.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:`Git`}),(0,z.jsx)(s,{checked:I,onCheckedChange:K})]})]}),X.length>0&&(0,z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 text-xs text-muted-foreground ${_?`hidden md:flex`:``}`,children:X.map((e,t)=>(0,z.jsxs)(`button`,{type:`button`,className:`rounded px-1.5 py-0.5 font-mono hover:bg-accent hover:text-foreground`,onClick:()=>b({filePath:e.path,fileSelectedPath:``,fileSelectedLine:0}),children:[e.label,t<X.length-1&&e.label!==`/`?` /`:``]},`${e.path}-${t}`))}),Z&&(0,z.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:Z}),(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 overflow-hidden md:rounded-md md:border md:border-border md:grid-cols-[22rem_minmax(0,1fr)] ${_?``:`rounded-md border border-border`}`,children:[(0,z.jsxs)(`div`,{className:`min-h-0 overflow-auto border-b border-border bg-card md:border-b-0 md:border-r ${_?`hidden md:block`:``}`,children:[w?.parent&&(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent`,onClick:()=>b({filePath:w.parent,fileSelectedPath:``,fileSelectedLine:0}),children:[(0,z.jsx)(O,{className:`h-4 w-4 text-muted-foreground`}),(0,z.jsx)(`span`,{children:`Parent directory`})]}),w?.entries.map(e=>{let t=_===e.path||u===e.path,n=e.type===`directory`?k:l,r=V(e.gitStatus);return(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent ${t?`bg-accent`:``}`,onClick:()=>J(e),children:[(0,z.jsx)(n,{className:`h-4 w-4 shrink-0 ${e.type===`directory`?`text-tone-info-fg`:`text-muted-foreground`}`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs ${r?.text??``}`,children:e.name}),e.symlink&&(0,z.jsx)(c,{className:`h-3 w-3 shrink-0 text-muted-foreground/60`}),(0,z.jsx)(U,{status:e.gitStatus}),e.type!==`directory`&&(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:o(e.size)})]},e.path)}),!A&&w&&w.entries.length===0&&(0,z.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:`No files`})]}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden ${_?``:`hidden md:flex`}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs text-muted-foreground hover:text-foreground md:hidden`,onClick:()=>b({fileSelectedPath:``,fileSelectedLine:0}),children:[(0,z.jsx)(O,{className:`h-3.5 w-3.5`}),`Back to files`]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,z.jsx)(Q,{orchestratorId:W?.id||``,selectedPath:_,line:y,onReadError:F})})]})]})]})}function ae(){return(0,z.jsx)($,{})}function oe(){return i(e=>e.fileOverlayOpen)?(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background/80 backdrop-blur-sm`,children:(0,z.jsx)(`div`,{className:`absolute inset-4 overflow-hidden rounded-md border border-border bg-background p-4 shadow-xl`,children:(0,z.jsx)($,{overlay:!0})})}):null}export{T as _,L as a,P as c,j as d,A as f,E as g,D as h,ae as i,N as l,O as m,Q as n,I as o,k as p,oe as r,F as s,ie as t,M as u,w as v};
|
|
3
|
-
//# sourceMappingURL=files-
|
|
3
|
+
//# sourceMappingURL=files-DXWcrxOz.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Ct as i,E as a,t as o}from"./store-DKPDIZBe.js";import"./provider-display-BEeLXC_D.js";import{h as s}from"./display-CDeH4I8T.js";import{t as c}from"./host-mTgRw7xh.js";import{t as l}from"./chevron-right-iljytE0x.js";import{t as u}from"./cpu-Dndy84IU.js";import{t as d}from"./git-merge-C7eIG425.js";import{t as f}from"./globe-Cl5fXtqs.js";import{t as p}from"./layers-DEfClY-v.js";import{t as m}from"./loader-circle-BfPd4kOD.js";import{t as h}from"./pencil-B1Hf2V_J.js";import{t as ee}from"./rocket-BmO1qSu-.js";import{t as te}from"./triangle-alert-BBNhfgMi.js";import{t as ne}from"./users-C7B3u9jv.js";import{t as g}from"./button-Do6Z3vvn.js";import{t as _}from"./badge-DqJRtj_p.js";import{t as v}from"./input-CsTB6jIx.js";import{a as re,c as y,i as ie,l as b,n as ae,o as x,r as oe,s as se,t as S,u as C}from"./fleet-metrics-BHEt5yc_.js";import{i as w,o as T,r as E,s as D,t as O}from"./card-C4QJ4hCW.js";var k=e(n(),1),A=r(),j={ok:`text-tone-success-fg`,warn:`text-tone-warning-fg`,crit:`text-tone-danger-fg`,idle:`text-tone-neutral-fg`},M={ok:`stroke-tone-success`,warn:`stroke-tone-warning`,crit:`stroke-tone-danger`,idle:`stroke-tone-neutral`},N={ok:`bg-tone-success`,warn:`bg-tone-warning`,crit:`bg-tone-danger`,idle:`bg-tone-neutral`},P=20,F=2*Math.PI*P;function I({label:e,pct:n,tone:r,center:i,sub:a,title:o}){let s=n===void 0?0:S(n),c=F*(1-s/100);return(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-1 min-w-0`,title:o,children:[(0,A.jsxs)(`div`,{className:`relative h-[60px] w-[60px]`,children:[(0,A.jsxs)(`svg`,{viewBox:`0 0 48 48`,role:`img`,"aria-label":`${e} ${i}`,className:`h-full w-full -rotate-90`,children:[(0,A.jsx)(`circle`,{cx:`24`,cy:`24`,r:P,fill:`none`,strokeWidth:`4.5`,className:`stroke-foreground/10`}),n===void 0?null:(0,A.jsx)(`circle`,{cx:`24`,cy:`24`,r:P,fill:`none`,strokeWidth:`4.5`,strokeLinecap:`round`,"data-testid":`ring-${e.toLowerCase()}`,"data-pct":Math.round(s),className:t(M[r],`motion-safe:animate-fleet-ring-in motion-safe:transition-[stroke-dashoffset] motion-safe:duration-700`),style:{strokeDasharray:F,strokeDashoffset:c,"--ring-c":F}})]}),(0,A.jsx)(`span`,{className:t(`absolute inset-0 flex items-center justify-center text-[13px] font-semibold tabular-nums`,j[r]),children:i})]}),(0,A.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground leading-none`,children:e}),a?(0,A.jsx)(`div`,{className:`text-[10px] text-muted-foreground/80 leading-none truncate max-w-full tabular-nums`,children:a}):null]})}function ce({tone:e,live:n,title:r}){return(0,A.jsxs)(`span`,{className:`relative flex h-3 w-3 items-center justify-center shrink-0`,title:r,role:`img`,"aria-label":r,children:[n?(0,A.jsx)(`span`,{className:t(`absolute inline-flex h-full w-full rounded-full opacity-50 motion-safe:animate-fleet-ping`,N[e])}):null,(0,A.jsx)(`span`,{className:t(`relative inline-flex h-2.5 w-2.5 rounded-full ring-2 ring-card`,N[e])})]})}var L={idle:1,normal:1,busy:2,saturated:3,blocked:4};function le({band:e,tone:n,title:r}){let i=L[e]??0;return(0,A.jsx)(`span`,{className:`inline-flex items-end gap-[3px] h-3.5`,title:r,role:`img`,"aria-label":`pressure ${e}`,children:[1,2,3,4].map(e=>(0,A.jsx)(`span`,{className:t(`w-[3px] rounded-sm transition-colors`,e<=i?N[n]:`bg-foreground/15`),style:{height:`${25+e*18}%`}},e))})}function ue({cells:e,active:n,queued:r}){let i=t=>t<e.own?`bg-tone-sky`:t<e.own+e.other?`bg-tone-warning`:t<e.own+e.other+e.unattributed?`bg-tone-success`:``;return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-[3px]`,"data-testid":`gate-cells`,children:[Array.from({length:e.total},(e,r)=>{let a=i(r);return(0,A.jsx)(`span`,{className:t(`h-3 w-3 rounded-[3px]`,a?[a,n&&`motion-safe:animate-fleet-breathe`]:`bg-foreground/10`),style:a&&n?{animationDelay:`${r%6*160}ms`}:void 0},r)}),r>0?(0,A.jsx)(`span`,{className:`ml-1.5 flex items-center gap-[3px]`,title:`${r} queued ${r===1?`gate`:`gates`}`,children:Array.from({length:Math.min(r,6)},(e,t)=>(0,A.jsx)(`span`,{className:`h-3 w-3 rounded-[3px] border border-dashed border-tone-warning/80 motion-safe:animate-fleet-breathe`},t))}):null]})}function R({dots:e,tone:n,active:r,queued:i=0}){return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-[3px]`,children:[Array.from({length:e.filled},(e,i)=>(0,A.jsx)(`span`,{className:t(`h-2 w-2 rounded-full`,N[n],r&&`motion-safe:animate-fleet-breathe`),style:r?{animationDelay:`${i%6*200}ms`}:void 0},`f${i}`)),Array.from({length:e.empty},(e,t)=>(0,A.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-foreground/10`},`e${t}`)),Array.from({length:e.over},(e,t)=>(0,A.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-tone-danger ring-1 ring-tone-danger/40`},`o${t}`)),Array.from({length:Math.min(i,6)},(e,t)=>(0,A.jsx)(`span`,{className:`h-2 w-2 rounded-full border border-dashed border-tone-warning/80 motion-safe:animate-fleet-breathe`},`q${t}`))]})}function z({icon:e,label:t,right:n,children:r,title:i}){return(0,A.jsxs)(`div`,{className:`space-y-1.5`,title:i,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wider text-muted-foreground`,children:[e,(0,A.jsx)(`span`,{children:t}),(0,A.jsx)(`span`,{className:`ml-auto normal-case tracking-normal tabular-nums text-foreground/80 text-[11px]`,children:n})]}),r]})}function de({label:e,icon:n,checked:r,saving:i,disabled:a,title:o,onChange:s}){return(0,A.jsxs)(`label`,{title:o,"data-state":r?`on`:`off`,"data-saving":i||void 0,className:t(`group/toggle flex select-none items-center gap-1.5 rounded-full border py-0.5 pl-1.5 pr-1 text-[11px] font-medium transition-colors`,`focus-within:ring-2 focus-within:ring-ring/50`,r?`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`:`border-foreground/10 bg-foreground/[0.03] text-muted-foreground`,a?`cursor-wait`:`cursor-pointer hover:border-foreground/25`,i&&`motion-safe:animate-fleet-breathe`),children:[(0,A.jsx)(`input`,{type:`checkbox`,role:`switch`,className:`peer sr-only`,checked:r,disabled:a,onChange:s}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:`flex items-center`,children:i?(0,A.jsx)(m,{className:`h-3 w-3 motion-safe:animate-spin`}):n}),(0,A.jsx)(`span`,{children:e}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:t(`relative h-3.5 w-6 rounded-full transition-colors`,r?`bg-tone-success`:`bg-foreground/20`),children:(0,A.jsx)(`span`,{className:t(`absolute top-0.5 h-2.5 w-2.5 rounded-full bg-white shadow-sm transition-all`,r?`left-[calc(100%-0.75rem)]`:`left-0.5`)})})]})}var B={"systemd-user-scope":`Linux cgroup (systemd scope)`,"delegated-cgroup":`Linux cgroup (delegated)`,taskpolicy:`macOS background QoS`,nice:`nice priority`,"admission-only":`Admission only`},V={land:`Land`,iterate:`Iterate`,validation:`Validation`};function H(e){let t=e.cpuQuotaAvailable?`soft CPU shares${e.cpuLimit===void 0?``:` · ceiling ${U(e.cpuLimit)} CPUs`}`:`no CPU control${e.priority?` · priority ${e.priority}`:``}`;return{label:B[e.mechanism],detail:t,degraded:e.mechanism===`nice`||e.mechanism===`admission-only`,reason:e.reason}}function U(e){return String(Math.round(e*10)/10)}function W(e){let t=e/1024**3;return t>=1?`${Math.round(t*10)/10} GB`:`${Math.round(e/1024**2)} MB`}function G(e){return e?e.replace(/\/+$/,``).split(`/`).at(-1)||e:`unknown repository`}function K(e,t){let n=e.resource_control,r=n?.sampledAt??e.sampled_at;if(e.state===`unavailable`||!r||t-r>6e4)return{state:`unknown`};if(!n)return{state:`off`};let i=H(n),a=[`agent`,`land`].flatMap(e=>n.paths?.[e]?[{name:e,view:H(n.paths[e])}]:[]),o=(n.work??[]).map(e=>({id:e.id,repository:G(e.repository),repositoryPath:e.repository,kind:e.kind,state:e.state})),s=[...i.degraded?[`${i.label}: ${i.reason??`CPU quota unavailable`}`]:[],...a.filter(e=>e.view.degraded).map(e=>`${e.name===`agent`?`Agent`:`Land`} path, ${e.view.label}: ${e.view.reason??`CPU quota unavailable`}`)];return{state:`on`,mechanism:i,paths:a,usableCpus:U(n.usableCpus),gateCpus:U(n.gateCpus),memory:W(n.memoryBytes),...n.gateMemoryBytes?{gateMemory:n.gateMemoryUsedBytes===void 0?`cap ${W(n.gateMemoryBytes)}`:`${W(n.gateMemoryUsedBytes)} of ${W(n.gateMemoryBytes)} in use`}:{},...n.runMemoryBytes?{runMemory:W(n.runMemoryBytes)}:{},slots:n.slots,held:n.held,waiters:n.waiters,iterateOverflow:n.iterateOverflow,kinds:n.kinds?c.map(e=>({kind:e,label:V[e],...n.kinds[e],cpus:U(n.kinds[e].cpus)})):void 0,work:o,hiddenWork:Math.max(0,n.held+n.waiters-o.length),degradations:s}}var q={landSlots:`Land slots`,validationSlots:`Validation slots`,runCpus:`CPUs per run`,runMemory:`Memory per run (GiB)`};function J({host:e,field:t}){let n=o(e=>e.setHostGateBudget),[r,i]=(0,k.useState)(null),[a,s]=(0,k.useState)(!1),c=e.policy?.[t]??(t===`landSlots`?e.policy?.gateBudget??e.gate_budget:t===`validationSlots`?e.policy?.validationGateBudget:void 0)??null,l=t===`runMemory`?1024**3:1,u=r??(c===null?``:String(c/l)),d=u.trim()===``?null:Number(u)*l,f=t===`landSlots`||t===`validationSlots`,p=d===null||Number.isFinite(d)&&d>0&&(t===`runCpus`?d>=.01&&d<=1e3:Number.isSafeInteger(d)&&(!f||d<=1e3)),m=r!==null&&d!==c,h=async r=>{let a={[t]:r};t===`landSlots`&&(a.gateBudget=null),t===`validationSlots`&&(a.validationGateBudget=null),t===`runCpus`&&(a.landGateCpus=null,a.validationGateCpus=null),s(!0);try{await n(e.id,a)&&i(null)}finally{s(!1)}};return(0,A.jsxs)(`form`,{className:`space-y-1`,onSubmit:e=>{e.preventDefault(),p&&m&&h(d)},children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`label`,{htmlFor:`${t}-${e.id}`,className:`text-[11px] text-muted-foreground`,children:q[t]}),(0,A.jsx)(v,{id:`${t}-${e.id}`,inputMode:`decimal`,className:`h-7 w-20 text-center tabular-nums`,value:u,placeholder:`auto`,disabled:a,"aria-invalid":!p,onChange:e=>i(e.target.value)}),(0,A.jsx)(g,{type:`submit`,size:`sm`,variant:`outline`,className:`h-7 text-xs`,"aria-label":`Apply ${q[t]}`,disabled:!p||!m||a,children:a?`Saving…`:`Apply`}),c===null?null:(0,A.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 text-xs`,disabled:a,"aria-label":`Use automatic ${q[t]}`,onClick:()=>void h(null),children:`Use automatic`})]}),p?null:(0,A.jsx)(`p`,{className:`text-[10px] text-tone-danger-fg`,children:f?`Whole number 1–1000, or empty.`:t===`runCpus`?`0.01–1000 CPUs, or empty.`:`Positive memory in GiB, or empty.`})]})}function Y({host:e}){return(0,A.jsxs)(`div`,{className:`space-y-2`,"aria-label":`Gate pool settings`,children:[Object.keys(q).map(t=>(0,A.jsx)(J,{host:e,field:t},t)),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Empty uses fleet or hardware defaults. Land and validation slots add up to one shared pool. CPUs and memory per run are soft shares; the gate slice caps total gate memory.`})]})}function fe({host:e}){let n=K(e,Date.now()),r=n.state===`on`?`${n.held} held · ${n.waiters} queued`:n.state===`off`?`off`:`no data`;return(0,A.jsx)(z,{icon:(0,A.jsx)(u,{className:`w-3 h-3`}),label:`Resource control`,right:r,title:`Built-in host resource control: how this host limits gate CPU, what it has admitted, and the gate budget`,children:(0,A.jsxs)(`div`,{className:`space-y-2 text-[11px]`,"data-testid":`resource-control`,children:[n.state===`unknown`?(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Unknown: no fresh sample from this host's orchestrator.`}):n.state===`off`?(0,A.jsxs)(`p`,{className:`text-muted-foreground`,"data-testid":`resource-control-off`,children:[`Off on this host. Set `,(0,A.jsx)(`code`,{className:`break-all`,children:`AGENT_RELAY_HOST_RESOURCE_CONTROL=1`}),` on its orchestrator to enable shared admission and CPU limits; until then gates use per-repository leases.`]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(_,{variant:`secondary`,className:`text-[10px]`,"data-testid":`resource-mechanism`,children:n.mechanism.label}),(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:n.mechanism.detail})]}),(0,A.jsxs)(`dl`,{className:`grid grid-cols-3 gap-2 tabular-nums`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`CPUs`}),(0,A.jsxs)(`dd`,{children:[n.gateCpus,` of `,n.usableCpus]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Memory`}),(0,A.jsx)(`dd`,{children:n.memory})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Shared pool`}),(0,A.jsxs)(`dd`,{children:[n.held,` / `,n.slots,n.iterateOverflow?` +${n.iterateOverflow} iterate`:``]})]})]}),n.gateMemory?(0,A.jsxs)(`p`,{className:`text-muted-foreground`,"data-testid":`resource-gate-memory`,children:[`Gate memory: `,n.gateMemory,`.`,n.runMemory?` Each run has a ${n.runMemory} soft share; another gate starts only while that much is free.`:``]}):null,n.kinds?(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsxs)(`p`,{className:`text-muted-foreground`,children:[`One pool for all gates. A free slot goes to lands first, then iterate, then validation.`,n.iterateOverflow?` Iterate may use ${n.iterateOverflow} extra slot when the pool is full.`:``]}),(0,A.jsx)(`ul`,{"aria-label":`Gate kinds`,className:`space-y-0.5 tabular-nums`,children:n.kinds.map(e=>(0,A.jsxs)(`li`,{children:[e.label,`: `,e.held,` held · `,e.waiters,` queued · `,e.cpus,` CPUs per run (soft)`]},e.kind))})]}):(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Pool detail not reported by this orchestrator.`}),n.degradations.map(e=>(0,A.jsxs)(`div`,{"data-testid":`resource-degraded`,className:`flex items-start gap-1.5 rounded-md bg-tone-warning/10 px-2 py-1.5 leading-snug text-tone-warning-fg`,children:[(0,A.jsx)(te,{className:`w-3 h-3 mt-px shrink-0`}),(0,A.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`Degraded. `,e]})]},e)),n.paths.length>1||n.paths.some(e=>e.view.label!==n.mechanism.label)?(0,A.jsx)(`ul`,{className:`space-y-0.5 text-muted-foreground`,children:n.paths.map(e=>(0,A.jsxs)(`li`,{children:[e.name===`agent`?`Agents`:`Lands`,`: `,e.view.label,` · `,e.view.detail]},e.name))}):null,n.work.length>0?(0,A.jsxs)(`ul`,{className:`space-y-1`,"aria-label":`Held and queued gates`,children:[n.work.map(e=>(0,A.jsxs)(`li`,{"data-testid":`resource-work`,"data-state":e.state,className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:t(`shrink-0 rounded-full border px-1.5 text-[10px] font-medium`,e.state===`held`?`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`:`border-dashed border-tone-warning/80 text-tone-warning-fg`),children:e.state}),(0,A.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.kind}),(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.repositoryPath??e.id,children:e.repository})]},e.id)),n.hiddenWork>0?(0,A.jsxs)(`li`,{className:`text-muted-foreground`,children:[`+`,n.hiddenWork,` more not listed`]}):null]}):n.held+n.waiters>0?(0,A.jsxs)(`p`,{className:`text-muted-foreground`,children:[n.held+n.waiters,` gates in flight; detail not reported by this orchestrator.`]}):(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`No gates held or queued.`})]}),e.resource_control?.gateLimits?.enabled?(0,A.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Gate cap: `,e.resource_control.gateLimits.gateRunCapMs/6e4,` min · Slot hold cap: `,e.resource_control.gateLimits.slotHoldCapMs/6e4,` min`]}):null,Object.keys(e.gate_reservations??{}).length>0?(0,A.jsx)(`ul`,{"aria-label":`Project reserved gate slots`,className:`space-y-0.5 text-muted-foreground`,children:Object.entries(e.gate_reservations).map(([e,t])=>(0,A.jsxs)(`li`,{children:[e,`: `,t,` reserved gate slot`,t===1?``:`s`]},e))}):null,e.gate_reservation_warning?(0,A.jsx)(`p`,{role:`alert`,className:`text-tone-warning-fg`,children:e.gate_reservation_warning}):null,(0,A.jsx)(Y,{host:e})]})})}function X({session:e,now:t}){let n=o(t=>t.agentsById[e.agentId]),r=o(t=>t.orchestrators.find(t=>t.id===e.orchestratorId)?.hostname),i=o(e=>e.openAgentDetail),a=n?.label||n?.name||e.agentId;return(0,A.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 py-2 text-sm`,"data-testid":`browser-fleet-row`,"data-session-id":e.id,children:[n?(0,A.jsx)(`button`,{type:`button`,className:`min-w-0 max-w-full truncate font-medium hover:underline`,onClick:()=>i(n),children:a}):(0,A.jsx)(`span`,{className:`min-w-0 max-w-full truncate font-medium`,children:a}),(0,A.jsx)(`span`,{className:`text-muted-foreground`,title:e.orchestratorId,children:r??e.orchestratorId}),(0,A.jsx)(_,{variant:`outline`,className:`text-[11px]`,children:e.status}),(0,A.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,title:new Date(e.createdAt).toLocaleString(),children:[`open `,s(t,e.createdAt)]}),(0,A.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,title:`Time since the agent last used this browser, as of the host's last report`,children:[`idle `,e.status===`running`&&e.lastActivityAt?s(t,e.lastActivityAt):`—`]}),(0,A.jsx)(`span`,{className:`ml-auto`,children:(0,A.jsx)(C,{session:e,label:`Stop the browser of ${a}`})})]})}function pe(){window.location.hash=`settings/agents`,o.getState().switchView(`settings`)}function Z(){let e=o(e=>e.browser),t=i();if(!e?.enabled)return null;let n=Object.values(e.sessions).filter(a).sort((e,t)=>t.createdAt-e.createdAt),r=e.limits;return(0,A.jsxs)(O,{size:`sm`,"data-testid":`browser-fleet`,children:[(0,A.jsxs)(T,{children:[(0,A.jsxs)(D,{className:`flex items-center gap-2 text-sm`,children:[(0,A.jsx)(f,{className:`size-4`}),`Browser sessions`]}),(0,A.jsxs)(w,{className:`flex flex-wrap items-center gap-x-2 text-xs`,children:[r?(0,A.jsxs)(`span`,{"data-testid":`browser-fleet-limits`,children:[`Up to `,r.perAgent,` per agent and `,r.perHost,` per host. An idle browser stops after `,r.idleTimeoutMinutes,` min.`]}):(0,A.jsx)(`span`,{children:`Headless browsers that agents run on their hosts.`}),(0,A.jsx)(g,{variant:`link`,size:`sm`,className:`h-auto p-0 text-xs`,onClick:pe,children:`Change limits`})]})]}),(0,A.jsx)(E,{children:e.fleetError?(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.fleetError}):n.length===0?(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No browser is open.`}):(0,A.jsx)(`ul`,{className:`divide-y`,children:n.map(e=>(0,A.jsx)(X,{session:e,now:t},e.id))})})]})}var me={healthy:`ok`,degraded:`warn`,unavailable:`crit`};function he(e){return e===`idle`||e===`normal`?`ok`:e===`busy`?`warn`:e===`saturated`||e===`blocked`?`crit`:`idle`}function Q({label:e,children:t}){return(0,A.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,A.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,A.jsx)(`dd`,{className:`text-right text-foreground tabular-nums`,children:t})]})}function $({host:e}){let n=o(e=>e.setHostAdmission),[r,i]=(0,k.useState)(null),a=async t=>{i(t);try{await n(e.id,{[t]:e.policy?.[t]===!1})}finally{i(null)}},s=o(e=>e.openHostEdit),c=o(e=>e.fetchHostProviders),u=o(t=>ie(t.orchestrators,e.id)),f=o(e=>e.acceptHostHardware),m=e.state!==`unavailable`&&!!e.gates_sampled_at&&Date.now()-e.gates_sampled_at<=6e4,v=(e.landing_slots?.queued??0)-(e.landing_slots?.wait_reasons?.reduce((e,t)=>e+t.count,0)??0),S=m?e.gate_capacity:void 0,C=e.state===`unavailable`?void 0:e.gate_arming,w=e.system_tags.includes(`conflict:pending`),M=e.enabled?me[e.state]??`idle`:`idle`,P=re(e.cpu_utilization),F=b(x(e.used_ram),x(e.total_ram)),L=x(e.total_storage),B=x(e.free_storage),V=L&&B!==void 0?b(L-B,L):void 0,H=e=>e===void 0?`—`:`${Math.round(e)}%`,U=m?e.running_gates:void 0,W=(S?.reservations??S?.reservedCores??U??0)>0,G=S?oe(S):U===void 0?`unknown`:`${U} running`,K=e.agent_slots?.used??e.live_agents,q=e.agent_slots?.max,J=q!==void 0&&K>q,Y=e.landing_slots,X=(Y?.used??0)>0,pe=e.policy?.spawnEnabled===!1||e.policy?.gatesEnabled===!1,Z=e.band_reason??e.band,$=e.project_toolchain,ge=[e.band&&e.band!==`normal`&&e.band_reason&&!e.state_details?.includes(e.band_reason)?{text:e.band_reason,tone:`idle`}:null,e.state_details?{text:e.state_details,tone:`warn`}:null,e.identity.matched?null:{text:`${e.identity.cause} ${e.identity.remedy}`,tone:`crit`},C?.state===`unarmed`?{text:`Gate capacity NOT ARMED (${C.cause}): gates run uncapped. ${C.reason??``}`,tone:`crit`}:null,$?.resolver?.error?{text:`Project toolchains refused: ${$.resolver.error}`,tone:`crit`}:null].filter(e=>e!==null);return(0,A.jsxs)(O,{className:t(`relative gap-3 transition-shadow hover:shadow-md`,!e.enabled&&`opacity-60`),children:[(0,A.jsx)(`div`,{className:t(`absolute inset-x-0 top-0 h-0.5`,N[M],`opacity-70`),"aria-hidden":!0}),(0,A.jsxs)(T,{className:`pb-0 pt-1 px-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,A.jsx)(`div`,{className:`pt-1.5`,children:(0,A.jsx)(ce,{tone:M,live:e.enabled&&e.state===`healthy`,title:`${e.enabled?e.state:`disabled`}`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsx)(D,{className:`text-sm font-semibold truncate`,children:e.label}),(0,A.jsxs)(`div`,{className:`text-[11px] text-muted-foreground mt-0.5 truncate`,children:[e.os,e.os_version?` ${e.os_version}`:``,` · `,e.cpu_cores,`c / `,e.cpu_threads,`t`]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pt-0.5`,children:[(0,A.jsx)(`span`,{className:`sr-only`,children:e.state}),e.band?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(le,{band:e.band,tone:he(e.band),title:Z}),(0,A.jsx)(`span`,{className:t(`text-[10px] font-medium`,j[he(e.band)]),title:Z,children:e.band})]}):null]})]}),(e.tags.length>0||e.system_tags.length>0)&&(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-2`,children:[e.tags.map(e=>(0,A.jsx)(_,{variant:`secondary`,className:`text-[10px]`,children:e},`tag-${e}`)),e.system_tags.map(e=>(0,A.jsx)(_,{variant:`outline`,className:`text-[10px] text-muted-foreground`,children:e},`stag-${e}`))]})]}),(0,A.jsxs)(E,{className:`px-4 space-y-3.5`,children:[(0,A.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 rounded-lg bg-foreground/[0.03] py-3 px-1`,children:[(0,A.jsx)(I,{label:`CPU`,pct:P,tone:y(P),center:H(P),sub:e.free_threads===void 0?void 0:`${e.free_threads} free`,title:`CPU utilization ${e.cpu_utilization??`unknown`}: busy share of all cores${e.cpu_pressure?` · CPU pressure ${e.cpu_pressure} (share of time tasks wait for a CPU)`:``}${e.free_threads===void 0?``:` · ${e.free_threads} free threads`}`}),(0,A.jsx)(I,{label:`RAM`,pct:F,tone:y(F),center:H(F),sub:e.used_ram?`${e.used_ram} / ${e.total_ram}`:e.total_ram,title:`RAM ${e.used_ram??`unknown`} used of ${e.total_ram}${e.usable_ram?` · ${e.usable_ram} available`:``}`}),(0,A.jsx)(I,{label:`Disk`,pct:V,tone:y(V),center:H(V),sub:e.free_storage?`${e.free_storage} free`:e.total_storage,title:`Disk ${e.free_storage??`unknown`} free of ${e.total_storage}`})]}),(0,A.jsx)(z,{icon:(0,A.jsx)(p,{className:`w-3 h-3`}),label:`Gates`,right:G,title:`Gate slots: one cell per CPU core of host gate capacity; blue = Relay's gates, amber = other users' gates, dashed = queued`,children:S?(0,A.jsx)(ue,{cells:ae(S),active:W,queued:S.queued}):(0,A.jsx)(`div`,{className:`h-3 rounded-[3px] bg-foreground/10`})}),(0,A.jsx)(fe,{host:e}),(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,A.jsx)(z,{icon:(0,A.jsx)(ne,{className:`w-3 h-3`}),label:`Agents`,right:q===void 0?K:`${K} / ${q}`,title:q===void 0?`${K} live agents`:`${K} / ${q} ${e.agent_slots?.cap_source===`operator`?`cap`:`default cap`}`,children:(0,A.jsx)(R,{dots:se(K,q),tone:J?`crit`:`ok`,active:K>0})}),Y?(0,A.jsx)(z,{icon:(0,A.jsx)(d,{className:`w-3 h-3`}),label:`Landing`,right:`${Y.used} / ${Y.max}${Y.queued>0?` +${Y.queued}`:``}`,title:`Landing admission: ${Y.used} / ${Y.max} slots, ${Y.queued} queued`,children:(0,A.jsx)(R,{dots:se(Y.used,Y.max),tone:`ok`,active:X,queued:Y.queued})}):null]}),ge.map(e=>(0,A.jsxs)(`div`,{className:t(`flex items-start gap-1.5 rounded-md px-2 py-1.5 text-[11px] leading-snug`,e.tone===`crit`?`bg-tone-danger/10 text-tone-danger-fg`:e.tone===`warn`?`bg-tone-warning/10 text-tone-warning-fg`:`bg-foreground/5 text-muted-foreground`),children:[(0,A.jsx)(te,{className:`w-3 h-3 mt-px shrink-0`}),(0,A.jsx)(`span`,{title:e.text,children:e.text})]},e.text)),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[11px]`,children:[[`spawnEnabled`,`gatesEnabled`].map(t=>(0,A.jsx)(de,{label:t===`spawnEnabled`?`Spawns`:`Gates`,icon:t===`spawnEnabled`?(0,A.jsx)(ee,{className:`h-3 w-3`}):(0,A.jsx)(p,{className:`h-3 w-3`}),checked:e.policy?.[t]!==!1,saving:r===t,disabled:r!==null,title:t===`spawnEnabled`?`Spawns: whether new agents may start on this host. Off drains it — running agents continue.`:`Gates: whether this host may run test gates and landings. Off drains it — running gates finish.`,onChange:()=>void a(t)},t)),(0,A.jsxs)(`div`,{className:`ml-auto flex gap-1.5`,children:[w?(0,A.jsx)(g,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:()=>void f(e.id),children:`Accept new hardware / same host`}):null,(0,A.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-7 text-xs gap-1`,onClick:()=>{u&&c(u),s(e)},children:[(0,A.jsx)(h,{className:`w-3 h-3`}),`Edit host`]})]})]}),pe?(0,A.jsxs)(`div`,{className:`text-xs text-tone-warning-fg`,children:[`Draining: `,e.live_agents,` live agents · `,U??`unknown`,` running gates`]}):null,(0,A.jsxs)(`details`,{className:`group text-xs`,children:[(0,A.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground`,children:[(0,A.jsx)(l,{className:`w-3 h-3 transition-transform group-open:rotate-90`}),`Details`]}),(0,A.jsxs)(`dl`,{className:`mt-2 space-y-1`,children:[(0,A.jsx)(Q,{label:`RAM`,children:e.total_ram}),(0,A.jsx)(Q,{label:`Storage`,children:e.total_storage}),(0,A.jsxs)(Q,{label:`CPU`,children:[e.cpu_type,e.cpu_model?` ${e.cpu_model}`:``]}),(0,A.jsxs)(Q,{label:`Cores/Threads`,children:[e.cpu_cores,`c / `,e.cpu_threads,`t`]}),(0,A.jsx)(Q,{label:`CPU utilization`,children:e.cpu_utilization??`—`}),e.cpu_pressure?(0,A.jsx)(Q,{label:`CPU pressure (PSI)`,children:e.cpu_pressure}):null,e.free_threads===void 0?null:(0,A.jsx)(Q,{label:`Free threads`,children:e.free_threads}),e.used_ram?(0,A.jsx)(Q,{label:`Used RAM`,children:e.used_ram}):null,e.usable_ram?(0,A.jsx)(Q,{label:`Avail RAM`,children:e.usable_ram}):null,e.free_storage?(0,A.jsx)(Q,{label:`Free disk`,children:e.free_storage}):null,(0,A.jsx)(Q,{label:`Agents`,children:q===void 0?K:`${K} / ${q} ${e.agent_slots?.cap_source===`operator`?`cap`:`default cap`}`}),Y?(0,A.jsxs)(Q,{label:`Landing admission`,children:[Y.used,` / `,Y.max,` `,Y.cap_source===`operator`?`slots`:`default slots`,Y.wait_reasons?.length?Y.wait_reasons.map(e=>` · ${e.count} ${e.reason}`).join(``):``,v>0?` · ${v} queued lands`:``]}):null,(0,A.jsx)(Q,{label:`Gates`,children:G}),$?(0,A.jsx)(Q,{label:`Project toolchains`,children:$.resolver?`mise${$.resolver.miseVersion?` ${$.resolver.miseVersion}`:``}${$.resolver.error?` (unavailable)`:``}`:`off`}):null,Object.entries($?.projects??{}).map(([e,t])=>(0,A.jsx)(Q,{label:(0,A.jsx)(`span`,{title:e,children:e.split(`/`).filter(Boolean).at(-1)??e}),children:t},e))]})]})]})]})}function ge(){let e=o(e=>e.hosts),t=o(e=>e.hostsLoading),n=o(e=>e.fetchHosts),r=e.filter(e=>e.enabled).length;return(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-base font-semibold`,children:`Fleet`}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Registered hosts, hardware, and live load`})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,A.jsxs)(_,{variant:`outline`,className:`text-xs`,children:[r,` enabled`]}),(0,A.jsx)(g,{size:`sm`,variant:`outline`,disabled:t,onClick:()=>void n(),children:t?`Refreshing…`:`Refresh`})]})]}),e.length===0?(0,A.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:t?`Loading hosts…`:`No hosts registered.`}):(0,A.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>(0,A.jsx)($,{host:e},e.id))}),(0,A.jsx)(Z,{})]})}export{ge as FleetView};
|
|
2
|
-
//# sourceMappingURL=fleet-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Ct as i,E as a,t as o}from"./store-BgDALGIX.js";import"./provider-display-bWwiuedV.js";import{h as s}from"./display-BemJG1f_.js";import{t as c}from"./host-mTgRw7xh.js";import{t as l}from"./chevron-right-iljytE0x.js";import{t as u}from"./cpu-Dndy84IU.js";import{t as d}from"./git-merge-C7eIG425.js";import{t as f}from"./globe-Cl5fXtqs.js";import{t as p}from"./layers-DEfClY-v.js";import{t as m}from"./loader-circle-BfPd4kOD.js";import{t as h}from"./pencil-B1Hf2V_J.js";import{t as ee}from"./rocket-BmO1qSu-.js";import{t as te}from"./triangle-alert-BBNhfgMi.js";import{t as ne}from"./users-C7B3u9jv.js";import{t as g}from"./button-Do6Z3vvn.js";import{t as _}from"./badge-DqJRtj_p.js";import{t as v}from"./input-CsTB6jIx.js";import{a as re,c as y,i as ie,l as b,n as ae,o as x,r as oe,s as se,t as S,u as C}from"./fleet-metrics-BGoDAFI-.js";import{i as w,o as T,r as E,s as D,t as O}from"./card-C4QJ4hCW.js";var k=e(n(),1),A=r(),j={ok:`text-tone-success-fg`,warn:`text-tone-warning-fg`,crit:`text-tone-danger-fg`,idle:`text-tone-neutral-fg`},M={ok:`stroke-tone-success`,warn:`stroke-tone-warning`,crit:`stroke-tone-danger`,idle:`stroke-tone-neutral`},N={ok:`bg-tone-success`,warn:`bg-tone-warning`,crit:`bg-tone-danger`,idle:`bg-tone-neutral`},P=20,F=2*Math.PI*P;function I({label:e,pct:n,tone:r,center:i,sub:a,title:o}){let s=n===void 0?0:S(n),c=F*(1-s/100);return(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-1 min-w-0`,title:o,children:[(0,A.jsxs)(`div`,{className:`relative h-[60px] w-[60px]`,children:[(0,A.jsxs)(`svg`,{viewBox:`0 0 48 48`,role:`img`,"aria-label":`${e} ${i}`,className:`h-full w-full -rotate-90`,children:[(0,A.jsx)(`circle`,{cx:`24`,cy:`24`,r:P,fill:`none`,strokeWidth:`4.5`,className:`stroke-foreground/10`}),n===void 0?null:(0,A.jsx)(`circle`,{cx:`24`,cy:`24`,r:P,fill:`none`,strokeWidth:`4.5`,strokeLinecap:`round`,"data-testid":`ring-${e.toLowerCase()}`,"data-pct":Math.round(s),className:t(M[r],`motion-safe:animate-fleet-ring-in motion-safe:transition-[stroke-dashoffset] motion-safe:duration-700`),style:{strokeDasharray:F,strokeDashoffset:c,"--ring-c":F}})]}),(0,A.jsx)(`span`,{className:t(`absolute inset-0 flex items-center justify-center text-[13px] font-semibold tabular-nums`,j[r]),children:i})]}),(0,A.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground leading-none`,children:e}),a?(0,A.jsx)(`div`,{className:`text-[10px] text-muted-foreground/80 leading-none truncate max-w-full tabular-nums`,children:a}):null]})}function ce({tone:e,live:n,title:r}){return(0,A.jsxs)(`span`,{className:`relative flex h-3 w-3 items-center justify-center shrink-0`,title:r,role:`img`,"aria-label":r,children:[n?(0,A.jsx)(`span`,{className:t(`absolute inline-flex h-full w-full rounded-full opacity-50 motion-safe:animate-fleet-ping`,N[e])}):null,(0,A.jsx)(`span`,{className:t(`relative inline-flex h-2.5 w-2.5 rounded-full ring-2 ring-card`,N[e])})]})}var L={idle:1,normal:1,busy:2,saturated:3,blocked:4};function le({band:e,tone:n,title:r}){let i=L[e]??0;return(0,A.jsx)(`span`,{className:`inline-flex items-end gap-[3px] h-3.5`,title:r,role:`img`,"aria-label":`pressure ${e}`,children:[1,2,3,4].map(e=>(0,A.jsx)(`span`,{className:t(`w-[3px] rounded-sm transition-colors`,e<=i?N[n]:`bg-foreground/15`),style:{height:`${25+e*18}%`}},e))})}function ue({cells:e,active:n,queued:r}){let i=t=>t<e.own?`bg-tone-sky`:t<e.own+e.other?`bg-tone-warning`:t<e.own+e.other+e.unattributed?`bg-tone-success`:``;return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-[3px]`,"data-testid":`gate-cells`,children:[Array.from({length:e.total},(e,r)=>{let a=i(r);return(0,A.jsx)(`span`,{className:t(`h-3 w-3 rounded-[3px]`,a?[a,n&&`motion-safe:animate-fleet-breathe`]:`bg-foreground/10`),style:a&&n?{animationDelay:`${r%6*160}ms`}:void 0},r)}),r>0?(0,A.jsx)(`span`,{className:`ml-1.5 flex items-center gap-[3px]`,title:`${r} queued ${r===1?`gate`:`gates`}`,children:Array.from({length:Math.min(r,6)},(e,t)=>(0,A.jsx)(`span`,{className:`h-3 w-3 rounded-[3px] border border-dashed border-tone-warning/80 motion-safe:animate-fleet-breathe`},t))}):null]})}function R({dots:e,tone:n,active:r,queued:i=0}){return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-[3px]`,children:[Array.from({length:e.filled},(e,i)=>(0,A.jsx)(`span`,{className:t(`h-2 w-2 rounded-full`,N[n],r&&`motion-safe:animate-fleet-breathe`),style:r?{animationDelay:`${i%6*200}ms`}:void 0},`f${i}`)),Array.from({length:e.empty},(e,t)=>(0,A.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-foreground/10`},`e${t}`)),Array.from({length:e.over},(e,t)=>(0,A.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-tone-danger ring-1 ring-tone-danger/40`},`o${t}`)),Array.from({length:Math.min(i,6)},(e,t)=>(0,A.jsx)(`span`,{className:`h-2 w-2 rounded-full border border-dashed border-tone-warning/80 motion-safe:animate-fleet-breathe`},`q${t}`))]})}function z({icon:e,label:t,right:n,children:r,title:i}){return(0,A.jsxs)(`div`,{className:`space-y-1.5`,title:i,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wider text-muted-foreground`,children:[e,(0,A.jsx)(`span`,{children:t}),(0,A.jsx)(`span`,{className:`ml-auto normal-case tracking-normal tabular-nums text-foreground/80 text-[11px]`,children:n})]}),r]})}function de({label:e,icon:n,checked:r,saving:i,disabled:a,title:o,onChange:s}){return(0,A.jsxs)(`label`,{title:o,"data-state":r?`on`:`off`,"data-saving":i||void 0,className:t(`group/toggle flex select-none items-center gap-1.5 rounded-full border py-0.5 pl-1.5 pr-1 text-[11px] font-medium transition-colors`,`focus-within:ring-2 focus-within:ring-ring/50`,r?`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`:`border-foreground/10 bg-foreground/[0.03] text-muted-foreground`,a?`cursor-wait`:`cursor-pointer hover:border-foreground/25`,i&&`motion-safe:animate-fleet-breathe`),children:[(0,A.jsx)(`input`,{type:`checkbox`,role:`switch`,className:`peer sr-only`,checked:r,disabled:a,onChange:s}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:`flex items-center`,children:i?(0,A.jsx)(m,{className:`h-3 w-3 motion-safe:animate-spin`}):n}),(0,A.jsx)(`span`,{children:e}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:t(`relative h-3.5 w-6 rounded-full transition-colors`,r?`bg-tone-success`:`bg-foreground/20`),children:(0,A.jsx)(`span`,{className:t(`absolute top-0.5 h-2.5 w-2.5 rounded-full bg-white shadow-sm transition-all`,r?`left-[calc(100%-0.75rem)]`:`left-0.5`)})})]})}var B={"systemd-user-scope":`Linux cgroup (systemd scope)`,"delegated-cgroup":`Linux cgroup (delegated)`,taskpolicy:`macOS background QoS`,nice:`nice priority`,"admission-only":`Admission only`},V={land:`Land`,iterate:`Iterate`,validation:`Validation`};function H(e){let t=e.cpuQuotaAvailable?`soft CPU shares${e.cpuLimit===void 0?``:` · ceiling ${U(e.cpuLimit)} CPUs`}`:`no CPU control${e.priority?` · priority ${e.priority}`:``}`;return{label:B[e.mechanism],detail:t,degraded:e.mechanism===`nice`||e.mechanism===`admission-only`,reason:e.reason}}function U(e){return String(Math.round(e*10)/10)}function W(e){let t=e/1024**3;return t>=1?`${Math.round(t*10)/10} GB`:`${Math.round(e/1024**2)} MB`}function G(e){return e?e.replace(/\/+$/,``).split(`/`).at(-1)||e:`unknown repository`}function K(e,t){let n=e.resource_control,r=n?.sampledAt??e.sampled_at;if(e.state===`unavailable`||!r||t-r>6e4)return{state:`unknown`};if(!n)return{state:`off`};let i=H(n),a=[`agent`,`land`].flatMap(e=>n.paths?.[e]?[{name:e,view:H(n.paths[e])}]:[]),o=(n.work??[]).map(e=>({id:e.id,repository:G(e.repository),repositoryPath:e.repository,kind:e.kind,state:e.state})),s=[...i.degraded?[`${i.label}: ${i.reason??`CPU quota unavailable`}`]:[],...a.filter(e=>e.view.degraded).map(e=>`${e.name===`agent`?`Agent`:`Land`} path, ${e.view.label}: ${e.view.reason??`CPU quota unavailable`}`)];return{state:`on`,mechanism:i,paths:a,usableCpus:U(n.usableCpus),gateCpus:U(n.gateCpus),memory:W(n.memoryBytes),...n.gateMemoryBytes?{gateMemory:n.gateMemoryUsedBytes===void 0?`cap ${W(n.gateMemoryBytes)}`:`${W(n.gateMemoryUsedBytes)} of ${W(n.gateMemoryBytes)} in use`}:{},...n.runMemoryBytes?{runMemory:W(n.runMemoryBytes)}:{},slots:n.slots,held:n.held,waiters:n.waiters,iterateOverflow:n.iterateOverflow,kinds:n.kinds?c.map(e=>({kind:e,label:V[e],...n.kinds[e],cpus:U(n.kinds[e].cpus)})):void 0,work:o,hiddenWork:Math.max(0,n.held+n.waiters-o.length),degradations:s}}var q={landSlots:`Land slots`,validationSlots:`Validation slots`,runCpus:`CPUs per run`,runMemory:`Memory per run (GiB)`};function J({host:e,field:t}){let n=o(e=>e.setHostGateBudget),[r,i]=(0,k.useState)(null),[a,s]=(0,k.useState)(!1),c=e.policy?.[t]??(t===`landSlots`?e.policy?.gateBudget??e.gate_budget:t===`validationSlots`?e.policy?.validationGateBudget:void 0)??null,l=t===`runMemory`?1024**3:1,u=r??(c===null?``:String(c/l)),d=u.trim()===``?null:Number(u)*l,f=t===`landSlots`||t===`validationSlots`,p=d===null||Number.isFinite(d)&&d>0&&(t===`runCpus`?d>=.01&&d<=1e3:Number.isSafeInteger(d)&&(!f||d<=1e3)),m=r!==null&&d!==c,h=async r=>{let a={[t]:r};t===`landSlots`&&(a.gateBudget=null),t===`validationSlots`&&(a.validationGateBudget=null),t===`runCpus`&&(a.landGateCpus=null,a.validationGateCpus=null),s(!0);try{await n(e.id,a)&&i(null)}finally{s(!1)}};return(0,A.jsxs)(`form`,{className:`space-y-1`,onSubmit:e=>{e.preventDefault(),p&&m&&h(d)},children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`label`,{htmlFor:`${t}-${e.id}`,className:`text-[11px] text-muted-foreground`,children:q[t]}),(0,A.jsx)(v,{id:`${t}-${e.id}`,inputMode:`decimal`,className:`h-7 w-20 text-center tabular-nums`,value:u,placeholder:`auto`,disabled:a,"aria-invalid":!p,onChange:e=>i(e.target.value)}),(0,A.jsx)(g,{type:`submit`,size:`sm`,variant:`outline`,className:`h-7 text-xs`,"aria-label":`Apply ${q[t]}`,disabled:!p||!m||a,children:a?`Saving…`:`Apply`}),c===null?null:(0,A.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 text-xs`,disabled:a,"aria-label":`Use automatic ${q[t]}`,onClick:()=>void h(null),children:`Use automatic`})]}),p?null:(0,A.jsx)(`p`,{className:`text-[10px] text-tone-danger-fg`,children:f?`Whole number 1–1000, or empty.`:t===`runCpus`?`0.01–1000 CPUs, or empty.`:`Positive memory in GiB, or empty.`})]})}function Y({host:e}){return(0,A.jsxs)(`div`,{className:`space-y-2`,"aria-label":`Gate pool settings`,children:[Object.keys(q).map(t=>(0,A.jsx)(J,{host:e,field:t},t)),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Empty uses fleet or hardware defaults. Land and validation slots add up to one shared pool. CPUs and memory per run are soft shares; the gate slice caps total gate memory.`})]})}function fe({host:e}){let n=K(e,Date.now()),r=n.state===`on`?`${n.held} held · ${n.waiters} queued`:n.state===`off`?`off`:`no data`;return(0,A.jsx)(z,{icon:(0,A.jsx)(u,{className:`w-3 h-3`}),label:`Resource control`,right:r,title:`Built-in host resource control: how this host limits gate CPU, what it has admitted, and the gate budget`,children:(0,A.jsxs)(`div`,{className:`space-y-2 text-[11px]`,"data-testid":`resource-control`,children:[n.state===`unknown`?(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Unknown: no fresh sample from this host's orchestrator.`}):n.state===`off`?(0,A.jsxs)(`p`,{className:`text-muted-foreground`,"data-testid":`resource-control-off`,children:[`Off on this host. Set `,(0,A.jsx)(`code`,{className:`break-all`,children:`AGENT_RELAY_HOST_RESOURCE_CONTROL=1`}),` on its orchestrator to enable shared admission and CPU limits; until then gates use per-repository leases.`]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(_,{variant:`secondary`,className:`text-[10px]`,"data-testid":`resource-mechanism`,children:n.mechanism.label}),(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:n.mechanism.detail})]}),(0,A.jsxs)(`dl`,{className:`grid grid-cols-3 gap-2 tabular-nums`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`CPUs`}),(0,A.jsxs)(`dd`,{children:[n.gateCpus,` of `,n.usableCpus]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Memory`}),(0,A.jsx)(`dd`,{children:n.memory})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Shared pool`}),(0,A.jsxs)(`dd`,{children:[n.held,` / `,n.slots,n.iterateOverflow?` +${n.iterateOverflow} iterate`:``]})]})]}),n.gateMemory?(0,A.jsxs)(`p`,{className:`text-muted-foreground`,"data-testid":`resource-gate-memory`,children:[`Gate memory: `,n.gateMemory,`.`,n.runMemory?` Each run has a ${n.runMemory} soft share; another gate starts only while that much is free.`:``]}):null,n.kinds?(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsxs)(`p`,{className:`text-muted-foreground`,children:[`One pool for all gates. A free slot goes to lands first, then iterate, then validation.`,n.iterateOverflow?` Iterate may use ${n.iterateOverflow} extra slot when the pool is full.`:``]}),(0,A.jsx)(`ul`,{"aria-label":`Gate kinds`,className:`space-y-0.5 tabular-nums`,children:n.kinds.map(e=>(0,A.jsxs)(`li`,{children:[e.label,`: `,e.held,` held · `,e.waiters,` queued · `,e.cpus,` CPUs per run (soft)`]},e.kind))})]}):(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Pool detail not reported by this orchestrator.`}),n.degradations.map(e=>(0,A.jsxs)(`div`,{"data-testid":`resource-degraded`,className:`flex items-start gap-1.5 rounded-md bg-tone-warning/10 px-2 py-1.5 leading-snug text-tone-warning-fg`,children:[(0,A.jsx)(te,{className:`w-3 h-3 mt-px shrink-0`}),(0,A.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`Degraded. `,e]})]},e)),n.paths.length>1||n.paths.some(e=>e.view.label!==n.mechanism.label)?(0,A.jsx)(`ul`,{className:`space-y-0.5 text-muted-foreground`,children:n.paths.map(e=>(0,A.jsxs)(`li`,{children:[e.name===`agent`?`Agents`:`Lands`,`: `,e.view.label,` · `,e.view.detail]},e.name))}):null,n.work.length>0?(0,A.jsxs)(`ul`,{className:`space-y-1`,"aria-label":`Held and queued gates`,children:[n.work.map(e=>(0,A.jsxs)(`li`,{"data-testid":`resource-work`,"data-state":e.state,className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:t(`shrink-0 rounded-full border px-1.5 text-[10px] font-medium`,e.state===`held`?`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`:`border-dashed border-tone-warning/80 text-tone-warning-fg`),children:e.state}),(0,A.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.kind}),(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.repositoryPath??e.id,children:e.repository})]},e.id)),n.hiddenWork>0?(0,A.jsxs)(`li`,{className:`text-muted-foreground`,children:[`+`,n.hiddenWork,` more not listed`]}):null]}):n.held+n.waiters>0?(0,A.jsxs)(`p`,{className:`text-muted-foreground`,children:[n.held+n.waiters,` gates in flight; detail not reported by this orchestrator.`]}):(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`No gates held or queued.`})]}),e.resource_control?.gateLimits?.enabled?(0,A.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Gate cap: `,e.resource_control.gateLimits.gateRunCapMs/6e4,` min · Slot hold cap: `,e.resource_control.gateLimits.slotHoldCapMs/6e4,` min`]}):null,Object.keys(e.gate_reservations??{}).length>0?(0,A.jsx)(`ul`,{"aria-label":`Project reserved gate slots`,className:`space-y-0.5 text-muted-foreground`,children:Object.entries(e.gate_reservations).map(([e,t])=>(0,A.jsxs)(`li`,{children:[e,`: `,t,` reserved gate slot`,t===1?``:`s`]},e))}):null,e.gate_reservation_warning?(0,A.jsx)(`p`,{role:`alert`,className:`text-tone-warning-fg`,children:e.gate_reservation_warning}):null,(0,A.jsx)(Y,{host:e})]})})}function X({session:e,now:t}){let n=o(t=>t.agentsById[e.agentId]),r=o(t=>t.orchestrators.find(t=>t.id===e.orchestratorId)?.hostname),i=o(e=>e.openAgentDetail),a=n?.label||n?.name||e.agentId;return(0,A.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 py-2 text-sm`,"data-testid":`browser-fleet-row`,"data-session-id":e.id,children:[n?(0,A.jsx)(`button`,{type:`button`,className:`min-w-0 max-w-full truncate font-medium hover:underline`,onClick:()=>i(n),children:a}):(0,A.jsx)(`span`,{className:`min-w-0 max-w-full truncate font-medium`,children:a}),(0,A.jsx)(`span`,{className:`text-muted-foreground`,title:e.orchestratorId,children:r??e.orchestratorId}),(0,A.jsx)(_,{variant:`outline`,className:`text-[11px]`,children:e.status}),(0,A.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,title:new Date(e.createdAt).toLocaleString(),children:[`open `,s(t,e.createdAt)]}),(0,A.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,title:`Time since the agent last used this browser, as of the host's last report`,children:[`idle `,e.status===`running`&&e.lastActivityAt?s(t,e.lastActivityAt):`—`]}),(0,A.jsx)(`span`,{className:`ml-auto`,children:(0,A.jsx)(C,{session:e,label:`Stop the browser of ${a}`})})]})}function pe(){window.location.hash=`settings/agents`,o.getState().switchView(`settings`)}function Z(){let e=o(e=>e.browser),t=i();if(!e?.enabled)return null;let n=Object.values(e.sessions).filter(a).sort((e,t)=>t.createdAt-e.createdAt),r=e.limits;return(0,A.jsxs)(O,{size:`sm`,"data-testid":`browser-fleet`,children:[(0,A.jsxs)(T,{children:[(0,A.jsxs)(D,{className:`flex items-center gap-2 text-sm`,children:[(0,A.jsx)(f,{className:`size-4`}),`Browser sessions`]}),(0,A.jsxs)(w,{className:`flex flex-wrap items-center gap-x-2 text-xs`,children:[r?(0,A.jsxs)(`span`,{"data-testid":`browser-fleet-limits`,children:[`Up to `,r.perAgent,` per agent and `,r.perHost,` per host. An idle browser stops after `,r.idleTimeoutMinutes,` min.`]}):(0,A.jsx)(`span`,{children:`Headless browsers that agents run on their hosts.`}),(0,A.jsx)(g,{variant:`link`,size:`sm`,className:`h-auto p-0 text-xs`,onClick:pe,children:`Change limits`})]})]}),(0,A.jsx)(E,{children:e.fleetError?(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.fleetError}):n.length===0?(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No browser is open.`}):(0,A.jsx)(`ul`,{className:`divide-y`,children:n.map(e=>(0,A.jsx)(X,{session:e,now:t},e.id))})})]})}var me={healthy:`ok`,degraded:`warn`,unavailable:`crit`};function he(e){return e===`idle`||e===`normal`?`ok`:e===`busy`?`warn`:e===`saturated`||e===`blocked`?`crit`:`idle`}function Q({label:e,children:t}){return(0,A.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,A.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,A.jsx)(`dd`,{className:`text-right text-foreground tabular-nums`,children:t})]})}function $({host:e}){let n=o(e=>e.setHostAdmission),[r,i]=(0,k.useState)(null),a=async t=>{i(t);try{await n(e.id,{[t]:e.policy?.[t]===!1})}finally{i(null)}},s=o(e=>e.openHostEdit),c=o(e=>e.fetchHostProviders),u=o(t=>ie(t.orchestrators,e.id)),f=o(e=>e.acceptHostHardware),m=e.state!==`unavailable`&&!!e.gates_sampled_at&&Date.now()-e.gates_sampled_at<=6e4,v=(e.landing_slots?.queued??0)-(e.landing_slots?.wait_reasons?.reduce((e,t)=>e+t.count,0)??0),S=m?e.gate_capacity:void 0,C=e.state===`unavailable`?void 0:e.gate_arming,w=e.system_tags.includes(`conflict:pending`),M=e.enabled?me[e.state]??`idle`:`idle`,P=re(e.cpu_utilization),F=b(x(e.used_ram),x(e.total_ram)),L=x(e.total_storage),B=x(e.free_storage),V=L&&B!==void 0?b(L-B,L):void 0,H=e=>e===void 0?`—`:`${Math.round(e)}%`,U=m?e.running_gates:void 0,W=(S?.reservations??S?.reservedCores??U??0)>0,G=S?oe(S):U===void 0?`unknown`:`${U} running`,K=e.agent_slots?.used??e.live_agents,q=e.agent_slots?.max,J=q!==void 0&&K>q,Y=e.landing_slots,X=(Y?.used??0)>0,pe=e.policy?.spawnEnabled===!1||e.policy?.gatesEnabled===!1,Z=e.band_reason??e.band,$=e.project_toolchain,ge=[e.band&&e.band!==`normal`&&e.band_reason&&!e.state_details?.includes(e.band_reason)?{text:e.band_reason,tone:`idle`}:null,e.state_details?{text:e.state_details,tone:`warn`}:null,e.identity.matched?null:{text:`${e.identity.cause} ${e.identity.remedy}`,tone:`crit`},C?.state===`unarmed`?{text:`Gate capacity NOT ARMED (${C.cause}): gates run uncapped. ${C.reason??``}`,tone:`crit`}:null,$?.resolver?.error?{text:`Project toolchains refused: ${$.resolver.error}`,tone:`crit`}:null].filter(e=>e!==null);return(0,A.jsxs)(O,{className:t(`relative gap-3 transition-shadow hover:shadow-md`,!e.enabled&&`opacity-60`),children:[(0,A.jsx)(`div`,{className:t(`absolute inset-x-0 top-0 h-0.5`,N[M],`opacity-70`),"aria-hidden":!0}),(0,A.jsxs)(T,{className:`pb-0 pt-1 px-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,A.jsx)(`div`,{className:`pt-1.5`,children:(0,A.jsx)(ce,{tone:M,live:e.enabled&&e.state===`healthy`,title:`${e.enabled?e.state:`disabled`}`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsx)(D,{className:`text-sm font-semibold truncate`,children:e.label}),(0,A.jsxs)(`div`,{className:`text-[11px] text-muted-foreground mt-0.5 truncate`,children:[e.os,e.os_version?` ${e.os_version}`:``,` · `,e.cpu_cores,`c / `,e.cpu_threads,`t`]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pt-0.5`,children:[(0,A.jsx)(`span`,{className:`sr-only`,children:e.state}),e.band?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(le,{band:e.band,tone:he(e.band),title:Z}),(0,A.jsx)(`span`,{className:t(`text-[10px] font-medium`,j[he(e.band)]),title:Z,children:e.band})]}):null]})]}),(e.tags.length>0||e.system_tags.length>0)&&(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-2`,children:[e.tags.map(e=>(0,A.jsx)(_,{variant:`secondary`,className:`text-[10px]`,children:e},`tag-${e}`)),e.system_tags.map(e=>(0,A.jsx)(_,{variant:`outline`,className:`text-[10px] text-muted-foreground`,children:e},`stag-${e}`))]})]}),(0,A.jsxs)(E,{className:`px-4 space-y-3.5`,children:[(0,A.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 rounded-lg bg-foreground/[0.03] py-3 px-1`,children:[(0,A.jsx)(I,{label:`CPU`,pct:P,tone:y(P),center:H(P),sub:e.free_threads===void 0?void 0:`${e.free_threads} free`,title:`CPU utilization ${e.cpu_utilization??`unknown`}: busy share of all cores${e.cpu_pressure?` · CPU pressure ${e.cpu_pressure} (share of time tasks wait for a CPU)`:``}${e.free_threads===void 0?``:` · ${e.free_threads} free threads`}`}),(0,A.jsx)(I,{label:`RAM`,pct:F,tone:y(F),center:H(F),sub:e.used_ram?`${e.used_ram} / ${e.total_ram}`:e.total_ram,title:`RAM ${e.used_ram??`unknown`} used of ${e.total_ram}${e.usable_ram?` · ${e.usable_ram} available`:``}`}),(0,A.jsx)(I,{label:`Disk`,pct:V,tone:y(V),center:H(V),sub:e.free_storage?`${e.free_storage} free`:e.total_storage,title:`Disk ${e.free_storage??`unknown`} free of ${e.total_storage}`})]}),(0,A.jsx)(z,{icon:(0,A.jsx)(p,{className:`w-3 h-3`}),label:`Gates`,right:G,title:`Gate slots: one cell per CPU core of host gate capacity; blue = Relay's gates, amber = other users' gates, dashed = queued`,children:S?(0,A.jsx)(ue,{cells:ae(S),active:W,queued:S.queued}):(0,A.jsx)(`div`,{className:`h-3 rounded-[3px] bg-foreground/10`})}),(0,A.jsx)(fe,{host:e}),(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,A.jsx)(z,{icon:(0,A.jsx)(ne,{className:`w-3 h-3`}),label:`Agents`,right:q===void 0?K:`${K} / ${q}`,title:q===void 0?`${K} live agents`:`${K} / ${q} ${e.agent_slots?.cap_source===`operator`?`cap`:`default cap`}`,children:(0,A.jsx)(R,{dots:se(K,q),tone:J?`crit`:`ok`,active:K>0})}),Y?(0,A.jsx)(z,{icon:(0,A.jsx)(d,{className:`w-3 h-3`}),label:`Landing`,right:`${Y.used} / ${Y.max}${Y.queued>0?` +${Y.queued}`:``}`,title:`Landing admission: ${Y.used} / ${Y.max} slots, ${Y.queued} queued`,children:(0,A.jsx)(R,{dots:se(Y.used,Y.max),tone:`ok`,active:X,queued:Y.queued})}):null]}),ge.map(e=>(0,A.jsxs)(`div`,{className:t(`flex items-start gap-1.5 rounded-md px-2 py-1.5 text-[11px] leading-snug`,e.tone===`crit`?`bg-tone-danger/10 text-tone-danger-fg`:e.tone===`warn`?`bg-tone-warning/10 text-tone-warning-fg`:`bg-foreground/5 text-muted-foreground`),children:[(0,A.jsx)(te,{className:`w-3 h-3 mt-px shrink-0`}),(0,A.jsx)(`span`,{title:e.text,children:e.text})]},e.text)),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[11px]`,children:[[`spawnEnabled`,`gatesEnabled`].map(t=>(0,A.jsx)(de,{label:t===`spawnEnabled`?`Spawns`:`Gates`,icon:t===`spawnEnabled`?(0,A.jsx)(ee,{className:`h-3 w-3`}):(0,A.jsx)(p,{className:`h-3 w-3`}),checked:e.policy?.[t]!==!1,saving:r===t,disabled:r!==null,title:t===`spawnEnabled`?`Spawns: whether new agents may start on this host. Off drains it — running agents continue.`:`Gates: whether this host may run test gates and landings. Off drains it — running gates finish.`,onChange:()=>void a(t)},t)),(0,A.jsxs)(`div`,{className:`ml-auto flex gap-1.5`,children:[w?(0,A.jsx)(g,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:()=>void f(e.id),children:`Accept new hardware / same host`}):null,(0,A.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-7 text-xs gap-1`,onClick:()=>{u&&c(u),s(e)},children:[(0,A.jsx)(h,{className:`w-3 h-3`}),`Edit host`]})]})]}),pe?(0,A.jsxs)(`div`,{className:`text-xs text-tone-warning-fg`,children:[`Draining: `,e.live_agents,` live agents · `,U??`unknown`,` running gates`]}):null,(0,A.jsxs)(`details`,{className:`group text-xs`,children:[(0,A.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground`,children:[(0,A.jsx)(l,{className:`w-3 h-3 transition-transform group-open:rotate-90`}),`Details`]}),(0,A.jsxs)(`dl`,{className:`mt-2 space-y-1`,children:[(0,A.jsx)(Q,{label:`RAM`,children:e.total_ram}),(0,A.jsx)(Q,{label:`Storage`,children:e.total_storage}),(0,A.jsxs)(Q,{label:`CPU`,children:[e.cpu_type,e.cpu_model?` ${e.cpu_model}`:``]}),(0,A.jsxs)(Q,{label:`Cores/Threads`,children:[e.cpu_cores,`c / `,e.cpu_threads,`t`]}),(0,A.jsx)(Q,{label:`CPU utilization`,children:e.cpu_utilization??`—`}),e.cpu_pressure?(0,A.jsx)(Q,{label:`CPU pressure (PSI)`,children:e.cpu_pressure}):null,e.free_threads===void 0?null:(0,A.jsx)(Q,{label:`Free threads`,children:e.free_threads}),e.used_ram?(0,A.jsx)(Q,{label:`Used RAM`,children:e.used_ram}):null,e.usable_ram?(0,A.jsx)(Q,{label:`Avail RAM`,children:e.usable_ram}):null,e.free_storage?(0,A.jsx)(Q,{label:`Free disk`,children:e.free_storage}):null,(0,A.jsx)(Q,{label:`Agents`,children:q===void 0?K:`${K} / ${q} ${e.agent_slots?.cap_source===`operator`?`cap`:`default cap`}`}),Y?(0,A.jsxs)(Q,{label:`Landing admission`,children:[Y.used,` / `,Y.max,` `,Y.cap_source===`operator`?`slots`:`default slots`,Y.wait_reasons?.length?Y.wait_reasons.map(e=>` · ${e.count} ${e.reason}`).join(``):``,v>0?` · ${v} queued lands`:``]}):null,(0,A.jsx)(Q,{label:`Gates`,children:G}),$?(0,A.jsx)(Q,{label:`Project toolchains`,children:$.resolver?`mise${$.resolver.miseVersion?` ${$.resolver.miseVersion}`:``}${$.resolver.error?` (unavailable)`:``}`:`off`}):null,Object.entries($?.projects??{}).map(([e,t])=>(0,A.jsx)(Q,{label:(0,A.jsx)(`span`,{title:e,children:e.split(`/`).filter(Boolean).at(-1)??e}),children:t},e))]})]})]})]})}function ge(){let e=o(e=>e.hosts),t=o(e=>e.hostsLoading),n=o(e=>e.fetchHosts),r=e.filter(e=>e.enabled).length;return(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-base font-semibold`,children:`Fleet`}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Registered hosts, hardware, and live load`})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,A.jsxs)(_,{variant:`outline`,className:`text-xs`,children:[r,` enabled`]}),(0,A.jsx)(g,{size:`sm`,variant:`outline`,disabled:t,onClick:()=>void n(),children:t?`Refreshing…`:`Refresh`})]})]}),e.length===0?(0,A.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:t?`Loading hosts…`:`No hosts registered.`}):(0,A.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>(0,A.jsx)($,{host:e},e.id))}),(0,A.jsx)(Z,{})]})}export{ge as FleetView};
|
|
2
|
+
//# sourceMappingURL=fleet-TEuOCZXE.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{k as r,t as i}from"./store-
|
|
2
|
-
//# sourceMappingURL=fleet-metrics-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{k as r,t as i}from"./store-BgDALGIX.js";import{t as a}from"./square-Bqly37YM.js";import{t as o}from"./button-Do6Z3vvn.js";var s=e(t(),1),c=n();function l({session:e,label:t}){let[n,l]=(0,s.useState)(!1);if(e.status!==`starting`&&e.status!==`running`)return null;let u=async()=>{l(!0);try{await r(i.setState,i.getState,e.id)}catch(e){i.getState().showError(`Could not stop the browser`,e.message,e)}finally{l(!1)}};return(0,c.jsxs)(o,{size:`sm`,variant:`outline`,className:`h-7 gap-1 text-xs`,disabled:n,"aria-label":t,onClick:()=>void u(),children:[(0,c.jsx)(a,{className:`size-3`}),n?`Stopping…`:`Stop`]})}var u={MB:1,GB:1024,TB:1024*1024};function d(e){let t=/^(\d+(?:\.\d+)?)\s*(MB|GB|TB)$/i.exec(e?.trim()??``);return t?Number(t[1])*u[t[2].toUpperCase()]:void 0}function f(e){let t=/^(\d+(?:\.\d+)?)\s*%$/.exec(e?.trim()??``);return t?Number(t[1]):void 0}function p(e){return Math.max(0,Math.min(100,e))}function m(e){return e===void 0?`idle`:e>=90?`crit`:e>=70?`warn`:`ok`}function h(e,t){return e===void 0||!t?void 0:p(e/t*100)}var g=64,_=24;function v(e){let t=Math.max(1,Math.min(g,Math.round(e.totalCores))),n=Math.min(t,Math.round(e.reservedCores));if(e.ownReservedCores===void 0)return{total:t,own:0,other:0,unattributed:n};let r=Math.min(n,Math.round(e.ownReservedCores));return{total:t,own:r,other:n-r,unattributed:0}}function y(e){let{reservations:t,ownReservations:n}=e,r=`${e.reservedCores}/${e.totalCores} cores`;return t===void 0||n===void 0?r:t===0?`no gates · ${r}`:`${t} ${t===1?`gate`:`gates`} (${n} Relay, ${t-n} other) · ${r}`}function b(e,t){if(t===void 0)return{filled:Math.min(e,_),empty:0,over:0};let n=Math.min(t,_);return{filled:Math.min(e,n),empty:Math.max(0,n-e),over:Math.min(Math.max(0,e-t),6)}}function x(e,t){if(t)return(e.find(e=>e.hostId===t)??e.find(e=>e.id===t))?.id}export{f as a,m as c,x as i,h as l,v as n,d as o,y as r,b as s,p as t,l as u};
|
|
2
|
+
//# sourceMappingURL=fleet-metrics-BGoDAFI-.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-BgDALGIX.js";import{a,o,u as s}from"./artifacts-Bjq-ZyBA.js";import{U as c}from"./display-BemJG1f_.js";import{n as l,t as u}from"./issue-ref-chip-DbH8J9Ak.js";import{t as d}from"./paperclip-CNpKZKum.js";import{n as f,t as p}from"./task-chip-CYj0mpoL.js";import{t as m}from"./code-preview-KIRZA6cz.js";import{i as h,n as g,r as _,t as ee}from"./lib-G-25QXXf.js";var v=e(n(),1),y=r();function b({id:e,label:t,compact:n,className:r}){return(0,y.jsx)(f,{label:t??e,icon:(0,y.jsx)(d,{"aria-hidden":!0,className:n?`h-2.5 w-2.5 shrink-0`:`h-3 w-3 shrink-0`}),title:t?`${t} (${e})`:`Open artifact ${e}`,ariaLabel:`Open artifact ${t??e}`,compact:n,className:r,onClick:()=>o(e)})}var x=200,S=[3e3,1e4,3e4],C={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)},w=new Map,T=new Set,E,D,O=!1,k=!1,A=0;function j(e){D&&C.clear(D),D=C.set(M,e)}async function M(){if(D=void 0,!(w.size===0||!E)){O=!0,k=!1;try{await E()}catch{}if(O=!1,w.size!==0){if(k){A=0,j(x);return}j(S[Math.min(A++,S.length-1)])}}}function te(e,t){if(!t||e.length===0)return()=>{};E=t;let n=!1;for(let t of e)w.set(t,(w.get(t)??0)+1),T.has(t)||(T.add(t),n=!0);(n||!D&&!O)&&(O?k=!0:(A=0,j(x)));let r=!1;return()=>{if(!r){r=!0;for(let t of e){let e=(w.get(t)??1)-1;e>0?w.set(t,e):w.delete(t)}w.size>0||(T.clear(),D&&C.clear(D),D=void 0,A=0)}}}var N=String.raw`(?:(?<![\w.-])[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*)?#\d+\b`,P=RegExp(`(${N})|(https?:\\/\\/[^\\s\`'")\\]]+)|(\\bT\\d+\\b(?!\\/))|(\\b${s}\\b)|((?:\\/[\\w.@+-][^\\s\`'")\\]]*|(?:\\.{1,2}\\/|(?<![\\w.@+-])[\\w.@+-]+\\/)[^\\s\`'")\\]]*))`,`g`),F=/\bT(\d+)\b(?!\/)/g,I=RegExp(`(${N})`,`g`),L=/[.,;:!?]+$/,R=new Set([`src`,`app`,`apps`,`lib`,`server`,`client`,`dashboard`,`orchestrator`,`runner`,`sdk`,`codex`,`claude`,`public`,`docs`,`test`,`tests`,`scripts`,`config`,`configs`]),z={..._,attributes:{..._.attributes,code:[..._.attributes?.code||[],[`className`,/^language-[\w-]+$/]]}};function B(e){if(e===`/api`||e.startsWith(`/api/`))return!1;if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))return!0;let t=e.split(`/`).filter(Boolean),n=t[0]??``,r=t[t.length-1]??``;return n.startsWith(`.`)||R.has(n)?!0:r.includes(`.`)}function V(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.id==`number`?t.id:typeof t.id==`string`?Number(t.id):NaN;if(!Number.isSafeInteger(n)||n<=0)return null;let r=typeof t.title==`string`&&t.title.trim()?t.title:typeof t.label==`string`&&t.label.trim()?t.label:void 0,i=typeof t.status==`string`&&t.status.trim()?t.status:void 0;return{id:n,meta:{...r?{title:r}:{},...i?{status:i}:{}}}}function H(e){let t=new Set;for(let n of e.matchAll(F)){let e=Number(n[1]);Number.isSafeInteger(e)&&e>0&&t.add(e)}return[...t].sort((e,t)=>e-t)}function U(e,t,n){let r=new Set(e),i=new Map;if(r.size===0)return i;for(let e of t){let t=V(e);t&&r.has(t.id)&&i.set(t.id,t.meta)}for(let e of n){let t=V(e);t&&r.has(t.id)&&i.set(t.id,t.meta)}return i}function W(e,t,n){if(e.length===0)return``;let r=U(e,t,n);return e.map(e=>{let t=r.get(e);return`${e}:${t?.title??``}:${t?.status??``}`}).join(`|`)}function G(e,t){let n=new Set;for(let r of e.matchAll(I)){let e=r[1];if(!e)continue;let i=e.lastIndexOf(`#`),a=e.slice(i+1),o=e.slice(0,i)||t;o&&n.add(`${o}#${a}`)}return[...n].sort()}function K(e,t){let n=new Set(e),r=new Map;if(n.size===0)return r;for(let e of Object.values(t)){let t=`${e.repo}#${e.externalKey}`;n.has(t)&&r.set(t,e)}return r}function q(e,t){if(e.length===0)return``;let n=K(e,t);return e.map(e=>{let t=n.get(e);return`${e}:${t?.id??``}:${t?.status??``}:${t?.updatedAt??``}:${t?.url??``}`}).join(`|`)}function ne(e,t,n,r){let i=[],a=0;for(let n of e.matchAll(P)){let o=n[1],s=n[2],c=n[3],u=n[4],d=n[5],f=o||s||c||u||d,p=n.index??0;if(!f||p<a)continue;if(c){let t=Number(c.slice(1));Number.isSafeInteger(t)&&t>0&&(p>a&&i.push({text:e.slice(a,p)}),i.push({text:c,taskId:t}),a=p+c.length);continue}if(u){p>a&&i.push({text:e.slice(a,p)}),i.push({text:u,artifactId:u}),a=p+u.length;continue}if(o){let n=o.lastIndexOf(`#`),s=o.slice(0,n)||t,c=o.slice(n+1),u=e.slice(p+o.length).match(/^(?:\/\d+)+/)?.[0]??``;if(s){p>a&&i.push({text:e.slice(a,p)});let t=r?.get(`${s}#${c}`);i.push({text:o,issueUrl:`https://github.com/${s}/issues/${c}`,...t?{issueRef:t}:{issuePlaceholder:l(s,c)}}),u&&i.push({text:u}),a=p+o.length+u.length}else u&&(p>a&&i.push({text:e.slice(a,p)}),i.push({text:o+u}),a=p+o.length+u.length);continue}if(s){let t=s.replace(L,``),n=s.slice(t.length);p>a&&i.push({text:e.slice(a,p)}),i.push({text:t,url:t}),n&&i.push({text:n}),a=p+s.length;continue}if(!f.includes(`/`))continue;let m=f.replace(L,``),h=f.slice(m.length),g=m.match(/^(.*):(\d+)$/),_=g?Number(g[2]):void 0;g&&(m=g[1]),B(m)&&(p>a&&i.push({text:e.slice(a,p)}),i.push({text:m,path:m,line:Number.isFinite(_)?_:void 0}),h&&i.push({text:h}),a=p+f.length)}return a<e.length&&i.push({text:e.slice(a)}),i}function J({text:e,onOpenPath:t,onPreviewPath:n,onPreviewPathEnd:r,isPathLinkable:i,resolvePathTitle:a,issueRepo:o,onOpenTask:s,loadedTasksById:c,issueRefsByKey:l}){let d=(0,v.useMemo)(()=>ne(e,o,c,l),[e,o,c,l]);return d.length===1&&!d[0]?.path&&!d[0]?.url&&!d[0]?.issueUrl&&!d[0]?.taskId&&!d[0]?.artifactId?(0,y.jsx)(y.Fragment,{children:e}):(0,y.jsx)(y.Fragment,{children:d.map((e,o)=>{if(e.taskId!=null){if(s){let t=c?.get(e.taskId);return(0,y.jsx)(p,{id:e.taskId,title:t?.title,status:t?.status,compact:!0,onClick:()=>s(e.taskId)},`task-${e.taskId}-${o}`)}return(0,y.jsx)(`span`,{children:e.text},o)}if(e.artifactId)return(0,y.jsx)(b,{id:e.artifactId,compact:!0},`art-${e.artifactId}-${o}`);if(e.issueUrl){let t=e.issueRef??e.issuePlaceholder;if(t)return(0,y.jsx)(u,{issueRef:t,compact:!0},`${e.issueUrl}-${o}`)}if(e.url)return(0,y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`underline decoration-dotted underline-offset-2`,onClick:e=>e.stopPropagation(),children:e.text},`${e.url}-${o}`);if(e.path&&t){if(i&&!i(e.path,e.line))return(0,y.jsxs)(`span`,{children:[e.text,e.line?`:${e.line}`:``]},`${e.path}-${o}`);let s=a?.(e.path,e.line);return(0,y.jsxs)(`button`,{type:`button`,className:`chat-link rounded-sm font-mono underline decoration-dotted underline-offset-2`,onClick:n=>{n.stopPropagation(),t(e.path,e.line)},onMouseEnter:t=>n?.(e.path,e.line,t.currentTarget.getBoundingClientRect()),onFocus:t=>n?.(e.path,e.line,t.currentTarget.getBoundingClientRect()),onMouseLeave:()=>r?.(),onBlur:()=>r?.(),title:s?`Open ${s}`:`Open file`,children:[e.text,e.line?`:${e.line}`:``]},`${e.path}-${o}`)}return(0,y.jsx)(`span`,{children:e.text},o)})})}var Y=({className:e,children:t})=>{let n=/language-([\w-]+)/.exec(e||``),r=String(t).replace(/\n$/,``);return n?(0,y.jsx)(m,{content:r,path:`.${n[1]}`,languageHint:n[1],compact:!0}):a(r)?(0,y.jsx)(b,{id:r,compact:!0}):(0,y.jsx)(`code`,{className:e,children:t})},X=({href:e,children:t})=>(0,y.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),children:t});function Z(e,t,n=!1){return v.Children.map(e,e=>{if(typeof e==`string`)return n?e:(0,y.jsx)(J,{text:e,onOpenPath:t.onOpenPath,onPreviewPath:t.onPreviewPath,onPreviewPathEnd:t.onPreviewPathEnd,isPathLinkable:t.isPathLinkable,resolvePathTitle:t.resolvePathTitle,issueRepo:t.issueRepo,onOpenTask:t.onOpenTask,loadedTasksById:t.loadedTasksById,issueRefsByKey:t.issueRefsByKey});if(!v.isValidElement(e))return e;let r=e.type;if(r===J||r===X||r===`a`)return e;let i=e.props;if(i?.children==null)return e;let a=n||r===Y||r===`code`||r===`pre`;return v.cloneElement(e,void 0,Z(i.children,t,a))})}var Q=v.createContext({});function $(e){return function({children:t}){return(0,y.jsx)(e,{children:Z(t,v.useContext(Q))})}}var re={p:$(`p`),li:$(`li`),h1:$(`h1`),h2:$(`h2`),h3:$(`h3`),h4:$(`h4`),h5:$(`h5`),h6:$(`h6`),td:$(`td`),th:$(`th`),blockquote:$(`blockquote`),a:X,code:Y};function ie({text:e,rawBody:n,className:r,onOpenPath:a,onPreviewPath:o,onPreviewPathEnd:s,isPathLinkable:l,resolvePathTitle:u,issueRepo:d,onPrimary:f,onOpenTask:p}){let m=(0,v.useMemo)(()=>c(n||``),[n]),_=ae(m?m.text:e),b=(0,v.useMemo)(()=>/\S{2049}/u.test(_),[_]),x=i(e=>e.stats?.defaultIssueRepo),S=d??x,C=(0,v.useMemo)(()=>H(_),[_]),w=(0,v.useMemo)(()=>G(_,S),[_,S]),T=i(e=>W(C,e.tasks,e.deliverableTasks)),E=i(e=>e.openTaskDetailById),D=i(e=>q(w,e.issueRefsById)),O=(0,v.useMemo)(()=>{let e=i.getState();return U(C,e.tasks,e.deliverableTasks)},[C,T]),k=(0,v.useMemo)(()=>K(w,i.getState().issueRefsById),[w,D]),A=w.filter(e=>!k.has(e)).join(`|`);v.useEffect(()=>A?te(A.split(`|`),i.getState().fetchAllIssueRefs):void 0,[A]);let j=p??E,M=(0,v.useMemo)(()=>({onOpenPath:a,onPreviewPath:o,onPreviewPathEnd:s,isPathLinkable:l,resolvePathTitle:u,issueRepo:S,onOpenTask:j,loadedTasksById:O,issueRefsByKey:k}),[a,o,s,l,u,S,j,O,k]),N=(0,v.useMemo)(()=>(0,y.jsx)(h,{remarkPlugins:[ee],rehypePlugins:[[g,z]],components:re,children:_}),[_]);return(0,y.jsxs)(`div`,{className:r,children:[(0,y.jsx)(`div`,{className:t(`chat-markdown`,f&&`chat-markdown-on-primary`),children:(0,y.jsx)(Q.Provider,{value:M,children:b?(0,y.jsx)(oe,{text:_,children:N},_):N})}),m&&m.meta.length>0&&(0,y.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:m.meta.map(([e,t])=>(0,y.jsxs)(`span`,{className:`inline-flex text-[10px] leading-tight bg-muted px-1.5 py-0.5 rounded text-muted-foreground font-mono`,children:[e,`: `,t]},e))})]})}function ae(e){return e.includes(`\\n`)?e.replace(/\\n/g,`
|
|
2
2
|
`):e}function oe({text:e,children:t}){let[n,r]=(0,v.useState)(!1);return(0,y.jsxs)(`div`,{className:`chat-long-token space-y-2`,children:[!n&&(0,y.jsxs)(`p`,{className:`whitespace-pre-wrap`,children:[e.slice(0,512),`...`]}),n&&t,(0,y.jsx)(`button`,{type:`button`,className:`text-xs underline underline-offset-2`,"aria-expanded":n,onClick:()=>r(!n),children:n?`Show less`:`Show full message`})]})}export{ie as FormattedBody};
|
|
3
|
-
//# sourceMappingURL=formatted-body-impl-
|
|
3
|
+
//# sourceMappingURL=formatted-body-impl-BB9eq9nN.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./formatted-body-impl-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./preload-helper-HclGiUj8.js";var i=e(t(),1),a=n(),o=(0,i.lazy)(()=>r(()=>import(`./formatted-body-impl-
|
|
3
|
-
//# sourceMappingURL=formatted-body-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./formatted-body-impl-BB9eq9nN.js","./rolldown-runtime-QTnfLwEv.js","./dist-DeW2Y1R5.js","./store-BgDALGIX.js","./provider-display-bWwiuedV.js","./display-BemJG1f_.js","./api-CIIVBtAV.js","./agent-liveness-DSQY1Aa_.js","./artifacts-Bjq-ZyBA.js","./issue-ref-chip-DbH8J9Ak.js","./external-link-BRfu-fHG.js","./task-chip-CYj0mpoL.js","./paperclip-CNpKZKum.js","./code-preview-KIRZA6cz.js","./themes-G5j9m1Ji.js","./loader-circle-BfPd4kOD.js","./copy-button-CjOj4HEf.js","./check-B3M9Ug1P.js","./copy-DFxhHRtV.js","./button-Do6Z3vvn.js","./preload-helper-HclGiUj8.js","./lib-G-25QXXf.js","./lib-D7DTGM1F.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./preload-helper-HclGiUj8.js";var i=e(t(),1),a=n(),o=(0,i.lazy)(()=>r(()=>import(`./formatted-body-impl-BB9eq9nN.js`).then(e=>({default:e.FormattedBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]),import.meta.url));function s(e){return(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:e.className,children:e.text}),children:(0,a.jsx)(o,{...e})})}export{s as t};
|
|
3
|
+
//# sourceMappingURL=formatted-body-qy2nTD_1.js.map
|
package/public/assets/{host-providers-dialog-mapF4Fj9.js → host-providers-dialog-BGPHxuwT.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-
|
|
2
|
-
//# sourceMappingURL=host-providers-dialog-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-BgDALGIX.js";import{i,n as a,o,r as s,s as c,t as l}from"./dialog-uuJ9_geR.js";import{t as u}from"./switch-DuCA7mrB.js";import{t as d}from"./badge-DqJRtj_p.js";import{t as f}from"./input-CsTB6jIx.js";var p=e(t(),1),m=n();function h(e){return!e||e.available?{label:`waiting for host probe`,detail:`Enabled; the host has not reported this provider yet (next heartbeat).`}:{label:e.cli&&!e.cli.ok&&/not found/.test(e.cli.error??``)?`not installed on host`:`unavailable on host`,detail:e.reason||`Host probe failed`}}function g({orchId:e}){let t=r(t=>t.hostProvidersById[e]),n=r(t=>t.orchestrators.find(t=>t.id===e)),i=r(e=>e.setHostProvider),[a,o]=(0,p.useState)(``),[s,c]=(0,p.useState)(null);async function l(t,n){c(t);try{await i(e,t,n,n?void 0:a||void 0),o(``)}finally{c(null)}}return t?(0,m.jsxs)(`div`,{className:`space-y-1`,children:[t.source===`env-fallback`&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No central setting yet — the host is using its env list.`}),t.providers.map(e=>{let t=n?n.providers.includes(e.provider):e.advertised,r=e.enabled&&!t?h(n?.providerStatus?.find(t=>t.name===e.provider)):void 0;return(0,m.jsxs)(`div`,{className:`flex items-center gap-3 rounded border border-border/60 px-3 py-2`,children:[(0,m.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,m.jsx)(`span`,{className:`truncate`,children:e.provider}),!t&&(0,m.jsx)(d,{variant:`outline`,className:`h-4 shrink-0 text-[10px]`,title:r?r.detail:e.reason||`Disabled by the operator`,children:r?r.label:`off`})]}),e.reason&&(0,m.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,title:e.reason,children:e.reason}),r&&r.label!==`waiting for host probe`&&(0,m.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,title:r.detail,children:r.detail})]}),(0,m.jsx)(u,{checked:e.enabled,disabled:s!==null,"aria-label":`${e.provider} ${e.enabled?`enabled`:`disabled`}`,onCheckedChange:t=>void l(e.provider,t)})]},e.provider)}),(0,m.jsx)(f,{value:a,onChange:e=>o(e.target.value),placeholder:`Reason for the next disable (optional)`,className:`h-8 text-xs`})]}):(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading providers…`})}function _({orchId:e,hostname:t,open:n,onOpenChange:r}){return(0,m.jsx)(l,{open:n,onOpenChange:r,children:(0,m.jsxs)(s,{className:`max-w-lg`,children:[(0,m.jsxs)(o,{children:[(0,m.jsxs)(c,{className:`text-sm`,children:[`Edit host — `,t]}),(0,m.jsx)(i,{children:`Turn providers on or off for this host. Stored centrally, applied live within one probe cycle — no file edit, no restart.`})]}),(0,m.jsx)(a,{children:(0,m.jsx)(g,{orchId:e})})]})})}export{g as n,_ as t};
|
|
2
|
+
//# sourceMappingURL=host-providers-dialog-BGPHxuwT.js.map
|