@hearsay-tools/squawk 0.19.0-dev.9045 → 0.19.0-dev.9065
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/built-in-cli-commands.js +1 -1
- package/dist/built-in-cli-commands.js.map +1 -1
- package/dist/cli-dispatch.d.ts +1 -1
- package/dist/cli-dispatch.js +19 -4
- package/dist/cli-dispatch.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/health.d.ts +2 -2
- package/dist/contract/hosts.d.ts +141 -0
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +140 -8
- package/dist/contract/projects.d.ts +8 -2
- package/dist/contract/workspace.d.ts +10 -0
- package/dist/core/cli-registry.d.ts +1 -0
- package/dist/core/server-hook-registry.d.ts +4 -2
- package/dist/core/server-hook-registry.js.map +1 -1
- package/dist/delegation/routes.d.ts +4 -4
- package/dist/delegation/transport.d.ts +14 -14
- package/dist/features/automations/automations-routes.d.ts +150 -150
- package/dist/features/automations/automations-routes.js +4 -3
- package/dist/features/automations/automations-routes.js.map +1 -1
- package/dist/features/automations/tools.d.ts +8 -8
- package/dist/features/hosts/cli.d.ts +8 -0
- package/dist/features/hosts/cli.js +172 -0
- package/dist/features/hosts/cli.js.map +1 -0
- package/dist/features/hosts/index.d.ts +12 -0
- package/dist/features/hosts/index.js +34 -0
- package/dist/features/hosts/index.js.map +1 -0
- package/dist/features/hosts/registry.d.ts +52 -0
- package/dist/features/hosts/registry.js +198 -0
- package/dist/features/hosts/registry.js.map +1 -0
- package/dist/features/hosts/routes.d.ts +348 -0
- package/dist/features/hosts/routes.js +113 -0
- package/dist/features/hosts/routes.js.map +1 -0
- package/dist/features/hosts/ssh-config.d.ts +9 -0
- package/dist/features/hosts/ssh-config.js +59 -0
- package/dist/features/hosts/ssh-config.js.map +1 -0
- package/dist/home/entry-authorization.js +1 -1
- package/dist/home/entry-authorization.js.map +1 -1
- package/dist/home/home.d.ts +2 -0
- package/dist/home/home.js +1 -0
- package/dist/home/home.js.map +1 -1
- package/dist/home/migration-plan.js +1 -1
- package/dist/home/migration-plan.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/runs/run-decode.d.ts +72 -72
- package/dist/serve-boot.d.ts +1 -1
- package/dist/serve-boot.js +4 -2
- package/dist/serve-boot.js.map +1 -1
- package/dist/serve-command.d.ts +2 -2
- package/dist/serve-command.js +47 -31
- package/dist/serve-command.js.map +1 -1
- package/dist/server/activity-routes.js +1 -1
- package/dist/server/activity-routes.js.map +1 -1
- package/dist/server/activity-sources.d.ts +1 -1
- package/dist/server/activity-sources.js +6 -4
- package/dist/server/activity-sources.js.map +1 -1
- package/dist/server/activity-topic.js +5 -2
- package/dist/server/activity-topic.js.map +1 -1
- package/dist/server/live-routes.d.ts +8 -7
- package/dist/server/live-routes.js +2 -2
- package/dist/server/live-routes.js.map +1 -1
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/plugin-server-hooks.js +7 -4
- package/dist/server/plugin-server-hooks.js.map +1 -1
- package/dist/server/project-context.d.ts +3 -1
- package/dist/server/project-context.js +5 -1
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/projects-routes.d.ts +107 -45
- package/dist/server/projects-routes.js +15 -8
- package/dist/server/projects-routes.js.map +1 -1
- package/dist/server/providers-routes.d.ts +16 -2
- package/dist/server/providers-routes.js +9 -4
- package/dist/server/providers-routes.js.map +1 -1
- package/dist/server/server-deps.d.ts +11 -4
- package/dist/server/server-deps.js +26 -9
- package/dist/server/server-deps.js.map +1 -1
- package/dist/server/server.d.ts +2811 -2710
- package/dist/server/server.js +23 -31
- package/dist/server/server.js.map +1 -1
- package/dist/server/start-server.js +22 -14
- package/dist/server/start-server.js.map +1 -1
- package/dist/server/workspace-identity-routes.d.ts +29 -0
- package/dist/server/workspace-identity-routes.js +21 -0
- package/dist/server/workspace-identity-routes.js.map +1 -0
- package/dist/server/workspace-live-routes.d.ts +28 -7
- package/dist/server/workspace-live-routes.js +5 -1
- package/dist/server/workspace-live-routes.js.map +1 -1
- package/dist/server/workspace-projects.d.ts +11 -8
- package/dist/server/workspace-projects.js +50 -12
- package/dist/server/workspace-projects.js.map +1 -1
- package/dist/server/workspace-routes.d.ts +1 -1
- package/dist/server/workspace-routes.js +2 -2
- package/dist/server/workspace-routes.js.map +1 -1
- package/dist/server/workspace-run-feed.d.ts +4 -4
- package/dist/server/workspace-run-feed.js +2 -0
- package/dist/server/workspace-run-feed.js.map +1 -1
- package/dist/task-cli/discovery.js +7 -0
- package/dist/task-cli/discovery.js.map +1 -1
- package/dist/workflows/continuation-admission.d.ts +72 -72
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/dist/workspace/backups.d.ts +1 -1
- package/dist/workspace/backups.js +1 -1
- package/dist/workspace/backups.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-CdmTsc7W.js +1 -0
- package/web/dist/assets/activity-motion-CrFzRrI5.js +1 -0
- package/web/dist/assets/{activity-route-DaOODJfE.js → activity-route-CGRkPwJP.js} +1 -1
- package/web/dist/assets/agent-accounts-D_7QcFSx.js +1 -0
- package/web/dist/assets/{agent-config-section-ChCUYJvh.js → agent-config-section-C6I_sRta.js} +1 -1
- package/web/dist/assets/agent-defaults-section-CiOFMcep.js +1 -0
- package/web/dist/assets/{appearance-BaKisvC2.js → appearance-CBX1qOwx.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-UIiTWcbw.js → archive-on-merge-field-BzxW7NJS.js} +1 -1
- package/web/dist/assets/ask-card-CKD_gFDN.js +9 -0
- package/web/dist/assets/attention-DnxGjw_R.js +1 -0
- package/web/dist/assets/{automations-route-CGSoXi8F.js → automations-route-CoSNUId5.js} +2 -2
- package/web/dist/assets/commit-list-CCgF6z16.js +1 -0
- package/web/dist/assets/control-locations-kCPVEtOM.js +1 -0
- package/web/dist/assets/diff-BcseHLlM.js +3 -0
- package/web/dist/assets/{diff-controls-6choyWOW.js → diff-controls-DhD4a7Z4.js} +1 -1
- package/web/dist/assets/diff-view--Nv4Px8F.js +11 -0
- package/web/dist/assets/discard-changes-dialog-CD2HMH7E.js +1 -0
- package/web/dist/assets/{file-preview-BuhO1VP-.js → file-preview-BwrymAy7.js} +2 -2
- package/web/dist/assets/{folder-browser-CUUWpb8F.js → folder-browser-Civftk0W.js} +1 -1
- package/web/dist/assets/{git-toolbar-CO6UuTb4.js → git-toolbar-CYgIbgOf.js} +1 -1
- package/web/dist/assets/{github-B889h5f5.js → github-CtYRNNDH.js} +1 -1
- package/web/dist/assets/{global-activity-route-BkpZPyJJ.js → global-activity-route-BXAhhLrt.js} +1 -1
- package/web/dist/assets/index-BUmO8olN.css +1 -0
- package/web/dist/assets/index-CXvWnyZg.js +21 -0
- package/web/dist/assets/label-feCJ3WOT.js +1 -0
- package/web/dist/assets/markdown-BAmUNyiK.js +2 -0
- package/web/dist/assets/{open-in-menu-CI3ceNjU.js → open-in-menu-Bzca0KPF.js} +1 -1
- package/web/dist/assets/{option-select-B70jYJmb.js → option-select-BxFrlK_-.js} +1 -1
- package/web/dist/assets/{preferences-section-BqkzoH2b.js → preferences-section-ByeO0I87.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-BJOWI8lQ.js → preview-pane-connected-CJy9Miri.js} +3 -3
- package/web/dist/assets/{project-location-6FRHBXD1.js → project-location-Cq1K7hXN.js} +1 -1
- package/web/dist/assets/{project-router-C53GCY_8.js → project-router-j0uBi7Ep.js} +1 -1
- package/web/dist/assets/projects-section-P0RuBn2c.js +1 -0
- package/web/dist/assets/{prompt-templates-section-D76qYrSf.js → prompt-templates-section-ChqZ2Gl4.js} +2 -2
- package/web/dist/assets/queries-CchoEEzj.js +1 -0
- package/web/dist/assets/read-state-c_RNJaXO.js +1 -0
- package/web/dist/assets/{reference-chip-95DURw1q.js → reference-chip-z7dZJVH-.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-DnWNbH2y.js → remote-settings-notice-DYOP5Yxe.js} +1 -1
- package/web/dist/assets/repo-git-DcZTZ70-.js +1 -0
- package/web/dist/assets/{report-reader-CpJLRVEU.js → report-reader-D0ud2uIA.js} +1 -1
- package/web/dist/assets/{report-selection-DAPzf1Aa.js → report-selection-BdGxjISG.js} +1 -1
- package/web/dist/assets/{reports-BfFbGW9C.js → reports-BNO0jrQI.js} +1 -1
- package/web/dist/assets/{resources-section-Dy4MvxQ3.js → resources-section-CQkpzv63.js} +1 -1
- package/web/dist/assets/review-notes-drafts-B_Mb82AK.js +1 -0
- package/web/dist/assets/review-panel-DcEmHodb.js +1 -0
- package/web/dist/assets/review-strip-En21aXDx.js +1 -0
- package/web/dist/assets/{run-detail-refresh-DYY7EWeq.js → run-detail-refresh-C5qmRdgD.js} +1 -1
- package/web/dist/assets/run-diff-BvGvPk3g.js +3 -0
- package/web/dist/assets/run-header-DE0wTSnO.js +2 -0
- package/web/dist/assets/{select-8oIZpehA.js → select--dGOlrzM.js} +1 -1
- package/web/dist/assets/selected-file-CfBWFB6p.js +1 -0
- package/web/dist/assets/{session-context-section-CZqQQJGv.js → session-context-section-b4-i_DSE.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-BaGf1RsO.js → settings-agent-picker-BhyVKLRu.js} +1 -1
- package/web/dist/assets/{settings-save-bar-Cf4yhgkq.js → settings-save-bar-9D1QPg_P.js} +1 -1
- package/web/dist/assets/{settings-shell-z82OVv2a.js → settings-shell-Ct4CWWvw.js} +1 -1
- package/web/dist/assets/{sidebar-section-qfOGEVL3.js → sidebar-section-azclPE--.js} +1 -1
- package/web/dist/assets/skills-BizIiogS.js +1 -0
- package/web/dist/assets/{tab-link-BGfSJ-ah.js → tab-link-BKlpD9sn.js} +1 -1
- package/web/dist/assets/task-changes-DjB5jujp.js +5 -0
- package/web/dist/assets/task-commits-cDkfIAvD.js +1 -0
- package/web/dist/assets/task-file-scope-DLVI8zBp.js +1 -0
- package/web/dist/assets/task-files-BVbjuEaL.js +1 -0
- package/web/dist/assets/{task-github-item-DnNiAi4a.js → task-github-item-DW5Rl7Me.js} +1 -1
- package/web/dist/assets/{task-groups-7p6Gvpg8.js → task-groups-CGCnVqHE.js} +1 -1
- package/web/dist/assets/{task-thread-DhI_-n7G.js → task-thread-DTLhAQbe.js} +2 -2
- package/web/dist/assets/task-thread-DxVehGLy.css +1 -0
- package/web/dist/assets/thread-state-VRKiUyJj.js +4 -0
- package/web/dist/assets/toaster-zMN8cNZQ.js +4 -0
- package/web/dist/assets/use-finish-run-BK7gmbXh.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-pINTYkY9.js +1 -0
- package/web/dist/assets/use-path-bases-D1yBeTzY.js +1 -0
- package/web/dist/assets/use-workspace-config-save-9jm9qV6u.js +1 -0
- package/web/dist/assets/{workflows-CRHgSxlj.js → workflows-D2h67tAS.js} +3 -3
- package/web/dist/assets/{workspace-tools-D0zfWP2r.js → workspace-tools-uIbmvTfR.js} +1 -1
- package/web/dist/assets/{worktrees-section-CtUlEBb7.js → worktrees-section-Cm1pcQ9g.js} +1 -1
- package/web/dist/index.html +17 -13
- package/web/dist/assets/accounts-section-JYR2cUD1.js +0 -1
- package/web/dist/assets/activity-motion-CNYtkGbr.js +0 -1
- package/web/dist/assets/agent-defaults-section-D36po1w1.js +0 -1
- package/web/dist/assets/attention-xl4bwNkx.js +0 -1
- package/web/dist/assets/commit-list-D5mq6f1e.js +0 -1
- package/web/dist/assets/diff-D09l13xg.js +0 -3
- package/web/dist/assets/diff-view-DpEo21jl.js +0 -11
- package/web/dist/assets/discard-changes-dialog-CV4M8057.js +0 -1
- package/web/dist/assets/index-ChOV2nBM.js +0 -21
- package/web/dist/assets/index-aGnZVJo_.css +0 -1
- package/web/dist/assets/label-DRXJ8ljY.js +0 -1
- package/web/dist/assets/markdown-C5Y3C4ot.js +0 -2
- package/web/dist/assets/projects-section-BqJfeeng.js +0 -1
- package/web/dist/assets/queries-jsRcJKo6.js +0 -1
- package/web/dist/assets/repo-git-BeRg8mHS.js +0 -1
- package/web/dist/assets/review-panel-yvq4rZum.js +0 -11
- package/web/dist/assets/run-header-Ceq-E2oX.js +0 -2
- package/web/dist/assets/skills-2MhY3En5.js +0 -1
- package/web/dist/assets/task-changes-lt1cfvG6.js +0 -1
- package/web/dist/assets/task-commits-BctQpv8y.js +0 -1
- package/web/dist/assets/task-file-scope-D5aDzxzp.js +0 -1
- package/web/dist/assets/task-files-DSBZuGO1.js +0 -1
- package/web/dist/assets/task-thread-1mNL_5FP.css +0 -1
- package/web/dist/assets/thread-state-BcHmo8Fn.js +0 -4
- package/web/dist/assets/toaster-C1BFyQ8i.js +0 -4
- package/web/dist/assets/use-hand-to-agent-state-KMwiaQ7P.js +0 -1
- package/web/dist/assets/use-path-bases-DRgUcnZ6.js +0 -1
- package/web/dist/assets/use-workspace-config-save-D2fOudMd.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{o as i}from"./dist-C_rn70hE.js";import{Dt as a,Ft as o,Nt as s,Rt as c,Wt as l,un as u,xt as d,zt as f}from"./queries-jsRcJKo6.js";import{n as p,un as m,vi as h}from"./toaster-C1BFyQ8i.js";import{n as g}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{k as _,mt as v}from"./design-icons-QbNMZniQ.js";import{t as y}from"./button-C8jUIs8Q.js";import{n as b,r as x,t as S}from"./popover-CvL6hQ5c.js";import{t as C}from"./centered-state-BgSV4e79.js";import{$t as w,Jt as T,Qt as E,Rn as D,Xt as ee,Yt as te,Zt as O,en as k,or as A,tn as j}from"./index-ChOV2nBM.js";import{t as M}from"./option-select-B70jYJmb.js";import{n as N,t as P}from"./save-cue-CpHgT93o.js";import{n as F,t as I}from"./settings-field-Bhh8I9fJ.js";import{t as L}from"./use-path-bases-DRgUcnZ6.js";import{r as R}from"./settings-save-bar-Cf4yhgkq.js";import{n as z}from"./saved-draft-BwzBc-_Y.js";import{t as B}from"./settings-list-detail-Dn5CWzHj.js";var V=t(n(),1),H=r();function U(){let e=a();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{p(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>p(e.message,{tone:`danger`})})}}function W({project:e,onOpenChange:t,onConfirm:n}){let r={home:o().data?.homeDir??null,root:null};return(0,H.jsx)(T,{open:e!==null,onOpenChange:t,children:(0,H.jsxs)(O,{children:[(0,H.jsxs)(k,{children:[(0,H.jsxs)(j,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,H.jsxs)(E,{children:[`This only unregisters the project — `,(0,H.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,e?(0,H.jsx)(D,{value:e.root,bases:r,className:`mt-1 text-xs text-foreground`}):null]})]}),(0,H.jsxs)(w,{children:[(0,H.jsx)(ee,{children:`Keep it`}),(0,H.jsx)(te,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var G=e({MaxParallelSelect:()=>$,ProjectTagsEditor:()=>Q,ProjectsSection:()=>Y,STATUS_LABEL:()=>q}),K=1,q={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function J(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Y(){let e=o(),t=d();return e.isPending||t.isPending?(0,H.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,H.jsx)(C,{icon:(0,H.jsx)(_,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,H.jsx)(X,{config:e.data,registry:t.data})}function X({config:e,registry:t}){let[n,r]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{"data-slot":`projects-section`,className:`flex w-full flex-col gap-7`,children:[(0,H.jsx)(Z,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,H.jsx)(Z,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/squawk/projects`,slot:`checkout`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,H.jsx)(ne,{registry:t,workspaceMax:e.resources.maxParallel}),(0,H.jsx)(y,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,H.jsx)(A,{open:!0,onOpenChange:r}):null]})}function Z({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,footer:o,refreshProjects:s=!1}){let c=h(),d=u({mutationFn:t=>m(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{c.setQueryData(l.config,t),e===`browseRoot`?c.invalidateQueries({queryKey:l.fsBrowseRoot}):s&&c.invalidateQueries({queryKey:l.projects})}}),[f,p]=z(t),g=f.trim();R({dirty:g!==t,invalid:g===``,save:()=>d.mutateAsync(g),discard:()=>{p(t),d.reset()}});let _=d.isError?d.error.message:null;return(0,H.jsxs)(F,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":_!==null,"data-slot":`projects-${a}-root`,value:f,disabled:d.isPending,placeholder:i,onChange:e=>{p(e.target.value),d.isError&&d.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`})}),_===null?(0,H.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:o}):(0,H.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-xs text-danger`,children:[_,` — setting unchanged`]})]})}function ne({registry:e,workspaceMax:t}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),o=U(),s=(0,V.useMemo)(()=>c(e.projects),[e.projects]);return(0,H.jsxs)(F,{wide:!0,title:`Registered projects`,hint:`Connected repositories. Removing a project only unregisters it — no files on disk are deleted.`,children:[(0,H.jsx)(B,{slot:`project-list`,label:`Projects registered in this workspace`,items:e.projects,itemKey:e=>e.id,selectedKey:i,onSelect:a,empty:(0,H.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}),row:e=>(0,H.jsx)(ie,{project:e}),detail:n=>(0,H.jsx)(ae,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:s,disabled:o.isPending,onRemove:()=>r(n)})}),(0,H.jsx)(W,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),o.confirm(e)}})]})}function re({project:e}){return(0,H.jsxs)(`span`,{"data-slot":`project-status-pill`,className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-muted px-2.5 py-0.5 text-[12px] leading-5`,children:[(0,H.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:q[e.status]}),e.status===`missing`?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:`·`}),(0,H.jsx)(`span`,{className:`text-soft-foreground`,children:e.source})]})]})}function ie({project:e}){let t=L(),n=e.tags?.length??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`settings-list-row-title min-w-0 flex-1`,children:e.name}),(0,H.jsx)(`span`,{"data-slot":`project-row-status`,className:e.status===`missing`?`shrink-0 text-[12px] text-danger`:`shrink-0 text-[12px] text-soft-foreground`,children:q[e.status]})]}),(0,H.jsxs)(`span`,{className:`settings-list-row-meta`,children:[(0,H.jsx)(D,{value:e.root,bases:t,className:`text-[12px]`}),n>0?` · ${n} tag${n===1?``:`s`}`:``]})]})}function ae({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){let o=N(),s=N(),c=L();return(0,H.jsxs)(`div`,{"data-slot":`project-row`,"data-project":e.id,className:`flex min-w-0 flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium text-foreground`,children:e.name}),(0,H.jsx)(re,{project:e})]}),(0,H.jsx)(D,{value:e.root,bases:c,wrap:!0,className:`text-xs text-soft-foreground`}),(0,H.jsxs)(`span`,{className:`text-[12px] text-soft-foreground`,children:[`Added `,J(e.addedAt)]})]}),(0,H.jsxs)(`div`,{"data-slot":`project-tags-field`,className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(`span`,{className:I,children:[`Tags `,(0,H.jsx)(P,{saved:o.saved})]}),(0,H.jsx)(Q,{project:e,vocabulary:r,onSaved:o.flash})]}),(0,H.jsxs)(`label`,{"data-slot":`project-max-parallel-field`,className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(`span`,{className:I,children:[`Max parallel tasks `,(0,H.jsx)(P,{saved:s.saved})]}),(0,H.jsx)($,{project:e,workspaceMax:n,onSaved:s.flash})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-border pt-3`,children:[e.status===`missing`?null:(0,H.jsx)(y,{asChild:!0,variant:`outline`,children:(0,H.jsx)(g,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,H.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function Q({project:e,vocabulary:t,onSaved:n}){let r=s(),[a,o]=(0,V.useState)(``),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(-1),m=(0,V.useRef)(null),h=e.tags??[],g=f(t,h,a),_=c&&g.length>0,y=t=>{r.mutate({id:e.id,tags:t},{onSuccess:()=>n?.(),onError:e=>p(e.message,{tone:`danger`})})},C=t=>{let n=t.trim().slice(0,32);if(d(-1),n){if(h.some(e=>e.toLowerCase()===n.toLowerCase())){o(``);return}if(h.length>=20){p(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}o(``),y([...h,n])}},w=e=>{y(h.filter(t=>t!==e))},T=`project-tag-suggestions-${e.id}`;return(0,H.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[h.map(t=>(0,H.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-accent-strong/15 py-px pr-1 pl-2 text-xs font-medium whitespace-nowrap text-accent-text`,children:[t,(0,H.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:r.isPending,onClick:()=>w(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,H.jsx)(v,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,H.jsxs)(S,{open:_,onOpenChange:l,children:[(0,H.jsx)(b,{asChild:!0,children:(0,H.jsx)(`input`,{ref:m,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":_,"aria-controls":_?T:void 0,"aria-autocomplete":`list`,"aria-activedescendant":_&&u>=0?`${T}-${u}`:void 0,placeholder:h.length===0?`Add tag…`:`+`,value:a,maxLength:32,disabled:r.isPending,onFocus:()=>l(!0),onBlur:()=>l(!1),onChange:e=>{if(l(!0),d(-1),e.target.value.includes(`,`)){o(e.target.value.replace(/,/g,``));return}o(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(g.length===0)return;e.preventDefault(),l(!0);let t=e.key===`ArrowDown`?1:-1,n=u+t;d(n>=g.length?-1:n<-1?g.length-1:n);return}if(e.key===`Escape`&&_){e.preventDefault(),l(!1),d(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),C(u>=0?g[u]??a:a);return}if(e.key===`Tab`){l(!1);return}if(e.key===`Backspace`&&a===``&&h.length>0){e.preventDefault();let t=h[h.length-1];t!==void 0&&w(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,H.jsxs)(x,{align:`start`,sideOffset:4,id:T,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,H.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-xs text-soft-foreground`,children:`Tags used in this workspace`}),g.map((e,t)=>(0,H.jsx)(`button`,{type:`button`,id:`${T}-${t}`,role:`option`,"aria-selected":t===u,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{C(e),m.current?.focus()},onMouseEnter:()=>d(t),className:i(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===u&&`bg-muted`),children:e},e))]})]})]})}function $({project:e,workspaceMax:t,onSaved:n}){let r=s(),i=e.maxParallel===void 0?``:String(e.maxParallel);return(0,H.jsx)(M,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:i,disabled:r.isPending,onValueChange:t=>{let i=t===``?null:Number(t);r.mutate({id:e.id,maxParallel:i},{onSuccess:()=>n?.(),onError:e=>p(e.message,{tone:`danger`})})},className:`settings-select w-full max-w-full bg-card`,options:[{value:``,label:`Inherit workspace (${t})`},...Array.from({length:16},(e,t)=>t+K).map(e=>({value:String(e),label:String(e)}))]})}export{U as a,W as i,q as n,G as r,$ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{d as n,p as r}from"./dist-C_rn70hE.js";import{$ as i,$t as a,A as o,Ai as s,Bn as c,C as l,Ct as u,D as d,Di as f,Dt as p,E as m,Et as h,F as g,Fi as _,G as v,Hn as ee,Ht as te,It as ne,J as re,Jt as ie,K as ae,Kt as oe,L as se,Mi as ce,Mt as le,N as ue,Nt as de,O as fe,Ot as pe,Pi as me,Pt as he,Q as ge,Qt as _e,Ri as ve,Rn as ye,S as be,Si as xe,Sn as Se,St as Ce,Ti as we,Tr as Te,Un as Ee,Ur as De,Vn as Oe,Vr as ke,Vt as Ae,Wn as je,Wr as Me,Wt as Ne,X as Pe,Xr as Fe,Xt as Ie,Y as Le,Yr as Re,Yt as ze,Zt as Be,_n as Ve,_t as He,a as Ue,an as We,b as Ge,bn as Ke,br as qe,bt as Je,ci as Ye,cn as Xe,ct as Ze,di as Qe,en as $e,et,fi as tt,fn as nt,gn as rt,gt as it,h as at,hi as ot,hn as st,ii as ct,in as lt,k as ut,kt as dt,li as ft,ln as pt,m as mt,mi as ht,mn as gt,n as _t,nn as vt,oi as yt,on as bt,pi as xt,pn as St,pt as Ct,q as wt,qt as Tt,si as y,sn as Et,tn as Dt,ui as Ot,v as kt,vi as b,vt as At,wt as jt,x as Mt,xi as Nt,xn as Pt,xt as Ft,y as It,yi as Lt,yn as Rt,yt as zt,zn as Bt}from"./toaster-C1BFyQ8i.js";import{A as Vt,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 Ht,j as k,z as A}from"./live-protocol-DMhTnCmf.js";function Ut(e,t){return e??t}function Wt(e,t){let n=Ut(e,t);return n===`1`||n===`true`}function Gt(e,t,n){return e?.trim()||Ut(t,n)||``}var Kt=class extends Nt{#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||qt(),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=xe({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 qt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Jt=class extends ve{#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),me(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&we(t.mutationKey)!==we(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??qt();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 Yt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Xt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Zt=class extends ve{#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||!me(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Yt(e,n).forEach(e=>{e.destroy()}),Yt(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=ce(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 Lt(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Xt(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)})})}}},j=e(t(),1);function M({queries:e,...t},n){let r=b(n),i=ot(),a=ht(),o=j.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Ye(e);let t=r.getQueryCache().get(e.queryHash);Qe(e,a,t)}),xt(a);let[c]=j.useState(()=>new Zt(r,o,t)),[l,u,d]=c.getOptimisticResult(o,t.combine),f=!i&&t.subscribed!==!1;j.useSyncExternalStore(j.useCallback(e=>f?c.subscribe(O.batchCalls(e)):s,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),j.useEffect(()=>{c.setQueries(o,t)},[o,t,c]);let p=l.some((e,t)=>Ot(o[t],e))?l.flatMap((e,t)=>{let n=o[t];return n&&Ot(n,e)?ft(n,new Lt(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=o[t];return n&&tt({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 N(e,t){let n=b(t),[r]=j.useState(()=>new Jt(n,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);let i=j.useSyncExternalStore(j.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=j.useCallback((e,t)=>{r.mutate(e,t).catch(s)},[r]);if(i.error&&_(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function P(e={}){let t=e.projectId??r();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function F(e,t={}){return{...P(t),runId:e}}function Qt(e,t=!0,n=!1,r){return y({queryKey:[P({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>de(P({projectId:e,boot:n}),{signal:t}),enabled:t,...r?{select:r}:{},placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function I(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:W.models(t),refetchType:n})}function $t(e,t=!0,n){return y({...en(e,n),enabled:t})}var en=(e,t)=>({queryKey:W.models(e,t),queryFn:({signal:n})=>je(e,{signal:n},t),staleTime:300*1e3});function tn(e,t=!0){let n=M({queries:e.map(e=>({...en(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}function nn(e,t){return JSON.stringify([e,t])}function rn(e){return e.type===`run`?e.run.id:e.id}function L(e,t){return{...e,runs:t}}function an(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}var on=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(nn(e.projectId,e.id),t))}at(e,t){return this.positions.get(nn(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 sn(e,t,n){let r=new on(e.runs),i=e,a=!1;for(let e of t)if(e.type===`usage`)i=pn(i,e.project,e.usage,r);else{let t=un(i,e.change,n,r);i=t.index,a||=t.reconcile}return{index:i,reconcile:a}}function cn(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function ln(e,t,n){return un(e,t,n,new on(e.runs))}function un(e,t,n,r){let{project:i}=t,a=r.at(i,rn(t)),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(i);if(t.type===`deleted`)return o?{index:L(e,r.remove(a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:L(e,r.remove(a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!cn(e,i,n))return{index:e,reconcile:!0};let l=ce(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||an(t,i)>e.perProjectLimit);return{index:L(e,t),reconcile:n}}if(s)return fn(e,l,r);let u=r.insert(l);return{index:L(e,u),reconcile:l.archived&&an(u,i)>e.perProjectLimit}}function dn(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 fn(e,t,n){let r=dn(e.runs,t.projectId),i=r!==void 0&&t.createdAt>r;return t.archived&&!i?{index:e,reconcile:!1}:{index:L(e,n.insert(t)),reconcile:t.archived||r===void 0||t.createdAt<r}}function pn(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=ce(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?L(e,r.runs):e}function mn(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 hn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function gn(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 _n(e){e.stream=void 0}function vn(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,rn(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function yn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function bn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function xn(e,t,n){if(!bn(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=ln(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 R=[`workspace`,`runs-index`],Sn=[`workspace`,`projects`],Cn=6e4,wn=100,Tn=new WeakMap;function En(e){let t=Tn.get(e);return t||(t=jn(e),Tn.set(e,t)),t}function Dn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:En(t).merge(e)}function On(e){let t=e.getQueryData(Sn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function kn(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 An(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 jn(e){let t=hn(),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(R,t)},h=()=>e.getQueryData(R),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:R,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:R,exact:!0}).then(()=>e.invalidateQueries({queryKey:R})):e.invalidateQueries({queryKey:R})).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=On(e),{index:s,reconcile:c}=sn(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,wn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){gn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){_n(t)},run(e,r,i=!1){if(l.has(e))return;let a=An(e,r);if(!vn(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),yn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=mn(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=xn(t,n,On(e));for(let e of l)i.index=mn(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),kn(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 Mn=k([`own`,`provider-spanning`]),Nn=x({suggested:T(x({id:D(),label:D(),desc:D()})),retired:T(D())}),Pn=x({id:k([`settings`,`mcp`,`memory`]),label:D(),note:D().optional(),empty:D().optional(),showsUserMcp:w(!0).optional()}),Fn=x({label:D(),note:D().optional(),groups:T(Pn)}),In=x({runners:T(x({id:ct,displayName:D(),modelListName:D(),modelIdScope:Mn,pickerLabel:D(),pickerDescription:D(),icon:D(),installHint:D(),loginCommand:D(),terminalLogin:E().optional(),browserLogin:E().optional(),managedInstall:w(!0).optional(),accountFolderExample:D().optional(),models:Nn,agentConfig:Fn}))}),Ln=[`workspace`,`runners`];async function Rn(e){return Ee(await Bt.api.v1.runners.$get({},c(e)),`/runners`,In)}var zn={queryKey:Ln,queryFn:({signal:e})=>Rn({signal:e}),staleTime:1/0};function Bn(){return y(zn)}function Vn(e){return e?.runners??[]}function Hn(e){return Vn(e).map(e=>e.id)}function Un(e,t){if(e!==void 0)return t.includes(e)?e:t[0]}function Wn(e){let t=Bn();return{runner:t.isSuccess?Un(e,Hn(t.data))??e:e,ready:!t.isPending}}function z(e,t){return e?.runners.find(e=>e.id===t)}function Gn(e,t){return z(e,t)?.displayName??t}function Kn(e,t){return z(e,t)?.pickerLabel??t}function qn(e,t){return z(e,t)?.modelListName}function Jn(e,t,n=!0){let i=Ii(),a=q(),{runner:o,ready:s}=Wn(e??i.data?.defaultRunner??`claude`),c=a.data?.capabilities?.localHandoff===!1?null:t,l=r(),u=y({queryKey:U.runnerSkills(o,c),queryFn:({signal:e})=>m(o,c,{signal:e,projectId:l}),enabled:n&&s&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...u,runner:o,account:c,data:u.data?.skills,list:u.data,unchecked:u.isError||!u.data||u.data.source===`unavailable`}}var Yn={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`}},Xn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function Zn(e){return typeof e==`string`&&Object.hasOwn(Yn,e)}function Qn(e){return e!==void 0&&Zn(e)?Yn[e]:void 0}var $n=`cez.reference-statuses.v1`,er=`cez.reference-conflicts.v1`,B=new Map(ir()),tr=1e3;function nr(e,t){if(B.get(e)!==t){for(B.delete(e),B.set(e,t);B.size>tr;){let e=B.keys().next().value;if(e===void 0)break;B.delete(e)}sr()}}var V=new Set(ar());function rr(e,t){if(V.has(e)!==t){if(t)for(V.add(e);V.size>tr;){let e=V.values().next().value;if(e===void 0)break;V.delete(e)}else V.delete(e);sr()}}function ir(){try{let e=globalThis.sessionStorage?.getItem($n);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`&&Zn(e[1])):[]}catch{return[]}}function ar(){try{let e=globalThis.sessionStorage?.getItem(er);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var or;function sr(){or===void 0&&(or=setTimeout(()=>{or=void 0;try{globalThis.sessionStorage?.setItem($n,JSON.stringify([...B])),globalThis.sessionStorage?.setItem(er,JSON.stringify([...V]))}catch{}},250))}var H=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function cr(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function lr(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 ur(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;nr(t,o),s!==void 0&&rr(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function dr(e,t,n){let r=H(t),i=B.get(r),a=V.has(r)?!0:void 0,o=n.data;if(o?.available){ur(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...cr(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...cr(i,a)});return}e.set(r,{state:`loading`,...cr(i,a)})}function fr(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of lr(i))dr(n,e,t)}),n}var U={get health(){return[r(),`health`]},runs:{get all(){return[r(),`runs`]},relationships:e=>[r(),`runs`,`relationships`,e],list:(e=r())=>[e,`runs`,`list`],archived:e=>[r(),`runs`,`archived`,e],detail:(e,t=r())=>[t,`runs`,`detail`,e],diff:e=>[r(),`runs`,`diff`,e],changes:e=>[r(),`runs`,`changes`,e],file:(e,t)=>[r(),`runs`,`files`,e,t],handoff:e=>[r(),`runs`,`handoff`,e],commits:e=>[r(),`runs`,`commits`,e],commit:(e,t)=>[r(),`runs`,`commit`,e,t]},get workflows(){return[r(),`workflows`]},runnerSkills:(e,t)=>[r(),`runner-skills`,e,t??null],get repo(){return[r(),`repo`]},get repoChanges(){return[r(),`repo`,`changes`]},repoCommit:e=>[r(),`repo`,`commit`,e],get repoBranches(){return[r(),`repo`,`branches`]},get uiState(){return[r(),`ui-state`]},get config(){return[r(),`config`]},get agentConfig(){return[r(),`agent-config`]},agentConfigFile:e=>[r(),`agent-config`,`file`,e],get sessionContext(){return[r(),`session-context`]},sessionContextPreview:(e,t,n=``)=>[r(),`session-context`,`preview`,t,e,n],get worktrees(){return[r(),`worktrees`]},github:(e={})=>[r(),`github`,e.limit??null],githubPages:e=>[r(),`github`,`pages`,e],githubPagesHead:e=>[r(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[r(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[r(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[r(),`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)=>[r(),`github`,`comments`,e,t],githubItem:(e,t)=>[r(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[r(),`github`,`pr-changes`,e],githubMergeState:e=>[r(),`github`,`merge-state`,e],get openTargets(){return[r(),`open-targets`]}},W={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:R,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)=>[...W.fsBrowseRoot,e,t]};function pr(){return Wt(void 0,void 0)}function G(e){return!pr()&&e}function mr(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 hr(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 gr(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 _r(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 vr(e,t){return Fe({kind:`topic`,topic:e},{value:t})}function yr(){let e=b();return y({queryKey:W.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(W.providerStatus),r=await Et(!1,{signal:t});return Te(n,e.getQueryData(W.providerStatus),r)},staleTime:5*6e4,refetchInterval:G(!1),refetchOnWindowFocus:!0})}function br(){let e=b();return N({mutationFn:()=>Et(!0),onMutate:()=>e.getQueryData(W.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(W.providerStatus,e=>Te(r,e,t)),I(e)}})}function xr(){let e=b();return N({mutationFn:({provider:e,authFailureId:t})=>rt(e,t),onMutate:()=>e.getQueryData(W.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(W.providerStatus,e=>Te(r,e,t,n.authFailureId)),I(e,n.provider)}})}function Sr(e={}){return y({queryKey:W.projects,queryFn:({signal:e})=>bt({signal:e}),...e})}function Cr(e,t=!1){return y({queryKey:W.fsBrowse(e,t),queryFn:({signal:n})=>ze(e??void 0,{signal:n,showHidden:t}),retry:!1})}function wr(){let e=b();return N({mutationFn:e=>nt(e),onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function Tr(){let e=b();return N({mutationFn:e=>gt(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:W.projects})}})}function Er(){let e=b();return N({mutationFn:e=>{let{id:t,...n}=e;return Pt(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:W.projects});let r=e.getQueryData(W.projects);return e.setQueryData(W.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Dr(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(W.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(W.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:W.projects})})}function Dr(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?[]:_r(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 Or(e){let t=b();return N({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(W.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:W.projects})})}function kr(){return Or(e=>{let{projectId:t,...n}=e;return $e(t,n)})}function Ar(){return Or(e=>{let{projectId:t,webhookId:n,...r}=e;return Se(t,n,r)})}function jr(){return Or(({projectId:e,webhookId:t})=>st(e,t))}function Mr(){return N({mutationFn:({projectId:e,webhookId:t})=>Rt(e,t),retry:!1})}function K(e){let t=b();return N({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:W.agentProfiles}),t.invalidateQueries({queryKey:W.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),I(t)])},onError:()=>{t.invalidateQueries({queryKey:U.health}),t.invalidateQueries({queryKey:W.agentProfiles,exact:!0})}})}function Nr(){return K(e=>_e(e))}function Pr(){return K(e=>{let{id:t,...n}=e;return Ke(t,n)})}function Fr(){return K(e=>St(e))}function Ir(){return K(e=>Ve(e))}function Lr(e,t){return y({queryKey:W.agentAccountStatus(e),queryFn:({signal:t})=>Dt(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Rr(){let e=b();return N({mutationFn:({provider:e,profileId:t})=>Be(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:W.agentProfiles}),e.invalidateQueries({queryKey:W.providerStatus}),I(e,n,`none`)])},onError:()=>{e.invalidateQueries({queryKey:U.health}),e.invalidateQueries({queryKey:W.agentProfiles,exact:!0})}})}function zr(){let e=b();return N({mutationFn:e=>Dt(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(W.agentAccountStatus(n),t),e.invalidateQueries({queryKey:W.agentProfiles}),I(e,t.status.provider)}})}function Br(){let e=b();return N({mutationFn:e=>Ie(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function Vr(){let e=b();return N({mutationFn:e=>a(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function Hr({enabled:e}){return y({queryKey:W.githubOwners,queryFn:({signal:e})=>lt({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Ur(){let e=b();(0,j.useEffect)(()=>{let t,r=()=>{let r=e.getQueryData(U.health);r&&(De({bootProject:r.bootProject??`default`,apiBase:n()}),t??=vr(`health`,t=>{e.setQueryData(U.health,t)}))};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),t?.(),Re()}},[e])}function q(){return y({queryKey:U.health,queryFn:({signal:e})=>We({signal:e})})}function Wr(e,t){let n=q().data,r=Sr(t).data?.projects,i=Ue(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?mr(n?.repo?.remote):void 0}function Gr(){return y({queryKey:W.uiState,queryFn:({signal:e})=>pt({signal:e})})}function Kr(){return y({queryKey:W.config,queryFn:({signal:e})=>Xe({signal:e})})}function qr(){return y({queryKey:W.agentProfiles,queryFn:({signal:e})=>vt({signal:e})})}var J=[`workspace`,`runs-index`],Y=e=>[e.cacheScope,`runs`,`list`],X=e=>[e.cacheScope,`runs`,`detail`,e.runId],Z=e=>typeof e==`function`?e():e;function Jr(e){let{seenAt:t,...n}=e;return n}function Yr(e,t){let n=Jr(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function Xr(e,t,n){return t?{...e,seenAt:n}:Jr(e)}function Zr(e){let t=()=>{e.invalidateQueries({queryKey:J})};function n(n,i){if(n===`index`)return t();let a=typeof i==`function`?i():i;if(n===`indexed`){t(),e.invalidateQueries({queryKey:[r(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(n===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=Me(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,r()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:Y(Z(n))}),await e.cancelQueries({queryKey:X(Z(n))});let i=e.getQueryData(Y(Z(n))),a=e.getQueryData(X(Z(n))),o=Z(n).runId,s=new Date().toISOString();return e.setQueryData(Y(Z(n)),e=>e?.map(e=>e.id===o?Xr(e,r,s):e)),e.setQueryData(X(Z(n)),e=>e&&Xr(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(Y(Z(n)),i),a&&e.setQueryData(X(Z(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(Y(Z(n)),e=>e?.map(e=>e.id===o?Yr(e,t):e)),a&&e.setQueryData(X(Z(n)),e=>e&&Yr(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?Xr(e,r,i.seenAt):e;e.setQueryData(Y(Z(n)),e=>e?.map(a));let s={...Z(n),runId:r?o:i.id};e.setQueryData(X(s),e=>e?a(e):i),t()}}}async function a(t,r){await e.cancelQueries({queryKey:J});let i=e.getQueryData(J),a=r();return e.setQueryData(J,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(J,i)},settle(){n(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:n}}function Q(){let e=b();return(0,j.useMemo)(()=>Zr(e),[e])}function Qr(e,t){if(!Ht(e.path))throw Error(`unsupported shared read`);let n=new URL(e.path,`http://cezar.invalid`);return n.searchParams.sort(),Fe({kind:`read`,path:`${n.pathname}${n.search}`,intervalMs:e.intervalMs},{value:t})}function $(e,t,n,r){let i=b(),a=JSON.stringify(t),o=(0,j.useMemo)(()=>JSON.parse(a),[a]);(0,j.useEffect)(()=>{if(!e||n===!1)return;let t=!0,a=Qr({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 $r(e,t=!1){return ee(await Bt.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:r(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),Oe(e,`/worker-destroy`))}function ei(){return y({queryKey:U.openTargets,queryFn:({signal:e})=>Ft({signal:e}),staleTime:5*6e4})}function ti(){return y({queryKey:U.runs.list(),queryFn:({signal:e})=>de(P(),{signal:e})})}function ni(e,t){return yt({queryKey:U.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>it({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===r()?e:void 0})}function ri(e){let t=e.trim();return y({queryKey:W.runsSearch(t),queryFn:({signal:e})=>oe(t,{signal:e}),enabled:t.length>=2,placeholderData:f,staleTime:1e4})}function ii(e=!0,t=Cn,n){let r=En(b());return $(`/api/v1/workspace/runs-index`,W.runsIndex,G(e?t:!1),Dn),y({queryKey:W.runsIndex,queryFn:({signal:e})=>he({signal:e}).then(r.merge),enabled:e,...n?{select:n}:{},staleTime:3e4,refetchInterval:!1})}function ai(e){let t=b();return N({mutationFn:({workerId:e,discardWork:t=!1})=>$r(e,t),onSettled:()=>t.invalidateQueries({queryKey:U.runs.relationships(e)})})}function oi(e,t={}){return y({queryKey:U.runs.relationships(e),queryFn:({signal:t})=>le(e,{signal:t}),enabled:t.enabled??!0})}function si(e){return y({queryKey:U.runs.detail(e??``),queryFn:({signal:t})=>Ce(F(e),{signal:t}),enabled:!!e})}function ci(e,t,n=!0,r){return y({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Ce(F(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t,...r?.staleTime===void 0?{}:{staleTime:r.staleTime},...r?.refetchOnMount===void 0?{}:{refetchOnMount:r.refetchOnMount}})}function li(e,t){return y({queryKey:t?[t,`runs`,`diff`,e??``]:U.runs.diff(e??``),queryFn:({signal:n})=>p(e,{signal:n,...t?{projectId:t}:{}}),enabled:!!e})}function ui(e,t=!1){return $(e?`/api/v1/p/${r()}/runs/${encodeURIComponent(e)}/changes`:void 0,U.runs.changes(e??``),G(t?4e3:!1)),y({queryKey:U.runs.changes(e??``),queryFn:({signal:t})=>u(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function di(e,t){return y({queryKey:U.runs.file(e??``,t??``),queryFn:({signal:n})=>pe(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function fi(e,t){return y({queryKey:[r(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Je(e,t,{signal:n}),enabled:t!==null,retry:!1})}function pi(e,t){return y({queryKey:[r(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>He(e,t,{signal:n}),enabled:t!==null,retry:!1})}function mi(e,t){return y({queryKey:[r(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>At(e,t,{signal:n}),enabled:t!==null,retry:!1})}function hi(e){return y({queryKey:[r(),`runs`,`artifacts`,e],queryFn:({signal:t})=>zt(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function gi(e,t=!1){return $(e?`/api/v1/p/${r()}/runs/${encodeURIComponent(e)}/commits`:void 0,U.runs.commits(e??``),G(t?5e3:!1)),y({queryKey:U.runs.commits(e??``),queryFn:({signal:t})=>h(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function _i(e,t){return y({queryKey:U.runs.commit(e??``,t??``),queryFn:({signal:n})=>jt(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function vi(e,t=!0){return y({queryKey:U.runs.handoff(e??``),queryFn:({signal:t})=>dt(F(e),{signal:t}),enabled:!!e&&t})}function yi(e,t,n){return y({queryKey:e===void 0?U.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>dt(F(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function bi(e,t){let n=[...new Set(e)],i=M({queries:n.map(e=>({queryKey:[e??r(),`automations`,`names`],queryFn:({signal:t})=>kt({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,j.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,i.map(e=>e.dataUpdatedAt)])])}function xi(e){let t=b();return N({mutationFn:t=>ne(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function Si(e){let t=b();return N({mutationFn:t=>Ae(e,t),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function Ci(e){let t=Q(),n=e?.projectId,r=e?.cacheScope,i=N({mutationFn:e=>ie(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,j.useCallback)(e=>({...F(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,j.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,j.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,j.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function wi(){let e=Q();return N({mutationFn:e=>ie(F(e),!1),onMutate:t=>e.patchRead(()=>F(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function Ti(e){let t=Q();return N({mutationFn:({id:t,pinned:n})=>te(F(t,e),n),onError:e=>_t(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??P(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function Ei(e,t){let n=Q();return N({mutationFn:n=>Tt(F(e,{projectId:t}),n),onMutate:()=>P({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof ye&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function Di(e,t){let n=Q();return N({mutationFn:(n={})=>Ze(F(e,{projectId:t}),n),onMutate:()=>P({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function Oi(e){let t=b();return N({mutationFn:({msgId:t,message:n})=>Ct(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function ki(e){let t=b();return N({mutationFn:t=>Ne(e,t),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function Ai(){return y({queryKey:U.workflows,queryFn:({signal:e})=>ut({signal:e})})}function ji(e){return y({queryKey:e?[e,`repo`]:U.repo,queryFn:({signal:t})=>Ge({signal:t},e)})}function Mi(e){return y({queryKey:[e,`repo`],queryFn:({signal:t})=>Ge({signal:t},e)})}function Ni(){return y({queryKey:U.repoBranches,queryFn:({signal:e})=>Mt({signal:e})})}function Pi(){return y({queryKey:U.repoChanges,queryFn:({signal:e})=>be({signal:e}),retry:!1})}function Fi(e){return y({queryKey:U.repoCommit(e??``),queryFn:({signal:t})=>l(e,{signal:t}),enabled:!!e,retry:!1})}function Ii(e){return y({queryKey:e?[e,`config`]:U.config,queryFn:({signal:t})=>It({signal:t,...e?{projectId:e}:{}})})}function Li(){return y({queryKey:U.worktrees,queryFn:({signal:e})=>o({signal:e})})}function Ri(e){return y({queryKey:[e,`worktrees`],queryFn:({signal:t})=>o({signal:t},e),staleTime:0})}function zi(e,t=!0,n=!1){return y({queryKey:[P({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>fe({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:ke(e.sidebarLimits)},enabled:t})}function Bi(){return zi(r())}function Vi(){return y({queryKey:U.agentConfig,queryFn:({signal:e})=>mt({signal:e})})}function Hi(e){return y({queryKey:U.agentConfigFile(e??``),queryFn:({signal:t})=>at(e,{signal:t}),enabled:e!==null})}function Ui(){return y({queryKey:U.sessionContext,queryFn:({signal:e})=>d({signal:e})})}function Wi(e,t,n=``){return y({queryKey:U.sessionContextPreview(e,t,n),queryFn:({signal:n})=>ue({content:e,role:t},{signal:n}),placeholderData:f,staleTime:0,retry:!1})}function Gi(){let e=b();return N({onMutate:()=>({fileKey:U.sessionContext}),mutationFn:e=>se(e),onSuccess:(t,n,r)=>{r&&e.setQueryData(r.fileKey,t)}})}function Ki(e){let t=b(),n=U.agentConfig,r=U.agentConfigFile(e);return N({mutationFn:t=>g(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}var qi=k([`passing`,`failing`,`pending`]).nullable(),Ji=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:qi.optional()});S(`available`,[x({available:w(!0),item:Ji.nullable(),labelColors:C(D(),D()).optional()}),x({available:w(!1),reason:D()})]),x({kind:k([`issue`,`pr`]),number:Vt().int().positive().safe()});var Yi=x({id:D(),title:D(),url:D()});x({available:E(),reason:D().optional(),repo:D().optional(),syncedAt:D().optional(),issues:T(Ji),prs:T(Ji),labelColors:C(D(),D()).optional(),viewerLogin:D().optional(),projects:T(Yi).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 Xi=D().min(1).max(2e3).optional();x({limit:D().optional(),refresh:D().optional(),issuesCursor:Xi,prsCursor:Xi,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(),qi)}),x({available:w(!1),reason:D()})]),x({kind:k([`issue`,`pr`]),q:D().trim().min(1).max(256),limit:Vt().int().positive().max(50).optional()}),x({available:E(),projectsReason:D().optional(),reason:D().optional(),items:T(Ji),truncated:E().optional(),labelColors:C(D(),D()).optional()});var Zi=A().nullable();S(`available`,[x({available:w(!0),prs:C(A(),qe),issues:C(A(),qe),conflicts:T(A()).optional(),recheckAfterMs:Zi}),x({available:w(!1),reason:D(),recheckAfterMs:Zi})]);var Qi=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()}),$i=k([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),ea=x({id:D(),kind:$i,actor:D(),avatarUrl:D().optional(),createdAt:D(),url:D().optional(),sha:D().optional(),message:D().optional(),checks:qi.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(Qi),truncated:E().optional(),events:T(ea).optional(),detail:x({body:D(),additions:A().int().nonnegative().optional(),deletions:A().int().nonnegative().optional()}).optional()});var ta=k([`merge`,`squash`,`rebase`]),na=x({name:D(),state:k([`passing`,`failing`,`pending`,`unknown`]),required:E().nullable(),url:D().optional()}),ra=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(na),methods:T(ta),defaultMethod:ta.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:ra}),x({available:w(!1),reason:D()})]),x({merged:w(!0),number:A(),url:D(),method:ta,mergeCommitSha:D().optional()});var ia=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(ia),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(Yi),membership:C(D(),T(D()))}),x({generation:D().uuid(),state:w(`unavailable`),reason:D()})]);function aa(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 oa(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function sa(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function ca(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){sa(t.issues,a,r),sa(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 la=e=>e.map(e=>e.number).join(`,`);function ua(e,t){let n=e[0];if(e.length>1&&n&&(la(n.issues)!==la(t.issues)||la(n.prs)!==la(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 da=class extends Error{};function fa(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await v({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new da(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>aa(e),retry:(e,t)=>!(t instanceof da)&&!(t instanceof ye&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function pa(e=50,t=!0){let n=b(),i=U.githubPages(e),a=U.githubPagesHead(e);$(`/api/v1/p/${r()}/github?limit=${e}`,a,G(t?6e4:!1));let o=yt({...fa(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),s=y({queryKey:a,queryFn:({signal:t})=>v({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:c}=o;(0,j.useEffect)(()=>{if(!s.data)return;let e=n.getQueryData(i);if(!e||e.pages.length===0)return;let t=ua(e.pages,s.data);t===`refetch`?c():n.setQueryData(i,{...e,pages:t})},[n,s.dataUpdatedAt,c]);let l=(o.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),u=M({queries:l.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>ge(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,j.useEffect)(()=>{u.forEach((e,t)=>{let r=l[t];!r||!e.data&&!e.error||n.setQueryData(i,t=>{if(!t)return t;let n=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==r||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==r?t:(n=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return n?{...t,pages:i}:t})})},[n,u.map((e,t)=>e.data||e.error?l[t]:``).join(`,`)]),{pages:o,data:(0,j.useMemo)(()=>ca(o.data?.pages??[]),[o.data])}}function ma(e,t=50,n=!0){let r=yt({...fa([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,j.useMemo)(()=>ca(r.data?.pages??[]),[r.data])}}function ha(e,t,n=!0){let r=M({queries:t.filter(e=>e.length>0).map(t=>({queryKey:U.githubCommentCounts(e,t),queryFn:({signal:n})=>wt(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,j.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 ga(e,t,n,r=!0){return y({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>et(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function _a(e,t=!0){return y({queryKey:U.githubChecks(e),queryFn:({signal:t})=>ae(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function va(e,t,n=!0){return y({queryKey:U.githubSearch(e,t),queryFn:({signal:n})=>et(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var ya=100;function ba(e){return[...e].sort((e,t)=>t-e).slice(0,ya).sort((e,t)=>e-t)}function xa(){let e=Ue(),t=q();return e.projectId??t.data?.bootProject}function Sa(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))nr(H({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))nr(H({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Ca=5*6e4;function wa(e){return e?e.recheckAfterMs:Ca}function Ta(e,t=!0){let n=(0,j.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:ba(t.prs),issues:ba(t.issues)}))},[e.map(H).sort().join(`|`)]),r=M({queries:n.map(e=>({queryKey:U.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>i(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>wa(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=b(),o=JSON.stringify(n.map((e,t)=>({...e,interval:wa(r[t]?.data)??!1})));(0,j.useEffect)(()=>{if(!t||pr())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=U.githubRefStatus(t.projectId,t.prs,t.issues);return Qr({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,j.useMemo)(()=>fr(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,j.useCallback)(e=>{let t=H(e),n=s.get(t);if(n)return n;let r=B.get(t);return{state:`idle`,...r?{status:r}:{},...V.has(t)?{conflicting:!0}:{}}},[s])}function Ea(e,t,n=!0){return y({queryKey:U.githubComments(e,t),queryFn:({signal:n})=>re(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Da(e,t,n=!0){return y({queryKey:U.githubItem(e,t),queryFn:({signal:n})=>Le(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Oa(e){return y({queryKey:U.githubPrChanges(e??0),queryFn:({signal:t})=>Pe(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{di as $,qn as $t,Li as A,Ir as At,Ci as B,mr as Bt,Ni as C,zr as Ct,Wi as D,Tr as Dt,Ui as E,Fr as Et,bi as F,Kr as Ft,Ti as G,Xn as Gt,xi as H,pr as Ht,Di as I,Gr as It,si as J,Un as Jt,ci as K,Qn as Kt,ai as L,vr as Lt,pi as M,Pr as Mt,mi as N,Er as Nt,Bi as O,jr as Ot,hi as P,Ar as Pt,li as Q,Hn as Qt,Oi as R,hr as Rt,ji as S,yr as St,Fi as T,wr as Tt,ei as U,U as Ut,wi as V,G as Vt,Si as W,W as Wt,_i as X,Vn as Xt,ui as Y,Gn as Yt,gi as Z,z as Zt,Mi as _,Hr as _t,Da as a,tn as an,Ei as at,Ki as b,Wr as bt,va as c,P as cn,Q as ct,xa as d,M as dn,Br as dt,Kn as en,vi as et,Ta as f,Kt as fn,Rr as ft,Ii as g,Cr as gt,Hi as h,kr as ht,Ea as i,I as in,ri as it,ni as j,Mr as jt,Ai as k,xr as kt,ma as l,F as ln,Lr as lt,Vi as m,Vr as mt,_a as n,Bn as nn,ti as nt,pa as o,$t as on,yi as ot,oa as p,Gt as pn,Nr as pt,ki as q,Jn as qt,ha as r,En as rn,ii as rt,Oa as s,Qt as sn,Qr as st,Sa as t,Wn as tn,oi as tt,ga as u,N as un,qr as ut,zi as v,q as vt,Pi as w,br as wt,Gi as x,Sr as xt,Ri as y,Ur as yt,fi as z,gr as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,p as i,s as a}from"./dist-C_rn70hE.js";import{A as o,C as s,Kt as c,S as l,T as u,U as d,Ut as f,bt as p,nt as m,un as h,w as g}from"./queries-jsRcJKo6.js";import{B as ee,Rn as _,T as v,f as y,n as b,ut as x,vi as S,w as C,z as te,zt as ne}from"./toaster-C1BFyQ8i.js";import{Z as w}from"./live-protocol-DMhTnCmf.js";import{g as T,h as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{c as D,f as O,i as re,t as k}from"./reference-chip-95DURw1q.js";import{D as ie,F as A,I as ae,M as oe,N as se,P as ce,Q as le,S as ue,X as de,Z as fe,c as pe,ct as me,d as he,j as ge,l as _e,n as ve,st as ye,w as be,y as xe}from"./design-icons-QbNMZniQ.js";import{t as Se}from"./createLucideIcon-BHp8sXmF.js";import{n as Ce,t as we}from"./circle-x-7nTlobAF.js";import{_ as Te}from"./nav-row-styles-CgP5uNp4.js";import{i as Ee,r as De,t as Oe}from"./git-toolbar-CO6UuTb4.js";import{t as j}from"./info-DA1x_4bz.js";import{t as ke}from"./loader-circle-CPBhhDbB.js";import{a as Ae,i as je,n as Me,r as Ne}from"./diff-controls-6choyWOW.js";import{t as M}from"./button-C8jUIs8Q.js";import{i as N,l as Pe,p as Fe,r as Ie,t as Le}from"./dropdown-menu-DjtKUK8F.js";import{a as Re,i as ze,n as Be,o as Ve,r as He,s as Ue,t as We}from"./dialog-DRZuXvul.js";import{t as P}from"./project-router-C53GCY_8.js";import{t as Ge}from"./status-dot-BXf-Ubd0.js";import{c as Ke,d as qe,f as Je,m as F,n as Ye,s as Xe,t as Ze}from"./page-shell-Dky5crRl.js";import{a as Qe,o as $e}from"./format-BU7D3IfE.js";import{t as I}from"./centered-state-BgSV4e79.js";import{$t as L,Bn as et,Bt as R,E as z,Ft as tt,Gt as nt,Ht as B,It as rt,Jt as V,Kt as it,Lt as at,Nt as ot,Pn as st,Pt as ct,Qt as H,Rn as lt,Rt as ut,T as dt,Ut as ft,Vt as pt,Wt as mt,Xt as U,Yt as W,Zt as G,ar as K,en as q,fr as ht,qt as gt,tn as J,vn as _t,xr as vt,yr as yt,zn as bt,zt as xt}from"./index-ChOV2nBM.js";import{t as St}from"./markdown-BBDDg-4t.js";import{t as Ct}from"./diff-D09l13xg.js";import{t as wt}from"./change-counts-wqSYI3W8.js";import{t as Tt}from"./code-workbench-CUkiQ1pF.js";import{t as Et}from"./file-text-nGpo7MVd.js";import{i as Dt,n as Ot,r as kt}from"./commit-list-D5mq6f1e.js";var Y=e(t(),1);function At(e,t){let n=S(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(w.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var jt=Se(`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=Se(`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=i(),t=l(),n=S(),a=At({queryKey:f.repo})>0,o=t.data?.info?t.data:null,s=ot(e,o,`screen`);return(0,X.jsx)(qe,{route:`repo-git`,density:o?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,X.jsx)(Ke,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:a,onClick:()=>{n.invalidateQueries({queryKey:f.repo}),n.invalidateQueries({queryKey:f.worktrees})},children:(0,X.jsx)(fe,{size:17,"aria-hidden":`true`,className:r(`size-[17px]`,a&&`motion-safe:animate-spin`)})})},children:(0,X.jsxs)(`div`,{"data-slot":`git-screen`,children:[o?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)(rt,{scope:e,repo:o,info:o.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)(ct,{branch:o?.info?.branch??null,counts:s,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)(Ke,{ref:r,variant:`primary`,"data-action":`new-branch`,disabled:R(i())&&!t,onClick:()=>n(!0),children:[(0,X.jsx)(de,{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=xt(i()),a=R(i()),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),u=o.trim(),d=Pt(u),f=d??c;return(0,X.jsx)(We,{open:!0,onOpenChange:e=>{!e&&!r.isPending&&n()},children:(0,X.jsx)(He,{"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(),!(!u||d||a)&&(l(null),r.mutate(u,{onSuccess:n,onError:e=>l(e.message)}))},children:[(0,X.jsxs)(Ve,{children:[(0,X.jsx)(Ue,{children:`New branch`}),(0,X.jsxs)(ze,{"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)(Be,{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)(K,{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:o,"aria-invalid":f?!0:void 0,"aria-describedby":f?`new-branch-name-hint`:void 0,onChange:e=>{s(e.target.value),l(null)}}),f?(0,X.jsx)(`p`,{id:`new-branch-name-hint`,"data-slot":d?`branch-name-hint`:`branch-create-refusal`,role:`alert`,className:`text-xs text-danger`,children:f}):null]}),(0,X.jsxs)(Re,{children:[(0,X.jsx)(M,{type:`button`,variant:`outline`,className:`min-h-11`,disabled:r.isPending,onClick:n,children:`Cancel`}),(0,X.jsx)(M,{type:`submit`,variant:`primary`,className:`min-h-11`,"data-action":`create-branch`,disabled:!u||d!==null||a,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=s(),a=new Map((n.data?.branches??[]).map(e=>[e.name,e])),o=n.data?.base??e.baseBranch??t.branch,c=xt(i(),e=>b(e.message,{tone:`danger`})),l=R(i()),[u,d]=(0,Y.useState)(``),f=u.trim().toLowerCase(),p=Gt(e,n.data?.branches),m=f?p.filter(e=>e.toLowerCase().includes(f)):p;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)(le,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,X.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:u,onChange:e=>d(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:[m.map(e=>{let n=e===t.branch,i=a.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)(P,{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:r(`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:o}):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)(M,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:l,onClick:()=>c.mutate(e),children:[(0,X.jsx)(ge,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),m.length===0?(0,X.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,u.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:ae,className:`border-success/40 text-semantic-green`},draft:{icon:A,className:`border-border text-muted-foreground`},merged:{icon:se,className:`border-merged-strong/35 text-merged-text`},closed:{icon:ce,className:`border-danger/40 text-semantic-red`}};function Vt({pr:e}){let{icon:t,className:n}=Bt[e.state],i=(0,X.jsxs)(`span`,{className:r(`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})]}),o=`inline-flex shrink-0 items-center rounded-[4px] max-md:min-h-11 no-hover:min-h-11`;return a(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:r(o,`group focus-visible:outline-2 focus-visible:outline-ring`),children:i}):(0,X.jsx)(`span`,{"data-slot":`branch-pr`,"data-pr-state":e.state,className:o,children:i})}function Ht({checks:e}){let t=e===`passing`?Ce:e===`failing`?we:yt;return(0,X.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:r(`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:r(`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=g(),t=F(),[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 _&&e.error.status===409,f=e.data?.files??[],p=(0,Y.useMemo)(()=>De(f),[f]),m=(0,Y.useMemo)(()=>f.some(St),[f]),h=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)(I,{icon:d?(0,X.jsx)(be,{size:16}):(0,X.jsx)(me,{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)(I,{icon:(0,X.jsx)(be,{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]:min-h-11`,children:[e.data?(0,X.jsx)(Oe,{stat:e.data.stat}):null,(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[m&&o?(0,X.jsx)(je,{}):null,m?(0,X.jsx)(`span`,{className:`max-md:hidden`,children:(0,X.jsx)(Ae,{preview:o,onPreviewChange:s})}):null,(0,X.jsx)(Ne,{mode:n,wrap:i,onModeChange:r,onWrapChange:a,disabled:m&&o}),(0,X.jsx)(Me,{wrap:i,onWrapChange:a,preview:o,onPreviewChange:m?s:void 0,disabled:m&&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)(Ee,{root:p,selected:c,onSelect:e=>{l(e),u.current?.scrollToPath(e)}})]}),children:(0,X.jsx)(Ct,{files:f,viewRef:u,mode:h,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}=E(),r=F(),i=e.log,a=(0,Y.useMemo)(()=>gt(i),[i]);if(n&&(!r||i.length===0))return(0,X.jsx)(Qt,{sha:n});let o=ft(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)(I,{icon:(0,X.jsx)(oe,{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:r(`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)(P,{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:it(e.when,e.at),children:nt(e.when,e.at)})]})]})]}),(0,X.jsx)(Yt,{source:e.source,stacked:n})]})}function Yt({source:e,stacked:t}){let n=r(`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)(P,{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:r(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)(se,{"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)(pe,{"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=ut(i(),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)(ke,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(ve,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(at,{checkout:n,returnFocus:r})]})}function Zt({sha:e}){return(0,X.jsx)(Dt,{commit:u(e),sha:e,slot:`repo-commit-preview`,loadFileText:t=>Et(()=>C(e,t))})}function Qt({sha:e}){return(0,X.jsx)(kt,{commit:u(e),sha:e,backTo:pt,backLabel:`All recent commits`,slot:`repo-commit`,loadFileText:t=>Et(()=>C(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=s(),t=m(),n=i(),r=p(),[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)(I,{icon:(0,X.jsx)(me,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let c=en(e.data.branches),l=c.reduce((e,t)=>e+t.rows.length,0),u=tn(e.data.branches),d=u>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)(j,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,X.jsxs)(`span`,{children:[u,` finished task`,u===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,u===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,X.jsx)(P,{to:B.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,f=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,X.jsxs)(re,{projectId:n,repoBase:r,requests:c.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,{}),d,c.length===0?(0,X.jsx)(Ze,{icon:(0,X.jsx)(ht,{size:16}),title:u>0?`Nothing else waiting to land`:`Everything landed`,description:u>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)(M,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(P,{to:B.cleanup,children:`Check cleanup`})}),(0,X.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(P,{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:c.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?f.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)(j,{"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.`]}),l<=3?(0,X.jsx)(Ye,{summary:`${l} ${l===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,X.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(P,{to:B.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:r(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,X.jsx)(j,{"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)(k,{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=S(),i=e.class===`orphan`,a=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,o=!i&&e.runId!==null&&!a,s=h({mutationFn:()=>x(e.runId),onSuccess:e=>{b(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:f.repoBranches}),n.invalidateQueries({queryKey:f.runs.all})},onError:e=>b(e instanceof _&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),[c,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)(P,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:r(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:r(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(Mt,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,i?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,"data-copied":c||void 0,"aria-live":`polite`,onClick:d,className:r(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[c?(0,X.jsx)(_e,{"aria-hidden":`true`}):(0,X.jsx)(xe,{"aria-hidden":`true`}),c?`Copied`:`Copy branch`]}):null,(0,X.jsxs)(Le,{children:[(0,X.jsx)(Fe,{"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)(ue,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(Ie,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(N,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(P,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,X.jsx)(N,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,X.jsx)(N,{className:r(!i&&`md:hidden`),onSelect:d,children:`Copy branch`}),(0,X.jsx)(Pe,{className:`md:hidden`}),(0,X.jsx)(N,{"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=Qe(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)(Te,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,X.jsx)(Ge,{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)(P,{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)(P,{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=c(D(`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=S(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=h({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:f.repo}),s()},onError:e=>b(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,X.jsx)(V,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(G,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(q,{children:[(0,X.jsxs)(J,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(H,{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:[l,` 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(),c&&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)(K,{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)(L,{children:[(0,X.jsx)(U,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(W,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function dn({base:e}){let t=s(),n=S(),[r,i]=(0,Y.useState)({merged:!1,empty:!1}),[a,o]=(0,Y.useState)(!1),c=(t.data?.branches??[]).filter(e=>e.class===`merged`),l=(t.data?.branches??[]).filter(e=>e.class===`empty`),u=[...c,...l],d=h({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:f.repo})},onError:e=>{n.invalidateQueries({queryKey:f.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 p=u.length,m=`branch${p===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 · `,p]}),(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:p===0||d.isPending,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)(ye,{"aria-hidden":`true`,className:`size-[12px]`}),d.isPending?`Deleting…`:`Delete ${p} ${m}`]})]}),(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:c,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,X.jsx)(fn,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:l,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(V,{open:a,onOpenChange:o,children:(0,X.jsxs)(G,{children:[(0,X.jsxs)(q,{children:[(0,X.jsxs)(J,{children:[`Delete `,p,` `,m,`?`]}),(0,X.jsxs)(H,{children:[c.length,` merged into `,e,` and `,l.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)(L,{children:[(0,X.jsx)(U,{children:`Keep them`}),(0,X.jsxs)(W,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{d.mutate(u.map(e=>e.name)),o(!1)},children:[`Delete `,p,` `,m]})]})]})})]})}function fn({kind:e,title:t,hint:n,rows:i,open:a,onToggle:o}){let s=`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":a,"aria-controls":s,disabled:i.length===0,onClick:o,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,` · `,i.length]}),(0,X.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n})]}),i.length>0?(0,X.jsx)(he,{"aria-hidden":`true`,className:r(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}):null]}),a?(0,X.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:i.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)(P,{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 ${O(t)} now`:`Reclaim ${e} now`}function vn(e,t,n){let r=t?O(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?` (${O(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)(vt,{"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)(V,{open:e,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(G,{children:[(0,X.jsxs)(q,{children:[(0,X.jsx)(J,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(H,{children:[n,` finished worktree`,n===1?``:`s`,` beyond the keep limit`,r?` (${O(r)})`:``,` `,n===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(L,{children:[(0,X.jsx)(U,{children:`Keep them`}),(0,X.jsx)(W,{"data-action":`worktrees-confirm`,onClick:a,children:i})]})]})}),(0,X.jsx)(V,{open:o!==null,onOpenChange:e=>{e||s()},children:(0,X.jsxs)(G,{children:[(0,X.jsxs)(q,{children:[(0,X.jsx)(J,{children:`Discard changes and reclaim worktrees?`}),(0,X.jsx)(H,{children:o?(0,X.jsxs)(X.Fragment,{children:[o.length,` finished worktree`,o.length===1?``:`s`,` beyond the keep limit`,f?` (${O(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)(L,{children:[(0,X.jsx)(U,{children:`Keep them`}),(0,X.jsx)(W,{"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)(V,{open:l!==null,onOpenChange:e=>{e||u()},children:(0,X.jsxs)(G,{children:[(0,X.jsxs)(q,{children:[(0,X.jsx)(J,{children:`Discard changes and reclaim worktree?`}),(0,X.jsx)(H,{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)(L,{children:[(0,X.jsx)(U,{children:`Keep it`}),(0,X.jsx)(W,{"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=o(),t=d().data?.targets.find(e=>e.id===`finder`),n=h({mutationFn:e=>ne(e,t.id),onError:e=>b(e.message,{tone:`danger`})}),r=S(),[i,a]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(null),p=()=>Promise.all([r.invalidateQueries({queryKey:f.worktrees}),r.invalidateQueries({queryKey:f.repoBranches})]),m=h({mutationFn:({runIds:e})=>ee(e?{discardWork:!0,runIds:e}:void 0),onSuccess:(e,{expected:t,runIds:n})=>{p(),b(gn(e.reclaimed.length,t,!!n))},onError:e=>b(e.message,{tone:`danger`})}),g=h({mutationFn:({worktree:e,discardWork:t})=>te(e.runId,t?{discardWork:!0}:void 0),onSuccess:(e,{worktree:t})=>{p(),b(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{p(),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:_,totalBytes:v,keep:y}=e.data,x=m.isPending||g.isPending,C=_.filter(e=>e.pastKeep),w=C.filter(e=>!e.reclaimBlocker),T=C.filter(e=>e.reclaimBlocker!==null),E=w.length>0,D=$(w),re=$(C),k=_n(w.length,D),ie=vn(C.length,re,E),A=v?O(v):null,ae=bn(y);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:[ae.prefix,(0,X.jsx)(P,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:_t(`worktrees`,` › `)}),ae.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:x||!E,title:yn(E,T.length),onClick:()=>a(!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)(vt,{"aria-hidden":`true`,className:`size-[12px]`}),k]})]}),T.length>0?(0,X.jsx)(xn,{blocked:T,discardLabel:ie,disabled:x,onDiscard:()=>c(C)}):null,_.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:_.map(e=>(0,X.jsx)(En,{worktree:e,keep:y,disabled:x,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>{e.reclaimBlocker?u(e):g.mutate({worktree:e,discardWork:!1})}},e.runId))}),(0,X.jsx)(Sn,{confirmClean:i,onCloseClean:()=>a(!1),cleanCount:w.length,cleanBytes:D,reclaimLabel:k,onConfirmClean:()=>{m.mutate({expected:w.length}),a(!1)},discardBatch:s,onCloseDiscardBatch:()=>c(null),onConfirmDiscardBatch:e=>{m.mutate({expected:e.length,runIds:e.map(e=>e.runId)})},discardRow:l,onCloseRow:()=>u(null),onConfirmRow:e=>g.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:i,opening:a,onReclaim:o}){let s=Tn(e,t),c=Qe(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${$e(c)}`:e.status,u=s.tone===`in-use`?`text-status-running`:s.tone===`blocked`?`text-danger`:`text-soft-foreground`,d=e.reclaimBlocker?`Cannot auto-reclaim: ${mn(e.reclaimBlocker)}`:void 0,f=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.state,title:d,className:r(`text-xs`,u),children:s.label}),p=`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`,m=e.reclaimBlocker?`Discard changes and reclaim the worktree of ${e.title} (branch kept)`:`Reclaim the worktree of ${e.title} (branch kept)`,h=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),` · `,l,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:O(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:f}),i?(0,X.jsx)(`button`,{type:`button`,className:p,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:a,onClick:i,children:(0,X.jsx)(ie,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":m,title:h,disabled:n,onClick:o,className:r(p,e.reclaimBlocker&&`text-danger hover:text-danger`),children:(0,X.jsx)(vt,{"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=l(),r=F(),[i]=T(),a=Dn(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,X.jsx)(Nt,{});if(n.isPending)return(0,X.jsx)(dt,{});if(n.isError)return(0,X.jsx)(Xe,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,X.jsx)(z,{}),children:(0,X.jsx)(I,{icon:(0,X.jsx)(me,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let o=n.data.info;return o?(0,X.jsx)(kn,{repo:n.data,info:o,section:e}):(0,X.jsx)(Xe,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,X.jsx)(z,{}),children:(0,X.jsx)(I,{icon:(0,X.jsx)(ge,{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),i=s(),a=An(n),o=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?Gt(e,i.data?.branches).length:n===`not-landed`?i.data?.branches.filter(e=>e.class===`not-landed`||e.class===`orphan`).length??0:4;return(0,X.jsx)(Xe,{template:r,route:`repo-git`,density:n===`not-landed`&&i.isPending?`full`:Je(o),rootProps:{"data-git-section":n},beforeHeader:(0,X.jsx)(z,{}),header:{title:a?.title??tt(n,t.branch),headerSlot:`repo-header`,subtitle:a?(0,X.jsxs)(X.Fragment,{children:[`Commit `,a.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}=E(),n=F(),r=e===`main`&&!n?t:void 0,i=u(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?` · ${mt(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,s().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{On as RepoGitRoute};
|
|
@@ -1,11 +0,0 @@
|
|
|
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,o as i,s as a}from"./dist-C_rn70hE.js";import{Jt as o,N as s,Q as c,Qt as l,St as u,Ut as d,Yt as f,ct as p,g as m,ln as h,nn as g,un as _}from"./queries-jsRcJKo6.js";import{Rn as v,ct as y,ht as b,mr as x,n as S,or as C,ut as w,vi as T}from"./toaster-C1BFyQ8i.js";import{f as E,n as D,p as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{I as te,J as O,Q as k,V as A,c as ne,d as j,l as M,mt as re,pt as ie,st as ae,y as oe}from"./design-icons-QbNMZniQ.js";import{t as N}from"./createLucideIcon-BHp8sXmF.js";import{t as se}from"./check-OP-CVgZG.js";import{t as ce}from"./chevron-right-BENZ-1ZN.js";import{t as le}from"./external-link-BE6y205O.js";import{t as ue}from"./eye-B8okNWXU.js";import{n as de}from"./smartphone-Lr8Ug2z_.js";import{t as fe}from"./loader-circle-CPBhhDbB.js";import{t as pe}from"./message-square-B-MD-8rD.js";import{n as me,t as he}from"./tool-display-B9NN44oU.js";import{t as ge}from"./square-terminal-B6RYYieR.js";import{t as P}from"./button-C8jUIs8Q.js";import{n as F,r as I,t as L}from"./collapsible-Bx2vViFx.js";import{t as R}from"./project-router-C53GCY_8.js";import{O as _e}from"./task-groups-7p6Gvpg8.js";import{a as ve,c as ye,i as be,l as xe,o as Se,s as Ce,t as we}from"./report-selection-DAPzf1Aa.js";import{n as Te}from"./centered-state-BgSV4e79.js";import{L as Ee,Q as De,Tn as Oe,an as ke,bn as Ae,br as je,gn as Me,ln as Ne,lr as Pe,mr as z,sn as Fe,yn as Ie}from"./index-ChOV2nBM.js";import{i as Le,r as Re}from"./highlighter-Cfo7mLVB.js";import{t as ze}from"./zoomable-image-BUTgYpld.js";import{i as Be,r as Ve,t as B}from"./markdown-C5Y3C4ot.js";import{r as He}from"./html-report-BX3msvci.js";import{t as V}from"./textarea-vEsJAUAV.js";import{t as Ue}from"./task-file-scope-D5aDzxzp.js";import{t as We}from"./report-title-D4Mbu2Er.js";var Ge=N(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Ke=N(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),qe=N(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Je=N(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ye=N(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Xe=N(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),H=e(t(),1),U=n();function Ze(e,t){if(e.length===1)return[t.replace(RegExp(`^${Qe(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $e(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var et=`
|
|
2
|
-
|
|
3
|
-
Additional comments:
|
|
4
|
-
`;function tt(e){let t=e.indexOf(et);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function nt({ask:e}){let t=e.answer===void 0?void 0:tt(e.answer),n=t===void 0?void 0:Ze(e.questions,t.body);return(0,U.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=$e(t,i),o=i!==void 0&&a.length===0;return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,U.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,U.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,U.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,U.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,U.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,U.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,U.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,U.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,U.jsx)(W,{text:i}):null]})]}):i===void 0?null:(0,U.jsx)(W,{text:i})]},t.id??r)}),n&&t?.comment?(0,U.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,U.jsx)(W,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,U.jsx)(W,{text:e.answer}):null]})}function W({text:e}){return(0,U.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function G(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function rt(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function it({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,U.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,U.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:a}):null,(0,U.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,U.jsxs)(P,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,U.jsx)(z,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,U.jsx)(dt,{onShowOrigin:l}):null,r?(0,U.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,U.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,U.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function at({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,U.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,a)=>{let s=t===a,c=G(a,n,r);return(0,U.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,U.jsx)(se,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,U.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,U.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:a?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(Ye,{"aria-hidden":`true`,className:`size-3`}),(0,U.jsx)(`span`,{children:`Comment`})]})]})}function ot({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,H.useId)();return(0,U.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,U.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,U.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,U.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=G(r,t,n);return(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,U.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:rt(r,t,n)})]},e.id??r)})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,U.jsx)(V,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function st({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,H.useId)();return r?(0,U.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,U.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,U.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,U.jsx)(V,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function ct({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,U.jsxs)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,U.jsx)(je,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,U.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,a=G(n,p,m);return(0,U.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,U.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,U.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,U.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,U.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,U.jsxs)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:l,children:[`Next`,(0,U.jsx)(ce,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:s||!r,onClick:d,children:v}):null]})]})}function lt({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,U.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 min-w-11 px-2 text-xs text-muted-foreground hover:text-foreground md:min-h-8 md:min-w-0`,onClick:s,children:[(0,U.jsx)(Ye,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,U.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,U.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function ut({blockedBy:e,reason:t,error:n}){return(0,U.jsxs)(U.Fragment,{children:[t?(0,U.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function dt({onShowOrigin:e,className:t}){return(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,t),children:`Show where it was asked`})}function ft({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,H.useRef)(!1);return(0,U.jsx)(be,{open:e,onOpenChange:t,children:(0,U.jsxs)(Se,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,U.jsxs)(ye,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,U.jsx)(xe,{children:`Question context`}),(0,U.jsx)(Ce,{children:`Your selections and drafts stay intact while you read.`}),(0,U.jsx)(ve,{asChild:!0,children:(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2 size-11 md:size-9`,children:(0,U.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,U.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,U.jsx)(Ue,{runId:n,children:(0,U.jsx)(B,{breaks:!0,children:r})})}),i?(0,U.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,className:`min-h-11 md:min-h-8`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function pt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mt=/^[A-Za-z0-9_./:=+,@%-]+$/;function ht(e){return e.replaceAll(`'`,`'\\''`)}function gt(e){return e===``?`''`:mt.test(e)?e:`\u0027${ht(e)}\u0027`}function _t(e){if(!pt(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(gt).join(` `)}}function vt(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function yt(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function bt(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function K(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function xt(e){let t=vt(yt(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))K(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){K(e[2])&&i.push({label:bt(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:bt(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&K(t)&&i.push({label:t,href:t})}return i}var St=(0,H.createContext)(void 0),Ct=(0,H.createContext)(void 0);function wt(e,t){let n=new Map;for(let r of xt(e)){let e=Be(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Tt(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Et({text:e,messageKey:t}){let n=(0,H.useContext)(Ve),r=(0,H.useContext)(Ct),i=t??r;if(!n||i===void 0)return null;let a=wt(e,n);return a.length===0?null:(0,U.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,U.jsx)(Dt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Dt({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,H.useContext)(St),c=(0,H.useContext)(we);(0,H.useLayoutEffect)(()=>c?.register(n,r),[c,n,r]);let l=s(r,n),u=E(),d=ee();if(l.isError)return(0,U.jsx)(D,{id:Tt(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=l.data?.artifact;if(f&&!He(f.name))return null;let p=new URLSearchParams(u.search);p.set(`report`,n),p.set(`card`,t);let m=new URLSearchParams(u.search).has(`report`)?u.state:null,h=new URLSearchParams(u.search);h.delete(`report`),h.delete(`card`);let g=`${u.pathname}${h.size?`?${h}`:``}`,_=window.navigation,v={reportCardEntry:!0,reportReturnTo:m?.reportReturnTo??g,reportReturnKey:m?.reportReturnKey??_?.currentEntry?.key,reportScrollTop:m?.reportScrollTop},y={pathname:u.pathname,search:`?${p}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,U.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":l.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,U.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?We(f):i}),(0,U.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,U.jsx)(D,{id:Tt(t,n),to:y,state:v,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=v.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;d(y,{state:{...v,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${l.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Ot={message:!0,reasoning:!0,tool:!0,hook:!0};function kt(e){return Object.hasOwn(Ot,e)&&Ot[e]}var At=e=>e.kind===`tool`,jt=e=>e.kind===`conversation`,Mt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Nt=(e,t,n)=>`${e} ${e===1?t:n}`;function Pt(e,t){let n=[];return e>0&&n.push(Nt(e,`file`,`files`)),t>0&&n.push(Nt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Ft(e){return`${e} earlier tool call${e===1?``:`s`}`}var It=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Lt(e){for(let t of It)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var Rt=new WeakMap;function zt(e){let t=Rt.get(e);if(t)return t;let n=Bt(e);return Rt.set(e,n),n}function Bt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(At).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=kt(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Pt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of Vt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(jt(e)){s(),c.push(e);continue}l(),At(e)&&Mt(e)&&!r.has(e.id)?o.push(e):(s(),At(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function Vt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var Ht=new Map,Ut=(0,H.createContext)(null);function Wt(){return(0,H.useContext)(Ut)}function Gt({runId:e,children:t}){let n=(0,H.useMemo)(()=>({get:t=>Ht.get(e)?.get(t),set:(t,n)=>{let r=Ht.get(e)??new Map;r.set(t,n),Ht.set(e,r)}}),[e]);return(0,U.jsx)(Ut.Provider,{value:n,children:t})}function Kt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function qt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Jt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Yt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Xt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Zt=new Map;function Qt(e,t){Zt.set(e,t)}function $t(e){return Zt.get(e)}var en=new Map;function tn(e,t){en.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function nn(e){return en.get(e)}function rn(e,t,n){let r=en.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var an=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),on=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),sn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),cn=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),ln=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function q(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function J(e){let t=q(e);return t===void 0?void 0:an.format(t)}function un(e){let t=q(e);return t===void 0?void 0:on.format(t)}var Y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function dn(e){let t=q(e);return t===void 0?void 0:Y(t)}function fn(e,t=new Date){let n=q(e);if(n===void 0)return;let r=Y(n);return r===Y(t)?`Today`:r===Y(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?sn:cn).format(n)}function pn(e,t){let n=q(e),r=q(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function mn({ts:e}){let t=J(e);return t===void 0?null:(0,U.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:un(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function hn({startedAt:e,completedAt:t}){let n=J(t);if(n===void 0)return null;let r=pn(e,t);return(0,U.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,U.jsx)(`time`,{dateTime:t,title:un(t),children:n}),r===void 0?null:(0,U.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function gn({ts:e}){let t=fn(e),n=q(e);if(t===void 0||n===void 0)return null;let r=ln.format(n);return(0,U.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,U.jsx)(`time`,{dateTime:dn(e),title:r,children:t}),(0,U.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var _n={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function vn({note:e}){return e.icon===`handoff`?(0,U.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,U.jsx)(Pe,{className:`size-3`})}),(0,U.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,U.jsxs)(L,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,U.jsxs)(I,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,U.jsx)(j,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,U.jsx)(F,{children:(0,U.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,U.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,U.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[_n[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,U.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var yn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function X({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=yn[e],c=r===void 0?void 0:J(r);return(0,U.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,U.jsxs)(`p`,{className:i(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,U.jsx)(pe,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,U.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,U.jsx)(mn,{ts:r})})]}),(0,U.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var bn=[],xn=(0,H.memo)(function({text:e,imageCount:t=0,images:n=bn,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(e),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(),y=()=>{m(e),v(void 0),f(!0)},b=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,U.jsxs)(X,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,U.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,U.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void b(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,U.jsx)(fe,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,U.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,U.jsxs)(X,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,U.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,U.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(Xe,{className:`size-3.5`})}):null,o?(0,U.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(ae,{className:`size-3.5`})}):null]}):null,_?(0,U.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,U.jsx)(B,{breaks:!0,children:e}),n.length>0?(0,U.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>x(e.split(`/`).pop()??``)?(0,U.jsx)(ze,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,U.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,U.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),Sn=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Cn=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function wn(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Cn).forEach(e=>e.remove());let r=xt(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!K(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Tn(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=wn(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var En=(0,H.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,H.useRef)(null),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),c=(0,H.useRef)(null);(0,H.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Tn(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,U.jsxs)(X,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,U.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Sn,children:[(0,U.jsx)(oe,{className:`size-3.5`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Sn,children:[(0,U.jsx)(z,{className:`size-3.5`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,U.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,U.jsx)(`div`,{ref:r,children:(0,U.jsx)(B,{breaks:!0,children:e})}),(0,U.jsx)(Et,{text:e,messageKey:n})]})});function Dn({incident:e}){let t=g().data;if(!t)return null;let n=f(t,e.provider);return(0,U.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,U.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var On=(0,H.memo)(function({text:e}){let t=(0,H.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
5
|
-
`,1)[0]??``,r=n.length<e.length;return(0,U.jsxs)(L,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,U.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,U.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,U.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,U.jsx)(B,{inline:!0,children:n})}),r?(0,U.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,U.jsx)(I,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,U.jsx)(F,{children:(0,U.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,U.jsx)(B,{children:e})})})]})});function kn(){return(0,U.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,U.jsx)(fe,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,U.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var An={read:z,edit:Xe,delete:ae,move:Je,search:k,execute:ge,think:Ke,fetch:de,task:ne,plan:A,other:ie},jn=e=>e.split(`
|
|
6
|
-
`).length;function Mn({text:e,streaming:t}){let[n,r]=(0,H.useState)(!1),a=(0,H.useRef)(null),o=(0,H.useRef)(!0);(0,H.useEffect)(()=>{let e=a.current;t&&e&&o.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=jn(e),c=!t&&!n&&s>12;return(0,U.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`div`,{ref:a,onScroll:t?e=>{o.current=Yt(e.currentTarget)}:void 0,className:i(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,U.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,U.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&s>12?(0,U.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${s} lines`}):null]})}function Nn({diffs:e}){return(0,U.jsx)(U.Fragment,{children:e.map((e,t)=>(0,U.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-xs wrap-anywhere text-muted-foreground`,children:e.path}),(0,U.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Pn(e.oldText).map((e,t)=>(0,U.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Pn(e.newText).map((e,t)=>(0,U.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
7
|
-
`).map((e,t)=>(0,U.jsx)(Fn,{text:e},t))})]},`${e.path}:${t}`))})}function Pn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
8
|
-
`)}function Fn({text:e}){return(0,U.jsx)(`span`,{className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function In(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Ln(e){let t=e.status===`running`||e.status===`pending`,n=Lt(e.title),{verb:r,detail:i}=e.toolKind===`execute`&&n.detail===void 0?{verb:`Ran`,detail:e.title}:n;return{busy:t,verb:r,detail:i,expandedCommand:(e.toolKind===`execute`?_t(e.input):me(e.name).toolKind===e.toolKind?he(e.name,e.input):void 0)??i,Icon:An[e.toolKind]??ie}}function Rn(e,t){return e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t>0}function zn({item:e,busy:t}){return(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,U.jsx)(fe,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,U.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,U.jsx)(`span`,{"data-slot":`tool-exit`,className:i(`rounded-full px-2 py-px font-mono text-xs font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})}function Bn({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,U.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,U.jsx)(`pre`,{"data-slot":`tool-command`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:t}),e.error!==void 0&&e.error!==``?(0,U.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap wrap-anywhere text-signal-word-red`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,U.jsx)(Nn,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,U.jsx)(Mn,{text:e.output,streaming:n}):null,r.length>0?(0,U.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:a?.(r,i??e.id)}):null]})}function Vn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let a=Wt(),[o,s]=(0,H.useState)(()=>n===void 0?null:a?.get(n)??null),c=e=>{n!==void 0&&a?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=Ln(e),m=Rn(e,t.length),h=f!==void 0||m,g=h&&(o??(m&&In(e)));return(0,U.jsxs)(L,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:g,onOpenChange:c,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,U.jsxs)(I,{disabled:!h,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:i(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,U.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:i(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,U.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,U.jsx)(zn,{item:e,busy:l})]}),(0,U.jsx)(F,{children:(0,U.jsx)(Bn,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function Hn(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function Un({item:e,cacheKey:t}){let n=Wt(),[r,a]=(0,H.useState)(()=>t===void 0?!1:n?.get(t)??!1),o=e=>{t!==void 0&&n?.set(t,e),a(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=Hn(e);return(0,U.jsxs)(L,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:o,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,U.jsxs)(I,{className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] hover:bg-muted`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,U.jsx)(Ge,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,U.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,U.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,U.jsx)(`span`,{"data-slot":`hook-exit`,className:`rounded-full bg-danger/10 px-2 py-px font-mono text-xs font-semibold text-danger`,children:e.exitCode}):null]})]}),(0,U.jsx)(F,{children:(0,U.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,U.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:i(`px-3 py-2 font-mono text-xs leading-[1.7] whitespace-pre-wrap [overflow-wrap:anywhere]`,(e.kind===`error`||e.kind===`stop`)&&`text-signal-word-red`),children:e.text},t)),e.source===void 0?null:(0,U.jsx)(`p`,{"data-slot":`hook-source`,className:`px-3 pb-2 font-mono text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.source}),l?(0,U.jsxs)(L,{className:`border-t border-border`,children:[(0,U.jsxs)(I,{"data-slot":`hook-raw-toggle`,className:`group flex w-full items-center gap-1 px-3 py-1 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),`Raw output${typeof e.exitCode==`number`?` · exit ${e.exitCode}`:``}`]}),(0,U.jsxs)(F,{children:[e.stdout?(0,U.jsx)(`pre`,{"data-slot":`hook-stdout`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.stdout}):null,e.stderr?(0,U.jsx)(`pre`,{"data-slot":`hook-stderr`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-signal-word-red [overflow-wrap:anywhere]`,children:e.stderr}):null]})]}):null]})})]})}function Wn({group:e,scope:t}){return(0,U.jsxs)(L,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,U.jsxs)(I,{className:`group flex h-[34px] tabular-nums w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,U.jsx)(F,{children:(0,U.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,U.jsx)(Vn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function Gn({count:e,children:t}){return(0,U.jsxs)(L,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,U.jsxs)(I,{className:`group flex items-center gap-1.5 rounded-md p-0.5 tabular-nums text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),Ft(e)]}),(0,U.jsx)(F,{children:(0,U.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function Kn({image:e}){return(0,U.jsx)(ze,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}var qn={finish:`Closed when the task finished`,superseded:`Closed when the worker went on`,"parent-stopped":`Closed when the parent stopped`,"worker-stopped":`Closed when the worker stopped`,undeliverable:`Closed: not delivered`};function Jn(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function Yn(e,t,n,r=``){let i=e.map((e,r)=>Jn(e,t[r]??[],n[r])).join(`
|
|
9
|
-
`),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function Xn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,U.jsx)(Zn,{text:e.context}):null;if(e.resolved)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,U.jsx)(Zn,{text:e.context}):null,(0,U.jsxs)(X,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,U.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?qn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,U.jsx)(nt,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,U.jsx)(Qn,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,U.jsx)(nr,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Zn({text:e}){return(0,U.jsx)(X,{role:`agent`,children:(0,U.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,U.jsx)(B,{breaks:!0,children:e})})})}function Qn({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,U.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,U.jsx)(P,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,U.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,U.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,U.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,U.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,U.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,U.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,U.jsxs)(`li`,{className:`break-words`,children:[(0,U.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,U.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,U.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,U.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,U.jsx)(R,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,U.jsx)(dt,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,U.jsx)(ft,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function $n(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,H.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,H.useState)(0),[h,g]=(0,H.useState)({}),[_,v]=(0,H.useState)({}),[y,b]=(0,H.useState)(``),[x,S]=(0,H.useState)(!1),[C,w]=(0,H.useState)(``),[T,E]=(0,H.useState)(!1),D=s&&p===c,ee=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;Ae(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let te=(e,t)=>g(n=>({...n,[e]:t})),O=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),k=e=>{te(e,[]),v(t=>({...t,[e]:t[e]??``}))},A=o.some((e,t)=>!e.options||_[t]!==void 0),ne=o.filter((e,t)=>G(t,h,_)).length,j=ne===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:E,onCommentStep:D,oneTap:ee,setQuestion:te,clearOtherAnswer:O,selectOther:k,hasOtherAnswer:A,answeredCount:ne,allAnswered:j,deliver:M,sendAll:()=>void M(Yn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function er({state:e,renderFreeTextReply:t}){let n=(0,H.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,U.jsx)(st,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,U.jsx)(ot,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(or,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(Jn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,U.jsxs)(`div`,{className:`pt-1`,children:[(0,U.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,U.jsx)(V,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function tr({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function nr(e){return e.delivery===void 0?(0,U.jsx)(rr,{...e}):(0,U.jsx)(ir,{...e,delivery:e.delivery})}function rr(e){let t=ke(e.run,e.projectId);return(0,U.jsx)(ir,{...e,delivery:t})}function ir({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=$n(e,m,d,f,a),[g,_]=(0,H.useState)(void 0),v=(0,H.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,U.jsx)(tr,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,U.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:i(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,U.jsx)(it,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,U.jsx)(at,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,U.jsx)(er,{state:h,renderFreeTextReply:o})}),(0,U.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,U.jsx)(ar,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,U.jsx)(ut,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,U.jsx)(ft,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function ar({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,U.jsx)(ct,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,U.jsx)(lt,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function or({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,H.useId)(),u=(0,H.useRef)(null),d=(0,H.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,H.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,U.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,U.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,U.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,U.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,U.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:i(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,U.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,U.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,U.jsx)(P,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:i(`h-auto min-h-11 w-full justify-start px-2.5 py-1.5 text-left`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,U.jsx)(V,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,U.jsx)(V,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}var sr=/^diff --git /;function cr(e){let t=e.replace(sr,``),n=t.lastIndexOf(` b/`);return Z(n>=0?t.slice(n+3):t)}function Z(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function lr(e){let t=Z(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function ur(e){return{path:cr(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function dr(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=Z(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=Z(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=lr(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=lr(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function fr(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function pr(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
10
|
-
`)){if(sr.test(i)){n=ur(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):dr(n,i);continue}fr(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function mr(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var hr=20,gr=300;function _r({runId:e,projectId:t}){let n=T(),r=c(e,t);(0,H.useEffect)(()=>{let r=t?[t,`runs`,`diff`,e]:d.runs.diff(e);n.invalidateQueries({queryKey:r})},[t,n,e]);let i=(0,H.useMemo)(()=>pr(r.data??``),[r.data]),[a,o]=(0,H.useState)(!1);if(r.isPending)return(0,U.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(r.isError)return(0,U.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:r.error.message});if(i.length===0)return(0,U.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:r.data.trim()||`(no changes)`});let s=mr(i),l=a?i:i.slice(0,hr);return(0,U.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{children:[s.files,` `,s.files===1?`file`:`files`,` changed`]}),(0,U.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,s.additions]}),` `,(0,U.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,s.deletions]})]})]}),l.map(e=>(0,U.jsx)(yr,{file:e},`${e.oldPath??``}→${e.path}`)),i.length>l.length?(0,U.jsxs)(P,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>o(!0),children:[`Show `,i.length-l.length,` more files`]}):null]})}var vr={added:`added`,deleted:`deleted`,renamed:`renamed`};function yr({file:e}){let[t,n]=(0,H.useState)(!0),r=vr[e.status],a=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,U.jsxs)(L,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-card-edge bg-card shadow-card`,children:[(0,U.jsxs)(I,{className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,U.jsx)(ce,{className:i(`mbs-[1px] size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,U.jsx)(`span`,{"data-slot":`diff-file-path`,title:a,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:e.oldPath?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,U.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,U.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,U.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-xs font-semibold tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.additions]}),` `,(0,U.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,e.deletions]})]})]}),(0,U.jsx)(F,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,U.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,U.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,U.jsx)(br,{lines:e.lines})})})]})}function br({lines:e}){let[t,n]=(0,H.useState)(!1),r=t?e:e.slice(0,gr),a=r.join(`
|
|
11
|
-
`),[o,s]=(0,H.useState)(null);(0,H.useEffect)(()=>{let e=!1;return Re(a,`diff`).then(t=>{e||s({text:a,tokens:t.tokens})}),()=>{e=!0}},[a]);let c=o?.text===a?o.tokens:Le(a,`diff`)?.tokens??null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,U.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,U.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>gr?(0,U.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}function xr(e,t,n,r){return _e(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function Sr(e,t,n){let r=new Set;for(let i of e.workflowDef?.steps??[]){if(i.command!==void 0||i.kind===`plugin`)continue;let a=i.runner??t,o=i.agentProfile??(a===(e.runner??t)?e.agentProfile:void 0)??n.repoAccount?.[a];n.readyOn(a,o)||r.add(a)}return[...r]}function Cr(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function wr(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function Tr(){let e=u(),t=g();return{providers:e,registered:t,providersPending:e.isPending||t.isPending,providersError:e.isError||t.isError,providersReady:e.isSuccess&&t.isSuccess}}function Er(e,t=null,n){let{registered:r,providersPending:i,providersError:a,providersReady:s}=Tr(),c=m(n),u=Ne(e),d=e.removedRunner!==void 0,f=u&&!e.runner||d,p=Oe(n),h=e.delegation?.role===`worker`,g=c.data?.defaultRunner,_=xr(e,u,d,o(g,l(r.data))??g),v=(t,n)=>Me(e,t,p.repoAccount,{original:_,target:n},u),{runners:y,signedOut:b}=p.runnersOn(e=>v(e,e)),x=h?_:Ee(t,y,_),S=y.includes(_),w=u?C(e.workflowDef,x,l(r.data)):[x],T=u&&h&&e.workflowDef?Sr(e,x,p):w.filter(e=>!p.readyOn(e,v(e,x))),E=s&&(!f||c.isSuccess)&&T.length===0,D=wr({needsConfig:f,configPending:c.isPending,configError:c.isError,providersPending:i,providersError:a,canContinue:E,untouched:u,missing:T});return{runners:y,signedOut:b,currentRunner:_,runner:x,currentRunnerConnected:S,canContinue:E,providerPending:i||f&&c.isPending,providerError:a,reason:D,runnerOverride:Cr(h,t,S,d,x)}}var Dr={open:!1,notes:``},Q=new Map,Or=new Set,$=null;function kr(){let e=[...Q.values()].some(e=>e.notes.trim()!==``);e&&$===null&&($=Ie()),!e&&$!==null&&($(),$=null);for(let e of Or)e()}function Ar(e){return Or.add(e),()=>{Or.delete(e)}}function jr(e){return Q.get(e)??Dr}function Mr(e,t){let n={...jr(e),...t};!n.open&&n.notes===``?Q.delete(e):Q.set(e,n),kr()}function Nr(e){Q.delete(e)&&kr()}function Pr(e){let t=(0,H.useSyncExternalStore)(Ar,()=>jr(e)),n=(0,H.useCallback)(t=>Mr(e,t),[e]),r=(0,H.useCallback)(()=>Nr(e),[e]);return{...t,update:n,clear:r}}function Fr(e,t){let n=T();return _({mutationFn:()=>b(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:d.runs.all}),t?.onSuccess?.()},onError:e=>S(e.message,{tone:`danger`})})}function Ir({run:e,projectId:t,onResolved:n}){return(0,U.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,U.jsx)(ue,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,U.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,U.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,U.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,U.jsx)(Rr,{run:e,projectId:t,onResolved:n})]})}function Lr({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,U.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,U.jsx)(Ir,{run:e,projectId:t,onResolved:n}),r?(0,U.jsx)(_r,{runId:e.id,projectId:t}):null]})}function Rr({run:e,projectId:t,onResolved:n}){let r=p(),i=T(),o=(0,H.useRef)(null),s=Pr(e.id),{notes:c,open:l,clear:u}=s,f=e=>s.update({notes:e}),[m,g]=(0,H.useState)(null),[b,x]=(0,H.useState)(null),C=Fr(e.id,{projectId:t,onSuccess:()=>{u(),n?.()}}),E=Er(e,null,t),ee=()=>i.invalidateQueries({queryKey:d.runs.all}),O=_({mutationFn:async n=>E.canContinue?y(h(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:E.runnerOverride}):null,onMutate:()=>h(e.id,{projectId:t}),onSuccess:(t,i,a)=>{t!==null&&(jr(e.id).notes.trim()===i&&u(),r.invalidateAfter(`continue`,a),n?.())},onError:e=>S(e.message,{tone:`danger`})}),k=_({mutationFn:()=>w(e.id,t),onSuccess:e=>{S(`Draft PR created — ${e.url}`),u(),ee(),n?.()},onError:e=>{e instanceof v&&e.manual!==void 0&&x(e.manual),S(e.message,{tone:`danger`})}}),A=()=>{if(!l){s.update({open:!0}),requestAnimationFrame(()=>o.current?.focus());return}let e=c.trim();if(e.length===0){g(`Write what to change first.`),o.current?.focus();return}g(null),O.mutate(e)};return(0,U.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[E.canContinue?null:(0,U.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:E.reason}),E.providerPending?null:(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button]:min-h-11 [&_a]:min-h-11`,children:[(0,U.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,U.jsxs)(D,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,U.jsx)(ue,{"aria-hidden":`true`}),`Review changes`]}):(0,U.jsxs)(R,{to:`/tasks/${e.id}/changes`,children:[(0,U.jsx)(ue,{"aria-hidden":`true`}),`Review changes`]})}),(0,U.jsxs)(P,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:E.reason??(l?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":E.canContinue?void 0:`review-provider-guidance`,"aria-expanded":l,"aria-controls":l?`review-notes`:void 0,disabled:O.isPending||!E.canContinue,onClick:A,children:[(0,U.jsx)(qe,{"aria-hidden":`true`}),l?`Send back with notes`:`Send back`]}),a(e.pullRequestUrl)?(0,U.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,children:(0,U.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,U.jsx)(le,{"aria-hidden":`true`}),`PR ↗`]})}):(0,U.jsxs)(P,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,U.jsx)(te,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,U.jsxs)(P,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:Fe(`review`),disabled:C.isPending,onClick:()=>C.mutate(),children:[(0,U.jsx)(M,{"aria-hidden":`true`}),`Accept`]}):null]}),l?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(V,{ref:o,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":m!==null||void 0,"aria-describedby":m===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:c,onChange:e=>{let t=e.target.value;f(t),m!==null&&t.trim().length>0&&g(null)},onKeyDown:e=>{De({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),A())},className:`min-h-11 text-base md:text-[13px]`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[m===null?(0,U.jsx)(`span`,{}):(0,U.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:m}),(0,U.jsx)(P,{"data-slot":`review-notes-cancel`,variant:`ghost`,size:`sm`,className:`min-h-11`,title:`Fold the notes box and drop the notes`,onClick:()=>{g(null),u()},children:`Cancel`})]})]}):null,b===null?null:(0,U.jsx)(zr,{command:b})]})}function zr({command:e}){return(0,U.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>S(`Command copied to clipboard.`)).catch(()=>S(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,U.jsx)(oe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,U.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Br(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Vr=1500;function Hr({status:e}){let t=(0,H.useRef)(e),[n,r]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Br())return;r(!0);let i=setTimeout(()=>r(!1),Vr);return()=>clearTimeout(i)},[e]),n?(0,U.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,U.jsx)(Te,{}),(0,U.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,U.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{tn as A,St as B,dn as C,nn as D,Kt as E,Wt as F,wt as H,zt as I,Lt as L,Jt as M,Xt as N,rn as O,Gt as P,kt as R,J as S,Yt as T,nt as U,Tt as V,Ye as W,kn as _,_r as a,mn as b,En as c,Kn as d,Dn as f,xn as g,Gn as h,Er as i,Qt as j,$t as k,Wn as l,Vn as m,Lr as n,Xn as o,On as p,Fr as r,Zn as s,Hr as t,Un as u,vn as v,qt as w,hn as x,gn as y,Ct as z};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,s as i}from"./dist-C_rn70hE.js";import{G as a,H as o,J as s,St as c,U as l,Ut as u,V as d,W as f,bt as p,cn as m,ct as h,d as g,et as _,ln as v,nn as y,nt as ee,un as b,vt as te,xt as x}from"./queries-jsRcJKo6.js";import{Bt as ne,Nn as S,Rn as C,Sr as w,dr as T,ft as re,lr as ie,n as E,rt as D,vi as ae,zt as oe}from"./toaster-C1BFyQ8i.js";import{C as se,S as ce,T as le,b as ue,g as de,i as fe,m as pe,n as me,p as he,t as O,x as ge}from"./reference-chip-95DURw1q.js";import{I as _e,S as ve,Y as ye,a as be,m as xe,mt as k,st as Se,t as Ce,u as we,y as A}from"./design-icons-QbNMZniQ.js";import{t as j}from"./createLucideIcon-BHp8sXmF.js";import{t as Te}from"./app-window-CSHwDX9N.js";import{n as Ee,r as De,t as Oe}from"./open-in-menu-CI3ceNjU.js";import{t as ke}from"./info-DA1x_4bz.js";import{t as Ae}from"./message-square-B-MD-8rD.js";import{t as M}from"./square-terminal-B6RYYieR.js";import{t as N}from"./button-C8jUIs8Q.js";import{a as P,i as F,l as I,n as L,p as R,r as z,t as B}from"./dropdown-menu-DjtKUK8F.js";import{i as je,r as Me,t as Ne}from"./popover-CvL6hQ5c.js";import{a as Pe,i as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dialog-DRZuXvul.js";import{c as Be,s as Ve,t as V}from"./project-router-C53GCY_8.js";import"./attention-xl4bwNkx.js";import{T as He,f as H,u as Ue}from"./task-groups-7p6Gvpg8.js";import{t as We}from"./status-dot-BXf-Ubd0.js";import{t as Ge}from"./format-BU7D3IfE.js";import{$n as Ke,$t as qe,B as Je,Dn as U,Fn as Ye,H as Xe,Jt as Ze,Qn as W,Qt as Qe,Sr as $e,Tn as et,V as tt,Xt as nt,Yt as rt,Zn as it,Zt as at,a as ot,en as st,hn as G,in as ct,lr as lt,m as ut,mn as K,mr as dt,o as ft,on as pt,r as q,tn as mt,un as ht,ur as gt}from"./index-ChOV2nBM.js";import{t as _t}from"./markdown-C5Y3C4ot.js";import{t as vt}from"./textarea-vEsJAUAV.js";import{t as yt}from"./task-file-scope-D5aDzxzp.js";import{t as J}from"./tab-link-BGfSJ-ah.js";var bt=j(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),xt=j(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),St=j(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(t(),1),X=n();function Ct(e){let t=h();return b({mutationFn:t=>D(v(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>m()),onError:e=>E(e.message,{tone:`danger`})})}function wt(e){return e.archived?`Unarchive`:`Archive task`}function Tt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(Ze,{open:t,onOpenChange:n,children:(0,X.jsxs)(at,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(st,{children:[(0,X.jsx)(mt,{children:`Archive task?`}),(0,X.jsxs)(Qe,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:H(e),children:H(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(qe,{children:[(0,X.jsx)(nt,{children:`Cancel`}),(0,X.jsx)(rt,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Et({run:e,className:t}){let[n,i]=(0,Y.useState)(!1),a=Ct(e.id),o=wt(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(N,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:r(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):i(!0),children:[e.archived?(0,X.jsx)($e,{"aria-hidden":`true`}):(0,X.jsx)(Ce,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o})]}),(0,X.jsx)(Tt,{run:e,open:n,onOpenChange:i,onConfirm:()=>{a.mutate(!0),i(!1)}})]})}function Dt({run:e,action:t,prUrl:n,patch:r}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&i(n)?(0,X.jsx)(N,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(N,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>E(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Ot({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(N,{variant:`outline`,asChild:!0,children:(0,X.jsx)(V,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&i(t.pullRequestUrl)?(0,X.jsx)(N,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Et,{run:e}):null]})]})}function kt({run:e}){let t=f(e.id),n=G(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-card-edge bg-card p-3 shadow-card [margin-block:0.75rem]`,children:[a?(0,X.jsx)(Dt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,X.jsx)(Ot,{run:e,blocker:i,flags:n}):null]})}var At=[`running`,`queued`,`waiting`];function jt(e,{queuePosition:t,now:n=new Date}){let r=S(e),i=Ye(e,r).label,a=t===void 0?i:`${i} #${t}`,o=At.includes(e.status)?Nt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Mt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Nt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ge(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),E(t)}catch{E(`Run manually: ${e}`)}}function Pt(e){let t=p(),n=g(),r=(0,Y.useMemo)(()=>le(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>he(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Ft(e){return b({mutationFn:()=>ne(e.id),onError:e=>{if(e instanceof C&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}E(e.message,{tone:`danger`})}})}function Q(e,t){let n=l(),r=c(),i=y(),a=b({mutationFn:t=>oe(e.id,t),onError:e=>E(e.message,{tone:`danger`})}),o=et(),s=He(e),u=o.runnersOn(e=>t&&s.sessionId!==void 0&&e===s.backend?s.profileId??`default`:o.repoAccount?.[e]).runners,d=e=>!r.isSuccess||!i.isSuccess||u.includes(e??`claude`);return{canResumeHere:t&&d(ht(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Ee(e.id);return t===void 0||i.isSuccess&&d(t)}).map(t=>({target:t,...pt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:a}}function It({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=y().data,s=K(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(N,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(M,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=De(e,o);return(0,X.jsxs)(N,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(N,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>E(`Worktree path copied`)).catch(()=>E(`Path: ${t}`))},children:[(0,X.jsx)(A,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(N,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,X.jsx)(A,{}),`Copy resume command`]})]}):null]})}function Lt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=K(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(Oe,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,X.jsxs)(F,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,X.jsxs)(N,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Z(s,`Worktree path copied`),children:[(0,X.jsx)(A,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Z(o,`Command copied to clipboard.`),children:[(0,X.jsx)(A,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Rt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Q(e,t);return!a&&o.length===0?null:r?(0,X.jsx)(F,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(N,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(k,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(It,{run:e,canResume:t,onResume:n})})]})}function zt({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{E(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(A,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Bt({run:e}){let t=p(),n=g(),r=r=>n===void 0?void 0:ge(n,e.id,r,t),a=(0,Y.useMemo)(()=>le(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(O,{reference:t,to:r(t),taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(ct,{run:e,prNumber:t.number})},de(t)));let l=se(e);l&&i(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(O,{reference:{kind:`PR`,url:l},taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(O,{reference:t,to:r(t),taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},de(t)));let d=ue(e,t);if(d&&i(d)&&!u.some(e=>e.url===d)){let t=pe(d);s.push((0,X.jsx)(O,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Vt(){let e=Ve(),t=x();return Je(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Ht=e=>e.map(e=>`${e.name}: ${tt(e.url)}`).join(`
|
|
2
|
-
`);function Ut(e){return Vt().length>0||e.notify===!0}function $({run:e}){let t=Vt(),n=t.length>0,r=o(e.id),[i,a]=(0,Y.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsxs)(B,{children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${Xe(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Ht(t):void 0,children:[(0,X.jsx)(We,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(z,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,X.jsx)(P,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-xs font-normal text-muted-foreground`,children:t.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:tt(e.url),children:e.name},e.id))}):null,n?(0,X.jsxs)(F,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,X.jsx)(Ae,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(F,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>E(`Stopped notifying the webhook`),onError:e=>E(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,X.jsx)(bt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,X.jsx)(lt,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,X.jsx)(Wt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),E(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>E(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Wt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,Y.useId)(),o=(0,Y.useId)(),[s,c]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=Xe(t);return(0,X.jsx)(ze,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,X.jsx)(Le,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,X.jsxs)(Ie,{className:`text-left`,children:[(0,X.jsx)(Re,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)(Fe,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:Ht(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(vt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,X.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(Pe,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,X.jsx)(N,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(N,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,X.jsx)(lt,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Gt({id:e}){return(0,X.jsxs)(V,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(be,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Kt({id:e}){let t=s(e),n=t.data?H(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(V,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(be,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(N,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var qt=3,Jt=(e,t)=>e.kind===t.kind&&e.number===t.number;function Yt(e,t,n=qt){let r=t?e.findIndex(e=>Jt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Xt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Zt({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?_e:xe,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(me,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Qt(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function $t({servers:e}){let t=ut();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,X.jsx)(Te,{"aria-hidden":`true`}),Qt(e,n),t.live?(0,X.jsx)(We,{tone:`success`,"aria-label":`Preview is live`}):null]})}function en(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function tn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,X.jsx)(Gt,{id:n}):(0,X.jsx)(Kt,{id:n})}function nn({isDesktop:e,desktopActivitySlot:t,attention:n,statusLine:r}){return e&&t?(0,X.jsx)(X.Fragment,{children:t}):(0,X.jsx)(q,{dot:n.tone,shape:n.shape,pulse:n.pulse,className:`max-md:hidden`,children:Mt(r)})}function rn(e,t,n){return n&&!e.archiveBlocker&&t.archive?(0,X.jsx)(Et,{run:e}):null}function an({archived:e,className:t}){return e?(0,X.jsx)(q,{"data-slot":`run-archived-pill`,dot:U.tone,shape:U.shape,className:t,children:U.label}):null}function on({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function sn({shown:e,run:t,previewToggle:n}){let r=Ut(t);return e&&(n||r)?(0,X.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,X.jsx)($,{run:t})]}):null}function cn({isDesktop:e,phoneBar:t,run:n,previewToggle:i,mobileActivitySlot:a}){let o=Ut(n);if(e||!a)return null;let s=t&&(!!i||o);return(0,X.jsxs)(`div`,{"data-slot":s?`run-mobile-actions`:void 0,"data-mobile-session-bar":t||void 0,className:r(`flex flex-wrap items-center gap-2 md:hidden`,t&&`border-t border-border py-1`),children:[a,s?(0,X.jsxs)(`span`,{className:`ms-auto flex shrink-0 flex-wrap items-center gap-2`,children:[i,(0,X.jsx)($,{run:n})]}):null]})}function ln({run:e,tab:t,activeItem:n,inlineItemTabs:i,overflowItemTabs:a,phoneBar:o,isDesktop:s}){let c=(0,Y.useRef)(null),[l,u]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let e=c.current;if(!e||s){u(!1);return}let t=()=>u(e.scrollWidth-e.clientWidth-e.scrollLeft>1),n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{n.disconnect(),e.removeEventListener(`scroll`,t)}},[s,i,a,e.diffStat?.files]);let d=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!d||s||c.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[d,i.map(e=>`${e.kind}#${e.number}`).join(`,`),s]),(0,X.jsxs)(`div`,{ref:c,"data-slot":`run-tabs`,"data-phone-bar":o||void 0,"data-overflow-end":l||void 0,className:r(`flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-2 max-md:[&>a]:text-[13.5px]`,o?`mt-0`:`mt-3`),children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:o,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:o,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:o,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:o,children:`Files`}),i.map(t=>(0,X.jsx)(J,{to:Xt(e.id,t),active:n!==null&&Jt(t,n),replace:o,children:(0,X.jsx)(Zt,{tab:t})},`${t.kind}-${t.number}`)),a.length>0?(0,X.jsxs)(B,{children:[(0,X.jsxs)(R,{"data-slot":`run-tabs-more`,"aria-label":`${a.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,a.length]}),(0,X.jsx)(z,{align:`end`,children:a.map(t=>(0,X.jsx)(F,{asChild:!0,children:(0,X.jsx)(V,{to:Xt(e.id,t),replace:o,children:(0,X.jsx)(Zt,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function un({run:e,tab:t=`session`,onMarkedUnread:n,desktopActivitySlot:i,mobileActivitySlot:a}){let o=S(e),s=G(e),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),f=dn(e,n),p=ee(),m=te(),h=jt(e,{queuePosition:e.status===`queued`?Ue(p.data??[]).get(e.id):void 0}),g=Ke(),_=W(),v=g!==null&&!_?g:null,y=v!==null,{referenceProjectId:b,repoBase:x,requests:ne}=Pt(e),C=(0,Y.useMemo)(()=>ce(e,x),[e,x]),w=typeof t==`object`?t:null,{inline:T,overflow:re}=Yt(C,w),ie=m.data?.capabilities?.preview===!0,E=e.worktreePath&&ie?(0,X.jsx)($t,{servers:e.previewServers??[]}):null,D=(0,X.jsx)(hn,{run:e,actions:f,onOpenChooser:()=>d(!0),onToggleNotes:()=>l(e=>!e)}),ae=rn(e,s,_);return(0,X.jsx)(fe,{projectId:b,repoBase:x,requests:ne,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:r(`relative z-20 shrink-0 bg-background px-4 md:px-9 md:pt-7`,y?`pt-0`:`pt-[18px]`,t===`session`&&`border-b border-border`),children:[(0,X.jsx)(on,{run:e}),(0,X.jsx)(kt,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(tn,{run:e}),v?(0,X.jsxs)(it,{slot:v,children:[(0,X.jsx)(mn,{run:e,status:(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(q,{"data-slot":`mobile-run-status`,dot:o.tone,shape:o.shape,pulse:o.pulse,className:`max-w-full self-start truncate px-2 py-px text-xs leading-4`,children:h.label}),(0,X.jsx)(an,{archived:e.archived,className:`px-2 py-px text-xs leading-4`})]})}),(0,X.jsx)(tn,{run:e,compact:!0}),D]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:en(e.delegation)}),(0,X.jsx)(pn,{run:e}),(0,X.jsx)(nn,{isDesktop:_,desktopActivitySlot:i,attention:o,statusLine:h}),(0,X.jsx)(an,{archived:e.archived,className:`max-md:hidden`}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[ae,E,(0,X.jsx)($,{run:e}),D]})]}),(0,X.jsx)(sn,{shown:v!==null&&!a,run:e,previewToggle:E}),(0,X.jsx)(ln,{run:e,tab:t,activeItem:w,inlineItemTabs:T,overflowItemTabs:re,phoneBar:y,isDesktop:_}),(0,X.jsx)(cn,{isDesktop:_,phoneBar:y,run:e,previewToggle:E,mobileActivitySlot:a}),c?(0,X.jsx)(vn,{runId:e.id,onClose:()=>l(!1)}):null,u?(0,X.jsx)(Rt,{run:e,canResume:G(e).terminal,onResume:()=>f.terminal.mutate(),onClose:()=>d(!1)}):null]}),(0,X.jsx)(_n,{run:e,actions:f})]})})}function dn(e,t){let n=ae(),r=Be(),[i,o]=(0,Y.useState)(null),s=()=>n.invalidateQueries({queryKey:u.runs.all}),c=e=>E(e.message,{tone:`danger`}),l=a(),f={isPending:l.isPending,mutate:()=>l.mutate({id:e.id,pinned:!e.pinned})},p=d();return{pin:f,markUnread:{isPending:p.isPending,mutate:()=>{t?.(),p.mutate(e.id,{onError:c})}},delete:b({mutationFn:()=>re(e.id),onSuccess:()=>{s(),r(`/`)},onError:c}),terminal:Ft(e),confirming:i,setConfirming:o}}function fn(e){let t=f(e.id),n=H(e);return{title:n,editor:ft(n,e=>t.mutate({title:e},{onError:e=>E(e.message,{tone:`danger`})}))}}function pn({run:e}){let{title:t,editor:n}=fn(e);return n.editing?(0,X.jsx)(ot,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(gt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function mn({run:e,status:t}){let{title:n,editor:r}=fn(e);return(0,X.jsxs)(Ne,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,X.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,X.jsx)(je,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(gt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Me,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,X.jsx)(ot,{editor:r,className:`text-[16px] font-semibold`})})]})}function hn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=G(e),a=K(e),o=W(),s=Ct(e.id),[c,l]=(0,Y.useState)(!1),u=f(e.id),d=(0,Y.useId)();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tt,{run:e,open:c,onOpenChange:l,onConfirm:()=>{s.mutate(!0),l(!1)}}),(0,X.jsxs)(B,{children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsx)(N,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,X.jsx)(ve,{"aria-hidden":`true`})})}),(0,X.jsxs)(z,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,X.jsx)(P,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!o&&i.archive&&!e.archiveBlocker?(0,X.jsx)(F,{disabled:s.isPending,onSelect:()=>e.archived?s.mutate(!1):l(!0),children:wt(e)}):null,(0,X.jsxs)(F,{onSelect:n,children:[(0,X.jsx)(dt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(Rt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,X.jsxs)(F,{onSelect:()=>void Z(a,`Command copied to clipboard.`),children:[(0,X.jsx)(A,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,X.jsxs)(F,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(xt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,X.jsxs)(L,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(St,{"aria-hidden":`true`}):(0,X.jsx)(ye,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,X.jsx)(I,{}),(0,X.jsx)(P,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(L,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:u.isPending,onCheckedChange:e=>u.mutate({archiveWhenDone:e},{onError:e=>E(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(L,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:u.isPending,"aria-describedby":d,onCheckedChange:e=>u.mutate({autoMergePr:e},{onError:e=>E(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:d,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)(gn,{run:e,patch:u}),i.deleteRun?(0,X.jsx)(I,{}):null,i.deleteRun?(0,X.jsxs)(F,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(Se,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function gn({run:e,patch:t}){let n=(0,Y.useId)(),r=(0,Y.useId)(),i=(0,Y.useId)(),a=e=>E(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I,{}),(0,X.jsx)(P,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsx)(L,{"data-slot":`allow-workers`,className:`min-h-11`,checked:T(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,X.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,X.jsx)(L,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:ie(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function _n({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(Ze,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(at,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(st,{children:[(0,X.jsx)(mt,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(Qe,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:H(e),children:H(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!w(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,X.jsxs)(qe,{children:[(0,X.jsx)(nt,{children:`Cancel`}),(0,X.jsx)(rt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function vn({runId:e,onClose:t}){let n=_(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 flex max-h-[min(45dvh,420px)] flex-col overflow-hidden rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(N,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(k,{})})]}),(0,X.jsx)(`div`,{"data-slot":`notes-panel-body`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(yt,{runId:e,children:(0,X.jsx)(_t,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})}),(0,X.jsxs)(`div`,{className:`mt-4 flex shrink-0 gap-3`,children:[(0,X.jsx)(N,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(N,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Ft as a,Lt as i,zt as n,Pt as o,Bt as r,jt as s,un as t};
|