@hearsay-tools/squawk 0.19.0-dev.9172 → 0.19.0-dev.9182
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/dist/contract/hosts.d.ts +925 -0
- package/dist/contract/index.js +104 -2
- package/dist/core/server-hook-registry.d.ts +13 -0
- package/dist/core/server-hook-registry.js.map +1 -1
- package/dist/delegation/transport.d.ts +78 -78
- package/dist/features/automations/automations-routes.d.ts +150 -150
- package/dist/features/hosts/admission.d.ts +52 -0
- package/dist/features/hosts/admission.js +89 -0
- package/dist/features/hosts/admission.js.map +1 -0
- package/dist/features/hosts/gateway.d.ts +14 -3
- package/dist/features/hosts/gateway.js +35 -21
- package/dist/features/hosts/gateway.js.map +1 -1
- package/dist/features/hosts/index.d.ts +7 -3
- package/dist/features/hosts/index.js +41 -7
- package/dist/features/hosts/index.js.map +1 -1
- package/dist/features/hosts/registry-reconciler.d.ts +41 -0
- package/dist/features/hosts/registry-reconciler.js +168 -0
- package/dist/features/hosts/registry-reconciler.js.map +1 -0
- package/dist/features/hosts/routes.d.ts +370 -4
- package/dist/features/hosts/routes.js +72 -62
- package/dist/features/hosts/routes.js.map +1 -1
- package/dist/features/hosts/runs-index-events.d.ts +23 -0
- package/dist/features/hosts/runs-index-events.js +116 -0
- package/dist/features/hosts/runs-index-events.js.map +1 -0
- package/dist/features/hosts/runs-index-patch.d.ts +203 -0
- package/dist/features/hosts/runs-index-patch.js +798 -0
- package/dist/features/hosts/runs-index-patch.js.map +1 -0
- package/dist/features/hosts/runs-index.d.ts +149 -0
- package/dist/features/hosts/runs-index.js +762 -0
- package/dist/features/hosts/runs-index.js.map +1 -0
- package/dist/features/hosts/runs-search.d.ts +28 -0
- package/dist/features/hosts/runs-search.js +151 -0
- package/dist/features/hosts/runs-search.js.map +1 -0
- package/dist/features/hosts/supervisor.d.ts +4 -0
- package/dist/features/hosts/supervisor.js +14 -6
- package/dist/features/hosts/supervisor.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/server/repo-routes.d.ts +52 -52
- package/dist/server/server.js +7 -1
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-run-feed.d.ts +4 -0
- package/dist/server/workspace-run-feed.js +13 -0
- package/dist/server/workspace-run-feed.js.map +1 -1
- package/package.json +4 -4
- package/scripts/benchmark-hosts-runs-index-probes.ts +242 -0
- package/scripts/benchmark-hosts-runs-index.ts +776 -0
- package/web/dist/assets/accounts-section-DYQC-wSh.js +1 -0
- package/web/dist/assets/activity-motion-XvrmbNgR.js +1 -0
- package/web/dist/assets/{activity-route-C2zP5vVV.js → activity-route-Dj8ltoqG.js} +1 -1
- package/web/dist/assets/{agent-accounts-D_ZKAmaW.js → agent-accounts-C2ILQhZy.js} +1 -1
- package/web/dist/assets/{agent-config-section-CwK_izpU.js → agent-config-section-D16TRCE_.js} +2 -2
- package/web/dist/assets/agent-defaults-section-Dm0khLjs.js +1 -0
- package/web/dist/assets/{appearance-DvoRcoRX.js → appearance-CP6zVctf.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DWPtF9dh.js → archive-on-merge-field-BA8aUtRQ.js} +1 -1
- package/web/dist/assets/{ask-card-D-om0EtP.js → ask-card-CLdlwd68.js} +1 -1
- package/web/dist/assets/attention-C7BUdd2s.js +1 -0
- package/web/dist/assets/automations-route-BVDO_Kai.js +2 -0
- package/web/dist/assets/{commit-list-CPJLP4DU.js → commit-list-Bdekr2K7.js} +1 -1
- package/web/dist/assets/{diff-BQJN6jzN.js → diff-Du0FsqAK.js} +2 -2
- package/web/dist/assets/{diff-controls-AsSX7gfO.js → diff-controls-DTC_6oqk.js} +1 -1
- package/web/dist/assets/{diff-view-BW5bbiaq.js → diff-view-TKooupFV.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-Bv4yc0N1.js → discard-changes-dialog-Bg-3Xbox.js} +1 -1
- package/web/dist/assets/{file-preview-CnrFxbea.js → file-preview-DMJCprVk.js} +1 -1
- package/web/dist/assets/{folder-browser-CFd1U5hn.js → folder-browser-3cBLlnE9.js} +1 -1
- package/web/dist/assets/{git-toolbar-C7iolhIi.js → git-toolbar-COhBdctn.js} +1 -1
- package/web/dist/assets/github-DUTSv2Hs.js +1 -0
- package/web/dist/assets/{global-activity-route-Dijwg4OL.js → global-activity-route-CypEKUv_.js} +1 -1
- package/web/dist/assets/hosts-iUyg8S3j.js +1 -0
- package/web/dist/assets/index-BV3EQb9T.js +21 -0
- package/web/dist/assets/index-Bh7COq0B.css +1 -0
- package/web/dist/assets/{label-CgU9vxuM.js → label-CWlxyeC-.js} +1 -1
- package/web/dist/assets/{markdown-Cljq4S1h.js → markdown-0uCxcToP.js} +1 -1
- package/web/dist/assets/{open-in-menu-BI7mnPPf.js → open-in-menu-Bf8JA2DJ.js} +1 -1
- package/web/dist/assets/{option-select-BcTkv-7t.js → option-select-DQJEHmHf.js} +1 -1
- package/web/dist/assets/{preferences-section-CEKXGhEj.js → preferences-section-Cvl5vyfN.js} +1 -1
- package/web/dist/assets/{preview-EtD19mg1.js → preview-BSFJfN4s.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-CKRBfx7t.js → preview-pane-connected-i3GJtDL3.js} +2 -2
- package/web/dist/assets/{project-location-hufc_p8y.js → project-location-BcjOhqun.js} +1 -1
- package/web/dist/assets/{project-router-Dc6KBQsv.js → project-router-CwD1firw.js} +1 -1
- package/web/dist/assets/{projects-section-vOFZ4lbx.js → projects-section-CAOFPkDQ.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-Caash2nq.js → prompt-templates-section-BXTfLET4.js} +1 -1
- package/web/dist/assets/queries-D9mg7sFY.js +1 -0
- package/web/dist/assets/{read-state-BeVNfGkB.js → read-state-BsTfJki5.js} +1 -1
- package/web/dist/assets/{reference-chip-BjerVjzM.js → reference-chip-CZKBU_Ud.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-fNgh5LdN.js → remote-settings-notice-CUK4ZFYF.js} +1 -1
- package/web/dist/assets/repo-git-Dx85MEuK.js +1 -0
- package/web/dist/assets/{report-reader-CK1WDtEH.js → report-reader-BDdY5kpz.js} +1 -1
- package/web/dist/assets/{report-selection-CZ8eb9QP.js → report-selection-Y2F9NTAs.js} +1 -1
- package/web/dist/assets/{reports-B-GImLAo.js → reports-DWKpm_us.js} +1 -1
- package/web/dist/assets/{resources-section-ApF3gXrw.js → resources-section-D9tzbv9w.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-BdjEFs1G.js → review-notes-drafts-BSkmq3Nj.js} +1 -1
- package/web/dist/assets/{review-panel-D4zmYH8O.js → review-panel-C9UZjWFl.js} +1 -1
- package/web/dist/assets/{review-strip-BpHXklAn.js → review-strip-qTG5JaOw.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-CE0vyYYA.js → run-detail-refresh-SYZM94ch.js} +1 -1
- package/web/dist/assets/{run-diff-ClfLRsHF.js → run-diff-D26PXp6r.js} +1 -1
- package/web/dist/assets/run-header-BrUcSJu6.js +2 -0
- package/web/dist/assets/{select-CwDhRDtw.js → select-BUsS7uOZ.js} +1 -1
- package/web/dist/assets/{session-context-section-C87jx7RB.js → session-context-section-Bgzou-NG.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-Dk8yJ57U.js → settings-agent-picker-CH3CQhOh.js} +1 -1
- package/web/dist/assets/{settings-save-bar-cu8BKCGT.js → settings-save-bar-cyvALSgW.js} +1 -1
- package/web/dist/assets/{settings-shell-mhQfQKf1.js → settings-shell-Cl-cu4r5.js} +1 -1
- package/web/dist/assets/{sidebar-section-DOQ5N1L6.js → sidebar-section-Cj2fDrhV.js} +1 -1
- package/web/dist/assets/{skills-DXJ1gQBD.js → skills-DLMbRR_5.js} +1 -1
- package/web/dist/assets/{status-dot-Bmn4xhch.js → status-dot-DTU7afRv.js} +1 -1
- package/web/dist/assets/{tab-link-6TltE1jl.js → tab-link-BJDe5cT4.js} +1 -1
- package/web/dist/assets/{task-changes-D9Sdmpmw.js → task-changes-ito4fOGh.js} +2 -2
- package/web/dist/assets/{task-commits-A0UIqxpL.js → task-commits-BYOIU9zy.js} +1 -1
- package/web/dist/assets/{task-file-scope-ID220XKo.js → task-file-scope-B8EEJyHp.js} +1 -1
- package/web/dist/assets/{task-files-Id2tuAAG.js → task-files-CF0QKnm-.js} +1 -1
- package/web/dist/assets/{task-github-item-YKUcwp2o.js → task-github-item-C6Fu8MvM.js} +1 -1
- package/web/dist/assets/{task-groups-DCg4iOB9.js → task-groups-BvVfsQKd.js} +1 -1
- package/web/dist/assets/{task-thread-A_vkygGX.js → task-thread-BWrvepxB.js} +2 -2
- package/web/dist/assets/{thread-state-6-BzRrJ_.js → thread-state-8E0eYXGu.js} +1 -1
- package/web/dist/assets/toaster-2ud_VdfV.js +4 -0
- package/web/dist/assets/{use-finish-run-DO-nnAaa.js → use-finish-run-a2qZy6zr.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-CADaL8U8.js → use-hand-to-agent-state-DT1ngmHe.js} +1 -1
- package/web/dist/assets/use-path-bases-CZ6F93wt.js +1 -0
- package/web/dist/assets/use-workspace-config-save-DDI7_WtK.js +1 -0
- package/web/dist/assets/{workflows-DOLG-Rns.js → workflows-2e0Sm6F1.js} +2 -2
- package/web/dist/assets/{workspace-tools-DTCJVDTE.js → workspace-tools-D4DO9w12.js} +1 -1
- package/web/dist/assets/{worktrees-section-BOHDbywt.js → worktrees-section-8-d6zWQ-.js} +5 -5
- package/web/dist/index.html +20 -20
- package/web/dist/assets/accounts-section-Bnr89jmC.js +0 -1
- package/web/dist/assets/activity-motion-BW0tAmYF.js +0 -1
- package/web/dist/assets/agent-defaults-section-RyEogH0g.js +0 -1
- package/web/dist/assets/attention-BI6592lk.js +0 -1
- package/web/dist/assets/automations-route-DfGE4xWT.js +0 -2
- package/web/dist/assets/github-DGElvfMU.js +0 -1
- package/web/dist/assets/hosts-CpDMDiQW.js +0 -1
- package/web/dist/assets/index-BVRdRJAN.css +0 -1
- package/web/dist/assets/index-DPfg7xSB.js +0 -21
- package/web/dist/assets/queries-IlC9MZgh.js +0 -1
- package/web/dist/assets/repo-git-5MK_RAR6.js +0 -1
- package/web/dist/assets/run-header-BUe92WWr.js +0 -2
- package/web/dist/assets/toaster-DNnL8v10.js +0 -4
- package/web/dist/assets/use-path-bases-CFAmFn_E.js +0 -1
- package/web/dist/assets/use-workspace-config-save-DScW6_8J.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Gt as r,O as i,Vt as a,un as o}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Gt as r,O as i,Vt as a,un as o}from"./queries-D9mg7sFY.js";import{Fi as s,R as c,n as l}from"./toaster-2ud_VdfV.js";import{o as u}from"./dist-CCX8mhHc.js";import{K as d,X as f,l as p,mt as m,rt as h,st as g,u as _}from"./design-icons-QbNMZniQ.js";import{t as v}from"./button-BV_AiLj2.js";import{i as y,r as b,t as x}from"./popover-BQolmvDR.js";import{a as S,i as C,o as w,r as T,s as E,t as D}from"./command-4D8sPZJy.js";import{f as O,i as k,p as A,u as j}from"./skills-pM_PouEs.js";import{t as M}from"./centered-state-N8vWM_Hw.js";import{at as N,ct as P,ft as F,lr as I,lt as L}from"./index-BV3EQb9T.js";import{t as R}from"./textarea-BGp28xFr.js";import{n as z,t as B}from"./settings-field-AyinSFR_.js";import{r as V}from"./settings-save-bar-cyvALSgW.js";import{n as H,t as U}from"./saved-draft-BwzBc-_Y.js";import{t as W}from"./settings-list-detail-BlEEuyae.js";var G=e(t(),1),K=n();function q({template:e}){let t=e.text.trim().split(`
|
|
2
2
|
`)[0]??``,n=e.skills?.length??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`settings-list-row-title`,children:e.label.trim()||`Untitled template`}),(0,K.jsxs)(`span`,{className:`settings-list-row-meta`,children:[t||`No instructions yet`,n>0?` · ${n} skill${n===1?``:`s`}`:``]})]})}function J(){let e=i();return e.isPending?(0,K.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,K.jsx)(M,{icon:(0,K.jsx)(d,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,K.jsx)(Y,{initial:L(e.data.promptTemplates)})}function Y({initial:e}){let t=s(),n=r(),u=i(),[d,p]=H(e,U),[h,_]=(0,G.useState)(null),y=o({mutationFn:e=>c({promptTemplates:e}),onSuccess:(e,n)=>{t.setQueryData(a.uiState,e),p(t=>U(t,n)?L(e.promptTemplates):t)},onError:e=>l(e.message,{tone:`danger`})}),b=JSON.stringify(d)!==JSON.stringify(e),x=d.some(e=>e.label.trim()===``||e.text.trim()===``);V({dirty:b,invalid:x,save:()=>y.mutateAsync(d),discard:()=>p(e)});let S=(e,t)=>p(n=>n.map(n=>n.id===e?{...n,...t}:n)),C=(e,t)=>p(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),w=e=>{let t=d.findIndex(t=>t.id===e),n=d.filter(t=>t.id!==e);p(n),_(n[Math.min(t,n.length-1)]?.id??null)};return(0,K.jsx)(`div`,{"data-slot":`prompt-templates-section`,"data-reports-dirty":``,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,K.jsxs)(z,{wide:!0,title:`Reusable instructions`,hint:`Insert templates from task composers, or apply them automatically with selected skills when the prompt is empty.`,children:[(0,K.jsx)(W,{slot:`prompt-template-list`,label:`Prompt templates`,items:d,itemKey:e=>e.id,selectedKey:h,onSelect:_,empty:(0,K.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one, or reset to the built-ins.`}),row:e=>(0,K.jsx)(q,{template:e}),detail:e=>(0,K.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(`label`,{htmlFor:`template-label-${e.id}`,className:B,children:`Template label`}),(0,K.jsx)(I,{id:`template-label-${e.id}`,"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>S(e.id,{label:t.target.value}),className:`flex-1 border-border bg-background`})]}),(0,K.jsx)(`label`,{htmlFor:`template-text-${e.id}`,className:B,children:`Instructions`}),(0,K.jsx)(R,{id:`template-text-${e.id}`,"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>S(e.id,{text:t.target.value}),className:`min-h-14 rounded-md border border-border bg-background text-[13px]`}),(0,K.jsx)(`p`,{className:B,children:`Apply automatically with skills`}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,K.jsx)(X,{label:e.label,skills:n.data??[],skillUsage:u.data?.skillUsage,selected:e.skills??[],onToggle:t=>C(e.id,t)}),(e.skills??[]).map(t=>(0,K.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>C(e.id,t),className:`inline-flex items-center gap-1 rounded-md border border-border bg-muted px-2 py-0.5 font-mono text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,K.jsx)(m,{"aria-hidden":`true`,className:`size-3`})]},t))]}),(0,K.jsxs)(v,{type:`button`,className:`self-start`,variant:`danger-ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>w(e.id),children:[(0,K.jsx)(g,{"aria-hidden":`true`,className:`size-3`}),`Delete template`]})]})}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsxs)(v,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,onClick:()=>{let e=P();p(t=>[...t,{id:e,label:``,text:``}]),_(e)},children:[(0,K.jsx)(f,{"aria-hidden":`true`,className:`size-3.5`}),`New template`]}),(0,K.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:y.isPending,onClick:()=>p(N.map(e=>({...e}))),children:`Reset to defaults`}),x?(0,K.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-xs text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function X({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),l=(0,G.useRef)(null),{mostUsed:d,project:f,global:m,ranked:g}=j(t,s,n),v=(e,t)=>{let n=r.includes(e.id);return(0,K.jsxs)(w,{value:O(e),keywords:A(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.id,"data-selected":n?`true`:void 0,onSelect:()=>i(e.id),children:[(0,K.jsx)(F,{skill:e,emphasized:t}),n?(0,K.jsx)(p,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},O(e))};return(0,K.jsxs)(x,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,K.jsx)(y,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,className:u(`inline-flex h-[26px] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,r.length>0&&`text-foreground`),children:[(0,K.jsx)(h,{"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`Add skill`,(0,K.jsx)(_,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,K.jsx)(b,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,K.jsxs)(D,{shouldFilter:!1,children:[(0,K.jsx)(S,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,K.jsxs)(E,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!t.some(e=>e.id===s.trim())?(0,K.jsx)(C,{children:(0,K.jsxs)(w,{value:`typed-skill`,onSelect:()=>i(s.trim()),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(g?g.length===0:d.length===0&&f.length===0&&m.length===0)?(0,K.jsx)(T,{children:`Nothing matches.`}):null,g?g.length>0?(0,K.jsx)(C,{children:g.map(e=>v(e,k(e)))}):null:(0,K.jsxs)(K.Fragment,{children:[d.length>0?(0,K.jsx)(C,{heading:`Most used`,children:d.map(e=>v(e,k(e)))}):null,f.length>0?(0,K.jsx)(C,{heading:`Project skills`,children:f.map(e=>v(e,!0))}):null,m.length>0?(0,K.jsx)(C,{heading:`Global`,children:m.map(e=>v(e,!1))}):null]})]})]})})]})}export{J as PromptTemplatesSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{d as n,n as r,p as i}from"./host-context-DDbYAKpm.js";import{$ as a,$t as o,A as s,Ai as c,An as l,C as u,Ci as d,Cn as f,Ct as p,D as m,Di as h,Dn as g,Dt as _,E as v,Ei as ee,Et as te,F as ne,Fi as y,G as re,Hi as ie,Ht as ae,Ii as oe,It as se,J as ce,Jn as le,Jt as ue,K as de,Kt as fe,L as pe,Mi as me,Mn as he,Mt as ge,N as _e,Nt as ve,O as ye,Oi as be,On as xe,Ot as Se,Pt as Ce,Q as we,Qi as Te,Qt as Ee,Ri as De,S as Oe,Sn as ke,St as Ae,Ti as je,Tn as Me,Vt as Ne,Wi as Pe,Wt as Fe,X as Ie,Xn as Le,Xt as Re,Y as ze,Yi as Be,Yr as Ve,Yt as He,Zi as Ue,Zn as We,Zt as Ge,_n as Ke,_t as qe,a as Je,an as Ye,b as Xe,bn as Ze,bt as Qe,cn as $e,ct as et,en as tt,et as nt,fn as rt,gn as it,gt as at,h as ot,hn as st,in as ct,ji as lt,k as ut,ki as dt,kn as ft,kt as pt,ln as mt,m as ht,mn as gt,n as _t,nn as vt,nr as yt,on as bt,pn as xt,pt as St,q as Ct,qi as wt,qt as Tt,rr as Et,sn as Dt,ta as Ot,tn as kt,v as At,vt as jt,wi as b,wn as Mt,wt as Nt,x as Pt,xi as Ft,xn as It,xt as Lt,y as Rt,yn as zt,yt as Bt,zi as Vt}from"./toaster-2ud_VdfV.js";import{A as Ht,B as x,F as S,H as C,I as w,N as T,P as E,W as D,Z as O,a as Ut,j as k,z as A}from"./live-protocol-CNUmr-VT.js";import{t as j}from"./host-storage-B72yoDU1.js";function Wt(e,t){return e??t}function Gt(e,t){let n=Wt(e,t);return n===`1`||n===`true`}function Kt(e,t,n){return e?.trim()||Wt(t,n)||``}var qt=class extends De{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Jt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Vt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),O.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Jt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Yt=class extends Ot{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ue(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ie(t.mutationKey)!==ie(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Jt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){O.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Xt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Zt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Qt=class extends Ot{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,O.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!Ue(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Xt(e,n).forEach(e=>{e.destroy()}),Xt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Be(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new oe(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Zt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&O.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},M=e(t(),1);function N({queries:e,...t},n){let r=y(n),i=me(),a=lt(),o=M.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{je(e);let t=r.getQueryCache().get(e.queryHash);be(e,a,t)}),c(a);let[s]=M.useState(()=>new Qt(r,o,t)),[l,u,d]=s.getOptimisticResult(o,t.combine),f=!i&&t.subscribed!==!1;M.useSyncExternalStore(M.useCallback(e=>f?s.subscribe(O.batchCalls(e)):wt,[s,f]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),M.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let p=l.some((e,t)=>h(o[t],e))?l.flatMap((e,t)=>{let n=o[t];return n&&h(n,e)?ee(n,new oe(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=o[t];return n&&dt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}function P(e,t){let n=y(t),[r]=M.useState(()=>new Yt(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);let i=M.useSyncExternalStore(M.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=M.useCallback((e,t)=>{r.mutate(e,t).catch(wt)},[r]);if(i.error&&Te(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function F(e={}){let t=e.projectId??i();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function I(e,t={}){return{...F(t),runId:e}}function $t(){return Gt(void 0,void 0)}function L(e){return!$t()&&e}function en(e,t=!0,n=!1,r){return b({queryKey:[F({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>ve(F({projectId:e,boot:n}),{signal:t}),enabled:t,...r?{select:r}:{},placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function R(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:q.models(t),refetchType:n})}function tn(e,t=!0,n){return b({...nn(e,n),enabled:t})}var nn=(e,t)=>({queryKey:q.models(e,t),queryFn:({signal:n})=>l(e,{signal:n},t),staleTime:300*1e3});function rn(e,t=!0){let n=N({queries:e.map(e=>({...nn(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}function an(e,t){return JSON.stringify([e,t])}function on(e){return e.type===`run`?e.run.id:e.id}function z(e,t){return{...e,runs:t}}function sn(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}var cn=class{runs;copied=!1;positions=new Map;constructor(e){this.runs=e,this.reindex()}reindex(){this.positions.clear(),this.runs.forEach((e,t)=>this.positions.set(an(e.projectId,e.id),t))}at(e,t){return this.positions.get(an(e,t))??-1}mutable(){return this.copied||=(this.runs=[...this.runs],!0),this.runs}replace(e,t){return this.mutable()[e]=t,this.runs}remove(e){return this.mutable().splice(e,1),this.reindex(),this.runs}insert(e){let t=this.runs.findIndex(t=>(t.createdAt??``).localeCompare(e.createdAt)<0);return this.mutable().splice(t<0?this.runs.length:t,0,e),this.reindex(),this.runs}};function ln(e,t,n){let r=new cn(e.runs),i=e,a=!1;for(let e of t)if(e.type===`usage`)i=hn(i,e.project,e.usage,r);else{let t=fn(i,e.change,n,r);i=t.index,a||=t.reconcile}return{index:i,reconcile:a}}function un(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function dn(e,t,n){return fn(e,t,n,new cn(e.runs))}function fn(e,t,n,r){let{project:i}=t,a=r.at(i,on(t)),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(i);if(t.type===`deleted`)return o?{index:z(e,r.remove(a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:z(e,r.remove(a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!un(e,i,n))return{index:e,reconcile:!0};let l=Be(o,{projectId:i,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=r.replace(a,l),n=o.archived!==l.archived&&(s||sn(t,i)>e.perProjectLimit);return{index:z(e,t),reconcile:n}}if(s)return mn(e,l,r);let u=r.insert(l);return{index:z(e,u),reconcile:l.archived&&sn(u,i)>e.perProjectLimit}}function pn(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function mn(e,t,n){let r=pn(e.runs,t.projectId),i=r!==void 0&&t.createdAt>r;return t.archived&&!i?{index:e,reconcile:!1}:{index:z(e,n.insert(t)),reconcile:t.archived||r===void 0||t.createdAt<r}}function hn(e,t,n,r){let i=!1;return e.runs.forEach((e,a)=>{if(e.projectId!==t)return;let o=n[e.id];if(o){let t=Be(e.usage,o);if(t===e.usage)return;r.replace(a,{...e,usage:t})}else{if(e.usage===void 0)return;let{usage:t,...n}=e;r.replace(a,n)}i=!0}),i?z(e,r.runs):e}function gn(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function _n(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function vn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function yn(e){e.stream=void 0}function bn(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,on(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function xn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function Sn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function Cn(e,t,n){if(!Sn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=dn(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var B=[`workspace`,`runs-index`],wn=[`workspace`,`projects`],Tn=6e4,En=100,Dn=new WeakMap;function On(e){let t=Dn.get(e);return t||(t=Nn(e),Dn.set(e,t)),t}function kn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:On(t).merge(e)}function An(e){let t=e.getQueryData(wn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function jn(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function Mn(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function Nn(e){let t=_n(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(B,t)},h=()=>e.getQueryData(B),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:B,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:B,exact:!0}).then(()=>e.invalidateQueries({queryKey:B})):e.invalidateQueries({queryKey:B})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=An(e),{index:s,reconcile:c}=ln(a,t.filter(e=>e.generation===a.generation?e.type===`usage`?!l.has(e.project):!l.has(e.change.project)&&e.change.seq>a.eventSeq:!1),o);s!==a&&m(s),c&&_({hold:!0})},ee=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,En),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){vn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){yn(t)},run(e,r,i=!1){if(l.has(e))return;let a=Mn(e,r);if(!bn(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),ee()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),ee()}},dropProject(e){l.add(e),xn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=gn(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=Cn(t,n,An(e));for(let e of l)i.index=gn(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),jn(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var Pn=k([`own`,`provider-spanning`]),Fn=x({suggested:T(x({id:D(),label:D(),desc:D()})),retired:T(D())}),In=x({id:k([`settings`,`mcp`,`memory`]),label:D(),note:D().optional(),empty:D().optional(),showsUserMcp:w(!0).optional()}),Ln=x({label:D(),note:D().optional(),groups:T(In)}),Rn=x({runners:T(x({id:Ft,displayName:D(),modelListName:D(),modelIdScope:Pn,pickerLabel:D(),pickerDescription:D(),icon:D(),installHint:D(),loginCommand:D(),terminalLogin:E().optional(),browserLogin:E().optional(),managedInstall:w(!0).optional(),accountFolderExample:D().optional(),models:Fn,agentConfig:Ln}))}),zn=[`workspace`,`runners`];async function Bn(e){return ft(await Mt.api.v1.runners.$get({},Me(e)),`/runners`,Rn)}var Vn={queryKey:zn,queryFn:({signal:e})=>Bn({signal:e}),staleTime:1/0};function Hn(){return b(Vn)}function Un(e){return e?.runners??[]}function Wn(e){return Un(e).map(e=>e.id)}function Gn(e,t){if(e!==void 0)return t.includes(e)?e:t[0]}function Kn(e){let t=Hn();return{runner:t.isSuccess?Gn(e,Wn(t.data))??e:e,ready:!t.isPending}}function V(e,t){return e?.runners.find(e=>e.id===t)}function qn(e,t){return V(e,t)?.displayName??t}function Jn(e,t){return V(e,t)?.pickerLabel??t}function Yn(e,t){return V(e,t)?.modelListName}function Xn(e,t,n=!0,r){let a=Bi(r,n),o=Kr(),{runner:s,ready:c}=Kn(e??a.data?.defaultRunner??`claude`),l=o.data?.capabilities?.localHandoff===!1?null:t,u=r??i(),d=b({queryKey:K.runnerSkills(s,l,u),queryFn:({signal:e})=>v(s,l,{signal:e,projectId:u}),enabled:n&&c&&(e!==void 0||!a.isPending)&&(!t||!o.isPending),retry:!1});return{...d,runner:s,account:l,data:d.data?.skills,list:d.data,unchecked:d.isError||!d.data||d.data.source===`unavailable`}}var Zn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},Qn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function $n(e){return typeof e==`string`&&Object.hasOwn(Zn,e)}function er(e){return e!==void 0&&$n(e)?Zn[e]:void 0}var tr=`cez.reference-statuses.v1`,nr=`cez.reference-conflicts.v1`,H=new Map(cr()),rr=1e3,U=new Set(lr()),ir=r()??`__local__`;function ar(){let e=r()??`__local__`;if(ir!==e){ir=e,clearTimeout(W),W=void 0,H.clear();for(let[e,t]of cr())H.set(e,t);U.clear();for(let e of lr())U.add(e)}}function or(e,t){if(ar(),H.get(e)!==t){for(H.delete(e),H.set(e,t);H.size>rr;){let e=H.keys().next().value;if(e===void 0)break;H.delete(e)}ur()}}function sr(e,t){if(ar(),U.has(e)!==t){if(t)for(U.add(e);U.size>rr;){let e=U.values().next().value;if(e===void 0)break;U.delete(e)}else U.delete(e);ur()}}function cr(){try{let e=globalThis.sessionStorage?.getItem(j(tr));if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&$n(e[1])):[]}catch{return[]}}function lr(){try{let e=globalThis.sessionStorage?.getItem(j(nr));if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var W;function ur(){if(W!==void 0)return;let e=j(tr),t=j(nr);W=setTimeout(()=>{W=void 0;try{globalThis.sessionStorage?.setItem(e,JSON.stringify([...H])),globalThis.sessionStorage?.setItem(t,JSON.stringify([...U]))}catch{}},250)}var G=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function dr(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function fr(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function pr(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;or(t,o),s!==void 0&&sr(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function mr(e,t,n){ar();let r=G(t),i=H.get(r),a=U.has(r)?!0:void 0,o=n.data;if(o?.available){pr(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...dr(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...dr(i,a)});return}e.set(r,{state:`loading`,...dr(i,a)})}function hr(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of fr(i))mr(n,e,t)}),n}var K={get health(){return[i(),`health`]},runs:{get all(){return[i(),`runs`]},relationships:e=>[i(),`runs`,`relationships`,e],list:(e=i())=>[e,`runs`,`list`],archived:e=>[i(),`runs`,`archived`,e],detail:(e,t=i())=>[t,`runs`,`detail`,e],diff:e=>[i(),`runs`,`diff`,e],changes:e=>[i(),`runs`,`changes`,e],file:(e,t)=>[i(),`runs`,`files`,e,t],handoff:e=>[i(),`runs`,`handoff`,e],commits:e=>[i(),`runs`,`commits`,e],commit:(e,t)=>[i(),`runs`,`commit`,e,t]},get workflows(){return[i(),`workflows`]},runnerSkills:(e,t,n=i())=>[n,`runner-skills`,e,t??null],get repo(){return[i(),`repo`]},get repoChanges(){return[i(),`repo`,`changes`]},repoCommit:e=>[i(),`repo`,`commit`,e],get repoBranches(){return[i(),`repo`,`branches`]},get uiState(){return[i(),`ui-state`]},get config(){return[i(),`config`]},get agentConfig(){return[i(),`agent-config`]},agentConfigFile:e=>[i(),`agent-config`,`file`,e],get sessionContext(){return[i(),`session-context`]},sessionContextPreview:(e,t,n=``)=>[i(),`session-context`,`preview`,t,e,n],get worktrees(){return[i(),`worktrees`]},github:(e={})=>[i(),`github`,e.limit??null],githubPages:e=>[i(),`github`,`pages`,e],githubPagesHead:e=>[i(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[i(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[i(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[i(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[i(),`github`,`comments`,e,t],githubItem:(e,t)=>[i(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[i(),`github`,`pr-changes`,e],githubMergeState:e=>[i(),`github`,`merge-state`,e],get openTargets(){return[i(),`open-targets`]}},q={models:(e,t)=>t&&t!=="default"?[`workspace`,`models`,e,t]:[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:B,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...q.fsBrowseRoot,e,t]};function gr(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function _r(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function vr(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function yr(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function br(e,t){return Et({kind:`topic`,topic:e},{value:t})}function xr(){let e=y();return b({queryKey:q.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(q.providerStatus),r=await Dt(!1,{signal:t});return he(n,e.getQueryData(q.providerStatus),r)},staleTime:5*6e4,refetchInterval:L(!1),refetchOnWindowFocus:!0})}function Sr(){let e=y();return P({mutationFn:()=>Dt(!0),onMutate:()=>e.getQueryData(q.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(q.providerStatus,e=>he(r,e,t)),R(e)}})}function Cr(){let e=y();return P({mutationFn:({provider:e,authFailureId:t})=>it(e,t),onMutate:()=>e.getQueryData(q.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(q.providerStatus,e=>he(r,e,t,n.authFailureId)),R(e,n.provider)}})}function wr(e={}){return b({queryKey:q.projects,queryFn:({signal:e})=>bt({signal:e}),...e})}function Tr(e,t=!1){return b({queryKey:q.fsBrowse(e,t),queryFn:({signal:n})=>He(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Er(){let e=y();return P({mutationFn:e=>rt(e),onSuccess:()=>e.invalidateQueries({queryKey:q.projects})})}function Dr(){let e=y();return P({mutationFn:e=>gt(e),retry:!1,onSuccess:(t,n)=>{e.setQueryData(q.projects,e=>e&&{...e,projects:e.projects.filter(e=>e.id!==n)}),e.invalidateQueries({queryKey:q.projects})}})}function Or(){let e=y();return P({mutationFn:e=>{let{id:t,...n}=e;return It(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:q.projects});let r=e.getQueryData(q.projects);return e.setQueryData(q.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?kr(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(q.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(q.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:q.projects})})}function kr(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:yr(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function Ar(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(q.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:q.projects})})}function jr(){return Ar(e=>{let{projectId:t,...n}=e;return tt(t,n)})}function Mr(){return Ar(e=>{let{projectId:t,webhookId:n,...r}=e;return ke(t,n,r)})}function Nr(){return Ar(({projectId:e,webhookId:t})=>st(e,t))}function Pr(){return P({mutationFn:({projectId:e,webhookId:t})=>zt(e,t),retry:!1})}function J(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:q.agentProfiles}),t.invalidateQueries({queryKey:q.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),R(t)])},onError:()=>{t.invalidateQueries({queryKey:K.health}),t.invalidateQueries({queryKey:q.agentProfiles,exact:!0})}})}function Fr(){return J(e=>Ee(e))}function Ir(){return J(e=>{let{id:t,...n}=e;return Ze(t,n)})}function Lr(){return J(e=>xt(e))}function Rr(){return J(e=>Ke(e))}function zr(e,t){return b({queryKey:q.agentAccountStatus(e),queryFn:({signal:t})=>kt(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Br(){let e=y();return P({mutationFn:({provider:e,profileId:t})=>Ge(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:q.agentProfiles}),e.invalidateQueries({queryKey:q.providerStatus}),R(e,n,`none`)])},onError:()=>{e.invalidateQueries({queryKey:K.health}),e.invalidateQueries({queryKey:q.agentProfiles,exact:!0})}})}function Vr(){let e=y();return P({mutationFn:e=>kt(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(q.agentAccountStatus(n),t),e.invalidateQueries({queryKey:q.agentProfiles}),R(e,t.status.provider)}})}function Hr(){let e=y();return P({mutationFn:e=>Re(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:q.projects})})}function Ur(){let e=y();return P({mutationFn:e=>o(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:q.projects})})}function Wr({enabled:e}){return b({queryKey:q.githubOwners,queryFn:({signal:e})=>ct({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Gr(){let e=y();(0,M.useEffect)(()=>{let t,r=()=>{let r=e.getQueryData(K.health);r&&(Le({bootProject:r.bootProject===void 0?`default`:r.bootProject,apiBase:n()}),t??=br(`health`,t=>{e.setQueryData(K.health,t)}))};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),t?.(),yt()}},[e])}function Kr(){return b({queryKey:K.health,queryFn:({signal:e})=>Ye({signal:e})})}function qr(e,t){let n=Kr().data,r=wr(t).data?.projects,i=Je(),a=e??i.projectId,o=a??n?.bootProject??void 0,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:n?.bootProject!==null&&(a===null||a===n?.bootProject)?gr(n?.repo?.remote):void 0}function Jr(e=!0){return b({queryKey:q.uiState,queryFn:({signal:e})=>mt({signal:e}),enabled:e})}function Yr(){return b({queryKey:q.config,queryFn:({signal:e})=>$e({signal:e})})}function Xr(){return b({queryKey:q.agentProfiles,queryFn:({signal:e})=>vt({signal:e})})}var Y=[`workspace`,`runs-index`],X=e=>[e.cacheScope,`runs`,`list`],Z=e=>[e.cacheScope,`runs`,`detail`,e.runId],Q=e=>typeof e==`function`?e():e;function Zr(e){let{seenAt:t,...n}=e;return n}function Qr(e,t){let n=Zr(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function $r(e,t,n){return t?{...e,seenAt:n}:Zr(e)}function ei(e){let t=()=>{e.invalidateQueries({queryKey:Y})};function n(n,r){if(n===`index`)return t();let a=typeof r==`function`?r():r;if(n===`indexed`){t(),e.invalidateQueries({queryKey:[i(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(n===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=We(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,i()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function r(n,r){await e.cancelQueries({queryKey:X(Q(n))}),await e.cancelQueries({queryKey:Z(Q(n))});let i=e.getQueryData(X(Q(n))),a=e.getQueryData(Z(Q(n))),o=Q(n).runId,s=new Date().toISOString();return e.setQueryData(X(Q(n)),e=>e?.map(e=>e.id===o?$r(e,r,s):e)),e.setQueryData(Z(Q(n)),e=>e&&$r(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(X(Q(n)),i),a&&e.setQueryData(Z(Q(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(X(Q(n)),e=>e?.map(e=>e.id===o?Qr(e,t):e)),a&&e.setQueryData(Z(Q(n)),e=>e&&Qr(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?$r(e,r,i.seenAt):e;e.setQueryData(X(Q(n)),e=>e?.map(a));let s={...Q(n),runId:r?o:i.id};e.setQueryData(Z(s),e=>e?a(e):i),t()}}}async function a(t,r){await e.cancelQueries({queryKey:Y});let i=e.getQueryData(Y),a=r();return e.setQueryData(Y,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(Y,i)},settle(){n(`indexed`,t)}}}return{patchRead:r,patchIndex:a,invalidateAfter:n}}function $(){let e=y();return(0,M.useMemo)(()=>ei(e),[e])}function ti(e,t){if(!Ut(e.path))throw Error(`unsupported shared read`);let n=new URL(e.path,`http://cezar.invalid`);return n.searchParams.sort(),Et({kind:`read`,path:`${n.pathname}${n.search}`,intervalMs:e.intervalMs},{value:t})}function ni(e,t,n,r){let i=y(),a=JSON.stringify(t),o=(0,M.useMemo)(()=>JSON.parse(a),[a]);(0,M.useEffect)(()=>{if(!e||n===!1)return;let t=!0,a=ti({path:e,intervalMs:n},(e,n)=>{n||i.cancelQueries({queryKey:o,exact:!0}).then(()=>{t&&i.setQueryData(o,r?r(e,i):e)})});return()=>{t=!1,a()}},[i,e,o,n,r])}async function ri(e,t=!1){return xe(await Mt.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:i(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),g(e,`/worker-destroy`))}function ii(){return b({queryKey:K.openTargets,queryFn:({signal:e})=>Lt({signal:e}),staleTime:5*6e4})}function ai(e=!0,t){return b({queryKey:t?K.runs.list(t):K.runs.list(),queryFn:({signal:e})=>ve(F(t?{projectId:t}:void 0),{signal:e}),enabled:e})}function oi(e,t){return d({queryKey:K.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>at({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===i()?e:void 0})}function si(e){let t=e.trim();return b({queryKey:q.runsSearch(t),queryFn:({signal:e})=>fe(t,{signal:e}),enabled:t.length>=2,placeholderData:Pe,staleTime:1e4})}function ci(e=!0,t=Tn,n){let r=On(y());return ni(`/api/v1/workspace/runs-index`,q.runsIndex,L(e?t:!1),kn),b({queryKey:q.runsIndex,queryFn:({signal:e})=>Ce({signal:e}).then(r.merge),enabled:e,...n?{select:n}:{},staleTime:3e4,refetchInterval:!1})}function li(e){let t=y();return P({mutationFn:({workerId:e,discardWork:t=!1})=>ri(e,t),onSettled:()=>t.invalidateQueries({queryKey:K.runs.relationships(e)})})}function ui(e,t={}){return b({queryKey:K.runs.relationships(e),queryFn:({signal:t})=>ge(e,{signal:t}),enabled:t.enabled??!0})}function di(e){return b({queryKey:K.runs.detail(e??``),queryFn:({signal:t})=>Ae(I(e),{signal:t}),enabled:!!e})}function fi(e,t,n=!0,r){return b({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Ae(I(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t,...r?.staleTime===void 0?{}:{staleTime:r.staleTime},...r?.refetchOnMount===void 0?{}:{refetchOnMount:r.refetchOnMount}})}function pi(e,t){return b({queryKey:t?[t,`runs`,`diff`,e??``]:K.runs.diff(e??``),queryFn:({signal:n})=>_(e,{signal:n,...t?{projectId:t}:{}}),enabled:!!e})}function mi(e,t=!1){return ni(e?`/api/v1/p/${i()}/runs/${encodeURIComponent(e)}/changes`:void 0,K.runs.changes(e??``),L(t?4e3:!1)),b({queryKey:K.runs.changes(e??``),queryFn:({signal:t})=>p(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function hi(e,t){return b({queryKey:K.runs.file(e??``,t??``),queryFn:({signal:n})=>Se(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function gi(e,t){return b({queryKey:[i(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Qe(e,t,{signal:n}),enabled:t!==null,retry:!1})}function _i(e,t){return b({queryKey:[i(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>qe(e,t,{signal:n}),enabled:t!==null,retry:!1})}function vi(e,t){return b({queryKey:[i(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>jt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function yi(e){return b({queryKey:[i(),`runs`,`artifacts`,e],queryFn:({signal:t})=>Bt(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function bi(e,t=!1){return ni(e?`/api/v1/p/${i()}/runs/${encodeURIComponent(e)}/commits`:void 0,K.runs.commits(e??``),L(t?5e3:!1)),b({queryKey:K.runs.commits(e??``),queryFn:({signal:t})=>te(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function xi(e,t){return b({queryKey:K.runs.commit(e??``,t??``),queryFn:({signal:n})=>Nt(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Si(e,t=!0){return b({queryKey:K.runs.handoff(e??``),queryFn:({signal:t})=>pt(I(e),{signal:t}),enabled:!!e&&t})}function Ci(e,t,n){return b({queryKey:e===void 0?K.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>pt(I(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function wi(e,t){let n=[...new Set(e)],r=N({queries:n.map(e=>({queryKey:[e??i(),`automations`,`names`],queryFn:({signal:t})=>At({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=r.map(e=>e.data);return(0,M.useMemo)(()=>{let e=new Map;return a.forEach((t,r)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([n[r]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([n,r.map(e=>e.dataUpdatedAt)])])}function Ti(e){let t=y();return P({mutationFn:t=>se(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:K.runs.all})})}function Ei(e){let t=y();return P({mutationFn:t=>Ne(e,t),onSuccess:()=>t.invalidateQueries({queryKey:K.runs.all})})}function Di(e){let t=$(),n=e?.projectId,r=e?.cacheScope,i=P({mutationFn:e=>ue(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,M.useCallback)(e=>({...I(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,M.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,M.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,M.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function Oi(){let e=$();return P({mutationFn:e=>ue(I(e),!1),onMutate:t=>e.patchRead(()=>I(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function ki(e){let t=$();return P({mutationFn:({id:t,pinned:n})=>ae(I(t,e),n),onError:e=>_t(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??F(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function Ai(e,t){let n=$();return P({mutationFn:n=>Tt(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof f&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function ji(e,t){let n=$();return P({mutationFn:(n={})=>et(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function Mi(e){let t=y();return P({mutationFn:({msgId:t,message:n})=>St(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:K.runs.all})})}function Ni(e){let t=y();return P({mutationFn:t=>Fe(e,t),onSuccess:()=>t.invalidateQueries({queryKey:K.runs.all})})}function Pi(){return b({queryKey:K.workflows,queryFn:({signal:e})=>ut({signal:e})})}function Fi(e){return b({queryKey:e?[e,`repo`]:K.repo,queryFn:({signal:t})=>Xe({signal:t},e)})}function Ii(e){return b({queryKey:[e,`repo`],queryFn:({signal:t})=>Xe({signal:t},e)})}function Li(){return b({queryKey:K.repoBranches,queryFn:({signal:e})=>Pt({signal:e})})}function Ri(){return b({queryKey:K.repoChanges,queryFn:({signal:e})=>Oe({signal:e}),retry:!1})}function zi(e){return b({queryKey:K.repoCommit(e??``),queryFn:({signal:t})=>u(e,{signal:t}),enabled:!!e,retry:!1})}function Bi(e,t=!0){return b({queryKey:e?[e,`config`]:K.config,queryFn:({signal:t})=>Rt({signal:t,...e?{projectId:e}:{}}),enabled:t})}function Vi(){return b({queryKey:K.worktrees,queryFn:({signal:e})=>s({signal:e})})}function Hi(e){return b({queryKey:[e,`worktrees`],queryFn:({signal:t})=>s({signal:t},e),staleTime:0})}function Ui(e,t=!0,n=!1){return b({queryKey:[F({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>ye({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:le(e.sidebarLimits)},enabled:t})}function Wi(e=!0,t){return Ui(t??i(),e)}function Gi(){return b({queryKey:K.agentConfig,queryFn:({signal:e})=>ht({signal:e})})}function Ki(e){return b({queryKey:K.agentConfigFile(e??``),queryFn:({signal:t})=>ot(e,{signal:t}),enabled:e!==null})}function qi(){return b({queryKey:K.sessionContext,queryFn:({signal:e})=>m({signal:e})})}function Ji(e,t,n=``){return b({queryKey:K.sessionContextPreview(e,t,n),queryFn:({signal:n})=>_e({content:e,role:t},{signal:n}),placeholderData:Pe,staleTime:0,retry:!1})}function Yi(){let e=y();return P({onMutate:()=>({fileKey:K.sessionContext}),mutationFn:e=>pe(e),onSuccess:(t,n,r)=>{r&&e.setQueryData(r.fileKey,t)}})}function Xi(e){let t=y(),n=K.agentConfig,r=K.agentConfigFile(e);return P({mutationFn:t=>ne(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}var Zi=k([`passing`,`failing`,`pending`]).nullable(),Qi=x({kind:k([`issue`,`pr`]),number:A(),title:D(),author:D(),createdAt:D(),labels:T(D()),body:D().optional(),url:D(),comments:A(),assignees:T(D()).optional(),projectIds:T(D()).optional(),isDraft:E().optional(),additions:A().optional(),deletions:A().optional(),checks:Zi.optional()});S(`available`,[x({available:w(!0),item:Qi.nullable(),labelColors:C(D(),D()).optional()}),x({available:w(!1),reason:D()})]),x({kind:k([`issue`,`pr`]),number:Ht().int().positive().safe()});var $i=x({id:D(),title:D(),url:D()});x({available:E(),reason:D().optional(),repo:D().optional(),syncedAt:D().optional(),issues:T(Qi),prs:T(Qi),labelColors:C(D(),D()).optional(),viewerLogin:D().optional(),projects:T($i).optional(),projectsReason:D().optional(),projectsState:k([`refreshing`,`ready`,`unavailable`]).optional(),projectsGeneration:D().optional(),issuesTotal:A().int().nonnegative().optional(),prsTotal:A().int().nonnegative().optional(),issuesNextCursor:D().nullable().optional(),prsNextCursor:D().nullable().optional(),commentsDeferred:w(!0).optional()});var ea=D().min(1).max(2e3).optional();x({limit:D().optional(),refresh:D().optional(),issuesCursor:ea,prsCursor:ea,issuesDone:w(`1`).optional(),prsDone:w(`1`).optional()}).superRefine((e,t)=>{e.issuesDone&&e.issuesCursor&&t.addIssue({code:`custom`,message:`issuesDone and issuesCursor are exclusive`}),e.prsDone&&e.prsCursor&&t.addIssue({code:`custom`,message:`prsDone and prsCursor are exclusive`}),e.issuesDone&&e.prsDone&&t.addIssue({code:`custom`,message:`both sides are done; there is no page to ask for`})}),x({kind:k([`issue`,`pr`]),numbers:D().regex(/^[1-9]\d{0,15}(,[1-9]\d{0,15})*$/).refine(e=>{let t=e.split(`,`);return t.length<=100&&t.every(e=>Number.isSafeInteger(Number(e)))},{message:`at most 100 safe positive integers`}),refresh:w(`1`).optional()}),S(`available`,[x({available:w(!0),counts:C(A(),A().int().nonnegative())}),x({available:w(!1),reason:D()})]),S(`available`,[x({available:w(!0),checks:C(A(),Zi)}),x({available:w(!1),reason:D()})]),x({kind:k([`issue`,`pr`]),q:D().trim().min(1).max(256),limit:Ht().int().positive().max(50).optional()}),x({available:E(),projectsReason:D().optional(),reason:D().optional(),items:T(Qi),truncated:E().optional(),labelColors:C(D(),D()).optional()});var ta=A().nullable();S(`available`,[x({available:w(!0),prs:C(A(),Ve),issues:C(A(),Ve),conflicts:T(A()).optional(),recheckAfterMs:ta}),x({available:w(!1),reason:D(),recheckAfterMs:ta})]);var na=x({id:A(),author:D(),avatarUrl:D().optional(),createdAt:D(),body:D(),kind:k([`comment`,`review`]),reviewState:k([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:D()}),ra=k([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),ia=x({id:D(),kind:ra,actor:D(),avatarUrl:D().optional(),createdAt:D(),url:D().optional(),sha:D().optional(),message:D().optional(),checks:Zi.optional(),label:x({name:D(),color:D().optional()}).optional(),subject:D().optional(),refNumber:A().optional(),refTitle:D().optional(),refIsPr:E().optional()});x({available:E(),reason:D().optional(),comments:T(na),truncated:E().optional(),events:T(ia).optional(),detail:x({body:D(),additions:A().int().nonnegative().optional(),deletions:A().int().nonnegative().optional()}).optional()});var aa=k([`merge`,`squash`,`rebase`]),oa=x({name:D(),state:k([`passing`,`failing`,`pending`,`unknown`]),required:E().nullable(),url:D().optional()}),sa=x({number:A(),title:D(),url:D(),state:k([`open`,`closed`,`merged`]),isDraft:E(),headRef:D(),baseRef:D(),headSha:D(),mergeable:k([`mergeable`,`conflicting`,`unknown`]),reviewDecision:k([`approved`,`changes-requested`,`review-required`,`not-required`,`unknown`]),checks:T(oa),methods:T(aa),defaultMethod:aa.nullable(),eligibility:k([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:T(x({code:D(),message:D()})),canMerge:E(),canOverride:E()});S(`available`,[x({available:w(!0),mergeState:sa}),x({available:w(!1),reason:D()})]),x({merged:w(!0),number:A(),url:D(),method:aa,mergeCommitSha:D().optional()});var ca=x({path:D(),previousPath:D().optional(),status:k([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:A(),deletions:A(),patch:D().optional(),patchUnavailableReason:k([`binary`,`too-large`,`not-provided`]).optional(),truncated:E().optional()});S(`available`,[x({available:w(!0),number:A(),headSha:D(),files:T(ca),additions:A(),deletions:A(),truncated:E(),reason:D().optional()}),x({available:w(!1),reason:D()})]),x({generation:D().uuid()}),S(`state`,[x({generation:D().uuid(),state:w(`ready`),projects:T($i),membership:C(D(),T(D()))}),x({generation:D().uuid(),state:w(`unavailable`),reason:D()})]);function la(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function ua(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function da(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function fa(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){da(t.issues,a,r),da(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var pa=e=>e.map(e=>e.number).join(`,`);function ma(e,t){let n=e[0];if(e.length>1&&n&&(pa(n.issues)!==pa(t.issues)||pa(n.prs)!==pa(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}var ha=class extends Error{};function ga(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await re({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new ha(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>la(e),retry:(e,t)=>!(t instanceof ha)&&!(t instanceof f&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function _a(e=50,t=!0){let n=y(),r=K.githubPages(e),a=K.githubPagesHead(e);ni(`/api/v1/p/${i()}/github?limit=${e}`,a,L(t?6e4:!1));let o=d({...ga(r,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),s=b({queryKey:a,queryFn:({signal:t})=>re({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:c}=o;(0,M.useEffect)(()=>{if(!s.data)return;let e=n.getQueryData(r);if(!e||e.pages.length===0)return;let t=ma(e.pages,s.data);t===`refetch`?c():n.setQueryData(r,{...e,pages:t})},[n,s.dataUpdatedAt,c]);let l=(o.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),u=N({queries:l.map(e=>({queryKey:[...r,`projects`,e],queryFn:({signal:t})=>we(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,M.useEffect)(()=>{u.forEach((e,t)=>{let i=l[t];!i||!e.data&&!e.error||n.setQueryData(r,t=>{if(!t)return t;let n=!1,r=t.pages.map(t=>{if(t.projectsGeneration!==i||t.projectsState!==`refreshing`)return t;let r=e.data;return r?.generation&&r.generation!==i?t:(n=!0,r?.state===`ready`?{...t,projectsState:`ready`,projects:r.projects,issues:t.issues.map(e=>({...e,projectIds:r.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:r?.reason??`Project boards unavailable. Refresh to try again.`})});return n?{...t,pages:r}:t})})},[n,u.map((e,t)=>e.data||e.error?l[t]:``).join(`,`)]),{pages:o,data:(0,M.useMemo)(()=>fa(o.data?.pages??[]),[o.data])}}function va(e,t=50,n=!0){let r=d({...ga([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,M.useMemo)(()=>fa(r.data?.pages??[]),[r.data])}}function ya(e,t,n=!0){let r=N({queries:t.filter(e=>e.length>0).map(t=>({queryKey:K.githubCommentCounts(e,t),queryFn:({signal:n})=>Ct(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,M.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function ba(e,t,n,r=!0){return b({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>nt(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function xa(e,t=!0){return b({queryKey:K.githubChecks(e),queryFn:({signal:t})=>de(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Sa(e,t,n=!0){return b({queryKey:K.githubSearch(e,t),queryFn:({signal:n})=>nt(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Ca=100;function wa(e){return[...e].sort((e,t)=>t-e).slice(0,Ca).sort((e,t)=>e-t)}function Ta(){let e=Je(),t=Kr();return e.projectId??t.data?.bootProject??void 0}function Ea(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))or(G({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))or(G({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Da=5*6e4;function Oa(e){return e?e.recheckAfterMs:Da}function ka(e,t=!0){let n=(0,M.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:wa(t.prs),issues:wa(t.issues)}))},[e.map(G).sort().join(`|`)]),r=N({queries:n.map(e=>({queryKey:K.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>a(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Oa(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),i=y(),o=JSON.stringify(n.map((e,t)=>({...e,interval:Oa(r[t]?.data)??!1})));(0,M.useEffect)(()=>{if(!t||$t())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=K.githubRefStatus(t.projectId,t.prs,t.issues);return ti({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,i]);let s=(0,M.useMemo)(()=>hr(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,M.useCallback)(e=>{let t=G(e),n=s.get(t);if(n)return n;let r=H.get(t);return{state:`idle`,...r?{status:r}:{},...U.has(t)?{conflicting:!0}:{}}},[s])}function Aa(e,t,n=!0){return b({queryKey:K.githubComments(e,t),queryFn:({signal:n})=>ce(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function ja(e,t,n=!0){return b({queryKey:K.githubItem(e,t),queryFn:({signal:n})=>ze(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Ma(e){return b({queryKey:K.githubPrChanges(e??0),queryFn:({signal:t})=>Ie(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{hi as $,Kn as $t,Vi as A,Rr as At,Di as B,gr as Bt,Li as C,Vr as Ct,Ji as D,Dr as Dt,qi as E,Lr as Et,wi as F,Yr as Ft,ki as G,Xn as Gt,Ti as H,q as Ht,ji as I,Jr as It,di as J,Un as Jt,fi as K,Gn as Kt,li as L,br as Lt,_i as M,Ir as Mt,vi as N,Or as Nt,Wi as O,Nr as Ot,yi as P,Mr as Pt,pi as Q,Jn as Qt,Mi as R,_r as Rt,Fi as S,xr as St,zi as T,Er as Tt,ii as U,Qn as Ut,Oi as V,K as Vt,Ei as W,er as Wt,xi as X,Wn as Xt,mi as Y,V as Yt,bi as Z,Yn as Zt,Ii as _,Wr as _t,ja as a,en as an,Ai as at,Xi as b,qr as bt,Sa as c,F as cn,$ as ct,Ta as d,N as dn,Hr as dt,Hn as en,Si as et,ka as f,qt as fn,Br as ft,Bi as g,Tr as gt,Ki as h,jr as ht,Aa as i,tn as in,si as it,oi as j,Pr as jt,Pi as k,Cr as kt,va as l,I as ln,zr as lt,Gi as m,Ur as mt,xa as n,R as nn,ai as nt,_a as o,L as on,Ci as ot,ua as p,Kt as pn,Fr as pt,Ni as q,qn as qt,ya as r,rn,ci as rt,Ma as s,$t as sn,ti as st,Ea as t,On as tn,ui as tt,ba as u,P as un,Xr as ut,Ui as v,Kr as vt,Ri as w,Sr as wt,Yi as x,wr as xt,Hi as y,Gr as yt,gi as z,vr as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mi as e}from"./toaster-
|
|
1
|
+
import{mi as e}from"./toaster-2ud_VdfV.js";import{o as t,w as n}from"./task-groups-BvVfsQKd.js";var r=[`done`,`failed`,`cancelled`];function i(e){return r.includes(e)}function a(t){return!e(t)&&i(t.status)&&!n(t)}function o(e){return e.reduce((e,r)=>t(r)||!n(r)?e:e+1,0)}function s(e){return e.status===`failed`?`danger`:`success`}export{o as n,s as r,a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ut as r,Wt as i,f as a}from"./queries-IlC9MZgh.js";import{Yt as o,mi as s,oi as c}from"./toaster-DNnL8v10.js";import{n as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as u,s as d}from"./dist-CCX8mhHc.js";import{F as f,I as p,N as m,P as h,U as g,_,ct as v,g as y,h as b,m as x,p as S}from"./design-icons-QbNMZniQ.js";import{n as C,r as w,t as T}from"./popover-BQolmvDR.js";import"./attention-BI6592lk.js";import{C as E,a as D,f as O,o as k,s as A,u as j}from"./task-groups-DCg4iOB9.js";function ee(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var M=e(t(),1),te=[{value:`all`,label:`All`},{value:`direct`,label:`Direct`},{value:`automations`,label:`Automations`}];function ne(e){return e?te:te.filter(e=>e.value!==`automations`)}function re(e,t){return e===`automations`&&!t?`all`:e}function ie(e){return e===`direct`||e===`automations`?e:`all`}function ae(e,t){return t===`all`||o(e)===(t===`automations`)}function oe(e){return e===`all`?void 0:e===`automations`}function N(e,t){let n={all:0,direct:0,automations:0};for(let r of e)k(r)||r.archived!==(t===`archived`)||(n.all+=1,o(r)?n.automations+=1:n.direct+=1);return n}function se(e,t,n,r,i){let a=A(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=N(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function ce(e){return e.rows.map(e=>e.run)}function le(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>c(e).bucket===`error`)?`danger`:`success`}}function ue(e,t,n){return D(e,t,j(n))}var P=(e,t)=>JSON.stringify([e,t]);function de(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=P(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:P(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of j(t))o.set(P(e,n),r);let s=e=>r.get(e.id);return D(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function F(e){return[e.run]}function fe(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function pe(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?fe(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var me=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:pe},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function he(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function ge(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function _e(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:ge(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of me)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function I(e,t,n={}){let r=he(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=_e(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var ve=new Set([`running`,`waiting`]);function L(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function ye(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function be(e,t=new Date){if(!s(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function xe(e){return e.steps?ee({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function Se(e,t,n=()=>``){let r=e.filter(e=>!k(e));return t.trim()?r.filter(e=>I(e,t,{scope:`shown`,extras:{displayTitle:O(e),automation:n(e),references:()=>R(e)}})):[...r]}function R(e){return U(e).map(e=>e.number)}function z(e,t){return e.filter(e=>E(e,t)).length}function Ce(e){return z(e)}function we(e){return B(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function B(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function V(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function H(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function U(e,t,n=e.projectId){let r=B(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>q(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:V(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(q(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??Te(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=H(a);o.has(c)||(o.add(c),s.push(a))}return s}function Te(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function W(e){return U(e)[0]}function G(e,t){if(!e.url)return!0;if(!t)return!1;let n=K(t);return n!==void 0&&K(e.url)===n}function K(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function Ee(e,t){let n=[];for(let r of U(e,t)){if(!G(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function De(e,t,n,r){if(G(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function q(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Oe(e,t){let n=ve.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:L(n.rssBytes),kind:`live`}};let r=L(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function ke(e,t,n=!1){return n||e.filter(e=>!t(e.label)).some(e=>e.rows.flatMap(F).some(e=>W(e)!==void 0))}var J=n(),Y=(0,M.createContext)(null);function Ae({children:e}){let[t,n]=(0,M.useState)(()=>new Map),r=(0,M.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,M.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),o=a((0,M.useMemo)(()=>[...t.values()].flat(),[t])),s=(0,M.useMemo)(()=>({publish:r,retract:i,lookup:o}),[r,i,o]);return(0,J.jsx)(Y.Provider,{value:s,children:e})}var X=(0,M.createContext)(null);function je({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,M.useContext)(Y),o=(0,M.useContext)(X),s=(0,M.useId)();(0,M.useEffect)(()=>{if(i)return i.publish(s,n),()=>i.retract(s)},[i,s,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let c=a(i?Me:n),l=i?.lookup??c,u=t??(o&&o.projectId===e?o.repoBase:void 0),d=(0,M.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,J.jsx)(X.Provider,{value:d,children:r})}var Me=[];function Z(e,t,n){let r=(0,M.useContext)(X),i=n??r?.projectId;return!r||!i||t===void 0?Fe:r.lookup({projectId:i,kind:e,number:t})}function Ne(e,t){let n=(0,M.useContext)(X),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function Pe(){let e=(0,M.useContext)(X);return{projectId:e?.projectId,repoBase:e?.repoBase}}var Fe=Object.freeze({state:`idle`}),Ie={success:`border-success/40 text-semantic-green`,danger:`border-danger/40 text-semantic-red`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-semantic-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-semantic-amber`,conflict:`border-conflict/45 text-semantic-conflict`},Le={success:`text-semantic-green`,danger:`text-semantic-red`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-semantic-info`,neutral:`text-soft-foreground`,pending:`text-semantic-amber`,conflict:`text-semantic-conflict`},Re={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},ze={draft:f,"review-required":p,"changes-requested":g,"checks-pending":null,"checks-failing":_,ready:S,merged:m,closed:h,open:x,completed:S,"not-planned":y};function Q(e){return e===`PR`?`pr-chip`:`issue-chip`}function $(e){return e?{"data-conflicting":`true`}:{}}function Be(e,t,n,r){return!n||r!==void 0&&G({kind:e,number:t??0,url:n},r)}function Ve(e,t,n){return e===`PR`&&(t??n)===!0}function He({plain:e,inert:t,conflicting:n,className:r,tone:i}){return e?u(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,r):u(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,Ie[i],r)}function Ue(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function We(e){return e===`PR`?`pull request`:`issue`}function Ge(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function Ke(e,t){return e&&t?Le[t.tone]:void 0}function qe(e,t){return!e&&(!t||!d(t))}function Je({conflicting:e,presentation:t,status:n,plain:r,compact:i,inert:a,kind:o,label:s,glyphClass:c}){return(0,J.jsxs)(J.Fragment,{children:[e?(0,J.jsx)(v,{className:u(`size-2.5 shrink-0`,c),"aria-hidden":`true`}):(0,J.jsx)(st,{status:t?n:void 0,className:r?u(`size-2.5`,c):void 0}),r&&i?o===`PR`?(0,J.jsx)(p,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,J.jsx)(x,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,r?(0,J.jsx)(`span`,{className:a?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:s}):s]})}function Ye({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,J.jsx)(`span`,{"data-slot":Q(e),"data-status":t,"data-inert":`true`,...$(n),className:r,children:i})}function Xe({kind:e,number:t,tooltip:n,url:r}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,t?` #${t}`:``,` · `,n.headline]}),(0,J.jsx)(`span`,{className:`block`,children:n.detail}),n.also?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:n.also}):null,r&&d(r)?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:r.replace(/^https?:\/\//,``)}):null]})}function Ze({reference:e,taskTitle:t,status:n,conflicting:a,conflictAction:o,projectId:s,repoBase:c,to:l,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=Pe(),y=Z(h,Be(h,g,_,c??v.repoBase)?g:void 0,s),b=n??y.status,x=i(b),S=Ve(h,a,y.conflicting),C=S?r:x,w=C?.tone??`accent`,T=He({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=it(y,C,S?x:void 0),D=Ue(h,g,p,f),O=We(h),k=Ge(O,g,t,C),A=(0,J.jsx)(Je,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:D,glyphClass:Ke(p,C)});if(m)return(0,J.jsx)(Ye,{kind:h,status:b,conflicting:S,chipClass:T,body:A});let j=qe(l,_)?(0,J.jsx)(`span`,{"data-slot":Q(h),"data-status":b,...$(S),"aria-label":C?`${O} ${D} — ${C.label}`:void 0,className:T,children:A}):(0,J.jsx)(Qe,{to:l,url:_,"data-slot":Q(h),"data-status":b,...$(S),title:E?void 0:_,"aria-label":k,className:p?T:u(T,Re[w]),children:A});return E?(0,J.jsx)(rt,{chip:j,action:S?o:void 0,state:y.state,children:(0,J.jsx)(Xe,{kind:h,number:g,tooltip:E,url:_})}):j}function Qe({to:e,url:t,children:n,...r}){return e?(0,J.jsx)(l,{to:e,...r,children:n}):(0,J.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var $e=(0,M.createContext)(()=>{});function et(){return(0,M.useContext)($e)}var tt=150,nt=120;function rt({chip:e,action:t,state:n,children:r}){let[i,a]=(0,M.useState)(!1),o=(0,M.useRef)(null),s=(0,M.useRef)(null),c=(0,M.useRef)(void 0),l=(0,M.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,M.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,M.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,J.jsxs)(T,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,J.jsx)(C,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,tt)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,nt)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,J.jsxs)(w,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,nt)},children:[(0,J.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,J.jsx)($e.Provider,{value:u,children:t}):null]})]})}function it(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${at(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function at(e){return e.charAt(0).toLowerCase()+e.slice(1)}function ot({kind:e,number:t,className:n}){let a=Z(e,t),o=i(a.status),s=e===`PR`&&a.conflicting===!0,c=s?r:o;if(!c)return null;let l=u(`size-2.5`,Le[c.tone]);return(0,J.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":a.status,...s?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:u(`inline-flex items-center`,n),children:s?(0,J.jsx)(v,{className:u(`shrink-0`,l),"aria-hidden":`true`}):(0,J.jsx)(st,{status:a.status,className:l})})}function st({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,J.jsx)(b,{"data-slot":`status-dot`,"data-tone":`pending`,className:u(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=ze[e];return n?(0,J.jsx)(n,{className:u(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}export{re as A,ne as B,we as C,xe as D,Oe as E,ae as F,oe as I,N as L,ce as M,ue as N,I as O,le as P,ie as R,Ee as S,U as T,be as _,Ae as a,V as b,Z as c,ye as d,L as f,H as g,ke as h,je as i,de as j,se as k,Se as l,q as m,ot as n,Ne as o,G as p,et as r,Pe as s,Ze as t,Ce as u,R as v,W as w,De as x,z as y,F as z};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ut as r,Wt as i,f as a}from"./queries-D9mg7sFY.js";import{mi as o,oi as s,wr as c}from"./toaster-2ud_VdfV.js";import{n as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as u,s as d}from"./dist-CCX8mhHc.js";import{F as f,I as p,N as m,P as h,U as g,_,ct as v,g as y,h as b,m as x,p as S}from"./design-icons-QbNMZniQ.js";import{n as C,r as w,t as T}from"./popover-BQolmvDR.js";import"./attention-C7BUdd2s.js";import{C as E,a as D,f as O,o as k,s as A,u as j}from"./task-groups-BvVfsQKd.js";function ee(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var M=e(t(),1),te=[{value:`all`,label:`All`},{value:`direct`,label:`Direct`},{value:`automations`,label:`Automations`}];function ne(e){return e?te:te.filter(e=>e.value!==`automations`)}function re(e,t){return e===`automations`&&!t?`all`:e}function ie(e){return e===`direct`||e===`automations`?e:`all`}function ae(e,t){return t===`all`||c(e)===(t===`automations`)}function oe(e){return e===`all`?void 0:e===`automations`}function N(e,t){let n={all:0,direct:0,automations:0};for(let r of e)k(r)||r.archived!==(t===`archived`)||(n.all+=1,c(r)?n.automations+=1:n.direct+=1);return n}function se(e,t,n,r,i){let a=A(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=N(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function ce(e){return e.rows.map(e=>e.run)}function le(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>s(e).bucket===`error`)?`danger`:`success`}}function ue(e,t,n){return D(e,t,j(n))}var P=(e,t)=>JSON.stringify([e,t]);function de(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=P(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:P(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of j(t))o.set(P(e,n),r);let s=e=>r.get(e.id);return D(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function F(e){return[e.run]}function fe(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function pe(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?fe(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var me=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:pe},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function he(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function ge(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function _e(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:ge(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of me)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function I(e,t,n={}){let r=he(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=_e(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var ve=new Set([`running`,`waiting`]);function L(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function ye(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function be(e,t=new Date){if(!o(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function xe(e){return e.steps?ee({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function Se(e,t,n=()=>``){let r=e.filter(e=>!k(e));return t.trim()?r.filter(e=>I(e,t,{scope:`shown`,extras:{displayTitle:O(e),automation:n(e),references:()=>R(e)}})):[...r]}function R(e){return U(e).map(e=>e.number)}function z(e,t){return e.filter(e=>E(e,t)).length}function Ce(e){return z(e)}function we(e){return B(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function B(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function V(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function H(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function U(e,t,n=e.projectId){let r=B(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>q(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:V(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(q(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??Te(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=H(a);o.has(c)||(o.add(c),s.push(a))}return s}function Te(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function W(e){return U(e)[0]}function G(e,t){if(!e.url)return!0;if(!t)return!1;let n=K(t);return n!==void 0&&K(e.url)===n}function K(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function Ee(e,t){let n=[];for(let r of U(e,t)){if(!G(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function De(e,t,n,r){if(G(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function q(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Oe(e,t){let n=ve.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:L(n.rssBytes),kind:`live`}};let r=L(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function ke(e,t,n=!1){return n||e.filter(e=>!t(e.label)).some(e=>e.rows.flatMap(F).some(e=>W(e)!==void 0))}var J=n(),Y=(0,M.createContext)(null);function Ae({children:e}){let[t,n]=(0,M.useState)(()=>new Map),r=(0,M.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,M.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),o=a((0,M.useMemo)(()=>[...t.values()].flat(),[t])),s=(0,M.useMemo)(()=>({publish:r,retract:i,lookup:o}),[r,i,o]);return(0,J.jsx)(Y.Provider,{value:s,children:e})}var X=(0,M.createContext)(null);function je({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,M.useContext)(Y),o=(0,M.useContext)(X),s=(0,M.useId)();(0,M.useEffect)(()=>{if(i)return i.publish(s,n),()=>i.retract(s)},[i,s,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let c=a(i?Me:n),l=i?.lookup??c,u=t??(o&&o.projectId===e?o.repoBase:void 0),d=(0,M.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,J.jsx)(X.Provider,{value:d,children:r})}var Me=[];function Z(e,t,n){let r=(0,M.useContext)(X),i=n??r?.projectId;return!r||!i||t===void 0?Fe:r.lookup({projectId:i,kind:e,number:t})}function Ne(e,t){let n=(0,M.useContext)(X),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function Pe(){let e=(0,M.useContext)(X);return{projectId:e?.projectId,repoBase:e?.repoBase}}var Fe=Object.freeze({state:`idle`}),Ie={success:`border-success/40 text-semantic-green`,danger:`border-danger/40 text-semantic-red`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-semantic-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-semantic-amber`,conflict:`border-conflict/45 text-semantic-conflict`},Le={success:`text-semantic-green`,danger:`text-semantic-red`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-semantic-info`,neutral:`text-soft-foreground`,pending:`text-semantic-amber`,conflict:`text-semantic-conflict`},Re={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},ze={draft:f,"review-required":p,"changes-requested":g,"checks-pending":null,"checks-failing":_,ready:S,merged:m,closed:h,open:x,completed:S,"not-planned":y};function Q(e){return e===`PR`?`pr-chip`:`issue-chip`}function $(e){return e?{"data-conflicting":`true`}:{}}function Be(e,t,n,r){return!n||r!==void 0&&G({kind:e,number:t??0,url:n},r)}function Ve(e,t,n){return e===`PR`&&(t??n)===!0}function He({plain:e,inert:t,conflicting:n,className:r,tone:i}){return e?u(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,r):u(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,Ie[i],r)}function Ue(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function We(e){return e===`PR`?`pull request`:`issue`}function Ge(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function Ke(e,t){return e&&t?Le[t.tone]:void 0}function qe(e,t){return!e&&(!t||!d(t))}function Je({conflicting:e,presentation:t,status:n,plain:r,compact:i,inert:a,kind:o,label:s,glyphClass:c}){return(0,J.jsxs)(J.Fragment,{children:[e?(0,J.jsx)(v,{className:u(`size-2.5 shrink-0`,c),"aria-hidden":`true`}):(0,J.jsx)(st,{status:t?n:void 0,className:r?u(`size-2.5`,c):void 0}),r&&i?o===`PR`?(0,J.jsx)(p,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,J.jsx)(x,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,r?(0,J.jsx)(`span`,{className:a?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:s}):s]})}function Ye({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,J.jsx)(`span`,{"data-slot":Q(e),"data-status":t,"data-inert":`true`,...$(n),className:r,children:i})}function Xe({kind:e,number:t,tooltip:n,url:r}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,t?` #${t}`:``,` · `,n.headline]}),(0,J.jsx)(`span`,{className:`block`,children:n.detail}),n.also?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:n.also}):null,r&&d(r)?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:r.replace(/^https?:\/\//,``)}):null]})}function Ze({reference:e,taskTitle:t,status:n,conflicting:a,conflictAction:o,projectId:s,repoBase:c,to:l,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=Pe(),y=Z(h,Be(h,g,_,c??v.repoBase)?g:void 0,s),b=n??y.status,x=i(b),S=Ve(h,a,y.conflicting),C=S?r:x,w=C?.tone??`accent`,T=He({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=it(y,C,S?x:void 0),D=Ue(h,g,p,f),O=We(h),k=Ge(O,g,t,C),A=(0,J.jsx)(Je,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:D,glyphClass:Ke(p,C)});if(m)return(0,J.jsx)(Ye,{kind:h,status:b,conflicting:S,chipClass:T,body:A});let j=qe(l,_)?(0,J.jsx)(`span`,{"data-slot":Q(h),"data-status":b,...$(S),"aria-label":C?`${O} ${D} — ${C.label}`:void 0,className:T,children:A}):(0,J.jsx)(Qe,{to:l,url:_,"data-slot":Q(h),"data-status":b,...$(S),title:E?void 0:_,"aria-label":k,className:p?T:u(T,Re[w]),children:A});return E?(0,J.jsx)(rt,{chip:j,action:S?o:void 0,state:y.state,children:(0,J.jsx)(Xe,{kind:h,number:g,tooltip:E,url:_})}):j}function Qe({to:e,url:t,children:n,...r}){return e?(0,J.jsx)(l,{to:e,...r,children:n}):(0,J.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var $e=(0,M.createContext)(()=>{});function et(){return(0,M.useContext)($e)}var tt=150,nt=120;function rt({chip:e,action:t,state:n,children:r}){let[i,a]=(0,M.useState)(!1),o=(0,M.useRef)(null),s=(0,M.useRef)(null),c=(0,M.useRef)(void 0),l=(0,M.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,M.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,M.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,J.jsxs)(T,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,J.jsx)(C,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,tt)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,nt)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,J.jsxs)(w,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,nt)},children:[(0,J.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,J.jsx)($e.Provider,{value:u,children:t}):null]})]})}function it(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${at(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function at(e){return e.charAt(0).toLowerCase()+e.slice(1)}function ot({kind:e,number:t,className:n}){let a=Z(e,t),o=i(a.status),s=e===`PR`&&a.conflicting===!0,c=s?r:o;if(!c)return null;let l=u(`size-2.5`,Le[c.tone]);return(0,J.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":a.status,...s?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:u(`inline-flex items-center`,n),children:s?(0,J.jsx)(v,{className:u(`shrink-0`,l),"aria-hidden":`true`}):(0,J.jsx)(st,{status:a.status,className:l})})}function st({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,J.jsx)(b,{"data-slot":`status-dot`,"data-tone":`pending`,className:u(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=ze[e];return n?(0,J.jsx)(n,{className:u(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}export{re as A,ne as B,we as C,xe as D,Oe as E,ae as F,oe as I,N as L,ce as M,ue as N,I as O,le as P,ie as R,Ee as S,U as T,be as _,Ae as a,V as b,Z as c,ye as d,L as f,H as g,ke as h,je as i,de as j,se as k,Se as l,q as m,ot as n,Ne as o,G as p,et as r,Pe as s,Ze as t,Ce as u,R as v,W as w,De as x,z as y,F as z};
|
package/web/dist/assets/{remote-settings-notice-fNgh5LdN.js → remote-settings-notice-CUK4ZFYF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ht as r,Vt as i,vt as a}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ht as r,Vt as i,vt as a}from"./queries-D9mg7sFY.js";import{Fi as o}from"./toaster-2ud_VdfV.js";import{Tn as s}from"./index-BV3EQb9T.js";var c=e(t(),1),l=n();function u(){let e=o(),t=(0,c.useCallback)(async()=>{await Promise.all([e.invalidateQueries({queryKey:i.health}),e.invalidateQueries({queryKey:i.agentConfig,exact:!0}),e.invalidateQueries({queryKey:r.agentProfiles,exact:!0})])},[e]);return(0,c.useEffect)(()=>{t()},[t]),t}var d=`${s()} remote-settings enable`;function f({risk:e}){return a().data?.capabilities?.remoteSettingsAdmin===!0?(0,l.jsxs)(`p`,{role:`note`,"data-slot":`remote-settings-notice`,className:`rounded-md border border-pending-strong/40 bg-pending/10 px-3 py-2 text-[13px] text-foreground`,children:[`Remote settings administration is on. `,e,`, and anyone who can open this cockpit can change them. The host operator turns this off with`,` `,(0,l.jsxs)(`code`,{children:[s(),` remote-settings disable`]}),`.`]}):null}export{f as n,u as r,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,C as i,S as a,T as o,U as s,Vt as c,Wt as l,bt as u,nt as d,un as f,w as p}from"./queries-D9mg7sFY.js";import{p as m}from"./host-context-DDbYAKpm.js";import{B as h,Cn as g,Fi as _,T as v,f as y,n as b,ut as ee,w as x,z as te,zt as ne}from"./toaster-2ud_VdfV.js";import{Z as S}from"./live-protocol-CNUmr-VT.js";import{_ as C,g as w}from"./chunk-KS7C4IRE-BdLLx37K.js";import{c as T,f as E,i as D,t as re}from"./reference-chip-CZKBU_Ud.js";import{o as O,s as k}from"./dist-CCX8mhHc.js";import{D as ie,F as A,I as j,M as ae,N as oe,P as se,Q as ce,S as le,X as ue,Z as de,c as fe,ct as M,d as pe,j as me,l as he,n as ge,st as _e,w as ve,y as ye}from"./design-icons-QbNMZniQ.js";import{t as be}from"./createLucideIcon-BHp8sXmF.js";import{n as xe,t as Se}from"./circle-x-7nTlobAF.js";import{_ as Ce}from"./nav-row-styles-CIedRn3A.js";import{i as we,r as Te,t as Ee}from"./git-toolbar-COhBdctn.js";import{t as De}from"./info-DA1x_4bz.js";import{t as Oe}from"./loader-circle-CPBhhDbB.js";import{a as ke,i as Ae,n as je,r as Me}from"./diff-controls-DTC_6oqk.js";import{t as N}from"./button-BV_AiLj2.js";import{i as P,l as Ne,p as Pe,r as Fe,t as Ie}from"./dropdown-menu-NJZfnQCU.js";import{a as Le,i as Re,n as ze,o as Be,r as Ve,s as He,t as Ue}from"./dialog-DKr-j9S6.js";import{t as F}from"./project-router-CwD1firw.js";import{t as We}from"./status-dot-DTU7afRv.js";import{c as Ge,d as Ke,f as qe,m as I,n as Je,s as L,t as Ye}from"./page-shell-BdjH5hyc.js";import{a as Xe,o as Ze}from"./format-BU7D3IfE.js";import{t as Qe}from"./control-locations-kCPVEtOM.js";import{t as R}from"./centered-state-N8vWM_Hw.js";import{$t as z,A as $e,Bn as et,Bt as tt,Cr as nt,Gt as rt,Ht as it,Jt as at,Kt as ot,Pn as st,Qt as ct,Rn as lt,Rt as ut,Tr as dt,Ut as ft,Vt as pt,Wt as mt,Xt as ht,Yt as gt,Zt as _t,an as B,en as V,gr as vt,in as H,k as yt,lr as U,nn as W,on as G,qt as K,rn as q,tn as J,zn as bt,zt as xt}from"./index-BV3EQb9T.js";import{t as St}from"./markdown-BBDDg-4t.js";import{t as Ct}from"./diff-Du0FsqAK.js";import{t as wt}from"./change-counts-BLLRvt46.js";import{t as Tt}from"./code-workbench-B0GIezrD.js";import{t as Et}from"./file-text-nGpo7MVd.js";import{i as Dt,n as Ot,r as kt}from"./commit-list-Bdekr2K7.js";var Y=e(t(),1);function At(e,t){let n=_(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(S.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var jt=be(`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`}]]),Mt=be(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),X=n();function Nt(){let e=m(),t=a(),n=_(),r=At({queryKey:c.repo})>0,i=t.data?.info?t.data:null,o=ut(e,i,`screen`);return(0,X.jsx)(Ke,{route:`repo-git`,density:i?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,X.jsx)(Ge,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:r,onClick:()=>{n.invalidateQueries({queryKey:c.repo}),n.invalidateQueries({queryKey:c.worktrees})},children:(0,X.jsx)(de,{size:17,"aria-hidden":`true`,className:O(`size-[17px]`,r&&`motion-safe:animate-spin`)})})},children:(0,X.jsxs)(`div`,{"data-slot":`git-screen`,children:[i?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)(pt,{scope:e,repo:i,info:i.info,variant:`screen`},e)}):t.isPending?(0,X.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,X.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,X.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,X.jsx)(xt,{branch:i?.info?.branch??null,counts:o,variant:`screen`})]})})}function Pt(e){if(e===``)return null;if(e===`@`)return`A branch cannot be named “@”.`;if(e.startsWith(`-`))return`A branch name cannot start with “-”.`;if(/\s/.test(e))return`A branch name cannot contain spaces.`;if(/[\u0000-\u001f\u007f]/.test(e))return`A branch name cannot contain control characters.`;let t=/[~^:?*[\\]/.exec(e);if(t)return`A branch name cannot contain “${t[0]}”.`;if(e.includes(`..`))return`A branch name cannot contain “..”.`;if(e.includes(`@{`))return`A branch name cannot contain “@{”.`;if(e.startsWith(`/`)||e.endsWith(`/`))return`A branch name cannot start or end with “/”.`;if(e.includes(`//`))return`A branch name cannot contain “//”.`;if(e.endsWith(`.`))return`A branch name cannot end with “.”.`;for(let t of e.split(`/`)){if(t.startsWith(`.`))return`A part of a branch name cannot start with “.”.`;if(t.endsWith(`.lock`))return`A part of a branch name cannot end with “.lock”.`}return null}function Ft({from:e}){let[t,n]=(0,Y.useState)(!1),r=(0,Y.useRef)(null);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Ge,{ref:r,variant:`primary`,"data-action":`new-branch`,disabled:rt(m())&&!t,onClick:()=>n(!0),children:[(0,X.jsx)(ue,{size:16,"aria-hidden":`true`}),`New branch`]}),t?(0,X.jsx)(It,{from:e,returnFocus:r,onClose:()=>n(!1)}):null]})}function It({from:e,returnFocus:t,onClose:n}){let r=mt(m()),i=rt(m()),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(null),l=a.trim(),u=Pt(l),d=u??s;return(0,X.jsx)(Ue,{open:!0,onOpenChange:e=>{!e&&!r.isPending&&n()},children:(0,X.jsx)(Ve,{"data-slot":`new-branch-dialog`,className:`sm:max-w-md`,onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-4`,onSubmit:e=>{e.preventDefault(),!(!l||u||i)&&(c(null),r.mutate(l,{onSuccess:n,onError:e=>c(e.message)}))},children:[(0,X.jsxs)(Be,{children:[(0,X.jsx)(He,{children:`New branch`}),(0,X.jsxs)(Re,{"data-slot":`new-branch-base`,children:[`Create from `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e}),` and switch to it. Switching changes your working tree.`]})]}),(0,X.jsxs)(ze,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,X.jsx)(U,{id:`new-branch-name`,autoComplete:`off`,spellCheck:!1,placeholder:`new-branch-name`,className:`h-11 bg-background font-mono md:text-base placeholder:text-soft-foreground`,value:a,"aria-invalid":d?!0:void 0,"aria-describedby":d?`new-branch-name-hint`:void 0,onChange:e=>{o(e.target.value),c(null)}}),d?(0,X.jsx)(`p`,{id:`new-branch-name-hint`,"data-slot":u?`branch-name-hint`:`branch-create-refusal`,role:`alert`,className:`text-xs text-danger`,children:d}):null]}),(0,X.jsxs)(Le,{children:[(0,X.jsx)(N,{type:`button`,variant:`outline`,disabled:r.isPending,onClick:n,children:`Cancel`}),(0,X.jsx)(N,{type:`submit`,variant:`primary`,"data-action":`create-branch`,disabled:!l||u!==null||i,children:r.isPending?`Creating…`:`Create`})]})]})})})}function Lt({entry:e}){return e.keptReason?(0,X.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function Rt({repo:e,info:t}){let n=i(),r=new Map((n.data?.branches??[]).map(e=>[e.name,e])),a=n.data?.base??e.baseBranch??t.branch,o=mt(m(),e=>b(e.message,{tone:`danger`})),s=rt(m()),[c,l]=(0,Y.useState)(``),u=c.trim().toLowerCase(),d=Gt(e,n.data?.branches),f=u?d.filter(e=>e.toLowerCase().includes(u)):d;return(0,X.jsx)(`section`,{"data-slot":`repo-branches`,className:`min-w-0`,children:(0,X.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(ce,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,X.jsx)(U,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:c,onChange:e=>l(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,X.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-3.5 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[f.map(e=>{let n=e===t.branch,i=r.get(e);return(0,X.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":i?.class,className:`flex min-h-[60px] flex-col items-start justify-center gap-1.5 py-2 md:flex-row md:items-center md:justify-start md:gap-2.5`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-[8px]`,children:[i?.runId?(0,X.jsx)(F,{to:`/tasks/${i.runId}`,"data-slot":`branch-task-link`,title:i.title?`Open the task ${i.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] font-mono text-[12px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,X.jsx)(`span`,{className:O(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),i&&!(n&&i.class===`active`)?(0,X.jsx)(Wt,{entry:i}):null]}),i?(0,X.jsx)(zt,{entry:i,base:a}):null,i?(0,X.jsx)(Lt,{entry:i}):null,e.startsWith(`cez/`)&&!n?null:n?(0,X.jsx)(`span`,{"data-slot":`branch-current`,className:`flex h-8 shrink-0 items-center rounded-md bg-accent-strong/10 px-2.5 text-[12px] font-medium text-accent-text md:ml-auto`,children:`Current`}):(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto`,disabled:s,onClick:()=>o.mutate(e),children:[(0,X.jsx)(me,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),f.length===0?(0,X.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,c.trim(),`”.`]}):null]})]})})}function zt({entry:e,base:t}){let n=e.pr?.state===`open`||e.pr?.state===`draft`;return(0,X.jsxs)(`span`,{"data-slot":`branch-facts`,className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`span`,{"data-slot":`branch-counts`,title:`${Z(e.ahead)} ahead of ${t}, ${Z(e.behind)} behind`,className:`shrink-0 font-mono tabular-nums`,children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,children:[`↑`,e.ahead,` ↓`,e.behind]}),(0,X.jsxs)(`span`,{className:`sr-only`,children:[Z(e.ahead),` ahead of `,t,`, `,Z(e.behind),` behind`]})]}),e.pr?(0,X.jsx)(Vt,{pr:e.pr}):null,n&&e.pr?.checks?(0,X.jsx)(Ht,{checks:e.pr.checks}):null]})}var Z=e=>`${e} commit${e===1?``:`s`}`,Bt={open:{icon:j,className:`border-success/40 text-semantic-green`},draft:{icon:A,className:`border-border text-muted-foreground`},merged:{icon:oe,className:`border-merged-strong/35 text-merged-text`},closed:{icon:se,className:`border-danger/40 text-semantic-red`}};function Vt({pr:e}){let{icon:t,className:n}=Bt[e.state],r=(0,X.jsxs)(`span`,{className:O(`inline-flex h-6 items-center gap-1 rounded-[4px] border px-1.5 text-xs font-medium group-hover:bg-muted`,n),children:[(0,X.jsx)(t,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,X.jsxs)(`span`,{className:`font-mono`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{children:e.state})]}),i=`inline-flex shrink-0 items-center rounded-[4px] max-md:min-h-11 no-hover:min-h-11`;return k(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`branch-pr`,"data-pr-state":e.state,title:`Open pull request #${e.number}`,className:O(i,`group focus-visible:outline-2 focus-visible:outline-ring`),children:r}):(0,X.jsx)(`span`,{"data-slot":`branch-pr`,"data-pr-state":e.state,className:i,children:r})}function Ht({checks:e}){let t=e===`passing`?xe:e===`failing`?Se:nt;return(0,X.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:O(`inline-flex shrink-0 items-center gap-1 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:[(0,X.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var Ut={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function Wt({entry:e}){return(0,X.jsx)(`span`,{"data-slot":`branch-class`,className:O(`shrink-0 rounded-[4px] border px-1.5 py-px text-xs leading-4 font-medium`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:Ut[e.class]})}function Gt(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function Kt(){let e=p(),t=I(),[n,r]=(0,Y.useState)(`unified`),[i,a]=(0,Y.useState)(!0),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),d=e.isError&&e.error instanceof g&&e.error.status===409,f=e.data?.files??[],m=(0,Y.useMemo)(()=>Te(f),[f]),h=(0,Y.useMemo)(()=>f.some(St),[f]),_=t?n:`unified`;return(0,X.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,X.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,X.jsx)(R,{icon:d?(0,X.jsx)(ve,{size:16}):(0,X.jsx)(M,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,X.jsx)(R,{icon:(0,X.jsx)(ve,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 pb-4 [&_button:not([data-button-size])]:min-h-11`,children:[e.data?(0,X.jsx)(Ee,{stat:e.data.stat}):null,(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h&&o?(0,X.jsx)(Ae,{}):null,h?(0,X.jsx)(`span`,{className:`max-md:hidden`,children:(0,X.jsx)(ke,{preview:o,onPreviewChange:s})}):null,(0,X.jsx)(Me,{mode:n,wrap:i,onModeChange:r,onWrapChange:a,disabled:h&&o}),(0,X.jsx)(je,{wrap:i,onWrapChange:a,preview:o,onPreviewChange:h?s:void 0,disabled:h&&o})]})]}),(0,X.jsx)(Tt,{className:`gap-5 [--diff-sticky-top:0px] md:gap-0`,treeSlot:`changes-tree-pane`,treeClassName:`overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)]`,tree:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,X.jsx)(we,{root:m,selected:c,onSelect:e=>{l(e),u.current?.scrollToPath(e)}})]}),children:(0,X.jsx)(Ct,{files:f,viewRef:u,mode:_,wrap:i,preview:o,loadFileText:e=>Et(()=>v(e)),totals:!1,className:`min-w-0 flex-1`})})]})})}function qt({repo:e,info:t}){let{sha:n}=w(),r=I(),i=e.log,a=(0,Y.useMemo)(()=>ct(i),[i]);if(n&&(!r||i.length===0))return(0,X.jsx)(Qt,{sha:n});let o=at(e,t),s=o&&o.behind>0?(0,X.jsx)(Xt,{info:t,tracking:o}):null;if(i.length===0)return(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsx)(`div`,{children:s}):null,(0,X.jsx)(R,{icon:(0,X.jsx)(ae,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]});let c=(0,X.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[s,a.map(e=>(0,X.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,X.jsx)(Jt,{commit:e,selected:r&&e.hash===(n??i[0]?.hash),stacked:r},e.hash))})]},e.label))]});return r?(0,X.jsx)(Tt,{className:`flex-none`,treeSlot:`repo-commits-pane`,tree:c,children:(0,X.jsx)(Zt,{sha:n??i[0]?.hash})}):c}function Jt({commit:e,selected:t,stacked:n}){return(0,X.jsxs)(`li`,{"data-selected":t?`true`:void 0,className:O(`flex min-h-[52px] gap-3.5 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,n?`flex-col items-stretch gap-0`:`items-center`,t&&`bg-muted/70`),children:[(0,X.jsxs)(F,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,"aria-current":t?`true`:void 0,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-0.5 px-4 py-2 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,X.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(Ot,{sha:e.hash}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,X.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,X.jsx)(`span`,{title:_t(e.when,e.at),children:ht(e.when,e.at)})]})]})]}),(0,X.jsx)(Yt,{source:e.source,stacked:n})]})}function Yt({source:e,stacked:t}){let n=O(`hidden shrink-0 items-center gap-[5px] text-xs text-muted-foreground md:flex`,t?`-mt-1.5 max-w-full self-start px-4 pb-2.5`:`max-w-[45%] pr-4`);return e?(0,X.jsxs)(F,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:O(n,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oe,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,X.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,X.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:n,children:`no task found`})}function Xt({info:e,tracking:t}){let n=ft(m(),e),r=(0,Y.useRef)(null);return(0,X.jsxs)(`div`,{"data-slot":`git-incoming`,className:`flex min-h-[44px] items-center gap-2.5 rounded-xl border border-border bg-card px-4 py-2`,children:[(0,X.jsx)(jt,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,X.jsxs)(`button`,{ref:r,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[28px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,X.jsx)(Oe,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(ge,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(it,{checkout:n,returnFocus:r})]})}function Zt({sha:e}){return(0,X.jsx)(Dt,{commit:o(e),sha:e,slot:`repo-commit-preview`,loadFileText:t=>Et(()=>x(e,t))})}function Qt({sha:e}){return(0,X.jsx)(kt,{commit:o(e),sha:e,backTo:ot,backLabel:`All recent commits`,slot:`repo-commit`,loadFileText:t=>Et(()=>x(e,t))})}var $t=`Squash-merged branches may show as not landed without GitHub`;function en(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function tn(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}function nn(){let e=i(),t=d(),n=m(),r=u(),[a,o]=(0,Y.useState)(null);if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`py-5 text-[13px] text-muted-foreground`,children:`Loading branches…`});if(e.isError)return(0,X.jsx)(R,{icon:(0,X.jsx)(M,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=en(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=tn(e.data.branches),f=l>0?(0,X.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(De,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,X.jsxs)(`span`,{children:[l,` finished task`,l===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,l===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,X.jsx)(F,{to:K.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,p=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,X.jsxs)(D,{projectId:n,repoBase:r,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,X.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[e.data.prStateKnown?null:(0,X.jsx)(rn,{}),f,s.length===0?(0,X.jsx)(Ye,{icon:(0,X.jsx)(vt,{size:16}),title:l>0?`Nothing else waiting to land`:`Everything landed`,description:l>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsx)(F,{to:K.cleanup,children:`Check cleanup`})}),(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsx)(F,{to:`/`,children:`View tasks`})})]})}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,X.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{children:e.note})]}):null]}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,X.jsx)(an,{entry:e,finishedAt:e.runId?p.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,X.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-1.5 px-1 text-xs leading-snug text-muted-foreground`,children:[(0,X.jsx)(De,{"aria-hidden":`true`,className:`mt-px size-3 shrink-0`}),`Delete a branch from its row's … menu. It confirms and names the commits it drops; nothing here is bulk-deleted.`]}),c<=3?(0,X.jsx)(Je,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsx)(F,{to:K.cleanup,children:`Open cleanup`})})}):null]})]}),(0,X.jsx)(un,{entry:a,onClose:()=>o(null)})]})}function rn({className:e}){return(0,X.jsxs)(`p`,{"data-slot":`git-no-forge`,className:O(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,X.jsx)(De,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),$t,`.`]})}function an({entry:e,finishedAt:t,onDelete:n}){return(0,X.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[60px] items-center gap-3 px-4 py-3 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,X.jsx)(cn,{entry:e,finishedAt:t}),(0,X.jsx)(on,{entry:e}),(0,X.jsx)(sn,{entry:e,onDelete:n})]})}function on({entry:e}){return(0,X.jsx)(X.Fragment,{children:e.pr?(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-1.5 text-xs text-muted-foreground md:flex`,children:[(0,X.jsx)(re,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,X.jsx)(ln,{entry:e})]}):null})}function sn({entry:e,onDelete:t}){let n=_(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,a=!r&&e.runId!==null&&!i,o=f({mutationFn:()=>ee(e.runId),onSuccess:e=>{b(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:c.repoBranches}),n.invalidateQueries({queryKey:c.runs.all})},onError:e=>b(e instanceof g&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),[s,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]);let d=()=>void navigator.clipboard.writeText(e.name).then(()=>{b(`Copied ${e.name}`),u.current!==null&&clearTimeout(u.current),l(!0),u.current=setTimeout(()=>l(!1),2e3)},()=>b(`Could not copy the branch name`,{tone:`danger`})),p=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-sm px-2.5 text-[12.5px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,X.jsxs)(X.Fragment,{children:[e.runId?(0,X.jsx)(F,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:O(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,a?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:o.isPending,onClick:()=>o.mutate(),className:O(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(Mt,{"aria-hidden":`true`}),o.isPending?`Creating…`:`Draft PR`]}):null,r?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,"data-copied":s||void 0,"aria-live":`polite`,onClick:d,className:O(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[s?(0,X.jsx)(he,{"aria-hidden":`true`}):(0,X.jsx)(ye,{"aria-hidden":`true`}),s?`Copied`:`Copy branch`]}):null,(0,X.jsxs)(Ie,{children:[(0,X.jsx)(Pe,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-8 shrink-0 items-center justify-center rounded-sm text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,X.jsx)(le,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(Fe,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(P,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(F,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,a?(0,X.jsx)(P,{className:`md:hidden`,disabled:o.isPending,onSelect:()=>o.mutate(),children:`Draft PR`}):null,(0,X.jsx)(P,{className:O(!r&&`md:hidden`),onSelect:d,children:`Copy branch`}),(0,X.jsx)(Ne,{className:`md:hidden`}),(0,X.jsx)(P,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function cn({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=t??e.lastCommit.at,a=Xe(i),o=e.runStatus?st(e.runStatus):void 0,s=n||!o?a:`${o.label}${a?` ${a}`:``}`,c=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,X.jsx)(Ce,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,X.jsx)(We,{tone:o?.tone??`neutral`,shape:o?.shape??`filled`,"aria-label":o?.label})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,X.jsx)(F,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] font-medium text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,X.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,X.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,X.jsx)(Q,{}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(wt,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{className:`truncate`,title:c,children:s})]}):null]}),e.parentRunId?(0,X.jsx)(F,{to:`/tasks/${e.parentRunId}`,"data-slot":`not-landed-parent`,className:`w-fit rounded-[2px] text-xs text-muted-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:`Worker of its parent task`}):null,(0,X.jsx)(Lt,{entry:e})]})]})}function Q(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function ln({entry:e}){let t=l(T(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function un({entry:e,onClose:t}){let n=_(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=f({mutationFn:e=>y({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;b(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:c.repo}),s()},onError:e=>b(e.message,{tone:`danger`})}),s=()=>{i(``),t()},l=e!==null&&r.trim()===e.name,u=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,X.jsx)(z,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(W,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(G,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(q,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,X.jsxs)(X.Fragment,{children:[`This drops the work of `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,X.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[u,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,e?.lastCommit.sha?(0,X.jsxs)(X.Fragment,{children:[` (`,(0,X.jsx)(et,{sha:e.lastCommit.sha,variant:`inline`}),`)`]}):null,`.`]})]})})]}),(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),l&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,X.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,X.jsx)(U,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,X.jsxs)(H,{children:[(0,X.jsx)(J,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(V,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!l||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function dn({base:e}){let t=i(),n=_(),[r,a]=(0,Y.useState)({merged:!1,empty:!1}),[o,s]=(0,Y.useState)(!1),l=(t.data?.branches??[]).filter(e=>e.class===`merged`),u=(t.data?.branches??[]).filter(e=>e.class===`empty`),d=[...l,...u],p=f({mutationFn:e=>y({names:e}),onSuccess:e=>{let t=e.refused.length;b(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:c.repo})},onError:e=>{n.invalidateQueries({queryKey:c.repo}),b(e.message,{tone:`danger`})}});if(t.isPending)return(0,X.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,X.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let m=d.length,h=`branch${m===1?``:`es`}`;return(0,X.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,m]}),(0,X.jsxs)(`p`,{className:`text-xs leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:m===0||p.isPending,onClick:()=>s(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(_e,{"aria-hidden":`true`,className:`size-[12px]`}),p.isPending?`Deleting…`:`Delete ${m} ${h}`]})]}),(0,X.jsx)(fn,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:$t.toLowerCase(),rows:l,open:r.merged,onToggle:()=>a(e=>({...e,merged:!e.merged}))}),(0,X.jsx)(fn,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:u,open:r.empty,onToggle:()=>a(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(z,{open:o,onOpenChange:s,children:(0,X.jsxs)(W,{children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(G,{children:[`Delete `,m,` `,h,`?`]}),(0,X.jsxs)(q,{children:[l.length,` merged into `,e,` and `,u.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,X.jsxs)(H,{children:[(0,X.jsx)(J,{children:`Keep them`}),(0,X.jsxs)(V,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{p.mutate(d.map(e=>e.name)),s(!1)},children:[`Delete `,m,` `,h]})]})]})})]})}function fn({kind:e,title:t,hint:n,rows:r,open:i,onToggle:a}){let o=`cleanup-branches-${e}`;return(0,X.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":o,disabled:r.length===0,onClick:a,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,X.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n})]}),r.length>0?(0,X.jsx)(pe,{"aria-hidden":`true`,className:O(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,X.jsx)(`ul`,{id:o,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,X.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-xs`,children:[(0,X.jsx)(lt,{value:e.name,className:`shrink-0 text-muted-foreground`}),e.runId?(0,X.jsx)(F,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,X.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,X.jsx)(bt,{iso:e.lastCommit.at,className:`shrink-0 text-soft-foreground`})]},e.name))}):null]})}function $(e){return e.some(e=>e.sizeBytes===null)?null:e.reduce((e,t)=>e+(t.sizeBytes??0),0)}function pn(e){return e.kind===`dirty`?`${e.uncommittedFiles} uncommitted`:e.kind===`detached-head`?`detached HEAD`:e.kind===`submodules`?`has submodules`:`broken worktree`}function mn(e){if(e.kind===`dirty`){let t=`${e.uncommittedFiles} uncommitted file${e.uncommittedFiles===1?``:`s`}`;return e.detachedHead?`${t} and a detached HEAD on no branch`:t}return e.kind===`detached-head`?`a detached HEAD whose commit is on no branch`:e.kind===`submodules`?`initialized submodules that Git will not remove without force`:`an unregistered or broken Git worktree directory`}function hn(e){let t=e.some(e=>e.reclaimBlocker?.kind===`dirty`),n=e.some(e=>e.reclaimBlocker?.kind===`detached-head`||e.reclaimBlocker?.kind===`dirty`&&e.reclaimBlocker.detachedHead),r=e.some(e=>e.reclaimBlocker?.kind===`submodules`),i=e.some(e=>e.reclaimBlocker?.kind===`invalid`),a=[...t?[`uncommitted work`]:[],...n?[`a detached HEAD`]:[],...r?[`initialized submodules`]:[],...i?[`a broken checkout`]:[]];return a.length<=1?a[0]??`uncommitted work`:`${a.slice(0,-1).join(`, `)} or ${a.at(-1)}`}function gn(e,t,n){let r=Math.max(0,t-e);return e===0?r===0?`Nothing to reclaim — no finished worktrees exceed the keep limit`:n?`Nothing was reclaimed — the worktrees past the keep limit are in use or could not be removed`:`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Reclaimed ${e} worktree${e===1?``:`s`} (branch kept)${r>0?` · ${r} kept: ${n?`in use or could not be removed`:`uncommitted work or in use`}`:``}`}function _n(e,t){return e===0?`Reclaim now`:t?`Reclaim ${E(t)} now`:`Reclaim ${e} now`}function vn(e,t,n){let r=t?E(t):String(e);return n?`Discard & reclaim all ${r}`:`Discard & reclaim ${r}`}function yn(e,t){if(!e)return t>0?`No clean worktrees past the keep limit — use Discard & reclaim for blocked worktrees`:`Nothing past the keep limit to reclaim`}function bn(e){return e===0?{prefix:`Retention is unlimited (`,suffix:`), so nothing is reclaimed on its own.`}:{prefix:`Retention keeps the newest ${e} finished checkout${e===1?``:`s`} (`,suffix:`) and reclaims the rest.`}}function xn({blocked:e,discardLabel:t,disabled:n,onDiscard:r}){let i=$(e),a=e.length===1?``:`s`,o=e.length===1?`it has`:`they have`;return(0,X.jsxs)(`div`,{"data-slot":`worktrees-blocked-banner`,className:`flex flex-col gap-[10px] border-b border-border bg-muted/40 px-[14px] py-[10px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-[12px] leading-[17px] text-foreground`,children:[e.length,` worktree`,a,` past the keep limit`,i?` (${E(i)})`:``,` `,`cannot be reclaimed automatically because `,o,` `,hn(e),`.`]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-discard-reclaim`,disabled:n,onClick:r,className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] border border-danger/40 px-[10px] text-[12px] font-medium text-danger hover:bg-danger/10 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 md:self-center`,children:[(0,X.jsx)(dt,{"aria-hidden":`true`,className:`size-[12px]`}),t]})]})}function Sn({confirmClean:e,onCloseClean:t,cleanCount:n,cleanBytes:r,reclaimLabel:i,onConfirmClean:a,discardBatch:o,onCloseDiscardBatch:s,onConfirmDiscardBatch:c,discardRow:l,onCloseRow:u,onConfirmRow:d}){let f=o?$(o):null,p=o?o.filter(e=>e.reclaimBlocker!==null).length:0,m=o?o.some(e=>!e.reclaimBlocker):!1,h=o?vn(o.length,f,m):``;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{open:e,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(W,{children:[(0,X.jsxs)(B,{children:[(0,X.jsx)(G,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(q,{children:[n,` finished worktree`,n===1?``:`s`,` beyond the keep limit`,r?` (${E(r)})`:``,` `,n===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(H,{children:[(0,X.jsx)(J,{children:`Keep them`}),(0,X.jsx)(V,{"data-action":`worktrees-confirm`,onClick:a,children:i})]})]})}),(0,X.jsx)(z,{open:o!==null,onOpenChange:e=>{e||s()},children:(0,X.jsxs)(W,{children:[(0,X.jsxs)(B,{children:[(0,X.jsx)(G,{children:`Discard changes and reclaim worktrees?`}),(0,X.jsx)(q,{children:o?(0,X.jsxs)(X.Fragment,{children:[o.length,` finished worktree`,o.length===1?``:`s`,` beyond the keep limit`,f?` (${E(f)})`:``,` will be reclaimed now.`,` `,`Uncommitted files and detached-HEAD commits in `,p,` blocked checkout`,p===1?``:`s`,` will be permanently discarded. Each task’s branch is kept.`]}):null})]}),(0,X.jsxs)(H,{children:[(0,X.jsx)(J,{children:`Keep them`}),(0,X.jsx)(V,{"data-action":`worktrees-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{o&&c(o),s()},children:h})]})]})}),(0,X.jsx)(z,{open:l!==null,onOpenChange:e=>{e||u()},children:(0,X.jsxs)(W,{children:[(0,X.jsxs)(B,{children:[(0,X.jsx)(G,{children:`Discard changes and reclaim worktree?`}),(0,X.jsx)(q,{children:l?.reclaimBlocker?(0,X.jsxs)(X.Fragment,{children:[l.title,` has `,mn(l.reclaimBlocker),`. Reclaiming removes the directory and permanently discards uncommitted or unbranched changes in it. The branch (`,l.branch??l.runId.slice(0,8),`) is kept.`]}):null})]}),(0,X.jsxs)(H,{children:[(0,X.jsx)(J,{children:`Keep it`}),(0,X.jsx)(V,{"data-action":`worktree-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{l&&d(l),u()},children:`Discard & reclaim`})]})]})})]})}function Cn(){let e=r(),t=s().data?.targets.find(e=>e.id===`finder`),n=f({mutationFn:e=>ne(e,t.id),onError:e=>b(e.message,{tone:`danger`})}),i=_(),[a,o]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,p]=(0,Y.useState)(null),m=()=>Promise.all([i.invalidateQueries({queryKey:c.worktrees}),i.invalidateQueries({queryKey:c.repoBranches})]),g=f({mutationFn:({runIds:e})=>h(e?{discardWork:!0,runIds:e}:void 0),onSuccess:(e,{expected:t,runIds:n})=>{m(),b(gn(e.reclaimed.length,t,!!n))},onError:e=>b(e.message,{tone:`danger`})}),v=f({mutationFn:({worktree:e,discardWork:t})=>te(e.runId,t?{discardWork:!0}:void 0),onSuccess:(e,{worktree:t})=>{m(),b(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{m(),b(e.message,{tone:`danger`})}});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:y,totalBytes:ee,keep:x}=e.data,S=g.isPending||v.isPending,C=y.filter(e=>e.pastKeep),w=C.filter(e=>!e.reclaimBlocker),T=C.filter(e=>e.reclaimBlocker!==null),D=w.length>0,re=$(w),O=$(C),k=_n(w.length,re),ie=vn(C.length,O,D),A=ee?E(ee):null,j=bn(x);return(0,X.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,A?` · ${A}`:``]}),(0,X.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-xs leading-[17px] text-soft-foreground`,children:[j.prefix,(0,X.jsx)(F,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:Qe(`worktrees`,` › `)}),j.suffix,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:S||!D,title:yn(D,T.length),onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(dt,{"aria-hidden":`true`,className:`size-[12px]`}),k]})]}),T.length>0?(0,X.jsx)(xn,{blocked:T,discardLabel:ie,disabled:S,onDiscard:()=>u(C)}):null,y.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:y.map(e=>(0,X.jsx)(En,{worktree:e,keep:x,disabled:S,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>{e.reclaimBlocker?p(e):v.mutate({worktree:e,discardWork:!1})}},e.runId))}),(0,X.jsx)(Sn,{confirmClean:a,onCloseClean:()=>o(!1),cleanCount:w.length,cleanBytes:re,reclaimLabel:k,onConfirmClean:()=>{g.mutate({expected:w.length}),o(!1)},discardBatch:l,onCloseDiscardBatch:()=>u(null),onConfirmDiscardBatch:e=>{g.mutate({expected:e.length,runIds:e.map(e=>e.runId)})},discardRow:d,onCloseRow:()=>p(null),onConfirmRow:e=>v.mutate({worktree:e,discardWork:!0})})]})}var wn=new Set([`queued`,`running`,`waiting`,`review`]);function Tn(e,t){return wn.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`,state:`in-use`}:e.reclaimBlocker?{label:pn(e.reclaimBlocker),tone:`blocked`,state:`blocked`}:e.pastKeep?{label:`reclaimable`,tone:`plain`,state:`reclaimable`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`,state:`kept`}}function En({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:a}){let o=Tn(e,t),s=Xe(e.finishedAt??void 0),c=e.status===`review`?`at review`:s?`${e.status} ${Ze(s)}`:e.status,l=o.tone===`in-use`?`text-status-running`:o.tone===`blocked`?`text-danger`:`text-soft-foreground`,u=e.reclaimBlocker?`Cannot auto-reclaim: ${mn(e.reclaimBlocker)}`:void 0,d=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":o.state,title:u,className:O(`text-xs`,l),children:o.label}),f=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`,p=e.reclaimBlocker?`Discard changes and reclaim the worktree of ${e.title} (branch kept)`:`Reclaim the worktree of ${e.title} (branch kept)`,m=e.reclaimBlocker?`Discard changes and reclaim the directory (branch kept)`:`Reclaim the directory (branch kept)`;return(0,X.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,X.jsxs)(`span`,{className:`truncate font-mono text-xs text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,c,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,o.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:E(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:d}),r?(0,X.jsx)(`button`,{type:`button`,className:f,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,X.jsx)(ie,{"aria-hidden":`true`,className:`size-[13px]`})}):null,o.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":p,title:m,disabled:n,onClick:a,className:O(f,e.reclaimBlocker&&`text-danger hover:text-danger`),children:(0,X.jsx)(dt,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function Dn(e){return e===`main`||e===`changes`?`Split`:`Table`}function On({section:e,index:t=!1}){let n=a(),r=I(),[i]=C(),o=Dn(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,X.jsx)(Nt,{});if(n.isPending)return(0,X.jsx)(yt,{});if(n.isError)return(0,X.jsx)(L,{template:o,route:`repo-git`,density:`empty`,beforeHeader:(0,X.jsx)($e,{}),children:(0,X.jsx)(R,{icon:(0,X.jsx)(M,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let s=n.data.info;return s?(0,X.jsx)(kn,{repo:n.data,info:s,section:e}):(0,X.jsx)(L,{template:o,route:`repo-git`,density:`empty`,beforeHeader:(0,X.jsx)($e,{}),children:(0,X.jsx)(R,{icon:(0,X.jsx)(me,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`Squawk is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function kn({repo:e,info:t,section:n}){let r=Dn(n),a=i(),o=An(n),s=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?Gt(e,a.data?.branches).length:n===`not-landed`?a.data?.branches.filter(e=>e.class===`not-landed`||e.class===`orphan`).length??0:4;return(0,X.jsx)(L,{template:r,route:`repo-git`,density:n===`not-landed`&&a.isPending?`full`:qe(s),rootProps:{"data-git-section":n},beforeHeader:(0,X.jsx)($e,{}),header:{title:o?.title??tt(n,t.branch),headerSlot:`repo-header`,subtitle:o?(0,X.jsxs)(X.Fragment,{children:[`Commit `,o.shortSha,` on `,t.branch]}):(0,X.jsx)(jn,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`,...n===`branches`?{primaryAction:(0,X.jsx)(Ft,{from:t.branch})}:{}},children:n===`main`?(0,X.jsx)(qt,{repo:e,info:t}):n===`not-landed`?(0,X.jsx)(nn,{}):n===`cleanup`?(0,X.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[(0,X.jsx)(Cn,{}),(0,X.jsx)(dn,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,X.jsx)(Rt,{repo:e,info:t}):(0,X.jsx)(Kt,{})})}function An(e){let{sha:t}=w(),n=I(),r=e===`main`&&!n?t:void 0,i=o(r);if(!r)return;let a=r.slice(0,8);return{title:i.data?.subject??`Commit ${a}`,shortSha:a}}function jn({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,X.jsxs)(X.Fragment,{children:[e.log.length===0?`No commits yet`:`Latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${gt(e.tracking)}`:``]});case`not-landed`:return(0,X.jsxs)(X.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,X.jsx)(Mn,{repo:e,info:t});case`changes`:return(0,X.jsxs)(X.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,X.jsxs)(X.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function Mn({repo:e,info:t}){let n=Gt(e,i().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{On as RepoGitRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,z as i}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,z as i}from"./queries-D9mg7sFY.js";import{Cn as a,it as o}from"./toaster-2ud_VdfV.js";import{_ as s,g as c,i as l,m as u,n as d,p as f}from"./chunk-KS7C4IRE-BdLLx37K.js";import{ct as p,r as m}from"./design-icons-QbNMZniQ.js";import{a as h,c as g,l as _,s as v,t as y}from"./file-preview-DMJCprVk.js";import{t as b}from"./button-BV_AiLj2.js";import{t as x}from"./centered-state-N8vWM_Hw.js";import{r as S}from"./html-report-BX3msvci.js";import{_ as C,g as w,v as T,zn as E}from"./index-BV3EQb9T.js";import{t as D}from"./html-report-frame-Bk6UkqKa.js";var O=e(t(),1),k=n();function A(){let e=f(),t=u();return()=>{if(e.key==="default"||window.history.state?.idx===0){t({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let n=window.navigation,r=j(e.state);n?.canGoBack?n.back():r?t(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):t(-1)}}function j(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function M(e){return e?.type===`file`?e:null}function N(){let[e]=s(),t=e.get(`path`),n=e.get(`artifact`);return{path:t,artifactId:n,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&n!==null||t===``||n===``}}function P(){let{id:e=``}=c(),t=N(),n=f(),r=A();return(0,k.jsx)(F,{runId:e,selection:t,fragment:n.hash,onBack:r,variant:`route`})}function F({runId:e,selection:t,fragment:n,onBack:r,variant:i,sourceLookup:a}){let{path:o,conflict:s,selected:c,result:u}=L(e,t,a),d=T(w,!0),p=T(C,!1),m=f(),[h,g]=(0,O.useState)(!1),_=M(u.data);if(i===`route`&&R(_))return(0,k.jsx)(l,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=B(_,o),y=i===`pane`&&!p&&!d?`Conversation`:`Back`,b=i===`pane`&&!h&&z(_),x=I(m.pathname,e,t);return(0,k.jsxs)(`div`,{"data-route":`task-report`,"data-variant":i,onKeyDown:e=>{i!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),r())},className:i===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,k.jsx)(V,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:r,backLabel:y,hideDownload:i===`pane`&&p,focusBack:i===`pane`}),(0,k.jsx)(`div`,{"data-slot":`report-body`,className:b?`flex min-h-0 flex-1 flex-col overflow-clip`:`flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,k.jsx)(H,{conflict:s,selected:c,result:u,source:h,name:v,fragment:n,pane:i===`pane`,filesHref:x})})]})}function I(e,t,n){let r=/^\/p\/[^/]+/.exec(e)?.[0]??``,i=n.artifactId?new URLSearchParams({artifact:n.artifactId}):new URLSearchParams({path:n.path??``});return`${r}/tasks/${encodeURIComponent(t)}/files?${i}`}function L(e,t,n){let{path:a=null,artifactId:o=null,conflict:s=!1}=t,c=n?.isPending||n?.isError,l=i(e,o||s||c?null:a),u=r(e,s||c?null:o),d=c&&n?{...n,data:void 0}:o?u:l;return{path:a,conflict:s,selected:a!==null||o!==null,result:d}}function R(e){return e!==null&&(!S(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function z(e){return e!==null&&!e.tooLarge&&!e.binary}function B(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function V({runId:e,file:t,name:n,source:r,onSource:i,onBack:a,backLabel:s,hideDownload:c,focusBack:l}){let u=(0,O.useRef)(null);(0,O.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let d=t?.artifact;return(0,k.jsxs)(`header`,{"data-slot":`report-bar`,className:`flex min-h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-2 md:px-4`,children:[(0,k.jsxs)(b,{ref:u,variant:`ghost`,className:`gap-1.5 px-2`,onClick:a,"aria-label":s,children:[(0,k.jsx)(m,{size:18,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`max-sm:sr-only`,children:s})]}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,k.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[d?(0,k.jsxs)(k.Fragment,{children:[`Published snapshot · `,(0,k.jsx)(E,{iso:d.createdAt})]}):`Live file`,` · `,h(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,k.jsx)(b,{variant:`ghost`,className:`px-3 text-accent-text`,onClick:i,children:r?`Preview`:`Source`}):null,d&&!c?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline focus-visible:ring-2`,href:o(e,d.id,`download`),children:`Download`}):null]})}function H({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:s}){if(e)return(0,k.jsx)(W,{icon:(0,k.jsx)(v,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,k.jsx)(`p`,{role:`status`,"data-slot":`report-loading`,className:`px-4 py-6 text-center text-sm text-soft-foreground`,children:`Loading report…`});if(n.isError)return(0,k.jsx)(U,{result:n});let c=n.data;return c.type===`file`?o&&!S(c.path)?(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,k.jsx)(d,{to:s,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):c.tooLarge?(0,k.jsx)(W,{icon:(0,k.jsx)(_,{}),title:`Too large to preview`,subtitle:`${h(c.size)} is past the 500 kB preview limit. Download it to read it.`}):c.binary?(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,k.jsx)(`div`,{className:`bg-card`,children:(0,k.jsx)(y,{path:c.path,text:c.content??``})}):(0,k.jsx)(D,{html:c.content??``,title:`Report: ${i}`,fragment:a,className:o?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,k.jsx)(W,{icon:(0,k.jsx)(v,{}),title:c.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:c.reason})}function U({result:e}){let t=e.error instanceof a&&e.error.status===404;return(0,k.jsx)(W,{icon:t?(0,k.jsx)(v,{}):(0,k.jsx)(p,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,k.jsx)(b,{variant:`outline`,onClick:()=>void e.refetch(),children:`Retry`})})}function W({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,k.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,k.jsx)(x,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{F as ReportReader,P as TaskReportRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{sn as r}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{sn as r}from"./queries-D9mg7sFY.js";import{m as i,p as a}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o}from"./dist-CCX8mhHc.js";import{mt as s}from"./design-icons-QbNMZniQ.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CyFJ-9Ex.js";import{t as g}from"./use-search-params-writer-DD5PEEZw.js";var _=e(t(),1),v=n();function y({...e}){return(0,v.jsx)(h,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-trigger`,...e})}function x({...e}){return(0,v.jsx)(d,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,v.jsx)(f,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,v.jsx)(c,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function w({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,v.jsxs)(S,{children:[(0,v.jsx)(C,{className:i}),(0,v.jsxs)(p,{"data-slot":`sheet-content`,className:o(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,v.jsxs)(d,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,v.jsx)(s,{className:`size-4`}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function T({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-1.5 p-4`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:o(`font-semibold text-foreground`,e),...t})}function D({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function O(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(r())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var k=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function A(e){let t=e.get(`report`);return!t||!k.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var j=(0,_.createContext)(null);function M(e){let t=a(),n=i(),[r,o]=g(),s=A(r),[c,l]=(0,_.useState)(()=>({runId:e,entries:new Map}));c.runId!==e&&l({runId:e,entries:new Map});let u=(0,_.useCallback)((t,n)=>(l(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),d=(0,_.useRef)({runId:e,callbacks:new Map});d.current.runId!==e&&(d.current={runId:e,callbacks:new Map});let f=(0,_.useCallback)((e,t)=>(d.current.callbacks.set(e,t),()=>{d.current.callbacks.get(e)===t&&d.current.callbacks.delete(e)}),[]),p=(0,_.useMemo)(()=>({register:u,registerOpener:f}),[u,f]),m=(0,_.useRef)(null);return(0,_.useEffect)(()=>{r.has(`report`)&&!s&&o(e=>(e.delete(`report`),e.delete(`card`),e))},[r,s,o]),(0,_.useEffect)(()=>{let n=m.current;!s&&n&&n.runId===e&&n.card&&d.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),m.current=s?{...s,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,s,t.state]),{selection:s,sourceRunId:c.runId===e&&s?c.entries.get(s.artifactId)??(s.card?void 0:e):void 0,registry:p,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}o(e=>(e.delete(`report`),e.delete(`card`),e))}}}export{x as a,T as c,y as i,E as l,M as n,w as o,O as r,D as s,j as t,b as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Lt as r,M as i,st as a,vt as o}from"./queries-IlC9MZgh.js";import{p as s}from"./host-context-DDbYAKpm.js";import{Ci as c,Er as l,Fi as u,Ni as d,Xn as f,Zn as p,_i as m,er as h,wr as g}from"./toaster-DNnL8v10.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-CNUmr-VT.js";import{h as T,p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as D}from"./dist-CCX8mhHc.js";import{Q as O}from"./design-icons-QbNMZniQ.js";import{t as ee}from"./arrow-up-right-DKGzsMqY.js";import{t as te}from"./chevron-right-BENZ-1ZN.js";import{t as k}from"./eye-B8okNWXU.js";import{t as A}from"./button-BV_AiLj2.js";import{t as j}from"./project-router-Dc6KBQsv.js";import{f as M,i as N,n as ne,r as re,t as P,u as F}from"./page-shell-BdjH5hyc.js";import{t as I}from"./use-search-params-writer-DD5PEEZw.js";import{Tn as L,j as R,lr as z,qn as B,vr as V,zn as H}from"./index-DPfg7xSB.js";import{t as U}from"./report-title-D4Mbu2Er.js";import{t as W}from"./html-report-frame-Bk6UkqKa.js";var G=e(t(),1),K=1e3,q=S().min(1).max(1024);_({q:S().max(K).optional(),before:q.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var J=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:m}).strict()),nextCursor:q.nullable(),total:w().int().nonnegative()}).strict(),Y=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),ie=_({runId:b(),taskTitle:S(),taskStatus:m}).strict(),ae=v(`type`,[Y.extend({type:y(`snapshot`)}),Y.extend({type:y(`content`)}),Y.extend({type:y(`metadata`),runs:x(ie)})]),X=new WeakMap;function oe(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var se=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=oe(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function ce(e,t){let n=X.get(e);n||(n=new Map,X.set(e,n));let r=n.get(t);return r||(r=new se(e,t),n.set(t,r)),r}async function le(e,t){let n=await f.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},p({signal:t}));return Y.parse(await h(n,`/reports/state`))}function ue(e){let t=ce(u(),e);return(0,G.useEffect)(()=>{let n=r(`reports:project:${e}`,e=>{let n=ae.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),i,o,s=()=>{if(g()===`finite`&&!i){o=new AbortController;let n=o.signal;le(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),i=a({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=Y.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else g()!==`finite`&&(o?.abort(),i?.(),i=void 0)};s();let c=l(s);return()=>{c(),o?.abort(),i?.(),n()}},[t,e]),t}async function de(e,t,n,r){let i=await f.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,K),...n?{before:n}:{}}},p(r?{signal:r}:void 0));return J.parse(await h(i,`/reports`))}function fe(e){let t=s(),n=ue(t);return c({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>de(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map,$={title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`};function pe(){let e=B(),t=o();return e===`unknown`?(0,Z.jsx)(F,{route:`reports`,density:`full`,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsx)(`div`,{"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:t.isError&&!t.isFetching?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.error instanceof Error?t.error.message:`Could not reach the server`}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})})}):e===`absent`?(0,Z.jsx)(R,{}):(0,Z.jsx)(me,{})}function me(){let e=E(),t=T(),[n,r]=I(),i=(n.get(`q`)??``).slice(0,K),a=fe(i),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(``),l=e.pathname+e.search,u=a.data?.pages.flatMap(e=>e.reports)??[],d=e=>{Q.set(l,{scroll:s.current?.scrollTop??0,row:e,pages:a.data?.pages.length??1})},[f,p]=(0,G.useState)(null),m=N(o);(0,G.useLayoutEffect)(()=>{if(!a.data||c.current===l)return;let n=Q.get(l),r=e.state?.filesRestoreKey===l;if(!n||!s.current||t!==`POP`&&!r){c.current=l;return}let i=s.current.querySelector(`[data-report-id="${n.row}"]`);if(a.isFetchNextPageError){c.current=l,s.current.scrollTop=0;return}if((!i||a.data.pages.length<n.pages)&&a.hasNextPage){a.isFetchingNextPage||a.fetchNextPage();return}c.current=l,s.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[l,a.data,a.hasNextPage,a.isFetchingNextPage,a.isFetchNextPageError,a.fetchNextPage,e.state,t]);let h=t=>r(n=>(t?n.set(`q`,t.slice(0,K)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),g=u.find(e=>e.id===f)??u[0]??null,_=a.isPending?`full`:M(u.length);return(0,Z.jsx)(F,{route:`reports`,density:_,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsxs)(`div`,{ref:o,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(O,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(z,{maxLength:K,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:i,onChange:e=>h(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),a.isPending?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):a.isError&&u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.error.message}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]})}):u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(P,{icon:(0,Z.jsx)(V,{}),title:i?`No matching reports`:`No published reports yet`,description:i?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[L(),` artifact publish`]}),` `,`to list it here.`]}),actions:i?(0,Z.jsx)(A,{"data-slot":`reports-clear-search`,variant:`outline`,onClick:()=>h(``),children:`Clear search`}):(0,Z.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(j,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(re,{list:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:u.map(e=>{let t=g?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":m&&t?`true`:void 0,className:D(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,m&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:U(e),children:(0,Z.jsx)(j,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:l,filesRestoreKey:l},onClick:()=>d(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:U(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(j,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(H,{className:`shrink-0`,iso:e.createdAt,prefix:`Published · `})]})]}),m?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${U(e)}`,"aria-pressed":t,onClick:()=>p(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(te,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),a.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(A,{variant:`outline`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:`Load more reports`})}):null,_===`sparse`?(0,Z.jsx)(ne,{summary:`${u.length} published ${u.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:m&&g?(0,Z.jsx)(he,{report:g,restoreKey:l,onOpenReader:()=>d(g.id)}):null})]})})}function he({report:e,restoreKey:t,onOpenReader:n}){let r=(0,G.useContext)(d)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${U(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:U(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,(0,Z.jsx)(H,{iso:e.createdAt,prefix:`Published · `})]})]}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`shrink-0 py-1.5`,children:(0,Z.jsxs)(j,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(ge,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function ge({report:e}){let t=i(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(W,{html:n.content,title:U(e),className:`min-h-0 flex-1`})}export{pe as ReportsRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Lt as r,M as i,st as a,vt as o}from"./queries-D9mg7sFY.js";import{p as s}from"./host-context-DDbYAKpm.js";import{Ci as c,Fi as l,Ni as u,On as d,Qn as f,Tn as p,_i as m,er as h,wn as g}from"./toaster-2ud_VdfV.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-CNUmr-VT.js";import{h as T,p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as D}from"./dist-CCX8mhHc.js";import{Q as O}from"./design-icons-QbNMZniQ.js";import{t as ee}from"./arrow-up-right-DKGzsMqY.js";import{t as te}from"./chevron-right-BENZ-1ZN.js";import{t as k}from"./eye-B8okNWXU.js";import{t as A}from"./button-BV_AiLj2.js";import{t as j}from"./project-router-CwD1firw.js";import{f as M,i as N,n as ne,r as re,t as P,u as F}from"./page-shell-BdjH5hyc.js";import{t as I}from"./use-search-params-writer-DD5PEEZw.js";import{Tn as L,j as R,lr as z,qn as B,vr as V,zn as H}from"./index-BV3EQb9T.js";import{t as U}from"./report-title-D4Mbu2Er.js";import{t as W}from"./html-report-frame-Bk6UkqKa.js";var G=e(t(),1),K=1e3,q=S().min(1).max(1024);_({q:S().max(K).optional(),before:q.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var J=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:m}).strict()),nextCursor:q.nullable(),total:w().int().nonnegative()}).strict(),Y=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),ie=_({runId:b(),taskTitle:S(),taskStatus:m}).strict(),ae=v(`type`,[Y.extend({type:y(`snapshot`)}),Y.extend({type:y(`content`)}),Y.extend({type:y(`metadata`),runs:x(ie)})]),X=new WeakMap;function oe(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var se=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=oe(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function ce(e,t){let n=X.get(e);n||(n=new Map,X.set(e,n));let r=n.get(t);return r||(r=new se(e,t),n.set(t,r)),r}async function le(e,t){let n=await g.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},p({signal:t}));return Y.parse(await d(n,`/reports/state`))}function ue(e){let t=ce(l(),e);return(0,G.useEffect)(()=>{let n=r(`reports:project:${e}`,e=>{let n=ae.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),i,o,s=()=>{if(f()===`finite`&&!i){o=new AbortController;let n=o.signal;le(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),i=a({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=Y.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else f()!==`finite`&&(o?.abort(),i?.(),i=void 0)};s();let c=h(s);return()=>{c(),o?.abort(),i?.(),n()}},[t,e]),t}async function de(e,t,n,r){let i=await g.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,K),...n?{before:n}:{}}},p(r?{signal:r}:void 0));return J.parse(await d(i,`/reports`))}function fe(e){let t=s(),n=ue(t);return c({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>de(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map,$={title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`};function pe(){let e=B(),t=o();return e===`unknown`?(0,Z.jsx)(F,{route:`reports`,density:`full`,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsx)(`div`,{"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:t.isError&&!t.isFetching?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.error instanceof Error?t.error.message:`Could not reach the server`}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})})}):e===`absent`?(0,Z.jsx)(R,{}):(0,Z.jsx)(me,{})}function me(){let e=E(),t=T(),[n,r]=I(),i=(n.get(`q`)??``).slice(0,K),a=fe(i),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(``),l=e.pathname+e.search,u=a.data?.pages.flatMap(e=>e.reports)??[],d=e=>{Q.set(l,{scroll:s.current?.scrollTop??0,row:e,pages:a.data?.pages.length??1})},[f,p]=(0,G.useState)(null),m=N(o);(0,G.useLayoutEffect)(()=>{if(!a.data||c.current===l)return;let n=Q.get(l),r=e.state?.filesRestoreKey===l;if(!n||!s.current||t!==`POP`&&!r){c.current=l;return}let i=s.current.querySelector(`[data-report-id="${n.row}"]`);if(a.isFetchNextPageError){c.current=l,s.current.scrollTop=0;return}if((!i||a.data.pages.length<n.pages)&&a.hasNextPage){a.isFetchingNextPage||a.fetchNextPage();return}c.current=l,s.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[l,a.data,a.hasNextPage,a.isFetchingNextPage,a.isFetchNextPageError,a.fetchNextPage,e.state,t]);let h=t=>r(n=>(t?n.set(`q`,t.slice(0,K)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),g=u.find(e=>e.id===f)??u[0]??null,_=a.isPending?`full`:M(u.length);return(0,Z.jsx)(F,{route:`reports`,density:_,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsxs)(`div`,{ref:o,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(O,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(z,{maxLength:K,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:i,onChange:e=>h(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),a.isPending?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):a.isError&&u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.error.message}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]})}):u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(P,{icon:(0,Z.jsx)(V,{}),title:i?`No matching reports`:`No published reports yet`,description:i?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[L(),` artifact publish`]}),` `,`to list it here.`]}),actions:i?(0,Z.jsx)(A,{"data-slot":`reports-clear-search`,variant:`outline`,onClick:()=>h(``),children:`Clear search`}):(0,Z.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(j,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(re,{list:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:u.map(e=>{let t=g?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":m&&t?`true`:void 0,className:D(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,m&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:U(e),children:(0,Z.jsx)(j,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:l,filesRestoreKey:l},onClick:()=>d(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:U(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(j,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(H,{className:`shrink-0`,iso:e.createdAt,prefix:`Published · `})]})]}),m?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${U(e)}`,"aria-pressed":t,onClick:()=>p(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(te,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),a.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(A,{variant:`outline`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:`Load more reports`})}):null,_===`sparse`?(0,Z.jsx)(ne,{summary:`${u.length} published ${u.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:m&&g?(0,Z.jsx)(he,{report:g,restoreKey:l,onOpenReader:()=>d(g.id)}):null})]})})}function he({report:e,restoreKey:t,onOpenReader:n}){let r=(0,G.useContext)(u)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${U(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:U(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,(0,Z.jsx)(H,{iso:e.createdAt,prefix:`Published · `})]})]}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`shrink-0 py-1.5`,children:(0,Z.jsxs)(j,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(ge,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function ge({report:e}){let t=i(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(W,{html:n.content,title:U(e),className:`min-h-0 flex-1`})}export{pe as ReportsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Ft as t}from"./queries-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Ft as t}from"./queries-D9mg7sFY.js";import{n}from"./chunk-KS7C4IRE-BdLLx37K.js";import{A as r}from"./design-icons-QbNMZniQ.js";import{t as i}from"./switch-B9OfOEzC.js";import{t as a}from"./centered-state-N8vWM_Hw.js";import{t as o}from"./option-select-DQJEHmHf.js";import{n as s}from"./save-cue-CpHgT93o.js";import{n as c,t as l}from"./settings-field-AyinSFR_.js";import{t as u}from"./use-workspace-config-save-DDI7_WtK.js";import{r as d}from"./settings-save-bar-cyvALSgW.js";import{n as f}from"./saved-draft-BwzBc-_Y.js";var p=e(),m=1,h=16,g=16,_=1,v=60,y=5,b=256;function x(){let e=t();return e.isPending?(0,p.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,p.jsx)(a,{icon:(0,p.jsx)(r,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,p.jsx)(S,{config:e.data})}function S({config:e}){let t=u(),n=s(),r=s(),a=s(),o=s(),l=s(),m=(e,n)=>t.mutate(e,{onSuccess:n}),h=e.resources.monitoringWakeIntervalMinutes??null,g=h===null?`park`:`interval`,[x,S]=f(String(h??y)),D=Number(x),O=!Number.isInteger(D)||D<_||D>v,k=g===`interval`&&O,j=e=>m({resources:{monitoringWakeIntervalMinutes:e===`park`?null:y}},()=>{S(String(y)),a.flash()});d({dirty:h!==null&&x!==String(h),invalid:O,busy:t.isPending,save:()=>t.mutateAsync({resources:{monitoringWakeIntervalMinutes:D}}),discard:()=>S(String(h??y))});let M=e.resources.autoResumeOnUsageLimit??!0,N=e=>m({resources:{autoResumeOnUsageLimit:e}},o.flash),P=e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``,[F,I]=f(P),L=F.trim()===``?0:Number(F),R=F.trim()!==``&&(!Number.isInteger(L)||L<b);d({dirty:(e.resources.memoryLimitMb??0)!==(R?-1:L),invalid:R,busy:t.isPending,save:()=>t.mutateAsync({resources:{memoryLimitMb:L===0?null:L}}),discard:()=>I(P)});let z=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,p.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,p.jsx)(C,{maxParallel:e.resources.maxParallel,onSelect:e=>m({resources:{maxParallel:e}},n.flash),disabled:t.isPending,saved:n.saved}),(0,p.jsx)(w,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>m({resources:{maxMonitoringSessions:e}},r.flash),disabled:t.isPending,saved:r.saved}),(0,p.jsx)(T,{wakeMode:g,setWakeMode:j,wakeInterval:x,setWakeInterval:S,showInvalid:k,saved:a.saved,saveIsPending:t.isPending}),(0,p.jsx)(c,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,saved:o.saved,children:(0,p.jsx)(i,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:t.isPending,onCheckedChange:N})}),(0,p.jsx)(E,{memory:F,setMemory:I,memoryInvalid:R,saveIsPending:t.isPending}),(0,p.jsx)(A,{composerDefaults:z,saveComposerDefault:(e,t)=>m({composerDefaults:{[e]:t===`inherit`?null:t===`on`}},l.flash),saveIsPending:t.isPending,saved:l.saved})]})}function C({maxParallel:e,onSelect:t,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:r,onValueChange:e=>t(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(m,h)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,p.jsx)(n,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function w({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onValueChange:e=>n(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(0,g)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function T({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:a,saved:o,saveIsPending:s}){return(0,p.jsxs)(c,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,saved:o,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(i,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${l}`,children:`Wake interval`}),(0,p.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:_,max:v,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null]}),a?(0,p.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function E({memory:e,setMemory:t,memoryInvalid:n,saveIsPending:r}){return(0,p.jsxs)(c,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:b,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:r,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`})]}),n?(0,p.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,b,` MiB, or leave empty for no limit.`]}):null]})}var D=[{value:`inherit`,label:`Inherit environment`},{value:`on`,label:`On`},{value:`off`,label:`Off`}];function O(e,t){return Array.from({length:t-e+1},(t,n)=>({value:String(e+n),label:String(e+n)}))}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n,saved:r}){return(0,p.jsxs)(c,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,saved:r,children:[(0,p.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Autonomous by default`}),(0,p.jsx)(o,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onValueChange:e=>t(`autonomous`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Use a worktree by default`}),(0,p.jsx)(o,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onValueChange:e=>t(`worktree`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{x as ResourcesSection};
|