@wjarka/cezarion 0.18.0-dev.8015 → 0.18.0-dev.8022

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/{accounts-section-CJ1xR0FN.js → accounts-section-Lxa13E8O.js} +1 -1
  3. package/web/dist/assets/{activity-motion-C01GEN0y.js → activity-motion-D-8GF_WP.js} +1 -1
  4. package/web/dist/assets/{activity-route-BZ1NIKSY.js → activity-route-Bo-Cyzsz.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-DvFcRRLD.js → agent-config-section-BE239EYo.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-BE88c2RN.js → agent-defaults-section-Bj5dO6F3.js} +1 -1
  7. package/web/dist/assets/{appearance-B9Z6lNEm.js → appearance-C2v7z5MF.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-DtR7twJI.js → archive-on-merge-field-Ta3WlY1p.js} +1 -1
  9. package/web/dist/assets/attention-B1Ei1IW6.js +1 -0
  10. package/web/dist/assets/{automations-route-Dpa01C3j.js → automations-route-DPpaFR0Q.js} +1 -1
  11. package/web/dist/assets/{commit-diff-panel-CGjhxIPJ.js → commit-diff-panel-CzY8bO3p.js} +1 -1
  12. package/web/dist/assets/{diff-DQ18_bA-.js → diff-3jSM3IH7.js} +2 -2
  13. package/web/dist/assets/{diff-view-CMwe_Rx7.js → diff-view-C3cwyYRv.js} +1 -1
  14. package/web/dist/assets/{file-preview-_lAUlt5u.js → file-preview-B71T62DU.js} +1 -1
  15. package/web/dist/assets/{folder-browser-Cy26Y6YK.js → folder-browser-BTYMFLBY.js} +1 -1
  16. package/web/dist/assets/{git-toolbar-BJM3pWHY.js → git-toolbar-Dng31AhK.js} +1 -1
  17. package/web/dist/assets/{github-aO7y0526.js → github-Cft2RNHM.js} +1 -1
  18. package/web/dist/assets/{global-activity-route-BWOfw2C5.js → global-activity-route-CngRjBlD.js} +1 -1
  19. package/web/dist/assets/{index-D-Y1olb1.js → index-MG3T7zFQ.js} +5 -5
  20. package/web/dist/assets/{label-CbEJ99h4.js → label-C9IGG0mW.js} +1 -1
  21. package/web/dist/assets/{markdown-BDWII3gy.js → markdown-BDWm6oGX.js} +1 -1
  22. package/web/dist/assets/{notifications-section-Z_4IW83J.js → notifications-section-BxIKJ1NF.js} +1 -1
  23. package/web/dist/assets/{open-in-menu-21vcjK3t.js → open-in-menu-LbTu2sP4.js} +1 -1
  24. package/web/dist/assets/{preview-pane-connected-CxwvH4pt.js → preview-pane-connected-CGQngtTw.js} +1 -1
  25. package/web/dist/assets/{project-location-CvJMe_Vp.js → project-location-B-18C392.js} +1 -1
  26. package/web/dist/assets/{project-router-hhGBPlav.js → project-router-DImKA81z.js} +1 -1
  27. package/web/dist/assets/project-scope-context-D3_4Nfjk.js +4 -0
  28. package/web/dist/assets/{projects-section-CQ34YFnT.js → projects-section-DQ1LxJ3A.js} +1 -1
  29. package/web/dist/assets/{prompt-templates-section-UIxQCLJq.js → prompt-templates-section-C5AYB6Ig.js} +1 -1
  30. package/web/dist/assets/{queries-D6ioEk6c.js → queries-BaHOUYn4.js} +1 -1
  31. package/web/dist/assets/{reference-chip-B5br2cfV.js → reference-chip-CdOqXRll.js} +1 -1
  32. package/web/dist/assets/{remote-settings-notice-BWDpTH5W.js → remote-settings-notice-BTdflMqO.js} +1 -1
  33. package/web/dist/assets/{repo-git-U12bPaG-.js → repo-git-DChiMWrS.js} +1 -1
  34. package/web/dist/assets/{report-reader-B5vipU-m.js → report-reader-nV2G6iRk.js} +1 -1
  35. package/web/dist/assets/{reports-Cdk8Dc-w.js → reports-CoQqVEy4.js} +1 -1
  36. package/web/dist/assets/{resources-section-BCLu3v1Z.js → resources-section-CVaIlicS.js} +1 -1
  37. package/web/dist/assets/{run-header-gOqc0BKa.js → run-header-xPtXOBkm.js} +1 -1
  38. package/web/dist/assets/{runners-5cgs0qUY.js → runners-DccsyraI.js} +1 -1
  39. package/web/dist/assets/{settings-agent-picker-CB7l8AW-.js → settings-agent-picker-ixlEQ-MP.js} +1 -1
  40. package/web/dist/assets/{settings-shell-BUHHoCDs.js → settings-shell-BwknM_fs.js} +1 -1
  41. package/web/dist/assets/{sidebar-section-8dTKLdQw.js → sidebar-section-BNy-fRPU.js} +1 -1
  42. package/web/dist/assets/{skills-thuBrq2s.js → skills-CKceHo5J.js} +1 -1
  43. package/web/dist/assets/{tab-link-DaFUyEhe.js → tab-link-VCVNqxFc.js} +1 -1
  44. package/web/dist/assets/{task-changes-DSpeg6sX.js → task-changes-D4H5YbMo.js} +1 -1
  45. package/web/dist/assets/{task-commits-DRDRswBh.js → task-commits-BNu0VTTf.js} +1 -1
  46. package/web/dist/assets/{task-files-Cevz9Mex.js → task-files-C8q8GHYK.js} +1 -1
  47. package/web/dist/assets/{task-github-item-DpLkKSKy.js → task-github-item-D5kHfnwY.js} +1 -1
  48. package/web/dist/assets/{task-groups-CafTiSSz.js → task-groups-C7yO8nMy.js} +1 -1
  49. package/web/dist/assets/{task-thread-BvM4rEQe.js → task-thread-Dhts8Nbu.js} +1 -1
  50. package/web/dist/assets/{tasks-table-DYjfmofR.js → tasks-table-I_z4e7uI.js} +1 -1
  51. package/web/dist/assets/{thread-state-A3TSuI5v.js → thread-state-DV19z3BD.js} +1 -1
  52. package/web/dist/assets/{use-hand-to-agent-state-IepoiFbj.js → use-hand-to-agent-state-C6e6Mgi1.js} +1 -1
  53. package/web/dist/assets/{useInfiniteQuery-B20OnjTe.js → useInfiniteQuery-DR5UfhCS.js} +1 -1
  54. package/web/dist/assets/useQuery-BMyCehPp.js +1 -0
  55. package/web/dist/assets/{workflows-B0TaHAzz.js → workflows-BNHmFZRc.js} +1 -1
  56. package/web/dist/assets/{workspace-tools-B8sP_p5c.js → workspace-tools-UHJAnHEN.js} +1 -1
  57. package/web/dist/assets/{worktrees-section-BDfwadB6.js → worktrees-section-B4XPx6R5.js} +1 -1
  58. package/web/dist/assets/{ws-ExzR2_Yn.js → ws-CH3zNFKR.js} +1 -1
  59. package/web/dist/index.html +15 -15
  60. package/web/dist/assets/attention-B6NEiTGm.js +0 -1
  61. package/web/dist/assets/project-scope-context-BiijuuWU.js +0 -4
  62. package/web/dist/assets/useQuery-BTg3x78A.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r}from"./utils-DSMR_WLb.js";import{Lr as i,ci as a,f as o,hn as s,hr as c,jt as l,zr as u}from"./project-scope-context-BiijuuWU.js";import{H as d,K as f,L as p,N as m,P as h,R as g,j as _,q as v}from"./live-protocol-D9ji1YCl.js";import{t as y}from"./useInfiniteQuery-B20OnjTe.js";import{f as b,m as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as S,t as C}from"./ws-ExzR2_Yn.js";import{t as w}from"./button-BQ2y4XRB.js";import{t as T}from"./project-router-hhGBPlav.js";import{Hn as E,b as D,gn as O}from"./index-D-Y1olb1.js";import{t as k}from"./report-title-D4Mbu2Er.js";var A=e(t(),1),j=1e3,M=d().min(1).max(1024);g({q:d().max(j).optional(),before:M.optional(),limit:d().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var N=g({reports:_(g({id:f(),runId:f(),name:d(),title:d(),createdAt:v(),size:p().int().nonnegative(),taskTitle:d(),taskStatus:c}).strict()),nextCursor:M.nullable(),total:p().int().nonnegative()}).strict(),P=g({epoch:f(),generation:p().int().nonnegative(),metadataGeneration:p().int().nonnegative()}).strict(),F=g({runId:f(),taskTitle:d(),taskStatus:c}).strict(),I=m(`type`,[P.extend({type:h(`snapshot`)}),P.extend({type:h(`content`)}),P.extend({type:h(`metadata`),runs:_(F)})]),L=new WeakMap;function R(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var z=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=R(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function B(e,t){let n=L.get(e);n||(n=new Map,L.set(e,n));let r=n.get(t);return r||(r=new z(e,t),n.set(t,r)),r}async function V(e,t){let n=await o.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},l({signal:t}));return P.parse(await s(n,`/reports/state`))}function H(e){let t=B(a(),e);return(0,A.useEffect)(()=>{let n=C(`reports:project:${e}`,e=>{let n=I.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,a,o=()=>{if(i()===`finite`&&!r){a=new AbortController;let n=a.signal;V(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=S({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=P.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else i()!==`finite`&&(a?.abort(),r?.(),r=void 0)};o();let s=u(o);return()=>{s(),a?.abort(),r?.(),n()}},[t,e]),t}async function U(e,t,n,r){let i=await o.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,j),...n?{before:n}:{}}},l(r?{signal:r}:void 0));return N.parse(await s(i,`/reports`))}function W(e){let t=r(),n=H(t);return y({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>U(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var G=n(),K=new Map;function q(){let e=b(),t=x(),[n,r]=D(),i=(n.get(`q`)??``).slice(0,j),a=W(i),o=(0,A.useRef)(null),s=(0,A.useRef)(``),c=e.pathname+e.search,l=a.data?.pages.flatMap(e=>e.reports)??[];(0,A.useLayoutEffect)(()=>{if(!a.data||s.current===c)return;let n=K.get(c),r=e.state?.filesRestoreKey===c;if(!n||!o.current||t!==`POP`&&!r){s.current=c;return}let i=o.current.querySelector(`[data-report-id="${n.row}"]`);if(a.isFetchNextPageError){s.current=c,o.current.scrollTop=0;return}if((!i||a.data.pages.length<n.pages)&&a.hasNextPage){a.isFetchingNextPage||a.fetchNextPage();return}s.current=c,o.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[c,a.data,a.hasNextPage,a.isFetchingNextPage,a.isFetchNextPageError,a.fetchNextPage,e.state,t]);let u=t=>r(n=>(t?n.set(`q`,t.slice(0,j)):n.delete(`q`),K.delete(e.pathname+`?`+n.toString()),n));return(0,G.jsxs)(`section`,{"data-route":`reports`,className:`flex h-full min-h-0 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border p-4`,children:[(0,G.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Reports`}),(0,G.jsx)(E,{maxLength:j,"aria-label":`Search reports`,placeholder:`Search reports or source tasks`,value:i,onChange:e=>u(e.target.value),className:`min-h-11`})]}),(0,G.jsxs)(`div`,{ref:o,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable]`,children:[a.isPending?(0,G.jsx)(`p`,{role:`status`,children:`Loading reports…`}):a.isError?(0,G.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`p`,{children:`Could not load reports`}),(0,G.jsx)(`p`,{className:`text-sm text-soft-foreground`,children:a.error.message}),(0,G.jsx)(w,{className:`min-h-11`,onClick:()=>void a.refetch(),children:`Retry`})]}):l.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`h2`,{className:`font-medium`,children:i?`No matching reports`:`No published reports yet`}),i?(0,G.jsx)(w,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>u(``),children:`Clear search`}):(0,G.jsxs)(`p`,{className:`text-sm text-soft-foreground`,children:[`Publish an HTML snapshot with `,(0,G.jsxs)(`code`,{children:[O(),` artifact publish`]}),` to list it here.`]})]}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-3`,children:l.map(e=>(0,G.jsxs)(`li`,{"data-slot":`report-row`,className:`reports-row rounded-lg border border-border bg-card p-3`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:(0,G.jsx)(T,{"data-report-id":e.id,className:`reports-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:c,filesRestoreKey:c},onClick:()=>K.set(c,{scroll:o.current?.scrollTop??0,row:e.id,pages:a.data?.pages.length??1}),children:k(e)})}),(0,G.jsx)(T,{className:`reports-task text-sm text-accent-text underline [overflow-wrap:anywhere]`,to:`/tasks/${e.runId}`,children:e.taskTitle}),(0,G.jsx)(`time`,{className:`block text-xs text-soft-foreground`,dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleString()})]},e.id))}),a.hasNextPage?(0,G.jsx)(w,{variant:`outline`,className:`min-h-11`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:`Load more reports`}):null]})]})}export{q as ReportsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r}from"./utils-DSMR_WLb.js";import{Lr as i,ci as a,f as o,hn as s,hr as c,jt as l,zr as u}from"./project-scope-context-D3_4Nfjk.js";import{H as d,K as f,L as p,N as m,P as h,R as g,j as _,q as v}from"./live-protocol-D9ji1YCl.js";import{t as y}from"./useInfiniteQuery-DR5UfhCS.js";import{f as b,m as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as S,t as C}from"./ws-CH3zNFKR.js";import{t as w}from"./button-BQ2y4XRB.js";import{t as T}from"./project-router-DImKA81z.js";import{Hn as E,b as D,gn as O}from"./index-MG3T7zFQ.js";import{t as k}from"./report-title-D4Mbu2Er.js";var A=e(t(),1),j=1e3,M=d().min(1).max(1024);g({q:d().max(j).optional(),before:M.optional(),limit:d().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var N=g({reports:_(g({id:f(),runId:f(),name:d(),title:d(),createdAt:v(),size:p().int().nonnegative(),taskTitle:d(),taskStatus:c}).strict()),nextCursor:M.nullable(),total:p().int().nonnegative()}).strict(),P=g({epoch:f(),generation:p().int().nonnegative(),metadataGeneration:p().int().nonnegative()}).strict(),F=g({runId:f(),taskTitle:d(),taskStatus:c}).strict(),I=m(`type`,[P.extend({type:h(`snapshot`)}),P.extend({type:h(`content`)}),P.extend({type:h(`metadata`),runs:_(F)})]),L=new WeakMap;function R(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var z=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=R(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function B(e,t){let n=L.get(e);n||(n=new Map,L.set(e,n));let r=n.get(t);return r||(r=new z(e,t),n.set(t,r)),r}async function V(e,t){let n=await o.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},l({signal:t}));return P.parse(await s(n,`/reports/state`))}function H(e){let t=B(a(),e);return(0,A.useEffect)(()=>{let n=C(`reports:project:${e}`,e=>{let n=I.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,a,o=()=>{if(i()===`finite`&&!r){a=new AbortController;let n=a.signal;V(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=S({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=P.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else i()!==`finite`&&(a?.abort(),r?.(),r=void 0)};o();let s=u(o);return()=>{s(),a?.abort(),r?.(),n()}},[t,e]),t}async function U(e,t,n,r){let i=await o.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,j),...n?{before:n}:{}}},l(r?{signal:r}:void 0));return N.parse(await s(i,`/reports`))}function W(e){let t=r(),n=H(t);return y({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>U(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var G=n(),K=new Map;function q(){let e=b(),t=x(),[n,r]=D(),i=(n.get(`q`)??``).slice(0,j),a=W(i),o=(0,A.useRef)(null),s=(0,A.useRef)(``),c=e.pathname+e.search,l=a.data?.pages.flatMap(e=>e.reports)??[];(0,A.useLayoutEffect)(()=>{if(!a.data||s.current===c)return;let n=K.get(c),r=e.state?.filesRestoreKey===c;if(!n||!o.current||t!==`POP`&&!r){s.current=c;return}let i=o.current.querySelector(`[data-report-id="${n.row}"]`);if(a.isFetchNextPageError){s.current=c,o.current.scrollTop=0;return}if((!i||a.data.pages.length<n.pages)&&a.hasNextPage){a.isFetchingNextPage||a.fetchNextPage();return}s.current=c,o.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[c,a.data,a.hasNextPage,a.isFetchingNextPage,a.isFetchNextPageError,a.fetchNextPage,e.state,t]);let u=t=>r(n=>(t?n.set(`q`,t.slice(0,j)):n.delete(`q`),K.delete(e.pathname+`?`+n.toString()),n));return(0,G.jsxs)(`section`,{"data-route":`reports`,className:`flex h-full min-h-0 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border p-4`,children:[(0,G.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Reports`}),(0,G.jsx)(E,{maxLength:j,"aria-label":`Search reports`,placeholder:`Search reports or source tasks`,value:i,onChange:e=>u(e.target.value),className:`min-h-11`})]}),(0,G.jsxs)(`div`,{ref:o,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable]`,children:[a.isPending?(0,G.jsx)(`p`,{role:`status`,children:`Loading reports…`}):a.isError?(0,G.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`p`,{children:`Could not load reports`}),(0,G.jsx)(`p`,{className:`text-sm text-soft-foreground`,children:a.error.message}),(0,G.jsx)(w,{className:`min-h-11`,onClick:()=>void a.refetch(),children:`Retry`})]}):l.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`h2`,{className:`font-medium`,children:i?`No matching reports`:`No published reports yet`}),i?(0,G.jsx)(w,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>u(``),children:`Clear search`}):(0,G.jsxs)(`p`,{className:`text-sm text-soft-foreground`,children:[`Publish an HTML snapshot with `,(0,G.jsxs)(`code`,{children:[O(),` artifact publish`]}),` to list it here.`]})]}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-3`,children:l.map(e=>(0,G.jsxs)(`li`,{"data-slot":`report-row`,className:`reports-row rounded-lg border border-border bg-card p-3`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:(0,G.jsx)(T,{"data-report-id":e.id,className:`reports-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:c,filesRestoreKey:c},onClick:()=>K.set(c,{scroll:o.current?.scrollTop??0,row:e.id,pages:a.data?.pages.length??1}),children:k(e)})}),(0,G.jsx)(T,{className:`reports-task text-sm text-accent-text underline [overflow-wrap:anywhere]`,to:`/tasks/${e.runId}`,children:e.taskTitle}),(0,G.jsx)(`time`,{className:`block text-xs text-soft-foreground`,dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleString()})]},e.id))}),a.hasNextPage?(0,G.jsx)(w,{variant:`outline`,className:`min-h-11`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:`Load more reports`}):null]})]})}export{q as ReportsRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Jt as r,ci as i}from"./project-scope-context-BiijuuWU.js";import{At as a,Nt as o,Yt as s}from"./queries-D6ioEk6c.js";import{n as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as l}from"./toaster-Bo5vCbz-.js";import{k as u}from"./design-icons-CzEoMH9c.js";import{t as d}from"./button-BQ2y4XRB.js";import{t as f}from"./switch-Bv2Zf1uU.js";import{t as p}from"./centered-state-V15AR_qo.js";import{t as m}from"./settings-field-Bl6WuvGX.js";var h=e(t(),1),g=n(),_=1,v=1,y=60,b=256;function x(){let e=a();return e.isPending?(0,g.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,g.jsx)(p,{icon:(0,g.jsx)(u,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,g.jsx)(S,{config:e.data})}function S({config:e}){let t=i(),n=s({mutationFn:e=>r(e),onSuccess:e=>t.setQueryData(o.config,e),onError:e=>l(e.message,{tone:`danger`})}),[a,c]=(0,h.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),u=e.resources.monitoringWakeIntervalMinutes??null,[d,p]=(0,h.useState)(u===null?`park`:`interval`),[_,x]=(0,h.useState)(String(u??5)),S=Number(_),D=!Number.isInteger(S)||S<v||S>y,k=d===`park`?u===null:!D&&u===S,A=d===`interval`&&D,j=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:d===`park`?null:S}},{onSuccess:()=>l(d===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${S} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>l(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=a.trim()===``?0:Number(a),F=a.trim()!==``&&(!Number.isInteger(P)||P<b),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>n.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>l(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,g.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,g.jsx)(C,{maxParallel:e.resources.maxParallel,onSelect:e=>n.mutate({resources:{maxParallel:e}}),disabled:n.isPending}),(0,g.jsx)(w,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>n.mutate({resources:{maxMonitoringSessions:e}}),disabled:n.isPending}),(0,g.jsx)(T,{wakeMode:d,setWakeMode:p,wakeInterval:_,setWakeInterval:x,showInvalid:A,wakeSaved:k,saveWake:j,saveIsPending:n.isPending}),(0,g.jsxs)(m,{title:`Auto-resume after a usage limit`,hint:`Resume eligible tasks once the provider usage limit resets.`,children:[(0,g.jsx)(f,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:n.isPending,onCheckedChange:N}),(0,g.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,g.jsx)(E,{memory:a,setMemory:c,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:n.isPending}),(0,g.jsx)(O,{composerDefaults:R,saveComposerDefault:(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:n.isPending})]})}function C({maxParallel:e,onSelect:t,disabled:n}){return(0,g.jsxs)(m,{title:`Max parallel tasks`,hint:`Limit simultaneously running tasks.`,children:[(0,g.jsx)(`select`,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+_).map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))}),(0,g.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,g.jsx)(c,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Configure per-project limits`}),`.`]})]})}function w({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,g.jsxs)(m,{title:`Extra monitoring sessions`,hint:`Additional capacity reserved for monitoring.`,children:[(0,g.jsx)(`select`,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,g.jsx)(`option`,{value:t,children:t},t))}),(0,g.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. Set 0 to make monitoring share active slots.`]})]})}function T({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return(0,g.jsxs)(m,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,g.jsxs)(`div`,{className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,g.jsx)(f,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full text-sm`,children:`Wake interval`}),(0,g.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:v,max:y,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block w-24 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,g.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,g.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})]}),i?(0,g.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,g.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]})}function E({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return(0,g.jsxs)(m,{title:`Per-task memory limit`,hint:`Leave blank for no limit.`,children:[(0,g.jsxs)(`div`,{className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,g.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:b,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,g.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,g.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})]}),n?(0,g.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,b,` MiB, or leave empty for no limit.`]}):(0,g.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]})}function D(e){return e===null?`inherit`:e?`on`:`off`}function O({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,g.jsxs)(m,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,g.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,g.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:D(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,g.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,g.jsx)(`option`,{value:`on`,children:`On`}),(0,g.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,g.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,g.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,g.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:D(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,g.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,g.jsx)(`option`,{value:`on`,children:`On`}),(0,g.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,g.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,g.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})}export{x as ResourcesSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Jt as r,ci as i}from"./project-scope-context-D3_4Nfjk.js";import{At as a,Nt as o,Yt as s}from"./queries-BaHOUYn4.js";import{n as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as l}from"./toaster-Bo5vCbz-.js";import{k as u}from"./design-icons-CzEoMH9c.js";import{t as d}from"./button-BQ2y4XRB.js";import{t as f}from"./switch-Bv2Zf1uU.js";import{t as p}from"./centered-state-V15AR_qo.js";import{t as m}from"./settings-field-Bl6WuvGX.js";var h=e(t(),1),g=n(),_=1,v=1,y=60,b=256;function x(){let e=a();return e.isPending?(0,g.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,g.jsx)(p,{icon:(0,g.jsx)(u,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,g.jsx)(S,{config:e.data})}function S({config:e}){let t=i(),n=s({mutationFn:e=>r(e),onSuccess:e=>t.setQueryData(o.config,e),onError:e=>l(e.message,{tone:`danger`})}),[a,c]=(0,h.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),u=e.resources.monitoringWakeIntervalMinutes??null,[d,p]=(0,h.useState)(u===null?`park`:`interval`),[_,x]=(0,h.useState)(String(u??5)),S=Number(_),D=!Number.isInteger(S)||S<v||S>y,k=d===`park`?u===null:!D&&u===S,A=d===`interval`&&D,j=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:d===`park`?null:S}},{onSuccess:()=>l(d===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${S} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>l(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=a.trim()===``?0:Number(a),F=a.trim()!==``&&(!Number.isInteger(P)||P<b),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>n.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>l(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,g.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,g.jsx)(C,{maxParallel:e.resources.maxParallel,onSelect:e=>n.mutate({resources:{maxParallel:e}}),disabled:n.isPending}),(0,g.jsx)(w,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>n.mutate({resources:{maxMonitoringSessions:e}}),disabled:n.isPending}),(0,g.jsx)(T,{wakeMode:d,setWakeMode:p,wakeInterval:_,setWakeInterval:x,showInvalid:A,wakeSaved:k,saveWake:j,saveIsPending:n.isPending}),(0,g.jsxs)(m,{title:`Auto-resume after a usage limit`,hint:`Resume eligible tasks once the provider usage limit resets.`,children:[(0,g.jsx)(f,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:n.isPending,onCheckedChange:N}),(0,g.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,g.jsx)(E,{memory:a,setMemory:c,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:n.isPending}),(0,g.jsx)(O,{composerDefaults:R,saveComposerDefault:(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:n.isPending})]})}function C({maxParallel:e,onSelect:t,disabled:n}){return(0,g.jsxs)(m,{title:`Max parallel tasks`,hint:`Limit simultaneously running tasks.`,children:[(0,g.jsx)(`select`,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+_).map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))}),(0,g.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,g.jsx)(c,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Configure per-project limits`}),`.`]})]})}function w({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,g.jsxs)(m,{title:`Extra monitoring sessions`,hint:`Additional capacity reserved for monitoring.`,children:[(0,g.jsx)(`select`,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,g.jsx)(`option`,{value:t,children:t},t))}),(0,g.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. Set 0 to make monitoring share active slots.`]})]})}function T({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return(0,g.jsxs)(m,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,g.jsxs)(`div`,{className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,g.jsx)(f,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full text-sm`,children:`Wake interval`}),(0,g.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:v,max:y,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block w-24 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,g.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,g.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})]}),i?(0,g.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,g.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]})}function E({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return(0,g.jsxs)(m,{title:`Per-task memory limit`,hint:`Leave blank for no limit.`,children:[(0,g.jsxs)(`div`,{className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,g.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:b,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,g.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,g.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})]}),n?(0,g.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,b,` MiB, or leave empty for no limit.`]}):(0,g.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]})}function D(e){return e===null?`inherit`:e?`on`:`off`}function O({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,g.jsxs)(m,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,g.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,g.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:D(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,g.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,g.jsx)(`option`,{value:`on`,children:`On`}),(0,g.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,g.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,g.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,g.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:D(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,g.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,g.jsx)(`option`,{value:`on`,children:`On`}),(0,g.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,g.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,g.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})}export{x as ResourcesSection};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{Fn as a,Gn as o,Lt as s,Pn as c,Rt as l,Wn as u,ci as d,i as f,jn as p,k as m,mr as h,o as g,pr as _,qn as v,rr as y,tr as b}from"./project-scope-context-BiijuuWU.js";import{F as x,Ht as ee,I as te,J as S,Jt as ne,L as re,M as ie,R as C,U as w,Yt as T,Z as E,_t as D,gt as ae,q as oe,qt as se,t as ce,ut as le,vt as ue,y as de,z as fe}from"./queries-D6ioEk6c.js";import{d as pe,h as me}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as he,d as ge,f as _e,g as ve,m as ye,o as be,p as xe,s as Se}from"./tasks-table-DYjfmofR.js";import{n as O}from"./toaster-Bo5vCbz-.js";import{s as Ce}from"./runners-5cgs0qUY.js";import{A as we,F as Te,a as Ee,at as De,f as Oe,ft as ke,g as Ae,h as je,i as Me,l as Ne,m as Pe,p as Fe,q as Ie,t as Le,v as k,x as Re}from"./design-icons-CzEoMH9c.js";import{t as A}from"./createLucideIcon-BHp8sXmF.js";import{t as ze}from"./app-window-CSHwDX9N.js";import{n as Be,r as Ve,t as He}from"./open-in-menu-21vcjK3t.js";import{t as Ue}from"./info-DA1x_4bz.js";import{a as We,t as Ge}from"./format-BNCkW110.js";import{t as Ke}from"./message-square-B-MD-8rD.js";import{i as qe,n as Je,t as j}from"./reference-chip-B5br2cfV.js";import{t as Ye}from"./square-terminal-B6RYYieR.js";import{t as M}from"./button-BQ2y4XRB.js";import{a as N,i as P,l as F,n as I,p as L,r as R,t as z}from"./dropdown-menu-4e2iKSMT.js";import{i as Xe,r as Ze,t as Qe}from"./popover-BPgUYFyu.js";import{a as $e,i as et,o as tt,r as nt,s as rt,t as it}from"./dialog-BVF6dIeS.js";import{c as at,s as ot,t as B}from"./project-router-hhGBPlav.js";import"./attention-B6NEiTGm.js";import{T as st,f as V,u as ct,x as lt}from"./task-groups-CafTiSSz.js";import{t as H}from"./status-dot-DtAOFiIi.js";import{$t as ut,An as dt,B as U,Bt as ft,Gn as pt,Gt as mt,Ht as ht,Kn as gt,Kt as _t,Qt as vt,R as yt,Ut as bt,Vt as xt,Wt as St,Xn as Ct,a as W,dn as G,en as wt,fn as K,jn as Tt,kn as Et,m as Dt,nn as Ot,nr as kt,o as At,qt as jt,r as Mt,rn as Nt,sn as Pt,yn as Ft,z as It}from"./index-D-Y1olb1.js";import{r as Lt,t as Rt}from"./markdown-BDWII3gy.js";import{i as zt}from"./automation-format-1lHzRTbq.js";import{t as Bt}from"./textarea-vJt9undk.js";import{t as q}from"./tab-link-DaFUyEhe.js";var Vt=A(`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`}]]),Ht=A(`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`}]]),Ut=A(`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`}]]),J=e(t(),1),Y=n();function Wt(e){let t=ee();return T({mutationFn:t=>g(ne(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>se()),onError:e=>O(e.message,{tone:`danger`})})}function Gt(e){return e.archived?`Unarchive`:`Archive task`}function Kt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Y.jsx)(ft,{open:t,onOpenChange:n,children:(0,Y.jsxs)(bt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(_t,{children:[(0,Y.jsx)(jt,{children:`Archive task?`}),(0,Y.jsxs)(St,{children:[`Move “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:V(e),children:V(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Y.jsxs)(mt,{children:[(0,Y.jsx)(ht,{children:`Cancel`}),(0,Y.jsx)(xt,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function X({run:e,className:t,compactOnMobile:n=!1}){let[r,a]=(0,J.useState)(!1),o=Wt(e.id),s=Gt(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(M,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":s,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:o.isPending,className:i(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?o.mutate(!1):a(!0),children:[e.archived?(0,Y.jsx)(kt,{"aria-hidden":`true`}):(0,Y.jsx)(Le,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:i(n&&`max-md:sr-only`),children:s})]}),(0,Y.jsx)(Kt,{run:e,open:r,onOpenChange:a,onConfirm:()=>{o.mutate(!0),a(!1)}})]})}function qt({run:e,action:t,prUrl:n,patch:i}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,Y.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Y.jsx)(M,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>O(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Jt({run:e,blocker:t,flags:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Y.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(B,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,Y.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Y.jsx)(X,{run:e}):null]})]})}function Yt({run:e}){let t=C(e.id),n=K(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,Y.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,Y.jsx)(qt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,Y.jsx)(Jt,{run:e,blocker:i,flags:n}):null]})}var Xt=[`running`,`queued`,`waiting`];function Zt(e,{queuePosition:t,now:n=new Date}){let r=p(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Xt.includes(e.status)?$t(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Qt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function $t(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),O(t)}catch{O(`Run manually: ${e}`)}}function en(e){let t=w(),n=E(),r=(0,J.useMemo)(()=>ve(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,J.useMemo)(()=>n===void 0?[]:r.filter(e=>he(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function tn(e){return T({mutationFn:()=>l(e.id),onError:e=>{if(e instanceof f&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}O(e.message,{tone:`danger`})}})}function Q(e,t){let n=re(),r=S(),i=Ce(),a=T({mutationFn:t=>s(e.id,t),onError:e=>O(e.message,{tone:`danger`})}),o=Ft(),c=st(e),l=o.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:o.repoAccount?.[e]).runners,u=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&u(Pt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Be(e.id);return t===void 0||i.isSuccess&&u(t)}).map(t=>({target:t,...Nt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:a}}function nn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=Ce().data,s=G(e);return!r&&i.length===0&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[r||i.length>0?(0,Y.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Y.jsxs)(M,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Y.jsx)(Ye,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=Ve(e,o);return(0,Y.jsxs)(M,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Y.jsxs)(M,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>O(`Worktree path copied`)).catch(()=>O(`Path: ${t}`))},children:[(0,Y.jsx)(k,{}),`Copy worktree path`]}):null]}):null,s?(0,Y.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Y.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,Y.jsxs)(M,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(k,{}),`Copy resume command`]})]}):null]})}function rn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=G(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,Y.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Y.jsx)(He,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,Y.jsxs)(P,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,Y.jsxs)(M,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Z(s,`Worktree path copied`),children:[(0,Y.jsx)(k,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,Y.jsxs)(M,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Z(o,`Command copied to clipboard.`),children:[(0,Y.jsx)(k,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function an({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,Y.jsx)(P,{onSelect:r,children:`Open in…`}):(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Y.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Y.jsx)(ke,{})})]}),e.worktreePath?(0,Y.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(nn,{run:e,canResume:t,onResume:n})})]})}function on({branch:e}){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null);(0,J.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{O(`Could not copy branch. Select and copy: ${e}`)}};return(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Y.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-[11px] font-medium break-all`,children:e}),(0,Y.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,Y.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function sn({run:e}){let t=w(),n=E(),i=r=>n===void 0?void 0:_e(n,e.id,r,t),a=(0,J.useMemo)(()=>ve(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Y.jsx)(j,{reference:t,to:i(t),taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Y.jsx)(wt,{run:e,prNumber:t.number})},Se(t)));let l=ye(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,Y.jsx)(j,{reference:{kind:`PR`,url:l},taskTitle:V(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,Y.jsx)(j,{reference:t,to:i(t),taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},Se(t)));let d=ge(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=be(d);s.push((0,Y.jsx)(j,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Y.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,Y.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,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function cn(){let e=ot(),t=oe();return yt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var ln=e=>e.map(e=>`${e.name}: ${It(e.url)}`).join(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{Fn as a,Gn as o,Lt as s,Pn as c,Rt as l,Wn as u,ci as d,i as f,jn as p,k as m,mr as h,o as g,pr as _,qn as v,rr as y,tr as b}from"./project-scope-context-D3_4Nfjk.js";import{F as x,Ht as ee,I as te,J as S,Jt as ne,L as re,M as ie,R as C,U as w,Yt as T,Z as E,_t as D,gt as ae,q as oe,qt as se,t as ce,ut as le,vt as ue,y as de,z as fe}from"./queries-BaHOUYn4.js";import{d as pe,h as me}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as he,d as ge,f as _e,g as ve,m as ye,o as be,p as xe,s as Se}from"./tasks-table-I_z4e7uI.js";import{n as O}from"./toaster-Bo5vCbz-.js";import{s as Ce}from"./runners-DccsyraI.js";import{A as we,F as Te,a as Ee,at as De,f as Oe,ft as ke,g as Ae,h as je,i as Me,l as Ne,m as Pe,p as Fe,q as Ie,t as Le,v as k,x as Re}from"./design-icons-CzEoMH9c.js";import{t as A}from"./createLucideIcon-BHp8sXmF.js";import{t as ze}from"./app-window-CSHwDX9N.js";import{n as Be,r as Ve,t as He}from"./open-in-menu-LbTu2sP4.js";import{t as Ue}from"./info-DA1x_4bz.js";import{a as We,t as Ge}from"./format-BNCkW110.js";import{t as Ke}from"./message-square-B-MD-8rD.js";import{i as qe,n as Je,t as j}from"./reference-chip-CdOqXRll.js";import{t as Ye}from"./square-terminal-B6RYYieR.js";import{t as M}from"./button-BQ2y4XRB.js";import{a as N,i as P,l as F,n as I,p as L,r as R,t as z}from"./dropdown-menu-4e2iKSMT.js";import{i as Xe,r as Ze,t as Qe}from"./popover-BPgUYFyu.js";import{a as $e,i as et,o as tt,r as nt,s as rt,t as it}from"./dialog-BVF6dIeS.js";import{c as at,s as ot,t as B}from"./project-router-DImKA81z.js";import"./attention-B1Ei1IW6.js";import{T as st,f as V,u as ct,x as lt}from"./task-groups-C7yO8nMy.js";import{t as H}from"./status-dot-DtAOFiIi.js";import{$t as ut,An as dt,B as U,Bt as ft,Gn as pt,Gt as mt,Ht as ht,Kn as gt,Kt as _t,Qt as vt,R as yt,Ut as bt,Vt as xt,Wt as St,Xn as Ct,a as W,dn as G,en as wt,fn as K,jn as Tt,kn as Et,m as Dt,nn as Ot,nr as kt,o as At,qt as jt,r as Mt,rn as Nt,sn as Pt,yn as Ft,z as It}from"./index-MG3T7zFQ.js";import{r as Lt,t as Rt}from"./markdown-BDWm6oGX.js";import{i as zt}from"./automation-format-1lHzRTbq.js";import{t as Bt}from"./textarea-vJt9undk.js";import{t as q}from"./tab-link-VCVNqxFc.js";var Vt=A(`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`}]]),Ht=A(`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`}]]),Ut=A(`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`}]]),J=e(t(),1),Y=n();function Wt(e){let t=ee();return T({mutationFn:t=>g(ne(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>se()),onError:e=>O(e.message,{tone:`danger`})})}function Gt(e){return e.archived?`Unarchive`:`Archive task`}function Kt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Y.jsx)(ft,{open:t,onOpenChange:n,children:(0,Y.jsxs)(bt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(_t,{children:[(0,Y.jsx)(jt,{children:`Archive task?`}),(0,Y.jsxs)(St,{children:[`Move “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:V(e),children:V(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Y.jsxs)(mt,{children:[(0,Y.jsx)(ht,{children:`Cancel`}),(0,Y.jsx)(xt,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function X({run:e,className:t,compactOnMobile:n=!1}){let[r,a]=(0,J.useState)(!1),o=Wt(e.id),s=Gt(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(M,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":s,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:o.isPending,className:i(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?o.mutate(!1):a(!0),children:[e.archived?(0,Y.jsx)(kt,{"aria-hidden":`true`}):(0,Y.jsx)(Le,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:i(n&&`max-md:sr-only`),children:s})]}),(0,Y.jsx)(Kt,{run:e,open:r,onOpenChange:a,onConfirm:()=>{o.mutate(!0),a(!1)}})]})}function qt({run:e,action:t,prUrl:n,patch:i}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,Y.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Y.jsx)(M,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>O(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Jt({run:e,blocker:t,flags:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Y.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(B,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,Y.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Y.jsx)(X,{run:e}):null]})]})}function Yt({run:e}){let t=C(e.id),n=K(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,Y.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,Y.jsx)(qt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,Y.jsx)(Jt,{run:e,blocker:i,flags:n}):null]})}var Xt=[`running`,`queued`,`waiting`];function Zt(e,{queuePosition:t,now:n=new Date}){let r=p(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Xt.includes(e.status)?$t(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Qt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function $t(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),O(t)}catch{O(`Run manually: ${e}`)}}function en(e){let t=w(),n=E(),r=(0,J.useMemo)(()=>ve(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,J.useMemo)(()=>n===void 0?[]:r.filter(e=>he(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function tn(e){return T({mutationFn:()=>l(e.id),onError:e=>{if(e instanceof f&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}O(e.message,{tone:`danger`})}})}function Q(e,t){let n=re(),r=S(),i=Ce(),a=T({mutationFn:t=>s(e.id,t),onError:e=>O(e.message,{tone:`danger`})}),o=Ft(),c=st(e),l=o.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:o.repoAccount?.[e]).runners,u=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&u(Pt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Be(e.id);return t===void 0||i.isSuccess&&u(t)}).map(t=>({target:t,...Nt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:a}}function nn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=Ce().data,s=G(e);return!r&&i.length===0&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[r||i.length>0?(0,Y.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Y.jsxs)(M,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Y.jsx)(Ye,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=Ve(e,o);return(0,Y.jsxs)(M,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Y.jsxs)(M,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>O(`Worktree path copied`)).catch(()=>O(`Path: ${t}`))},children:[(0,Y.jsx)(k,{}),`Copy worktree path`]}):null]}):null,s?(0,Y.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Y.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,Y.jsxs)(M,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(k,{}),`Copy resume command`]})]}):null]})}function rn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=G(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,Y.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Y.jsx)(He,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,Y.jsxs)(P,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,Y.jsxs)(M,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Z(s,`Worktree path copied`),children:[(0,Y.jsx)(k,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,Y.jsxs)(M,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Z(o,`Command copied to clipboard.`),children:[(0,Y.jsx)(k,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function an({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,Y.jsx)(P,{onSelect:r,children:`Open in…`}):(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Y.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Y.jsx)(ke,{})})]}),e.worktreePath?(0,Y.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(nn,{run:e,canResume:t,onResume:n})})]})}function on({branch:e}){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null);(0,J.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{O(`Could not copy branch. Select and copy: ${e}`)}};return(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Y.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-[11px] font-medium break-all`,children:e}),(0,Y.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,Y.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function sn({run:e}){let t=w(),n=E(),i=r=>n===void 0?void 0:_e(n,e.id,r,t),a=(0,J.useMemo)(()=>ve(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Y.jsx)(j,{reference:t,to:i(t),taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Y.jsx)(wt,{run:e,prNumber:t.number})},Se(t)));let l=ye(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,Y.jsx)(j,{reference:{kind:`PR`,url:l},taskTitle:V(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,Y.jsx)(j,{reference:t,to:i(t),taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},Se(t)));let d=ge(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=be(d);s.push((0,Y.jsx)(j,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Y.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,Y.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,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function cn(){let e=ot(),t=oe();return yt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var ln=e=>e.map(e=>`${e.name}: ${It(e.url)}`).join(`
2
2
  `);function un(e){return cn().length>0||e.notify===!0}function dn({run:e}){let t=cn(),n=t.length>0,r=te(e.id),[i,a]=(0,J.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,Y.jsxs)(Y.Fragment,{children:[o?(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsxs)(M,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${U(t)} — webhook actions`:`Notifying — webhook actions`,title:n?ln(t):void 0,children:[(0,Y.jsx)(H,{tone:`success`}),(0,Y.jsx)(`span`,{children:`Notifying`}),(0,Y.jsx)(Ne,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Y.jsxs)(R,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Y.jsx)(N,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,Y.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:It(e.url),children:e.name},e.id))}):null,n?(0,Y.jsxs)(P,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Y.jsx)(Ke,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Y.jsxs)(P,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>O(`Stopped notifying the webhook`),onError:e=>O(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Y.jsx)(Vt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Y.jsxs)(M,{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,Y.jsx)(pt,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Y.jsx)(fn,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),O(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>O(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function fn({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,J.useId)(),o=(0,J.useId)(),[s,c]=(0,J.useState)(``);(0,J.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=U(t);return(0,Y.jsx)(it,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,Y.jsx)(nt,{"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,Y.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,Y.jsxs)(tt,{className:`text-left`,children:[(0,Y.jsx)(rt,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Y.jsx)(et,{children:(0,Y.jsx)(`span`,{"data-webhook-destination":``,title:ln(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,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Y.jsx)(Bt,{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,Y.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Y.jsx)(Ue,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Y.jsxs)($e,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Y.jsx)(M,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(M,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,Y.jsx)(pt,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function pn({runId:e,children:t}){let n=pe(),r=(0,J.useMemo)(()=>({runId:e}),[e]);return n?(0,Y.jsx)(mn,{runId:e,children:t}):(0,Y.jsx)(Lt.Provider,{value:r,children:t})}function mn({runId:e,children:t}){let{projectId:n}=me(),r=(0,J.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,Y.jsx)(Lt.Provider,{value:r,children:t})}function hn(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function gn(e){return typeof e==`object`&&!!e&&!(0,J.isValidElement)(e)&&`keep`in e}function _n({slot:e,icon:t,title:n,meta:r,summary:a,aside:o,open:s,onToggle:c,className:l,children:u}){let d=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,Y.jsx)(`span`,{className:i(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),a??(gn(r)?(0,Y.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,Y.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,Y.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,Y.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,Y.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}))]}),f=c!==void 0;return(0,Y.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:i(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:c,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-start hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,children:[d,o,(0,Y.jsx)(Ne,{"aria-hidden":!0,className:i(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!o&&`ms-auto`,s&&`rotate-180`)})]}):(0,Y.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,o]}),f&&s?(0,Y.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:u}):null]})}function $(e){return _(e.delegation)}function vn(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId).reverse():[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])]}function yn(e){let t=e.delegation,n=$(e),r=D(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=vn(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function bn(e){let t=D(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>lt(e.status))}function xn({run:e,open:t,onToggle:n}){let r=D(e.id),a=ue(),s=ut(),c=e.delegation,l=new Map(r.data?.workers.map(e=>[e.workerId,e])),d=vn(c,r.data),f=u(e)??o(e),p=f?Sn(e,f):void 0,m=e=>a.data?.find(t=>t.id===e)??r.data?.titles?.find(t=>t.id===e),h=e=>{let t=m(e);return t?V(t):`worker ${e.slice(0,8)}`};return(0,Y.jsx)(_n,{slot:`workers`,icon:(0,Y.jsx)(we,{className:`size-4`}),title:`Workers`,meta:Cn({ids:d,workers:l,desktop:s,query:r}),aside:r.data?.capacity?(0,Y.jsx)(An,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,Y.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[r.data?.capacity&&r.data.capacity.outstanding>=r.data.capacity.limit?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`All worker slots are in use. Clean up finished workers to free a slot.`}):null,f?(0,Y.jsx)(Dn,{wait:f,dependencyLabel:p}):null,d.length>0?(0,Y.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:d.map(t=>{let n=l.get(t),a=m(t),o=n?Tn(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,Y.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,Y.jsxs)(B,{to:`/tasks/${t}`,"aria-label":`Worker task ${t}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Y.jsx)(wn,{status:n?.status}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate`,children:a?V(a):`Worker ${t.slice(0,8)}`}),n?.supervisorRunId&&n.supervisorRunId!==e.id?(0,Y.jsxs)(`span`,{"data-slot":`worker-supervisor`,className:`block truncate text-xs text-muted-foreground`,children:[`Started by `,h(n.supervisorRunId)]}):null]}),(0,Y.jsx)(`span`,{className:i(`max-w-[45%] shrink-0 truncate text-xs`,En(n?.status)),children:o}),(0,Y.jsx)(Ee,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,Y.jsx)(Mn,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,Y.jsx)(In,{state:n.destroy}):null]},t)})}):$(e)&&r.isSuccess?(0,Y.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,Y.jsx)(M,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function Sn(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return a(e)??c(n.role,t,`requestIds`in t&&v(n,t.requestIds))}function Cn({ids:e,workers:t,desktop:n,query:r}){if(e.length===0)return r.isError?`Unavailable`:r.isPending?`Linking…`:`No workers`;let i=`${e.length} linked`;if(!n)return i;let a=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&a.set(e,(a.get(e)??0)+1)}return[i,...[...a.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function wn({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,Y.jsx)(Oe,{"aria-hidden":!0,className:i(t,`text-success`)}):e===`failed`?(0,Y.jsx)(Ae,{"aria-hidden":!0,className:i(t,`text-danger`)}):e===`cancelled`?(0,Y.jsx)(je,{"aria-hidden":!0,className:i(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,Y.jsx)(We,{role:`status`,"aria-label":`Worker running`,className:i(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,Y.jsx)(Pe,{"aria-hidden":!0,className:i(t,`text-soft-foreground`)})}function Tn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function En(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function Dn({wait:e,dependencyLabel:t}){return(0,Y.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`requestIds`in e&&e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,`deadline`in e?(0,Y.jsxs)(Y.Fragment,{children:[` `,`Deadline: `,(0,Y.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: Squawk wakes this task when they have all settled.`]})}function On(e){return e.delegation?.role===`worker`&&o(e)?.phase===`wake-pending`}function kn({run:e}){let t=o(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,Y.jsx)(Dn,{wait:t,dependencyLabel:c(`worker`,t)}):null}function An({capacity:e}){return(0,Y.jsxs)(`span`,{"data-slot":`worker-capacity`,role:`status`,"aria-label":`Worker capacity: ${e.outstanding} of ${e.limit} in use`,className:`ms-auto shrink-0 whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:[e.outstanding,` of `,e.limit,` in use`]})}var jn=new Set([`review`,`done`,`failed`,`cancelled`]);function Mn({parentRunId:e,worker:t}){let n=de(e),[r,i]=(0,J.useState)(!1);if(!jn.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let a=t.workerId.slice(0,8),o=!!t.destroy&&t.destroy.phase!==`complete`,s=n.error instanceof f?n.error.work:void 0;return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`break-words text-xs`,children:h(t.workspace)?`Removes this worker's worktree and branch. Its result is saved first.`:`Stops this worker and frees its slot. It runs in this task's worktree, so no worktree or branch is removed. Its result is saved first.`}),(0,Y.jsx)(M,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${a}`,onClick:()=>{i(!1),n.mutate({workerId:t.workerId})},children:`Clean up`}),(0,Y.jsx)(M,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,Y.jsx)(M,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":o?`Retry clean up of worker ${a}`:`Clean up worker ${a}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:o?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,Y.jsx)(`span`,{role:`status`,className:`break-words text-xs`,children:s?`Cleanup stopped: this worker holds ${Pn(s)}. Land or commit what you need first, or discard it.`:`Cleanup did not finish: ${n.error.message}`}):null,s&&!r&&!n.isPending?(0,Y.jsx)(M,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Discard work and clean up worker ${a}`,onClick:()=>n.mutate({workerId:t.workerId,discardWork:!0}),children:`Discard work and clean up`}):null]})}var Nn=(e,t,n)=>`${e} ${e===1?t:n}`;function Pn(e){return[...e.uncommittedFiles?[Nn(e.uncommittedFiles,`uncommitted file`,`uncommitted files`)]:[],...e.commits?[`${Nn(e.commits,`commit`,`commits`)} no other branch reaches`]:[]].join(` and `)}function Fn(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function In({state:e}){if(!Fn(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,Y.jsx)(Ln,{at:t.nextAt});return(0,Y.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[t?.needsAttention?`Cleanup needs attention`:e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${t?e.error.replace(/\.$/,``):e.error}`:``,t?.needsAttention?(0,Y.jsxs)(Y.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,Y.jsxs)(Y.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function Ln({at:e}){let t=vt(3e4);return(0,Y.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:zt(t,Date.parse(e))})}function Rn({id:e}){return(0,Y.jsxs)(B,{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,Y.jsx)(Me,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function zn({id:e}){let t=le(e),n=t.data?V(t.data):e;return(0,Y.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,Y.jsxs)(B,{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,Y.jsx)(Me,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Y.jsx)(M,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Bn=3,Vn=(e,t)=>e.kind===t.kind&&e.number===t.number;function Hn(e,t,n=Bn){let r=t?e.findIndex(e=>Vn(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 Un=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Wn({tab:e}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(e.kind===`pr`?Te:Fe,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Y.jsx)(Je,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Gn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Kn({servers:e}){let t=Dt();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,Y.jsxs)(M,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Y.jsx)(ze,{"aria-hidden":`true`}),Gn(e,n),t.live?(0,Y.jsx)(H,{tone:`success`,"aria-label":`Preview is live`}):null]})}function qn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function Jn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,Y.jsx)(Rn,{id:n}):(0,Y.jsx)(zn,{id:n})}function Yn(e,t,n,r){return!e.archiveBlocker&&t.archive&&(n!==`session`||!Ot(e,r))?(0,Y.jsx)(X,{run:e}):null}function Xn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Y.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function Zn({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=un(t);return e&&(n||r||i)?(0,Y.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,Y.jsx)(dn,{run:t})]}):null}function Qn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,J.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,J.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,Y.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 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-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,Y.jsx)(q,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,Y.jsx)(q,{to:Un(e.id,t),active:n!==null&&Vn(t,n),replace:a,children:(0,Y.jsx)(Wn,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,Y.jsxs)(z,{children:[(0,Y.jsxs)(L,{"data-slot":`run-tabs-more`,"aria-label":`${i.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:[`+`,i.length]}),(0,Y.jsx)(R,{align:`end`,children:i.map(t=>(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(B,{to:Un(e.id,t),replace:a,children:(0,Y.jsx)(Wn,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function $n({run:e,tab:t=`session`,onMarkedUnread:n}){let r=p(e),a=K(e),o=bn(e),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),d=er(e,n),f=ue(),m=ie(),h=Zt(e,{queuePosition:e.status===`queued`?ct(f.data??[]).get(e.id):void 0}),g=Tt(),_=dt(),v=g!==null&&!_?g:null,y=v!==null,{referenceProjectId:b,repoBase:x,requests:ee}=en(e),te=(0,J.useMemo)(()=>xe(e,x),[e,x]),S=typeof t==`object`?t:null,{inline:ne,overflow:re}=Hn(te,S),C=m.data?.capabilities?.preview===!0,w=e.worktreePath&&C?(0,Y.jsx)(Kn,{servers:e.previewServers??[]}):null,T=(0,Y.jsx)(ir,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),E=Yn(e,a,t,o);return(0,Y.jsx)(qe,{projectId:b,repoBase:x,requests:ee,children:(0,Y.jsxs)(`header`,{"data-slot":`run-header`,className:i(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,y?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,Y.jsx)(Xn,{run:e}),(0,Y.jsx)(Yt,{run:e}),(0,Y.jsxs)(`div`,{className:`w-full`,children:[(0,Y.jsx)(Jn,{run:e}),v?(0,Y.jsxs)(Et,{slot:v,children:[(0,Y.jsx)(rr,{run:e}),(0,Y.jsx)(Jn,{run:e,compact:!0}),T]}):(0,Y.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,Y.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:qn(e.delegation)}),(0,Y.jsx)(nr,{run:e}),(0,Y.jsx)(Mt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Qt(h)}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[E,w,(0,Y.jsx)(dn,{run:e}),T]})]}),(0,Y.jsx)(Zn,{shown:v!==null,run:e,archiveButton:E,previewToggle:w}),(0,Y.jsx)(Qn,{run:e,tab:t,activeItem:S,inlineItemTabs:ne,overflowItemTabs:re,phoneBar:y,isDesktop:_}),s?(0,Y.jsx)(sr,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,Y.jsx)(an,{run:e,canResume:K(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,Y.jsx)(or,{run:e,actions:d})]})})}function er(e,t){let n=d(),r=at(),[i,a]=(0,J.useState)(null),o=()=>n.invalidateQueries({queryKey:ce.runs.all}),s=e=>O(e.message,{tone:`danger`}),c=fe(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=x();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:T({mutationFn:()=>m(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:tn(e),confirming:i,setConfirming:a}}function tr(e){let t=C(e.id),n=V(e);return{title:n,editor:At(n,e=>t.mutate({title:e},{onError:e=>O(e.message,{tone:`danger`})}))}}function nr({run:e}){let{title:t,editor:n}=tr(e);return n.editing?(0,Y.jsx)(W,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Y.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Y.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,Y.jsx)(gt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function rr({run:e}){let{title:t,editor:n}=tr(e);return(0,Y.jsxs)(Qe,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,Y.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,Y.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,Y.jsx)(Xe,{asChild:!0,children:(0,Y.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,Y.jsx)(gt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(Ze,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,Y.jsx)(W,{editor:n,className:`text-[16px] font-semibold`})})]})}function ir({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=K(e),a=G(e),o=C(e.id),s=(0,J.useId)();return(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Y.jsx)(Re,{"aria-hidden":`true`})})}),(0,Y.jsxs)(R,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Y.jsx)(N,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,Y.jsxs)(P,{onSelect:n,children:[(0,Y.jsx)(Ct,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Y.jsx)(an,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Y.jsxs)(P,{onSelect:()=>void Z(a,`Command copied to clipboard.`),children:[(0,Y.jsx)(k,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Y.jsxs)(P,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Y.jsx)(Ht,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Y.jsxs)(I,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Y.jsx)(Ut,{"aria-hidden":`true`}):(0,Y.jsx)(Ie,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Y.jsx)(F,{}),(0,Y.jsx)(N,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Y.jsx)(I,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:o.isPending,onCheckedChange:e=>o.mutate({archiveWhenDone:e},{onError:e=>O(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Y.jsx)(I,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:o.isPending,"aria-describedby":s,onCheckedChange:e=>o.mutate({autoMergePr:e},{onError:e=>O(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Y.jsx)(`p`,{id:s,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,Y.jsx)(ar,{run:e,patch:o}),i.deleteRun?(0,Y.jsx)(F,{}):null,i.deleteRun?(0,Y.jsxs)(P,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Y.jsx)(De,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function ar({run:e,patch:t}){let n=(0,J.useId)(),r=(0,J.useId)(),i=(0,J.useId)(),a=e=>O(e.message,{tone:`danger`});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(F,{}),(0,Y.jsx)(N,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Y.jsx)(I,{"data-slot":`allow-workers`,className:`min-h-11`,checked:y(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,Y.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,Y.jsx)(I,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:b(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,Y.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,Y.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 or({run:e,actions:t}){let n=t.confirming;return(0,Y.jsx)(ft,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Y.jsxs)(bt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(_t,{children:[(0,Y.jsx)(jt,{className:`text-danger`,children:`Delete task permanently?`}),(0,Y.jsx)(St,{children:(0,Y.jsxs)(Y.Fragment,{children:[`Delete “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:V(e),children:V(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!h(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,Y.jsxs)(mt,{children:[(0,Y.jsx)(ht,{children:`Cancel`}),(0,Y.jsx)(xt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function sr({runId:e,onClose:t}){let n=ae(e);return(0,Y.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Y.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Y.jsx)(ke,{})})]}),n.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Y.jsx)(pn,{runId:e,children:(0,Y.jsx)(Rt,{children:n.data})}):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,Y.jsx)(M,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Y.jsx)(M,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{en as _,Fn as a,bn as c,hn as d,pn as f,tn as g,rn as h,kn as i,yn as l,sn as m,In as n,On as o,on as p,xn as r,$ as s,$n as t,_n as u,Zt as v,X as y};
@@ -1 +1 @@
1
- import{Xr as e,f as t,gn as n,jt as r}from"./project-scope-context-BiijuuWU.js";import{H as i,M as a,P as o,R as s,j as c,k as l}from"./live-protocol-D9ji1YCl.js";import{t as u}from"./useQuery-BTg3x78A.js";var d=l([`own`,`provider-spanning`]),f=s({suggested:c(s({id:i(),label:i(),desc:i()})),retired:c(i())}),p=s({id:l([`settings`,`mcp`,`memory`]),label:i(),note:i().optional(),empty:i().optional(),showsUserMcp:o(!0).optional()}),m=s({label:i(),note:i().optional(),groups:c(p)}),h=s({runners:c(s({id:e,displayName:i(),modelListName:i(),modelIdScope:d,pickerLabel:i(),pickerDescription:i(),icon:i(),installHint:i(),loginCommand:i(),terminalLogin:a().optional(),browserLogin:a().optional(),managedInstall:o(!0).optional(),accountFolderExample:i().optional(),models:f,agentConfig:m}))}),g=[`workspace`,`runners`];async function _(e){return n(await t.api.v1.runners.$get({},r(e)),`/runners`,h)}var v={queryKey:g,queryFn:({signal:e})=>_({signal:e}),staleTime:1/0};function y(){return u(v)}function b(e){return e?.runners??[]}function x(e){return b(e).map(e=>e.id)}function S(e,t){return e?.runners.find(e=>e.id===t)}function C(e,t){return S(e,t)?.displayName??t}function w(e,t){return S(e,t)?.pickerLabel??t}function T(e,t){return S(e,t)?.modelListName}export{T as a,x as i,b as n,w as o,S as r,y as s,C as t};
1
+ import{Xr as e,f as t,gn as n,jt as r}from"./project-scope-context-D3_4Nfjk.js";import{H as i,M as a,P as o,R as s,j as c,k as l}from"./live-protocol-D9ji1YCl.js";import{t as u}from"./useQuery-BMyCehPp.js";var d=l([`own`,`provider-spanning`]),f=s({suggested:c(s({id:i(),label:i(),desc:i()})),retired:c(i())}),p=s({id:l([`settings`,`mcp`,`memory`]),label:i(),note:i().optional(),empty:i().optional(),showsUserMcp:o(!0).optional()}),m=s({label:i(),note:i().optional(),groups:c(p)}),h=s({runners:c(s({id:e,displayName:i(),modelListName:i(),modelIdScope:d,pickerLabel:i(),pickerDescription:i(),icon:i(),installHint:i(),loginCommand:i(),terminalLogin:a().optional(),browserLogin:a().optional(),managedInstall:o(!0).optional(),accountFolderExample:i().optional(),models:f,agentConfig:m}))}),g=[`workspace`,`runners`];async function _(e){return n(await t.api.v1.runners.$get({},r(e)),`/runners`,h)}var v={queryKey:g,queryFn:({signal:e})=>_({signal:e}),staleTime:1/0};function y(){return u(v)}function b(e){return e?.runners??[]}function x(e){return b(e).map(e=>e.id)}function S(e,t){return e?.runners.find(e=>e.id===t)}function C(e,t){return S(e,t)?.displayName??t}function w(e,t){return S(e,t)?.pickerLabel??t}function T(e,t){return S(e,t)?.modelListName}export{T as a,x as i,b as n,w as o,S as r,y as s,C as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{br as i,ci as a,f as o,hn as s}from"./project-scope-context-BiijuuWU.js";import{M as c,Nt as l,Yt as u}from"./queries-D6ioEk6c.js";import{t as d}from"./useQuery-BTg3x78A.js";import{i as f,n as p,s as m}from"./runners-5cgs0qUY.js";import{it as h,l as g}from"./design-icons-CzEoMH9c.js";import{t as _}from"./button-BQ2y4XRB.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-BVF6dIeS.js";import{Hn as w}from"./index-D-Y1olb1.js";var T=e(t(),1),E=n();function D(e,t){return p(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists,...e.isDefault||e.status===void 0?{}:{accountStatus:e.status.status}}))})}var O=(e,t)=>e.length>f(t).length;function k(e,t,n){let r=i(e.data,t),a=r!==void 0&&r.status!==`not-installed`&&(n??r.status)===`connected`,o=!e.isPending&&!e.isError&&r?.enabled===!0&&a;return{providerConnected:o,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:r?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`}}function A({rows:e,runner:t,accountFor:n,providerStatus:i,disabled:a=!1,accountDisabled:o=!1,onPick:s}){let c=m().data,l=c===void 0,u=O(e,c);return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:r(`gap-0.5 rounded-md border border-border bg-card p-0.5`,u?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let{providerConnected:d,providerReason:f}=k(i,c.runner.id,c.accountStatus),p=e.filter(e=>e.runner.id===c.runner.id).length>1,m=c.runner.id===t&&c.account===n(c.runner.id);return(0,E.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":c.runner.id,"data-account":c.account??``,title:f??c.desc,disabled:a||l||!d||p&&o,onClick:()=>s(c.runner.id,c.account,p),className:r(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,u?(0,E.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}async function j(e,t){return s(await o.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function M(e){return s(await o.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function N(e,t){return s(await o.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function P(e){return s(await o.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function F(e,t){let n=a(),[r,i]=(0,T.useState)(!1),[o,s]=(0,T.useState)(null),[c,f]=(0,T.useState)(``),p=(0,T.useRef)(null),m=(0,T.useRef)(!0),h=(0,T.useRef)(0),g=()=>{h.current++,v.current=!1;let e=p.current;p.current=null,e?.state===`waiting`&&P(e.id).catch(()=>{}),s(null),f(``),i(!1)};(0,T.useEffect)(()=>(m.current=!0,()=>{m.current=!1,h.current++;let e=p.current;e?.state===`waiting`&&P(e.id).catch(()=>{})}),[]);let _=u({mutationFn:n=>j(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!m.current||!v.current||t!==h.current){P(e.id).catch(()=>{});return}p.current=e,s(e)}}),v=(0,T.useRef)(r);v.current=r;let y=d({queryKey:[`browser-sign-in`,o?.id],queryFn:()=>M(o.id),enabled:r&&o?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),b=y.data??o,x=u({mutationFn:()=>N(o.id,c),retry:!1,onSuccess:()=>{f(``),y.refetch()}});return(0,T.useEffect)(()=>{b?.state===`connected`&&(p.current=b,s(b),Promise.all([n.invalidateQueries({queryKey:l.agentProfiles}),n.invalidateQueries({queryKey:l.providerStatus}),n.invalidateQueries({queryKey:l.models(e)})]))},[b,n,e]),{open:r,result:b,redirect:c,setRedirect:f,start:_,replay:x,status:y,error:_.error??x.error??y.error,close:g,connect:()=>{i(!0),v.current=!0,_.reset(),x.reset(),_.mutate(++h.current)}}}function I(){return`Open the sign-in link in your browser. After Google consent, the page shows a code. Copy that code, or the full address of that page, and paste it below.`}function L({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:l,status:u,error:d,close:f,connect:p}=F(e,t);return c().data?.capabilities?.settingsAdmin===!0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:p,children:`Connect`}),(0,E.jsx)(C,{open:r,onOpenChange:e=>{e||f()},children:(0,E.jsxs)(x,{children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(S,{children:[`Sign in to `,n]}),(0,E.jsx)(y,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,E.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,E.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,E.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,E.jsx)(I,{})}),(0,E.jsxs)(`label`,{className:`grid gap-2`,children:[`Code or page address`,(0,E.jsx)(w,{type:`text`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,E.jsx)(_,{disabled:!a.trim()||l.isPending,onClick:()=>l.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,E.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,E.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,E.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,d?(0,E.jsx)(`p`,{role:`alert`,children:d.message}):null,u.isError&&i?.state===`waiting`?(0,E.jsx)(_,{onClick:()=>void u.refetch(),children:`Retry status`}):null,(0,E.jsx)(v,{children:(0,E.jsx)(_,{variant:`outline`,onClick:f,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]}):null}function R(e){let t=(0,T.useRef)(null),n=e.rows.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id));return(0,E.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,E.jsxs)(`summary`,{children:[(0,E.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:(n?.label??e.runner).replace(/^codex/,`Codex`).replace(/^claude/,`Claude Code`)}),(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,E.jsx)(A,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}export{k as a,O as i,L as n,D as r,R as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{br as i,ci as a,f as o,hn as s}from"./project-scope-context-D3_4Nfjk.js";import{M as c,Nt as l,Yt as u}from"./queries-BaHOUYn4.js";import{t as d}from"./useQuery-BMyCehPp.js";import{i as f,n as p,s as m}from"./runners-DccsyraI.js";import{it as h,l as g}from"./design-icons-CzEoMH9c.js";import{t as _}from"./button-BQ2y4XRB.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-BVF6dIeS.js";import{Hn as w}from"./index-MG3T7zFQ.js";var T=e(t(),1),E=n();function D(e,t){return p(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists,...e.isDefault||e.status===void 0?{}:{accountStatus:e.status.status}}))})}var O=(e,t)=>e.length>f(t).length;function k(e,t,n){let r=i(e.data,t),a=r!==void 0&&r.status!==`not-installed`&&(n??r.status)===`connected`,o=!e.isPending&&!e.isError&&r?.enabled===!0&&a;return{providerConnected:o,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:r?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`}}function A({rows:e,runner:t,accountFor:n,providerStatus:i,disabled:a=!1,accountDisabled:o=!1,onPick:s}){let c=m().data,l=c===void 0,u=O(e,c);return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:r(`gap-0.5 rounded-md border border-border bg-card p-0.5`,u?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let{providerConnected:d,providerReason:f}=k(i,c.runner.id,c.accountStatus),p=e.filter(e=>e.runner.id===c.runner.id).length>1,m=c.runner.id===t&&c.account===n(c.runner.id);return(0,E.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":c.runner.id,"data-account":c.account??``,title:f??c.desc,disabled:a||l||!d||p&&o,onClick:()=>s(c.runner.id,c.account,p),className:r(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,u?(0,E.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}async function j(e,t){return s(await o.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function M(e){return s(await o.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function N(e,t){return s(await o.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function P(e){return s(await o.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function F(e,t){let n=a(),[r,i]=(0,T.useState)(!1),[o,s]=(0,T.useState)(null),[c,f]=(0,T.useState)(``),p=(0,T.useRef)(null),m=(0,T.useRef)(!0),h=(0,T.useRef)(0),g=()=>{h.current++,v.current=!1;let e=p.current;p.current=null,e?.state===`waiting`&&P(e.id).catch(()=>{}),s(null),f(``),i(!1)};(0,T.useEffect)(()=>(m.current=!0,()=>{m.current=!1,h.current++;let e=p.current;e?.state===`waiting`&&P(e.id).catch(()=>{})}),[]);let _=u({mutationFn:n=>j(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!m.current||!v.current||t!==h.current){P(e.id).catch(()=>{});return}p.current=e,s(e)}}),v=(0,T.useRef)(r);v.current=r;let y=d({queryKey:[`browser-sign-in`,o?.id],queryFn:()=>M(o.id),enabled:r&&o?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),b=y.data??o,x=u({mutationFn:()=>N(o.id,c),retry:!1,onSuccess:()=>{f(``),y.refetch()}});return(0,T.useEffect)(()=>{b?.state===`connected`&&(p.current=b,s(b),Promise.all([n.invalidateQueries({queryKey:l.agentProfiles}),n.invalidateQueries({queryKey:l.providerStatus}),n.invalidateQueries({queryKey:l.models(e)})]))},[b,n,e]),{open:r,result:b,redirect:c,setRedirect:f,start:_,replay:x,status:y,error:_.error??x.error??y.error,close:g,connect:()=>{i(!0),v.current=!0,_.reset(),x.reset(),_.mutate(++h.current)}}}function I(){return`Open the sign-in link in your browser. After Google consent, the page shows a code. Copy that code, or the full address of that page, and paste it below.`}function L({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:l,status:u,error:d,close:f,connect:p}=F(e,t);return c().data?.capabilities?.settingsAdmin===!0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:p,children:`Connect`}),(0,E.jsx)(C,{open:r,onOpenChange:e=>{e||f()},children:(0,E.jsxs)(x,{children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(S,{children:[`Sign in to `,n]}),(0,E.jsx)(y,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,E.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,E.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,E.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,E.jsx)(I,{})}),(0,E.jsxs)(`label`,{className:`grid gap-2`,children:[`Code or page address`,(0,E.jsx)(w,{type:`text`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,E.jsx)(_,{disabled:!a.trim()||l.isPending,onClick:()=>l.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,E.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,E.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,E.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,d?(0,E.jsx)(`p`,{role:`alert`,children:d.message}):null,u.isError&&i?.state===`waiting`?(0,E.jsx)(_,{onClick:()=>void u.refetch(),children:`Retry status`}):null,(0,E.jsx)(v,{children:(0,E.jsx)(_,{variant:`outline`,onClick:f,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]}):null}function R(e){let t=(0,T.useRef)(null),n=e.rows.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id));return(0,E.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,E.jsxs)(`summary`,{children:[(0,E.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:(n?.label??e.runner).replace(/^codex/,`Codex`).replace(/^claude/,`Claude Code`)}),(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,E.jsx)(A,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}export{k as a,O as i,L as n,D as r,R as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Cn as r,On as i,Tn as a,kn as o,wn as s}from"./project-scope-context-BiijuuWU.js";import{At as c,Ot as l,q as u,rt as d,v as f,wt as p}from"./queries-D6ioEk6c.js";import{n as m,p as h,r as g}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as _}from"./toaster-Bo5vCbz-.js";import{l as v,u as y}from"./design-icons-CzEoMH9c.js";import{t as b}from"./createLucideIcon-BHp8sXmF.js";import{t as x}from"./button-BQ2y4XRB.js";import{n as ee,r as S,t as te}from"./collapsible-BEV4FO-1.js";import{t as C}from"./switch-Bv2Zf1uU.js";import{t as w}from"./badge-D9JrXe0o.js";import{n as T,s as E,t as D}from"./project-router-hhGBPlav.js";import"./attention-B6NEiTGm.js";import{Hn as O,Rn as ne,dt as re,ft as k,pt as A,z as j}from"./index-D-Y1olb1.js";import{t as ie}from"./textarea-vJt9undk.js";import{ArchiveOnMergeField as ae}from"./archive-on-merge-field-DtR7twJI.js";import{a as oe,i as se,n as ce,t as le}from"./projects-section-CQ34YFnT.js";import{t as M}from"./settings-field-Bl6WuvGX.js";import{t as ue}from"./project-location-CvJMe_Vp.js";var de=b(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),N=e(t(),1),P={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},F=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),I={name:``,description:``,url:``,token:``,tasks:!0,triggers:i,agent:!1};function L(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??i,agent:e.agent}}var R=e=>o.filter(t=>e.includes(t));function z(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...F(e.triggers,i)?{}:{triggers:R(e.triggers)},agent:e.agent}}function B(e,t){let n={},r=e.name.trim(),a=e.description.trim(),o=e.url.trim();return r!==t.name&&(n.name=r),a!==(t.description??``)&&(n.description=a),o!==t.url&&(n.url=o),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),F(e.triggers,t.triggers??i)||(n.triggers=R(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var V=n(),H=`flex flex-col gap-1 text-[13px]`,U=`text-[11px] text-muted-foreground`;function W({draft:e,onChange:t,tokenSet:n}){let i=(0,N.useId)(),c=(0,N.useId)(),l=(0,N.useId)(),u=(0,N.useId)(),d=(0,N.useId)(),f=(0,N.useId)(),p=(0,N.useId)(),m=(0,N.useId)(),h=(0,N.useId)(),g=(0,N.useId)();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:i,className:U,children:`Name`}),(0,V.jsx)(O,{id:i,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:u,className:U,children:`URL`}),(0,V.jsx)(O,{id:u,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:a,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:c,className:U,children:`Description`}),(0,V.jsx)(ie,{id:c,"data-slot":`webhook-description`,"aria-describedby":l,rows:2,maxLength:r,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,V.jsx)(`span`,{id:l,className:`text-[11px] text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:d,className:U,children:`Token`}),(0,V.jsx)(O,{id:d,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:s,"aria-describedby":f,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,V.jsx)(`span`,{id:f,className:`text-[11px] text-soft-foreground`,children:n?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo. It is sent as a Bearer header.`})]}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(C,{id:p,"aria-describedby":m,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:p,className:`font-medium`,children:`Task notifications`}),(0,V.jsx)(`span`,{id:m,className:`text-[11px] text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,V.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,V.jsx)(`legend`,{className:`pbe-1 text-[11px] text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:o.map(n=>(0,V.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,V.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:P[n].label}),(0,V.jsx)(`span`,{className:`text-[11px] text-soft-foreground`,children:P[n].hint})]})]},n))}),(0,V.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(C,{id:h,"aria-describedby":g,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:h,className:`font-medium`,children:`Let agents send reports`}),(0,V.jsx)(`span`,{id:g,className:`text-[11px] text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var G=`max-sm:h-11`,K=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),fe=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function q({feedback:e}){return e?(0,V.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var J=`rounded-md border border-border bg-background`,Y=`flex flex-col gap-3 border-bs border-border p-3`;function pe({projectId:e,webhook:t,defaultOpen:n=!1}){let r=l(),i=d(),a=p(),[o,s]=(0,N.useState)(n),[c,u]=(0,N.useState)(()=>L(t)),[f,m]=(0,N.useState)(null),h=B(c,t),g=Object.keys(h).length>0,y=c.name.trim()!==``&&c.url.trim()!==``,b=r.isPending||i.isPending||a.isPending,C={projectId:e,webhookId:t.id},T=e=>r.mutate({...C,...h},{onSuccess:()=>{u(e=>({...e,token:``})),e?e():_(`${c.name.trim()} saved`)},onError:e=>m(K(e,`Save`))}),E=()=>a.mutate(C,{onSuccess:e=>m(fe(e)),onError:e=>m({tone:`danger`,text:e.message})});return(0,V.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:J,children:(0,V.jsxs)(te,{open:o,onOpenChange:s,children:[(0,V.jsx)(S,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,V.jsx)(w,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,V.jsx)(w,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,V.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:j(t.url)})]}),(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(ee,{children:(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,className:Y,onSubmit:e=>{e.preventDefault(),m(null),y&&g&&T()},children:[(0,V.jsx)(W,{draft:c,tokenSet:t.tokenSet,onChange:e=>u(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,"data-action":`webhook-save`,disabled:b||!y||!g,children:`Save`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`outline`,"data-action":`webhook-test`,disabled:b||!y,onClick:()=>{m(null),g?T(E):E()},children:`Send test`}),t.tokenSet?(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:b,onClick:()=>r.mutate({...C,token:``},{onSuccess:()=>_(`Webhook token cleared`),onError:e=>m({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:b,onClick:()=>i.mutate(C,{onSuccess:()=>_(`${t.name} removed`),onError:e=>m({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,V.jsx)(q,{feedback:f})]})})]})})}function me({projectId:e,onCreated:t,onCancel:n}){let r=f(),[i,a]=(0,N.useState)(I),[o,s]=(0,N.useState)(null),c=i.name.trim()!==``&&i.url.trim()!==``;return(0,V.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:J,children:[(0,V.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"aria-label":`New webhook`,className:Y,onSubmit:n=>{n.preventDefault(),s(null),c&&r.mutate({projectId:e,...z(i)},{onSuccess:({webhook:e})=>{_(`${e.name} created`),t(e)},onError:e=>s(K(e,`Create`))})},children:[(0,V.jsx)(W,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,"data-action":`webhook-create`,disabled:r.isPending||!c,children:`Create`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,V.jsx)(q,{feedback:o})]})]})}function he({project:e}){let t=e.webhooks??[],[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(null),o=t.length>=16;return(0,V.jsx)(M,{title:`Webhooks`,hint:`A webhook gets a POST from Squawk. Tasks can send their status to it, and agents can send it reports.`,children:(0,V.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,V.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,V.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,V.jsx)(pe,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,V.jsx)(me,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,V.jsx)(de,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,V.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function X(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Z(){let e=E(),t=u(),n=c();if(t.isPending)return(0,V.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(t.isError)return(0,V.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,t.error.message]});let r=t.data,i=r?.projects.find(t=>t.id===e);return!r||!i?null:(0,V.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,V.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,V.jsx)(ue,{}),(0,V.jsx)(ge,{project:i}),(0,V.jsx)(M,{title:`Max parallel tasks`,hint:n.data?`The workspace limit (${n.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:n.data?(0,V.jsx)(le,{project:i,workspaceMax:n.data.resources.maxParallel}):(0,V.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,V.jsx)(he,{project:i},i.id)]}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(_e,{project:i,bootProject:r.bootProject})})]})}function ge({project:e}){return(0,V.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Project`}),(0,V.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Branch`}),(0,V.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Status`}),(0,V.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[ce[e.status],e.status===`missing`?` — remove it below, or restore the folder`:null]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Added`}),(0,V.jsxs)(`dd`,{className:`mt-1`,children:[X(e.addedAt),(0,V.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Last opened`}),(0,V.jsx)(`dd`,{className:`mt-1`,children:X(e.lastOpenedAt)})]})]})}function _e({project:e,bootProject:t}){let[n,r]=(0,N.useState)(null),i=oe(),a=h(),o=e.id===t;return(0,V.jsxs)(M,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,V.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`Squawk is serving this project — it re-registers itself at every start.`}):null]}),(0,V.jsx)(se,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function ve(e){return e===`global`?{Link:m,NavLink:g}:{Link:D,NavLink:T}}function Q({scope:e,title:t,mobileTitle:n}){let r=ne().name;return(0,V.jsxs)(`header`,{"data-slot":`settings-main-header`,className:`settings-route-header flex shrink-0 flex-col gap-2`,children:[(0,V.jsxs)(`h1`,{className:`text-[15px] font-semibold tracking-normal max-md:text-[24px] max-md:font-normal`,children:[(0,V.jsx)(`span`,{className:`md:hidden`,children:n}),(0,V.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` · `,e===`global`?`every project`:r??`this project`]})]}),e===`global`?(0,V.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}function $({scope:e,activeId:t}){let{NavLink:n}=ve(e),r=A(e);return(0,V.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,V.jsxs)(`summary`,{children:[r.find(e=>e.id===t)?.title??`General`,(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,V.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,V.jsx)(n,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,r.map(t=>(0,V.jsx)(n,{to:k(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function ye({section:e,scope:t}){let n=e.component;return(0,V.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,V.jsx)(Q,{scope:t,title:e.title,mobileTitle:t===`global`?`Global settings`:`Project settings`}),(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:t,activeId:e.id}),(0,V.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,V.jsx)(`h2`,{className:`settings-panel-title`,children:e.title}),(0,V.jsx)(n,{})]})]})]})}function be(){return(0,V.jsxs)(`div`,{"data-route":`settings`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,V.jsx)(Q,{scope:`project`,title:`General`,mobileTitle:`Project settings`}),(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:`project`,activeId:null}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,V.jsx)(Z,{}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(ae,{})}),(0,V.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-border bg-card px-5 pt-5 text-base font-semibold md:hidden`,children:`Other project settings`}),(0,V.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:A(`project`).map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(D,{to:k(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 transition-colors hover:bg-card-2`,children:[(0,V.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,V.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,V.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,V.jsx)(y,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,V.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,V.jsx)(m,{to:re,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})]})}export{be as SettingsIndexRoute,ye as SettingsSectionRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Cn as r,On as i,Tn as a,kn as o,wn as s}from"./project-scope-context-D3_4Nfjk.js";import{At as c,Ot as l,q as u,rt as d,v as f,wt as p}from"./queries-BaHOUYn4.js";import{n as m,p as h,r as g}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as _}from"./toaster-Bo5vCbz-.js";import{l as v,u as y}from"./design-icons-CzEoMH9c.js";import{t as b}from"./createLucideIcon-BHp8sXmF.js";import{t as x}from"./button-BQ2y4XRB.js";import{n as ee,r as S,t as te}from"./collapsible-BEV4FO-1.js";import{t as C}from"./switch-Bv2Zf1uU.js";import{t as w}from"./badge-D9JrXe0o.js";import{n as T,s as E,t as D}from"./project-router-DImKA81z.js";import"./attention-B1Ei1IW6.js";import{Hn as O,Rn as ne,dt as re,ft as k,pt as A,z as j}from"./index-MG3T7zFQ.js";import{t as ie}from"./textarea-vJt9undk.js";import{ArchiveOnMergeField as ae}from"./archive-on-merge-field-Ta3WlY1p.js";import{a as oe,i as se,n as ce,t as le}from"./projects-section-DQ1LxJ3A.js";import{t as M}from"./settings-field-Bl6WuvGX.js";import{t as ue}from"./project-location-B-18C392.js";var de=b(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),N=e(t(),1),P={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},F=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),I={name:``,description:``,url:``,token:``,tasks:!0,triggers:i,agent:!1};function L(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??i,agent:e.agent}}var R=e=>o.filter(t=>e.includes(t));function z(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...F(e.triggers,i)?{}:{triggers:R(e.triggers)},agent:e.agent}}function B(e,t){let n={},r=e.name.trim(),a=e.description.trim(),o=e.url.trim();return r!==t.name&&(n.name=r),a!==(t.description??``)&&(n.description=a),o!==t.url&&(n.url=o),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),F(e.triggers,t.triggers??i)||(n.triggers=R(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var V=n(),H=`flex flex-col gap-1 text-[13px]`,U=`text-[11px] text-muted-foreground`;function W({draft:e,onChange:t,tokenSet:n}){let i=(0,N.useId)(),c=(0,N.useId)(),l=(0,N.useId)(),u=(0,N.useId)(),d=(0,N.useId)(),f=(0,N.useId)(),p=(0,N.useId)(),m=(0,N.useId)(),h=(0,N.useId)(),g=(0,N.useId)();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:i,className:U,children:`Name`}),(0,V.jsx)(O,{id:i,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:u,className:U,children:`URL`}),(0,V.jsx)(O,{id:u,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:a,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:c,className:U,children:`Description`}),(0,V.jsx)(ie,{id:c,"data-slot":`webhook-description`,"aria-describedby":l,rows:2,maxLength:r,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,V.jsx)(`span`,{id:l,className:`text-[11px] text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:d,className:U,children:`Token`}),(0,V.jsx)(O,{id:d,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:s,"aria-describedby":f,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,V.jsx)(`span`,{id:f,className:`text-[11px] text-soft-foreground`,children:n?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo. It is sent as a Bearer header.`})]}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(C,{id:p,"aria-describedby":m,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:p,className:`font-medium`,children:`Task notifications`}),(0,V.jsx)(`span`,{id:m,className:`text-[11px] text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,V.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,V.jsx)(`legend`,{className:`pbe-1 text-[11px] text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:o.map(n=>(0,V.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,V.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:P[n].label}),(0,V.jsx)(`span`,{className:`text-[11px] text-soft-foreground`,children:P[n].hint})]})]},n))}),(0,V.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(C,{id:h,"aria-describedby":g,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:h,className:`font-medium`,children:`Let agents send reports`}),(0,V.jsx)(`span`,{id:g,className:`text-[11px] text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var G=`max-sm:h-11`,K=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),fe=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function q({feedback:e}){return e?(0,V.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var J=`rounded-md border border-border bg-background`,Y=`flex flex-col gap-3 border-bs border-border p-3`;function pe({projectId:e,webhook:t,defaultOpen:n=!1}){let r=l(),i=d(),a=p(),[o,s]=(0,N.useState)(n),[c,u]=(0,N.useState)(()=>L(t)),[f,m]=(0,N.useState)(null),h=B(c,t),g=Object.keys(h).length>0,y=c.name.trim()!==``&&c.url.trim()!==``,b=r.isPending||i.isPending||a.isPending,C={projectId:e,webhookId:t.id},T=e=>r.mutate({...C,...h},{onSuccess:()=>{u(e=>({...e,token:``})),e?e():_(`${c.name.trim()} saved`)},onError:e=>m(K(e,`Save`))}),E=()=>a.mutate(C,{onSuccess:e=>m(fe(e)),onError:e=>m({tone:`danger`,text:e.message})});return(0,V.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:J,children:(0,V.jsxs)(te,{open:o,onOpenChange:s,children:[(0,V.jsx)(S,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,V.jsx)(w,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,V.jsx)(w,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,V.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:j(t.url)})]}),(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(ee,{children:(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,className:Y,onSubmit:e=>{e.preventDefault(),m(null),y&&g&&T()},children:[(0,V.jsx)(W,{draft:c,tokenSet:t.tokenSet,onChange:e=>u(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,"data-action":`webhook-save`,disabled:b||!y||!g,children:`Save`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`outline`,"data-action":`webhook-test`,disabled:b||!y,onClick:()=>{m(null),g?T(E):E()},children:`Send test`}),t.tokenSet?(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:b,onClick:()=>r.mutate({...C,token:``},{onSuccess:()=>_(`Webhook token cleared`),onError:e=>m({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:b,onClick:()=>i.mutate(C,{onSuccess:()=>_(`${t.name} removed`),onError:e=>m({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,V.jsx)(q,{feedback:f})]})})]})})}function me({projectId:e,onCreated:t,onCancel:n}){let r=f(),[i,a]=(0,N.useState)(I),[o,s]=(0,N.useState)(null),c=i.name.trim()!==``&&i.url.trim()!==``;return(0,V.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:J,children:[(0,V.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"aria-label":`New webhook`,className:Y,onSubmit:n=>{n.preventDefault(),s(null),c&&r.mutate({projectId:e,...z(i)},{onSuccess:({webhook:e})=>{_(`${e.name} created`),t(e)},onError:e=>s(K(e,`Create`))})},children:[(0,V.jsx)(W,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,"data-action":`webhook-create`,disabled:r.isPending||!c,children:`Create`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,V.jsx)(q,{feedback:o})]})]})}function he({project:e}){let t=e.webhooks??[],[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(null),o=t.length>=16;return(0,V.jsx)(M,{title:`Webhooks`,hint:`A webhook gets a POST from Squawk. Tasks can send their status to it, and agents can send it reports.`,children:(0,V.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,V.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,V.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,V.jsx)(pe,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,V.jsx)(me,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,V.jsx)(de,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,V.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function X(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Z(){let e=E(),t=u(),n=c();if(t.isPending)return(0,V.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(t.isError)return(0,V.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,t.error.message]});let r=t.data,i=r?.projects.find(t=>t.id===e);return!r||!i?null:(0,V.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,V.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,V.jsx)(ue,{}),(0,V.jsx)(ge,{project:i}),(0,V.jsx)(M,{title:`Max parallel tasks`,hint:n.data?`The workspace limit (${n.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:n.data?(0,V.jsx)(le,{project:i,workspaceMax:n.data.resources.maxParallel}):(0,V.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,V.jsx)(he,{project:i},i.id)]}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(_e,{project:i,bootProject:r.bootProject})})]})}function ge({project:e}){return(0,V.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Project`}),(0,V.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Branch`}),(0,V.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Status`}),(0,V.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[ce[e.status],e.status===`missing`?` — remove it below, or restore the folder`:null]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Added`}),(0,V.jsxs)(`dd`,{className:`mt-1`,children:[X(e.addedAt),(0,V.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Last opened`}),(0,V.jsx)(`dd`,{className:`mt-1`,children:X(e.lastOpenedAt)})]})]})}function _e({project:e,bootProject:t}){let[n,r]=(0,N.useState)(null),i=oe(),a=h(),o=e.id===t;return(0,V.jsxs)(M,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,V.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`Squawk is serving this project — it re-registers itself at every start.`}):null]}),(0,V.jsx)(se,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function ve(e){return e===`global`?{Link:m,NavLink:g}:{Link:D,NavLink:T}}function Q({scope:e,title:t,mobileTitle:n}){let r=ne().name;return(0,V.jsxs)(`header`,{"data-slot":`settings-main-header`,className:`settings-route-header flex shrink-0 flex-col gap-2`,children:[(0,V.jsxs)(`h1`,{className:`text-[15px] font-semibold tracking-normal max-md:text-[24px] max-md:font-normal`,children:[(0,V.jsx)(`span`,{className:`md:hidden`,children:n}),(0,V.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` · `,e===`global`?`every project`:r??`this project`]})]}),e===`global`?(0,V.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}function $({scope:e,activeId:t}){let{NavLink:n}=ve(e),r=A(e);return(0,V.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,V.jsxs)(`summary`,{children:[r.find(e=>e.id===t)?.title??`General`,(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,V.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,V.jsx)(n,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,r.map(t=>(0,V.jsx)(n,{to:k(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function ye({section:e,scope:t}){let n=e.component;return(0,V.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,V.jsx)(Q,{scope:t,title:e.title,mobileTitle:t===`global`?`Global settings`:`Project settings`}),(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:t,activeId:e.id}),(0,V.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,V.jsx)(`h2`,{className:`settings-panel-title`,children:e.title}),(0,V.jsx)(n,{})]})]})]})}function be(){return(0,V.jsxs)(`div`,{"data-route":`settings`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,V.jsx)(Q,{scope:`project`,title:`General`,mobileTitle:`Project settings`}),(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:`project`,activeId:null}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,V.jsx)(Z,{}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(ae,{})}),(0,V.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-border bg-card px-5 pt-5 text-base font-semibold md:hidden`,children:`Other project settings`}),(0,V.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:A(`project`).map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(D,{to:k(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 transition-colors hover:bg-card-2`,children:[(0,V.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,V.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,V.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,V.jsx)(y,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,V.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,V.jsx)(m,{to:re,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})]})}export{be as SettingsIndexRoute,ye as SettingsSectionRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r}from"./utils-DSMR_WLb.js";import{Nr as i,Pr as a,ci as o,qt as s}from"./project-scope-context-BiijuuWU.js";import{G as c,Yt as l}from"./queries-D6ioEk6c.js";import{t as u}from"./button-BQ2y4XRB.js";var d=e(t(),1),f=n(),p=[[`overall`,`Overall`],[`needsYou`,`Needs You`],[`finished`,`Finished`],[`working`,`Working`]];function m(){let e=r(),t=c(e);return t.isPending?(0,f.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading sidebar settings…`}):t.isError?(0,f.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,f.jsxs)(`p`,{role:`alert`,children:[`Sidebar settings did not load: `,t.error.message]}),(0,f.jsx)(u,{className:`min-h-[44px]`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,f.jsx)(h,{scope:e,initial:t.data.sidebarLimits??{}},e)}function h({scope:e,initial:t}){let n=o(),r=i(void 0),c=g(t),[m,h]=(0,d.useState)(()=>({values:c,saved:c,received:c})),{values:v,saved:y}=m,b=e=>h(t=>({...t,values:e})),x=a.safeParse(Object.fromEntries(p.map(([e])=>[e,v[e]===null?null:Number(v[e])]))),S=e=>v[e]!==null&&(v[e].trim()===``||!Number.isSafeInteger(Number(v[e]))||Number(v[e])<=0),C=p.some(([e])=>v[e]!==y[e]),w=l({onMutate:()=>n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),mutationFn:t=>s({sidebarLimits:t},e),onSuccess:async t=>{await n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),n.setQueryData([e,`ui-state`],t);let r=g(t.sidebarLimits);h({values:r,saved:r,received:r})}});return!w.isPending&&!_(m.received,c)&&h({values:C?v:c,saved:c,received:c}),(0,f.jsxs)(`form`,{"data-slot":`sidebar-settings`,className:`flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6`,onSubmit:e=>{e.preventDefault(),x.success&&!p.some(([e])=>S(e))&&!w.isPending&&w.mutate(x.data)},children:[(0,f.jsx)(`p`,{id:`sidebar-limits-help`,className:`text-sm text-muted-foreground`,children:`Limits apply to this project on desktop and mobile. The overall budget is shared in section order: Needs You, Finished, then Working. Each section also respects its own limit. Unlimited removes only that constraint.`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pinned tasks and groups containing a pin bypass both limits. A task group counts as one row. Archived uses only the overall limit; archived pins are not exempt.`}),p.map(([e,t])=>(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,f.jsx)(`label`,{htmlFor:`sidebar-${e}`,className:`text-sm font-medium`,children:t}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,f.jsx)(`input`,{id:`sidebar-${e}`,type:`number`,inputMode:`numeric`,min:`1`,step:`1`,value:v[e]??``,disabled:v[e]===null||w.isPending,"aria-invalid":S(e),"aria-describedby":S(e)?`sidebar-${e}-error sidebar-limits-help`:`sidebar-limits-help`,onChange:t=>b({...v,[e]:t.target.value}),className:`min-h-[44px] w-28 rounded-md border border-input bg-card px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`}),(0,f.jsxs)(`label`,{className:`flex min-h-[44px] cursor-pointer items-center gap-2 text-sm`,children:[(0,f.jsx)(`input`,{type:`checkbox`,"aria-label":`${t} Unlimited`,checked:v[e]===null,disabled:w.isPending,onChange:t=>b({...v,[e]:t.target.checked?null:String(r[e]??10)}),className:`size-4 accent-[var(--accent-strong)]`}),`Unlimited`]})]}),S(e)&&(0,f.jsx)(`p`,{id:`sidebar-${e}-error`,className:`text-sm text-danger`,children:`Enter a positive whole number or choose Unlimited.`})]},e)),(0,f.jsx)(u,{type:`submit`,className:`min-h-[44px] self-start`,variant:`primary`,disabled:!C||!x.success||p.some(([e])=>S(e))||w.isPending,children:w.isPending?`Saving…`:`Save sidebar limits`}),w.isError&&(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save sidebar limits: `,w.error.message]}),w.isSuccess&&!C&&(0,f.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Sidebar limits saved.`})]})}function g(e){let t=i(e);return Object.fromEntries(p.map(([e])=>[e,t[e]===null?null:String(t[e])]))}function _(e,t){return p.every(([n])=>e[n]===t[n])}export{m as SidebarSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r}from"./utils-DSMR_WLb.js";import{Nr as i,Pr as a,ci as o,qt as s}from"./project-scope-context-D3_4Nfjk.js";import{G as c,Yt as l}from"./queries-BaHOUYn4.js";import{t as u}from"./button-BQ2y4XRB.js";var d=e(t(),1),f=n(),p=[[`overall`,`Overall`],[`needsYou`,`Needs You`],[`finished`,`Finished`],[`working`,`Working`]];function m(){let e=r(),t=c(e);return t.isPending?(0,f.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading sidebar settings…`}):t.isError?(0,f.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,f.jsxs)(`p`,{role:`alert`,children:[`Sidebar settings did not load: `,t.error.message]}),(0,f.jsx)(u,{className:`min-h-[44px]`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,f.jsx)(h,{scope:e,initial:t.data.sidebarLimits??{}},e)}function h({scope:e,initial:t}){let n=o(),r=i(void 0),c=g(t),[m,h]=(0,d.useState)(()=>({values:c,saved:c,received:c})),{values:v,saved:y}=m,b=e=>h(t=>({...t,values:e})),x=a.safeParse(Object.fromEntries(p.map(([e])=>[e,v[e]===null?null:Number(v[e])]))),S=e=>v[e]!==null&&(v[e].trim()===``||!Number.isSafeInteger(Number(v[e]))||Number(v[e])<=0),C=p.some(([e])=>v[e]!==y[e]),w=l({onMutate:()=>n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),mutationFn:t=>s({sidebarLimits:t},e),onSuccess:async t=>{await n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),n.setQueryData([e,`ui-state`],t);let r=g(t.sidebarLimits);h({values:r,saved:r,received:r})}});return!w.isPending&&!_(m.received,c)&&h({values:C?v:c,saved:c,received:c}),(0,f.jsxs)(`form`,{"data-slot":`sidebar-settings`,className:`flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6`,onSubmit:e=>{e.preventDefault(),x.success&&!p.some(([e])=>S(e))&&!w.isPending&&w.mutate(x.data)},children:[(0,f.jsx)(`p`,{id:`sidebar-limits-help`,className:`text-sm text-muted-foreground`,children:`Limits apply to this project on desktop and mobile. The overall budget is shared in section order: Needs You, Finished, then Working. Each section also respects its own limit. Unlimited removes only that constraint.`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pinned tasks and groups containing a pin bypass both limits. A task group counts as one row. Archived uses only the overall limit; archived pins are not exempt.`}),p.map(([e,t])=>(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,f.jsx)(`label`,{htmlFor:`sidebar-${e}`,className:`text-sm font-medium`,children:t}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,f.jsx)(`input`,{id:`sidebar-${e}`,type:`number`,inputMode:`numeric`,min:`1`,step:`1`,value:v[e]??``,disabled:v[e]===null||w.isPending,"aria-invalid":S(e),"aria-describedby":S(e)?`sidebar-${e}-error sidebar-limits-help`:`sidebar-limits-help`,onChange:t=>b({...v,[e]:t.target.value}),className:`min-h-[44px] w-28 rounded-md border border-input bg-card px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`}),(0,f.jsxs)(`label`,{className:`flex min-h-[44px] cursor-pointer items-center gap-2 text-sm`,children:[(0,f.jsx)(`input`,{type:`checkbox`,"aria-label":`${t} Unlimited`,checked:v[e]===null,disabled:w.isPending,onChange:t=>b({...v,[e]:t.target.checked?null:String(r[e]??10)}),className:`size-4 accent-[var(--accent-strong)]`}),`Unlimited`]})]}),S(e)&&(0,f.jsx)(`p`,{id:`sidebar-${e}-error`,className:`text-sm text-danger`,children:`Enter a positive whole number or choose Unlimited.`})]},e)),(0,f.jsx)(u,{type:`submit`,className:`min-h-[44px] self-start`,variant:`primary`,disabled:!C||!x.success||p.some(([e])=>S(e))||w.isPending,children:w.isPending?`Saving…`:`Save sidebar limits`}),w.isError&&(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save sidebar limits: `,w.error.message]}),w.isSuccess&&!C&&(0,f.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Sidebar limits saved.`})]})}function g(e){let t=i(e);return Object.fromEntries(p.map(([e])=>[e,t[e]===null?null:String(t[e])]))}function _(e,t){return p.every(([n])=>e[n]===t[n])}export{m as SidebarSection};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Ct as i,ci as a}from"./project-scope-context-BiijuuWU.js";import{Pt as o,p as s,t as c}from"./queries-D6ioEk6c.js";import{g as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as u}from"./toaster-Bo5vCbz-.js";import{s as d,t as f}from"./runners-5cgs0qUY.js";import{O as p,T as m,X as h,Y as g,ct as _,ot as v,u as y}from"./design-icons-CzEoMH9c.js";import{t as b}from"./button-BQ2y4XRB.js";import{t as x}from"./project-router-hhGBPlav.js";import{f as S,l as C}from"./skills-pM_PouEs.js";import{Hn as w,V as T,vn as E,wn as D}from"./index-D-Y1olb1.js";var O=e(t(),1),k=n(),A=e=>e.split(`@`)[0]||e,j={project:0,user:1,plugin:2,system:3,other:4},M={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function N(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:A(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:M[t],kind:t}}function P(e){let t=new Map;for(let n of e){let e=N(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>j[e.kind]-j[t.kind]||e.label.localeCompare(t.label))}function F(e){let t=e.plugin?`${A(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var I={project:m,user:_,plugin:p,system:p,other:p};function L({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,O.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,k.jsx)(`div`,{"data-slot":`skills-list`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:e.map(e=>{let o=n||!a.has(e.key);return(0,k.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,k.jsx)(R,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,k.jsx)(z,{skill:e,open:e.id===t,runner:r,account:i},S(e))):null]},e.key)})})}function R({group:e,open:t,onToggle:n}){let i=I[e.kind];return(0,k.jsx)(`h2`,{className:`m-0`,children:(0,k.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:n,className:`flex min-h-10 w-full items-center gap-2 bg-muted/45 px-3.5 text-left text-xs font-semibold text-muted-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:text-foreground`,children:[(0,k.jsx)(y,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,k.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,k.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function z({skill:e,open:t,runner:n,account:r}){let i=D({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,k.jsxs)(`details`,{"data-slot":`skill-row`,"data-skill":e.id,"data-skill-path":e.path,name:`skill-details`,open:t||void 0,className:`group/skill border-t border-border/60 open:bg-sidebar-row-selected`,children:[(0,k.jsxs)(`summary`,{className:`grid min-h-11 cursor-pointer list-none grid-cols-1 items-baseline gap-x-4 gap-y-0.5 py-2.5 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)] [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(`span`,{className:`truncate text-[13.5px] font-semibold`,title:e.name,children:F(e)}),e.description?(0,k.jsx)(`span`,{className:`truncate text-[13px] text-muted-foreground group-open/skill:hidden`,children:e.description}):null]}),(0,k.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,k.jsx)(T,{skill:e,heading:null,actions:(0,k.jsx)(b,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,k.jsx)(x,{to:i,children:`Start task`})})})})]})}function B(){let e=s(),[t,n]=(0,O.useState)(null),[i,a]=(0,O.useState)(null),[c,u]=(0,O.useState)(``),[d]=l(),f=t??e.data?.defaultRunner??`claude`,p=o(t??e.data?.defaultRunner,i),m=G(f,p.account),_=p.data??[];return(0,k.jsxs)(`div`,{"data-route":`skills`,className:`mx-auto grid min-h-full w-full max-w-[1100px] grid-cols-1 content-start gap-5 px-[18px] py-6 md:p-9 max-md:[padding-block-end:5rem]`,children:[(0,k.jsxs)(`header`,{children:[(0,k.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,k.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,k.jsx)(H,{runner:f,onChange:e=>{n(e),a(null)}}),(0,k.jsx)(U,{runner:f,account:i,onChange:a}),(0,k.jsx)(`span`,{className:`ml-auto text-xs text-soft-foreground`,"data-slot":`skills-count`,children:p.list?`${_.length} ${_.length===1?`skill`:`skills`}${p.list.source===`cache`?` · from cache`:``}`:null}),(0,k.jsxs)(b,{variant:`outline`,size:`sm`,onClick:()=>void m.run(),disabled:m.running||p.isPending,"data-slot":`skills-refresh`,children:[(0,k.jsx)(g,{"aria-hidden":`true`,className:r(`size-3.5`,m.running&&`motion-safe:animate-spin`)}),`Re-read`]})]}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(h,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,k.jsx)(w,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:c,onChange:e=>u(e.target.value),className:`h-10 bg-card pl-9 text-[13px]`})]}),(0,k.jsx)(W,{query:p}),p.isPending?(0,k.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,k.jsx)(V,{skills:_,search:c,openId:d.get(`skill`),runner:f,account:p.account??null,unchecked:p.unchecked})]})}function V({skills:e,search:t,openId:n,runner:r,account:i,unchecked:a}){if(e.length===0)return a?null:(0,k.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`No skills reported by this runner and account.`});let o=C(e,t);return o.length===0?(0,k.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No skills match “`,t.trim(),`”.`]}):(0,k.jsx)(L,{groups:P(o),openId:n,searching:t.trim()!==``,runner:r,account:i})}function H({runner:e,onChange:t}){let n=d().data;return n?(0,k.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-0.5 overflow-x-auto rounded-[10px] border border-border bg-card p-[3px]`,children:n.runners.map(r=>(0,k.jsx)(`button`,{type:`button`,"aria-pressed":r.id===e,onClick:()=>t(r.id),className:`h-8 shrink-0 rounded-[7px] px-3 text-[13px] text-muted-foreground focus-visible:outline-2 aria-pressed:bg-muted aria-pressed:font-semibold aria-pressed:text-foreground pointer-hover:text-foreground`,children:f(n,r.id)},r.id))}):null}function U({runner:e,account:t,onChange:n}){let r=E().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,k.jsxs)(`select`,{"aria-label":`Account`,value:t??``,onChange:e=>n(e.target.value||null),className:`h-[38px] rounded-md border border-border bg-card px-2.5 text-[13px] text-foreground focus-visible:outline-2`,children:[(0,k.jsx)(`option`,{value:``,children:`Account: project default`}),r.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function W({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,k.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-pending/40 bg-pending/10 px-3.5 py-2.5 text-[13px]`,children:[e.unchecked&&!e.isPending?(0,k.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,k.jsx)(v,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,k.jsxs)(`span`,{children:[`Skill list unavailable. `,e.list?.reason??e.error?.message,` You can still type a skill id when starting a task.`]})]}):null,t.map((e,t)=>(0,k.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,k.jsx)(v,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,k.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function G(e,t){let n=a(),[r,o]=(0,O.useState)(!1),s=c.runnerSkills(e,t);return{running:r,run:async()=>{o(!0);try{n.setQueryData(s,await i(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:s.slice(0,3)})}catch(e){u(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{o(!1)}}}}export{B as SkillsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Ct as i,ci as a}from"./project-scope-context-D3_4Nfjk.js";import{Pt as o,p as s,t as c}from"./queries-BaHOUYn4.js";import{g as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as u}from"./toaster-Bo5vCbz-.js";import{s as d,t as f}from"./runners-DccsyraI.js";import{O as p,T as m,X as h,Y as g,ct as _,ot as v,u as y}from"./design-icons-CzEoMH9c.js";import{t as b}from"./button-BQ2y4XRB.js";import{t as x}from"./project-router-DImKA81z.js";import{f as S,l as C}from"./skills-pM_PouEs.js";import{Hn as w,V as T,vn as E,wn as D}from"./index-MG3T7zFQ.js";var O=e(t(),1),k=n(),A=e=>e.split(`@`)[0]||e,j={project:0,user:1,plugin:2,system:3,other:4},M={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function N(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:A(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:M[t],kind:t}}function P(e){let t=new Map;for(let n of e){let e=N(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>j[e.kind]-j[t.kind]||e.label.localeCompare(t.label))}function F(e){let t=e.plugin?`${A(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var I={project:m,user:_,plugin:p,system:p,other:p};function L({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,O.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,k.jsx)(`div`,{"data-slot":`skills-list`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:e.map(e=>{let o=n||!a.has(e.key);return(0,k.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,k.jsx)(R,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,k.jsx)(z,{skill:e,open:e.id===t,runner:r,account:i},S(e))):null]},e.key)})})}function R({group:e,open:t,onToggle:n}){let i=I[e.kind];return(0,k.jsx)(`h2`,{className:`m-0`,children:(0,k.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:n,className:`flex min-h-10 w-full items-center gap-2 bg-muted/45 px-3.5 text-left text-xs font-semibold text-muted-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:text-foreground`,children:[(0,k.jsx)(y,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,k.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,k.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function z({skill:e,open:t,runner:n,account:r}){let i=D({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,k.jsxs)(`details`,{"data-slot":`skill-row`,"data-skill":e.id,"data-skill-path":e.path,name:`skill-details`,open:t||void 0,className:`group/skill border-t border-border/60 open:bg-sidebar-row-selected`,children:[(0,k.jsxs)(`summary`,{className:`grid min-h-11 cursor-pointer list-none grid-cols-1 items-baseline gap-x-4 gap-y-0.5 py-2.5 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)] [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(`span`,{className:`truncate text-[13.5px] font-semibold`,title:e.name,children:F(e)}),e.description?(0,k.jsx)(`span`,{className:`truncate text-[13px] text-muted-foreground group-open/skill:hidden`,children:e.description}):null]}),(0,k.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,k.jsx)(T,{skill:e,heading:null,actions:(0,k.jsx)(b,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,k.jsx)(x,{to:i,children:`Start task`})})})})]})}function B(){let e=s(),[t,n]=(0,O.useState)(null),[i,a]=(0,O.useState)(null),[c,u]=(0,O.useState)(``),[d]=l(),f=t??e.data?.defaultRunner??`claude`,p=o(t??e.data?.defaultRunner,i),m=G(f,p.account),_=p.data??[];return(0,k.jsxs)(`div`,{"data-route":`skills`,className:`mx-auto grid min-h-full w-full max-w-[1100px] grid-cols-1 content-start gap-5 px-[18px] py-6 md:p-9 max-md:[padding-block-end:5rem]`,children:[(0,k.jsxs)(`header`,{children:[(0,k.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,k.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,k.jsx)(H,{runner:f,onChange:e=>{n(e),a(null)}}),(0,k.jsx)(U,{runner:f,account:i,onChange:a}),(0,k.jsx)(`span`,{className:`ml-auto text-xs text-soft-foreground`,"data-slot":`skills-count`,children:p.list?`${_.length} ${_.length===1?`skill`:`skills`}${p.list.source===`cache`?` · from cache`:``}`:null}),(0,k.jsxs)(b,{variant:`outline`,size:`sm`,onClick:()=>void m.run(),disabled:m.running||p.isPending,"data-slot":`skills-refresh`,children:[(0,k.jsx)(g,{"aria-hidden":`true`,className:r(`size-3.5`,m.running&&`motion-safe:animate-spin`)}),`Re-read`]})]}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(h,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,k.jsx)(w,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:c,onChange:e=>u(e.target.value),className:`h-10 bg-card pl-9 text-[13px]`})]}),(0,k.jsx)(W,{query:p}),p.isPending?(0,k.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,k.jsx)(V,{skills:_,search:c,openId:d.get(`skill`),runner:f,account:p.account??null,unchecked:p.unchecked})]})}function V({skills:e,search:t,openId:n,runner:r,account:i,unchecked:a}){if(e.length===0)return a?null:(0,k.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`No skills reported by this runner and account.`});let o=C(e,t);return o.length===0?(0,k.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No skills match “`,t.trim(),`”.`]}):(0,k.jsx)(L,{groups:P(o),openId:n,searching:t.trim()!==``,runner:r,account:i})}function H({runner:e,onChange:t}){let n=d().data;return n?(0,k.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-0.5 overflow-x-auto rounded-[10px] border border-border bg-card p-[3px]`,children:n.runners.map(r=>(0,k.jsx)(`button`,{type:`button`,"aria-pressed":r.id===e,onClick:()=>t(r.id),className:`h-8 shrink-0 rounded-[7px] px-3 text-[13px] text-muted-foreground focus-visible:outline-2 aria-pressed:bg-muted aria-pressed:font-semibold aria-pressed:text-foreground pointer-hover:text-foreground`,children:f(n,r.id)},r.id))}):null}function U({runner:e,account:t,onChange:n}){let r=E().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,k.jsxs)(`select`,{"aria-label":`Account`,value:t??``,onChange:e=>n(e.target.value||null),className:`h-[38px] rounded-md border border-border bg-card px-2.5 text-[13px] text-foreground focus-visible:outline-2`,children:[(0,k.jsx)(`option`,{value:``,children:`Account: project default`}),r.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function W({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,k.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-pending/40 bg-pending/10 px-3.5 py-2.5 text-[13px]`,children:[e.unchecked&&!e.isPending?(0,k.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,k.jsx)(v,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,k.jsxs)(`span`,{children:[`Skill list unavailable. `,e.list?.reason??e.error?.message,` You can still type a skill id when starting a task.`]})]}):null,t.map((e,t)=>(0,k.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,k.jsx)(v,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,k.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function G(e,t){let n=a(),[r,o]=(0,O.useState)(!1),s=c.runnerSkills(e,t);return{running:r,run:async()=>{o(!0);try{n.setQueryData(s,await i(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:s.slice(0,3)})}catch(e){u(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{o(!1)}}}}export{B as SkillsRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t,t as n}from"./utils-DSMR_WLb.js";import{t as r}from"./project-router-hhGBPlav.js";var i=e();function a({to:e,active:a=!1,onClick:o,count:s,replace:c,className:l,children:u}){return(0,i.jsxs)(r,{to:e,...t({replace:c}),"aria-current":a?`page`:void 0,onClick:o,className:n(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,a?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,l),children:[u,s===void 0?null:(0,i.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-[11.5px] font-normal text-soft-foreground`,children:s})]})}export{a as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t,t as n}from"./utils-DSMR_WLb.js";import{t as r}from"./project-router-DImKA81z.js";var i=e();function a({to:e,active:a=!1,onClick:o,count:s,replace:c,className:l,children:u}){return(0,i.jsxs)(r,{to:e,...t({replace:c}),"aria-current":a?`page`:void 0,onClick:o,className:n(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,a?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,l),children:[u,s===void 0?null:(0,i.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-[11.5px] font-normal text-soft-foreground`,children:s})]})}export{a as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{It as r,Rt as i,Wt as a,Yn as o,ci as s,h as c,i as l,on as u,vt as d,w as f}from"./project-scope-context-BiijuuWU.js";import{M as p,Yt as m,at as h,dt as g,t as _,ut as v}from"./queries-D6ioEk6c.js";import{h as y}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as b}from"./toaster-Bo5vCbz-.js";import{C as x,j as S}from"./design-icons-CzEoMH9c.js";import{t as C}from"./run-header-gOqc0BKa.js";import{i as w,n as T,r as E}from"./git-toolbar-BJM3pWHY.js";import{t as D}from"./button-BQ2y4XRB.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dialog-BVF6dIeS.js";import{b as P,f as F}from"./task-groups-CafTiSSz.js";import{t as I}from"./centered-state-V15AR_qo.js";import{$t as L,C as R,X as z,cn as B,w as V}from"./index-D-Y1olb1.js";import{t as H}from"./markdown-BBDDg-4t.js";import{t as U}from"./textarea-vJt9undk.js";import{t as W}from"./diff-DQ18_bA-.js";var G=e(t(),1),K=`no worktree — this task ran directly in the repo working tree`;function q(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${K}`)}function J(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${K}`)}function Y(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${K}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?o(e.run)?t(`Create PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):P(e.run)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function X(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:q(e),n=e.prUrl?[q(e),J(e)]:[J(e),Y(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?P(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Z=n();function Q({run:e,open:t,onOpenChange:n}){let r=s(),[i,a]=(0,G.useState)(``),o=F(e),l=(0,G.useRef)(o);l.current=o,(0,G.useEffect)(()=>{t&&a(l.current)},[t]);let u=m({mutationFn:t=>c(e.id,t),onSuccess:t=>{b(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:_.runs.changes(e.id)}),r.invalidateQueries({queryKey:_.runs.all})},onError:e=>b(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Z.jsx)(N,{open:t,onOpenChange:n,children:(0,Z.jsxs)(j,{"data-slot":`commit-dialog`,children:[(0,Z.jsxs)(A,{children:[(0,Z.jsx)(M,{children:`Commit changes`}),(0,Z.jsxs)(k,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Z.jsx)(U,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{z({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(),d())}}),(0,Z.jsxs)(O,{children:[(0,Z.jsx)(D,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Z.jsx)(D,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function $(){let{id:e}=y(),t=v(e);return t.isPending?(0,Z.jsx)(V,{tab:`changes`}):t.isError?(0,Z.jsx)(R,{tab:`changes`,error:t.error}):(0,Z.jsx)(ee,{run:t.data})}function ee({run:e}){let t=p(),n=h(),o=g(e.id,P(e)),c=L(),[u,d]=(0,G.useState)(`unified`),[v,y]=(0,G.useState)(!1),[x,S]=(0,G.useState)(!1),[w,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(!1),A=(0,G.useRef)(null),j=s(),M=()=>j.invalidateQueries({queryKey:_.runs.all}),N=e=>b(e.message,{tone:`danger`}),F=m({mutationFn:()=>a(e.id),onSuccess:e=>b(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:N}),I=m({mutationFn:()=>f(e.id),onSuccess:e=>{b(`Draft PR created — ${e.url}`),M()},onError:N}),R=m({mutationFn:()=>i(e.id),onError:e=>{if(e instanceof l&&e.command){navigator.clipboard.writeText(e.command).then(()=>b(`No terminal found — command copied to clipboard.`)).catch(()=>b(`Run manually: ${e.command}`));return}N(e)}}),z=m({mutationFn:t=>r(e.id,t),onError:N}),V=o.isError&&o.error instanceof l&&o.error.status===409,U=X({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!V,branch:e.branch,changedFiles:o.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:B(e)!==void 0,prUrl:e.pullRequestUrl}),W=e=>{switch(e){case`commit`:k(!0);break;case`push`:F.mutate();break;case`create-pr`:I.mutate();break;case`open-terminal`:R.mutate();break;case`view-pr`:break}},K=o.data?.files??[],q=(0,G.useMemo)(()=>E(K),[K]),J=(0,G.useMemo)(()=>K.some(H),[K]),Y=c?u:`unified`,$=!c||v;return(0,Z.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(C,{run:e,tab:`changes`}),(0,Z.jsx)(T,{bar:U,healthReady:t.data!==void 0,branch:e.branch,stat:o.data?.stat,mode:Y,wrap:$,preview:x,onModeChange:d,onWrapChange:y,onPreviewChange:J?S:void 0,onAction:W}),o.data?.repointedHead?(0,Z.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Z.jsx)(`code`,{children:o.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Z.jsx)(`code`,{children:o.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Z.jsx)(te,{changes:o,changesRefused:V,fileCount:K.length,children:(0,Z.jsx)(ne,{runId:e.id,files:K,tree:q,selected:w,selectFile:e=>{D(e),A.current?.scrollToPath(e)},diffRef:A,effectiveMode:Y,effectiveWrap:$,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Z.jsx)(Q,{run:e,open:O,onOpenChange:k})]})}function te({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(I,{icon:t?(0,Z.jsx)(x,{size:16}):(0,Z.jsx)(S,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Z.jsx)(I,{icon:(0,Z.jsx)(x,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function ne({runId:e,files:t,tree:n,selected:r,selectFile:i,diffRef:a,effectiveMode:o,effectiveWrap:s,preview:c,localHandoff:l,onOpenInApp:d}){return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,Z.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(w,{root:n,selected:r,onSelect:i})]}),(0,Z.jsx)(W,{files:t,viewRef:a,mode:o,wrap:s,preview:c,loadFileText:t=>re(e,t),imageSrc:t=>u(e,t),onOpenInApp:l?e=>d(e):void 0,className:`min-w-0 flex-1`})]})}async function re(e,t){try{let n=await d(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{$ as TaskChangesRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{It as r,Rt as i,Wt as a,Yn as o,ci as s,h as c,i as l,on as u,vt as d,w as f}from"./project-scope-context-D3_4Nfjk.js";import{M as p,Yt as m,at as h,dt as g,t as _,ut as v}from"./queries-BaHOUYn4.js";import{h as y}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as b}from"./toaster-Bo5vCbz-.js";import{C as x,j as S}from"./design-icons-CzEoMH9c.js";import{t as C}from"./run-header-xPtXOBkm.js";import{i as w,n as T,r as E}from"./git-toolbar-Dng31AhK.js";import{t as D}from"./button-BQ2y4XRB.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dialog-BVF6dIeS.js";import{b as P,f as F}from"./task-groups-C7yO8nMy.js";import{t as I}from"./centered-state-V15AR_qo.js";import{$t as L,C as R,X as z,cn as B,w as V}from"./index-MG3T7zFQ.js";import{t as H}from"./markdown-BBDDg-4t.js";import{t as U}from"./textarea-vJt9undk.js";import{t as W}from"./diff-3jSM3IH7.js";var G=e(t(),1),K=`no worktree — this task ran directly in the repo working tree`;function q(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${K}`)}function J(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${K}`)}function Y(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${K}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?o(e.run)?t(`Create PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):P(e.run)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function X(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:q(e),n=e.prUrl?[q(e),J(e)]:[J(e),Y(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?P(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Z=n();function Q({run:e,open:t,onOpenChange:n}){let r=s(),[i,a]=(0,G.useState)(``),o=F(e),l=(0,G.useRef)(o);l.current=o,(0,G.useEffect)(()=>{t&&a(l.current)},[t]);let u=m({mutationFn:t=>c(e.id,t),onSuccess:t=>{b(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:_.runs.changes(e.id)}),r.invalidateQueries({queryKey:_.runs.all})},onError:e=>b(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Z.jsx)(N,{open:t,onOpenChange:n,children:(0,Z.jsxs)(j,{"data-slot":`commit-dialog`,children:[(0,Z.jsxs)(A,{children:[(0,Z.jsx)(M,{children:`Commit changes`}),(0,Z.jsxs)(k,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Z.jsx)(U,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{z({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(),d())}}),(0,Z.jsxs)(O,{children:[(0,Z.jsx)(D,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Z.jsx)(D,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function $(){let{id:e}=y(),t=v(e);return t.isPending?(0,Z.jsx)(V,{tab:`changes`}):t.isError?(0,Z.jsx)(R,{tab:`changes`,error:t.error}):(0,Z.jsx)(ee,{run:t.data})}function ee({run:e}){let t=p(),n=h(),o=g(e.id,P(e)),c=L(),[u,d]=(0,G.useState)(`unified`),[v,y]=(0,G.useState)(!1),[x,S]=(0,G.useState)(!1),[w,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(!1),A=(0,G.useRef)(null),j=s(),M=()=>j.invalidateQueries({queryKey:_.runs.all}),N=e=>b(e.message,{tone:`danger`}),F=m({mutationFn:()=>a(e.id),onSuccess:e=>b(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:N}),I=m({mutationFn:()=>f(e.id),onSuccess:e=>{b(`Draft PR created — ${e.url}`),M()},onError:N}),R=m({mutationFn:()=>i(e.id),onError:e=>{if(e instanceof l&&e.command){navigator.clipboard.writeText(e.command).then(()=>b(`No terminal found — command copied to clipboard.`)).catch(()=>b(`Run manually: ${e.command}`));return}N(e)}}),z=m({mutationFn:t=>r(e.id,t),onError:N}),V=o.isError&&o.error instanceof l&&o.error.status===409,U=X({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!V,branch:e.branch,changedFiles:o.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:B(e)!==void 0,prUrl:e.pullRequestUrl}),W=e=>{switch(e){case`commit`:k(!0);break;case`push`:F.mutate();break;case`create-pr`:I.mutate();break;case`open-terminal`:R.mutate();break;case`view-pr`:break}},K=o.data?.files??[],q=(0,G.useMemo)(()=>E(K),[K]),J=(0,G.useMemo)(()=>K.some(H),[K]),Y=c?u:`unified`,$=!c||v;return(0,Z.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(C,{run:e,tab:`changes`}),(0,Z.jsx)(T,{bar:U,healthReady:t.data!==void 0,branch:e.branch,stat:o.data?.stat,mode:Y,wrap:$,preview:x,onModeChange:d,onWrapChange:y,onPreviewChange:J?S:void 0,onAction:W}),o.data?.repointedHead?(0,Z.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Z.jsx)(`code`,{children:o.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Z.jsx)(`code`,{children:o.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Z.jsx)(te,{changes:o,changesRefused:V,fileCount:K.length,children:(0,Z.jsx)(ne,{runId:e.id,files:K,tree:q,selected:w,selectFile:e=>{D(e),A.current?.scrollToPath(e)},diffRef:A,effectiveMode:Y,effectiveWrap:$,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Z.jsx)(Q,{run:e,open:O,onOpenChange:k})]})}function te({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(I,{icon:t?(0,Z.jsx)(x,{size:16}):(0,Z.jsx)(S,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Z.jsx)(I,{icon:(0,Z.jsx)(x,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function ne({runId:e,files:t,tree:n,selected:r,selectFile:i,diffRef:a,effectiveMode:o,effectiveWrap:s,preview:c,localHandoff:l,onOpenInApp:d}){return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,Z.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(w,{root:n,selected:r,onSelect:i})]}),(0,Z.jsx)(W,{files:t,viewRef:a,mode:o,wrap:s,preview:c,loadFileText:t=>re(e,t),imageSrc:t=>u(e,t),onOpenInApp:l?e=>d(e):void 0,className:`min-w-0 flex-1`})]})}async function re(e,t){try{let n=await d(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{$ as TaskChangesRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i}from"./project-scope-context-BiijuuWU.js";import{dt as a,ft as o,pt as s,ut as c}from"./queries-D6ioEk6c.js";import{h as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as u,S as d,X as f,j as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./run-header-gOqc0BKa.js";import{t as h}from"./project-router-hhGBPlav.js";import{b as g}from"./task-groups-CafTiSSz.js";import{t as _}from"./centered-state-V15AR_qo.js";import{C as v,Hn as y,s as b,w as x}from"./index-D-Y1olb1.js";import{t as S}from"./commit-diff-panel-CGjhxIPJ.js";var C=e(t(),1),w=n(),T=77;function E({slot:e,commits:t,className:n,heading:i}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[p,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(y,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(b,{scrollRef:d,startMargin:p,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(h,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:r(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:r(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:r(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:r(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=l(),t=c(e);return t.isPending?(0,w.jsx)(x,{tab:`changes`}):t.isError?(0,w.jsx)(v,{tab:`changes`,error:t.error}):(0,w.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=l(),n=s(e.id,g(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(m,{run:e,tab:`commits`}),t?(0,w.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(p,{size:16}),tone:n.error instanceof i&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof i&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(p,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:o(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=a(e.id,g(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(h,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i}from"./project-scope-context-D3_4Nfjk.js";import{dt as a,ft as o,pt as s,ut as c}from"./queries-BaHOUYn4.js";import{h as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as u,S as d,X as f,j as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./run-header-xPtXOBkm.js";import{t as h}from"./project-router-DImKA81z.js";import{b as g}from"./task-groups-C7yO8nMy.js";import{t as _}from"./centered-state-V15AR_qo.js";import{C as v,Hn as y,s as b,w as x}from"./index-MG3T7zFQ.js";import{t as S}from"./commit-diff-panel-CzY8bO3p.js";var C=e(t(),1),w=n(),T=77;function E({slot:e,commits:t,className:n,heading:i}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[p,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(y,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(b,{scrollRef:d,startMargin:p,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(h,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:r(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:r(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:r(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:r(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=l(),t=c(e);return t.isPending?(0,w.jsx)(x,{tab:`changes`}):t.isError?(0,w.jsx)(v,{tab:`changes`,error:t.error}):(0,w.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=l(),n=s(e.id,g(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(m,{run:e,tab:`commits`}),t?(0,w.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(p,{size:16}),tone:n.error instanceof i&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof i&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(p,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:o(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=a(e.id,g(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(h,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};