@hearsay-tools/squawk 0.19.0-dev.9065 → 0.19.0-dev.9069

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 (75) hide show
  1. package/dist/delegation/transport.d.ts +78 -78
  2. package/dist/features/automations/automations-routes.d.ts +150 -150
  3. package/dist/features/hosts/routes.d.ts +44 -44
  4. package/dist/server/models-routes.d.ts +12 -12
  5. package/dist/server/project-settings-routes.d.ts +107 -107
  6. package/dist/server/projects-routes.d.ts +73 -73
  7. package/dist/server/provider-sign-in-routes.d.ts +2 -2
  8. package/dist/server/repo-routes.d.ts +52 -52
  9. package/dist/server/reports-api.d.ts +2 -2
  10. package/dist/server/runners-routes.d.ts +10 -10
  11. package/dist/server/runs-routes.d.ts +335 -335
  12. package/dist/server/server.d.ts +1190 -1190
  13. package/dist/server/workspace-routes.d.ts +85 -85
  14. package/package.json +4 -4
  15. package/web/dist/assets/{accounts-section-CdmTsc7W.js → accounts-section-CiO5OMkx.js} +1 -1
  16. package/web/dist/assets/{activity-motion-CrFzRrI5.js → activity-motion-D2RZtcZk.js} +1 -1
  17. package/web/dist/assets/{activity-route-CGRkPwJP.js → activity-route-D7WKghms.js} +1 -1
  18. package/web/dist/assets/{agent-config-section-C6I_sRta.js → agent-config-section-DW7oAwLi.js} +1 -1
  19. package/web/dist/assets/{agent-defaults-section-CiOFMcep.js → agent-defaults-section-BsfycjfC.js} +1 -1
  20. package/web/dist/assets/{appearance-CBX1qOwx.js → appearance-D-a_UJUm.js} +1 -1
  21. package/web/dist/assets/{archive-on-merge-field-BzxW7NJS.js → archive-on-merge-field-RMn227ry.js} +1 -1
  22. package/web/dist/assets/{ask-card-CKD_gFDN.js → ask-card-DP9b-lI-.js} +1 -1
  23. package/web/dist/assets/{automations-route-CoSNUId5.js → automations-route-_Pv3FEnT.js} +1 -1
  24. package/web/dist/assets/{commit-list-CCgF6z16.js → commit-list-FjUd56tK.js} +1 -1
  25. package/web/dist/assets/{diff-BcseHLlM.js → diff-ZyKzQmlr.js} +2 -2
  26. package/web/dist/assets/{diff-controls-DhD4a7Z4.js → diff-controls-DHvk5BOR.js} +1 -1
  27. package/web/dist/assets/{diff-view--Nv4Px8F.js → diff-view-wHArQrRv.js} +1 -1
  28. package/web/dist/assets/{discard-changes-dialog-CD2HMH7E.js → discard-changes-dialog-u_8VAiFD.js} +1 -1
  29. package/web/dist/assets/{file-preview-BwrymAy7.js → file-preview-DbDhvIx2.js} +1 -1
  30. package/web/dist/assets/{git-toolbar-CYgIbgOf.js → git-toolbar-Bjvqzoo_.js} +1 -1
  31. package/web/dist/assets/{github-CtYRNNDH.js → github-DZyhI-94.js} +1 -1
  32. package/web/dist/assets/{global-activity-route-BXAhhLrt.js → global-activity-route-B20p5-qQ.js} +1 -1
  33. package/web/dist/assets/index-C8nM086t.css +1 -0
  34. package/web/dist/assets/{index-CXvWnyZg.js → index-TOx-AA67.js} +4 -4
  35. package/web/dist/assets/{markdown-BAmUNyiK.js → markdown-Ce0jEzBL.js} +1 -1
  36. package/web/dist/assets/{option-select-BxFrlK_-.js → option-select-BUpASY9Q.js} +1 -1
  37. package/web/dist/assets/{preferences-section-ByeO0I87.js → preferences-section-Cayq_QJk.js} +1 -1
  38. package/web/dist/assets/{preview-pane-connected-CJy9Miri.js → preview-pane-connected-C6q9f2y-.js} +1 -1
  39. package/web/dist/assets/{project-location-Cq1K7hXN.js → project-location-QEQeyIDW.js} +1 -1
  40. package/web/dist/assets/{projects-section-P0RuBn2c.js → projects-section-Ws3Kp5ky.js} +1 -1
  41. package/web/dist/assets/{prompt-templates-section-ChqZ2Gl4.js → prompt-templates-section-CfyNaD_K.js} +1 -1
  42. package/web/dist/assets/{remote-settings-notice-DYOP5Yxe.js → remote-settings-notice-DEs9jV72.js} +1 -1
  43. package/web/dist/assets/{repo-git-DcZTZ70-.js → repo-git-DpqwxFN6.js} +1 -1
  44. package/web/dist/assets/{report-reader-D0ud2uIA.js → report-reader-mwLAF_a8.js} +1 -1
  45. package/web/dist/assets/{reports-BNO0jrQI.js → reports-CN8KHXFF.js} +1 -1
  46. package/web/dist/assets/{resources-section-CQkpzv63.js → resources-section-BzYmdxRV.js} +1 -1
  47. package/web/dist/assets/{review-notes-drafts-B_Mb82AK.js → review-notes-drafts-D9s8XFRQ.js} +1 -1
  48. package/web/dist/assets/{review-panel-DcEmHodb.js → review-panel-Ds3S11Go.js} +1 -1
  49. package/web/dist/assets/{review-strip-En21aXDx.js → review-strip-BFq2VP2u.js} +1 -1
  50. package/web/dist/assets/run-header-788Dmvef.css +1 -0
  51. package/web/dist/assets/{run-header-DE0wTSnO.js → run-header-Bedua8do.js} +2 -2
  52. package/web/dist/assets/{select--dGOlrzM.js → select-CGjqNwut.js} +1 -1
  53. package/web/dist/assets/{session-context-section-b4-i_DSE.js → session-context-section-D0e8HLzL.js} +1 -1
  54. package/web/dist/assets/{settings-agent-picker-BhyVKLRu.js → settings-agent-picker-hFnntaW2.js} +1 -1
  55. package/web/dist/assets/{settings-save-bar-9D1QPg_P.js → settings-save-bar-DmONROMw.js} +1 -1
  56. package/web/dist/assets/{settings-shell-Ct4CWWvw.js → settings-shell-DjfeA3BW.js} +1 -1
  57. package/web/dist/assets/{sidebar-section-azclPE--.js → sidebar-section-DHJR37sv.js} +1 -1
  58. package/web/dist/assets/{skills-BizIiogS.js → skills-CFRO_xLW.js} +1 -1
  59. package/web/dist/assets/{task-changes-DjB5jujp.js → task-changes-BuNxS6PG.js} +1 -1
  60. package/web/dist/assets/{task-commits-cDkfIAvD.js → task-commits--1qJdD-O.js} +1 -1
  61. package/web/dist/assets/{task-file-scope-DLVI8zBp.js → task-file-scope-CFMwJrto.js} +1 -1
  62. package/web/dist/assets/{task-files-BVbjuEaL.js → task-files-CwH0b_vv.js} +1 -1
  63. package/web/dist/assets/{task-github-item-DW5Rl7Me.js → task-github-item-BezEGvZC.js} +1 -1
  64. package/web/dist/assets/{task-thread-DTLhAQbe.js → task-thread-T_RG916v.js} +2 -2
  65. package/web/dist/assets/{thread-state-VRKiUyJj.js → thread-state-zzV37Hgs.js} +1 -1
  66. package/web/dist/assets/{use-finish-run-BK7gmbXh.js → use-finish-run-CyV1CCkZ.js} +1 -1
  67. package/web/dist/assets/{use-hand-to-agent-state-pINTYkY9.js → use-hand-to-agent-state-Ci2rVhws.js} +1 -1
  68. package/web/dist/assets/use-path-bases-Cimv7R-0.js +1 -0
  69. package/web/dist/assets/{workflows-D2h67tAS.js → workflows-B9NzpaaA.js} +1 -1
  70. package/web/dist/assets/{workspace-tools-uIbmvTfR.js → workspace-tools-C0K5dFxy.js} +1 -1
  71. package/web/dist/assets/{worktrees-section-Cm1pcQ9g.js → worktrees-section-D48xLdpr.js} +1 -1
  72. package/web/dist/index.html +2 -2
  73. package/web/dist/assets/index-BUmO8olN.css +0 -1
  74. package/web/dist/assets/run-header-V9BxPSvn.css +0 -1
  75. package/web/dist/assets/use-path-bases-D1yBeTzY.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{o as r}from"./dist-C_rn70hE.js";import{Ut as i,g as a,nn as o,qt as s,tn as c}from"./queries-CchoEEzj.js";import{E as l,n as u,vi as d}from"./toaster-zMN8cNZQ.js";import{g as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{E as p,Q as m,Z as h,ct as g,d as _,k as v,rt as y,u as b,ut as x}from"./design-icons-QbNMZniQ.js";import{t as S}from"./button-C8jUIs8Q.js";import{t as C}from"./project-router-j0uBi7Ep.js";import{c as w,d as T,f as E,n as D,t as O}from"./page-shell-Dky5crRl.js";import{f as k,l as A}from"./skills-pM_PouEs.js";import{i as j}from"./agent-accounts-D_7QcFSx.js";import{Jn as M,X as N,sr as P}from"./index-CXvWnyZg.js";import{t as F}from"./option-select-BxFrlK_-.js";var I=e(t(),1),L=n(),R=e=>e.split(`@`)[0]||e,z={project:0,user:1,plugin:2,system:3,other:4},B={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function V(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:R(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:B[t],kind:t}}function H(e){let t=new Map;for(let n of e){let e=V(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>z[e.kind]-z[t.kind]||e.label.localeCompare(t.label))}function U(e){let t=e.plugin?`${R(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var W={project:p,user:x,plugin:v,system:v,other:v};function G({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,I.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,L.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,L.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,L.jsx)(K,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,L.jsx)(q,{skill:e,open:e.id===t,runner:r,account:i},k(e))):null]},e.key)})})}function K({group:e,open:t,onToggle:n}){let i=W[e.kind];return(0,L.jsx)(`h2`,{className:`m-0`,children:(0,L.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,L.jsx)(_,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,L.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,L.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function q({skill:e,open:t,runner:n,account:r}){let i=M({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,L.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,L.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-3 py-2 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover [&::-webkit-details-marker]:hidden`,children:[(0,L.jsxs)(`span`,{className:`grid min-w-0 flex-1 grid-cols-1 items-center gap-x-4 gap-y-0.5 sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)]`,children:[(0,L.jsx)(`span`,{className:`truncate text-[13.5px] leading-snug font-semibold text-foreground`,title:e.name,children:U(e)}),e.description?(0,L.jsx)(`span`,{className:`min-w-0 line-clamp-2 text-[13px] leading-snug text-muted-foreground [overflow-wrap:anywhere] group-open/skill:hidden`,title:e.description,children:e.description}):null]}),(0,L.jsx)(b,{"data-slot":`skill-row-cue`,"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/skill:rotate-180 motion-reduce:transition-none`})]}),(0,L.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,L.jsx)(N,{skill:e,heading:null,actions:(0,L.jsx)(S,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,L.jsx)(C,{to:i,children:`Start task`})})})})]})}function J(){let e=a(),[t,n]=(0,I.useState)(null),[i,o]=(0,I.useState)(null),[l,u]=(0,I.useState)(``),[d]=f(),p=t??e.data?.defaultRunner,{runner:g}=c(p??`claude`),_=i?.runner===g?i.id:null,v=e=>o(e===null?null:{runner:g,id:e}),y=s(p,_),b=$(g,y.account),x=y.data??[],O=A(x,l);return(0,L.jsxs)(T,{route:`skills`,density:y.isPending?`full`:E(O.length),className:`max-md:[padding-block-end:5rem]`,bodyClassName:`gap-5`,header:{title:`Skills`,subtitle:`The skills each agent loads in this project, as its runner reports them.`,secondaryActions:(0,L.jsxs)(w,{variant:`outline`,onClick:()=>void b.run(),disabled:b.running||y.isPending,"data-slot":`skills-refresh`,children:[(0,L.jsx)(h,{"aria-hidden":`true`,className:r(`size-3.5`,b.running&&`motion-safe:animate-spin`)}),`Re-read`]})},sparseFooter:!y.isPending&&O.length>0?(0,L.jsx)(D,{summary:`${O.length} ${O.length===1?`skill`:`skills`} available for this runner. Type / in New task to invoke one, or chain them into a workflow.`,actions:(0,L.jsx)(S,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,L.jsx)(C,{to:`/workflows`,children:`Open workflows`})})}):void 0,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(X,{runner:g,onChange:e=>{n(e),v(null)}}),(0,L.jsx)(Z,{runner:g,account:_,onChange:v}),(0,L.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,"data-slot":`skills-count`,children:y.list?`${x.length} ${x.length===1?`skill`:`skills`}${y.list.source===`cache`?` · from cache`:``}`:null})]}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(m,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(P,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:l,onChange:e=>u(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-9 text-[13px]`})]}),(0,L.jsx)(Q,{query:y}),y.isPending?(0,L.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,L.jsx)(Y,{skills:x,matches:O,search:l,onClearSearch:()=>u(``),onRefresh:()=>void b.run(),openId:d.get(`skill`),runner:g,account:y.account??null,unchecked:y.unchecked})]})}function Y({skills:e,matches:t,search:n,onClearSearch:r,onRefresh:i,openId:a,runner:o,account:s,unchecked:c}){return e.length===0?c?null:(0,L.jsx)(O,{icon:(0,L.jsx)(y,{}),title:`No skills reported by this runner and account.`,description:`Add a skill to this repository or your runner home, then re-read to refresh the inventory.`,actions:(0,L.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:i,children:`Re-read skills`})}):t.length===0?(0,L.jsx)(O,{icon:(0,L.jsx)(m,{}),title:`No skills match “${n.trim()}”.`,description:`Try a different keyword or clear the filter to browse every available skill.`,actions:(0,L.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:r,children:`Clear filter`})}):(0,L.jsx)(G,{groups:H(t),openId:a,searching:n.trim()!==``,runner:o,account:s})}function X({runner:e,onChange:t}){let n=o().data;return n?(0,L.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-1 overflow-x-auto rounded-lg border border-border bg-muted/60 p-1`,children:n.runners.map(n=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":n.id===e,onClick:()=>t(n.id),className:`h-8 shrink-0 rounded-md border border-transparent px-3 text-[13px] font-normal text-muted-foreground transition-colors focus-visible:outline-2 aria-pressed:border-border aria-pressed:bg-card aria-pressed:font-semibold aria-pressed:text-foreground aria-pressed:shadow-xs pointer-hover:text-foreground max-md:h-11`,children:n.displayName},n.id))}):null}function Z({runner:e,account:t,onChange:n}){let r=j().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,L.jsx)(F,{"aria-label":`Account`,value:t??``,onValueChange:e=>n(e||null),options:[{value:``,label:`Account: project default`},...r.map(e=>({value:e.id,label:e.label}))],className:`rounded-lg border-border bg-card text-[13px] text-foreground md:data-[size=default]:h-[38px]`})}function Q({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,L.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,L.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,L.jsx)(g,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,L.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,L.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,L.jsx)(g,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,L.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function $(e,t){let n=d(),[r,a]=(0,I.useState)(!1),o=i.runnerSkills(e,t);return{running:r,run:async()=>{a(!0);try{n.setQueryData(o,await l(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:o.slice(0,3)})}catch(e){u(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{a(!1)}}}}export{J 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{o as r}from"./dist-C_rn70hE.js";import{Ut as i,g as a,nn as o,qt as s,tn as c}from"./queries-CchoEEzj.js";import{E as l,n as u,vi as d}from"./toaster-zMN8cNZQ.js";import{g as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{E as p,Q as m,Z as h,ct as g,d as _,k as v,rt as y,u as b,ut as x}from"./design-icons-QbNMZniQ.js";import{t as S}from"./button-C8jUIs8Q.js";import{t as C}from"./project-router-j0uBi7Ep.js";import{c as w,d as T,f as E,n as D,t as O}from"./page-shell-Dky5crRl.js";import{f as k,l as A}from"./skills-pM_PouEs.js";import{i as j}from"./agent-accounts-D_7QcFSx.js";import{Jn as M,X as N,sr as P}from"./index-TOx-AA67.js";import{t as F}from"./option-select-BUpASY9Q.js";var I=e(t(),1),L=n(),R=e=>e.split(`@`)[0]||e,z={project:0,user:1,plugin:2,system:3,other:4},B={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function V(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:R(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:B[t],kind:t}}function H(e){let t=new Map;for(let n of e){let e=V(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>z[e.kind]-z[t.kind]||e.label.localeCompare(t.label))}function U(e){let t=e.plugin?`${R(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var W={project:p,user:x,plugin:v,system:v,other:v};function G({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,I.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,L.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,L.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,L.jsx)(K,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,L.jsx)(q,{skill:e,open:e.id===t,runner:r,account:i},k(e))):null]},e.key)})})}function K({group:e,open:t,onToggle:n}){let i=W[e.kind];return(0,L.jsx)(`h2`,{className:`m-0`,children:(0,L.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,L.jsx)(_,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,L.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,L.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function q({skill:e,open:t,runner:n,account:r}){let i=M({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,L.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,L.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-3 py-2 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover [&::-webkit-details-marker]:hidden`,children:[(0,L.jsxs)(`span`,{className:`grid min-w-0 flex-1 grid-cols-1 items-center gap-x-4 gap-y-0.5 sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)]`,children:[(0,L.jsx)(`span`,{className:`truncate text-[13.5px] leading-snug font-semibold text-foreground`,title:e.name,children:U(e)}),e.description?(0,L.jsx)(`span`,{className:`min-w-0 line-clamp-2 text-[13px] leading-snug text-muted-foreground [overflow-wrap:anywhere] group-open/skill:hidden`,title:e.description,children:e.description}):null]}),(0,L.jsx)(b,{"data-slot":`skill-row-cue`,"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/skill:rotate-180 motion-reduce:transition-none`})]}),(0,L.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,L.jsx)(N,{skill:e,heading:null,actions:(0,L.jsx)(S,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,L.jsx)(C,{to:i,children:`Start task`})})})})]})}function J(){let e=a(),[t,n]=(0,I.useState)(null),[i,o]=(0,I.useState)(null),[l,u]=(0,I.useState)(``),[d]=f(),p=t??e.data?.defaultRunner,{runner:g}=c(p??`claude`),_=i?.runner===g?i.id:null,v=e=>o(e===null?null:{runner:g,id:e}),y=s(p,_),b=$(g,y.account),x=y.data??[],O=A(x,l);return(0,L.jsxs)(T,{route:`skills`,density:y.isPending?`full`:E(O.length),className:`max-md:[padding-block-end:5rem]`,bodyClassName:`gap-5`,header:{title:`Skills`,subtitle:`The skills each agent loads in this project, as its runner reports them.`,secondaryActions:(0,L.jsxs)(w,{variant:`outline`,onClick:()=>void b.run(),disabled:b.running||y.isPending,"data-slot":`skills-refresh`,children:[(0,L.jsx)(h,{"aria-hidden":`true`,className:r(`size-3.5`,b.running&&`motion-safe:animate-spin`)}),`Re-read`]})},sparseFooter:!y.isPending&&O.length>0?(0,L.jsx)(D,{summary:`${O.length} ${O.length===1?`skill`:`skills`} available for this runner. Type / in New task to invoke one, or chain them into a workflow.`,actions:(0,L.jsx)(S,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,L.jsx)(C,{to:`/workflows`,children:`Open workflows`})})}):void 0,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(X,{runner:g,onChange:e=>{n(e),v(null)}}),(0,L.jsx)(Z,{runner:g,account:_,onChange:v}),(0,L.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,"data-slot":`skills-count`,children:y.list?`${x.length} ${x.length===1?`skill`:`skills`}${y.list.source===`cache`?` · from cache`:``}`:null})]}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(m,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(P,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:l,onChange:e=>u(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-9 text-[13px]`})]}),(0,L.jsx)(Q,{query:y}),y.isPending?(0,L.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,L.jsx)(Y,{skills:x,matches:O,search:l,onClearSearch:()=>u(``),onRefresh:()=>void b.run(),openId:d.get(`skill`),runner:g,account:y.account??null,unchecked:y.unchecked})]})}function Y({skills:e,matches:t,search:n,onClearSearch:r,onRefresh:i,openId:a,runner:o,account:s,unchecked:c}){return e.length===0?c?null:(0,L.jsx)(O,{icon:(0,L.jsx)(y,{}),title:`No skills reported by this runner and account.`,description:`Add a skill to this repository or your runner home, then re-read to refresh the inventory.`,actions:(0,L.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:i,children:`Re-read skills`})}):t.length===0?(0,L.jsx)(O,{icon:(0,L.jsx)(m,{}),title:`No skills match “${n.trim()}”.`,description:`Try a different keyword or clear the filter to browse every available skill.`,actions:(0,L.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:r,children:`Clear filter`})}):(0,L.jsx)(G,{groups:H(t),openId:a,searching:n.trim()!==``,runner:o,account:s})}function X({runner:e,onChange:t}){let n=o().data;return n?(0,L.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-1 overflow-x-auto rounded-lg border border-border bg-muted/60 p-1`,children:n.runners.map(n=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":n.id===e,onClick:()=>t(n.id),className:`h-8 shrink-0 rounded-md border border-transparent px-3 text-[13px] font-normal text-muted-foreground transition-colors focus-visible:outline-2 aria-pressed:border-border aria-pressed:bg-card aria-pressed:font-semibold aria-pressed:text-foreground aria-pressed:shadow-xs pointer-hover:text-foreground max-md:h-11`,children:n.displayName},n.id))}):null}function Z({runner:e,account:t,onChange:n}){let r=j().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,L.jsx)(F,{"aria-label":`Account`,value:t??``,onValueChange:e=>n(e||null),options:[{value:``,label:`Account: project default`},...r.map(e=>({value:e.id,label:e.label}))],className:`rounded-lg border-border bg-card text-[13px] text-foreground md:data-[size=default]:h-[38px]`})}function Q({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,L.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,L.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,L.jsx)(g,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,L.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,L.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,L.jsx)(g,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,L.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function $(e,t){let n=d(),[r,a]=(0,I.useState)(!1),o=i.runnerSkills(e,t);return{running:r,run:async()=>{a(!0);try{n.setQueryData(o,await l(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:o.slice(0,3)})}catch(e){u(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{a(!1)}}}}export{J as SkillsRoute};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{J as i,S as a,Ut as o,Y as s,un as c,vt as l}from"./queries-CchoEEzj.js";import{Bt as u,Gt as d,Ot as f,Rn as p,Rt as m,Ut as h,ir as g,n as _,st as v,ut as ee,vi as y}from"./toaster-zMN8cNZQ.js";import{h as b}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{M as x,u as S,w as C}from"./design-icons-QbNMZniQ.js";import{t as te}from"./run-header-DE0wTSnO.js";import{i as w,n as ne,r as T}from"./git-toolbar-CYgIbgOf.js";import{t as E}from"./button-C8jUIs8Q.js";import{a as D,i as O,o as k,r as A,s as j,t as M}from"./dialog-DRZuXvul.js";import{b as N,f as P}from"./task-groups-CGCnVqHE.js";import{f as re,l as ie,m as ae}from"./page-shell-Dky5crRl.js";import{t as F}from"./centered-state-BgSV4e79.js";import{A as oe,Un as se,at as ce,k as I,vn as L}from"./index-CXvWnyZg.js";import{t as R}from"./textarea-vEsJAUAV.js";import{t as z}from"./markdown-BBDDg-4t.js";import{n as B,t as V}from"./review-notes-drafts-B_Mb82AK.js";import{t as H}from"./diff-BcseHLlM.js";import{t as U}from"./code-workbench-CUkiQ1pF.js";import{t as W}from"./file-text-nGpo7MVd.js";import{i as le,n as G,r as ue}from"./selected-file-CfBWFB6p.js";var K=e(t(),1),q=`no worktree — this task ran directly in the repo working tree`;function J(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 — ${q}`)}function Y(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 — ${q}`)}function de(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${q}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?g(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):N(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function fe(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:J(e),n=e.prUrl?[J(e),Y(e)]:[Y(e),de(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?N(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,primaryVariant:e.run.status===`review`?`outline`:`primary`,secondary:n,menu:r}}function pe(e,t){let[n=``,...r]=t.trim().split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{J as i,S as a,Ut as o,Y as s,un as c,vt as l}from"./queries-CchoEEzj.js";import{Bt as u,Gt as d,Ot as f,Rn as p,Rt as m,Ut as h,ir as g,n as _,st as v,ut as ee,vi as y}from"./toaster-zMN8cNZQ.js";import{h as b}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{M as x,u as S,w as C}from"./design-icons-QbNMZniQ.js";import{t as te}from"./run-header-Bedua8do.js";import{i as w,n as ne,r as T}from"./git-toolbar-Bjvqzoo_.js";import{t as E}from"./button-C8jUIs8Q.js";import{a as D,i as O,o as k,r as A,s as j,t as M}from"./dialog-DRZuXvul.js";import{b as N,f as P}from"./task-groups-CGCnVqHE.js";import{f as re,l as ie,m as ae}from"./page-shell-Dky5crRl.js";import{t as F}from"./centered-state-BgSV4e79.js";import{A as oe,Un as se,at as ce,k as I,vn as L}from"./index-TOx-AA67.js";import{t as R}from"./textarea-vEsJAUAV.js";import{t as z}from"./markdown-BBDDg-4t.js";import{n as B,t as V}from"./review-notes-drafts-D9s8XFRQ.js";import{t as H}from"./diff-ZyKzQmlr.js";import{t as U}from"./code-workbench-CUkiQ1pF.js";import{t as W}from"./file-text-nGpo7MVd.js";import{i as le,n as G,r as ue}from"./selected-file-CfBWFB6p.js";var K=e(t(),1),q=`no worktree — this task ran directly in the repo working tree`;function J(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 — ${q}`)}function Y(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 — ${q}`)}function de(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${q}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?g(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):N(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function fe(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:J(e),n=e.prUrl?[J(e),Y(e)]:[Y(e),de(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?N(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,primaryVariant:e.run.status===`review`?`outline`:`primary`,secondary:n,menu:r}}function pe(e,t){let[n=``,...r]=t.trim().split(`
2
2
  `),i=[n,...r.map(e=>e.trim()===``?``:` ${e.trimEnd()}`)].join(`
3
3
  `);return`- \`${me(e)}\` — ${i}`}function me({path:e,side:t,line:n}){let r=typeof n==`number`||n.start===n.end?String(typeof n==`number`?n:n.start):`${n.start}-${n.end}`;return t===`old`?`${e} (old ${r})`:`${e}:${r}`}function he(e,t,n){let r=V(e).notes;B(e,{open:!0,notes:`${r}${r===``||r.endsWith(`
4
4
  `)?``:`
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{J as t,Ut as n,X as r,Z as i,dn as a}from"./queries-CchoEEzj.js";import{Rn as o,Tt as s,wt as c}from"./toaster-zMN8cNZQ.js";import{h as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as u,M as d}from"./design-icons-QbNMZniQ.js";import{t as f}from"./run-header-DE0wTSnO.js";import{t as p}from"./project-router-j0uBi7Ep.js";import{b as m}from"./task-groups-CGCnVqHE.js";import{f as h,l as g,m as _}from"./page-shell-Dky5crRl.js";import{t as v}from"./centered-state-BgSV4e79.js";import{A as y,Hn as b,k as x}from"./index-CXvWnyZg.js";import{t as S}from"./change-counts-wqSYI3W8.js";import{t as C}from"./code-workbench-CUkiQ1pF.js";import{t as w}from"./file-text-nGpo7MVd.js";import{i as T,r as E,t as D}from"./commit-list-CCgF6z16.js";import{i as O,n as k,r as A}from"./selected-file-CfBWFB6p.js";var j=e();function M(){let{id:e}=l(),n=t(e);return n.isPending?(0,j.jsx)(y,{tab:`changes`}):n.isError?(0,j.jsx)(x,{tab:`changes`,error:n.error}):(0,j.jsx)(N,{run:n.data})}function N({run:e}){let{sha:t}=l(),n=i(e.id,m(e)),r=_(),a=t??n.data?.commits[0]?.sha,s=t!==void 0&&(!r||n.isError||n.data?.commits.length===0);return(0,j.jsxs)(g,{route:`task-commits`,density:h(n.data?.commits.length??0),flushPadding:!0,children:[(0,j.jsx)(f,{run:e,tab:`commits`}),s?(0,j.jsx)(F,{runId:e.id,sha:t}):n.isPending?(0,j.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,j.jsx)(v,{icon:(0,j.jsx)(d,{size:16}),tone:n.error instanceof o&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof o&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,j.jsx)(v,{icon:(0,j.jsx)(d,{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,j.jsx)(P,{run:e,commits:n.data.commits,selectedSha:a})]})}function P({run:e,commits:t,selectedSha:n}){let i=r(e.id,n),a=L(e.id,t),o=A(e.id,`commit:${n??``}`,i.data?.files),c=O(e.id);return(0,j.jsx)(C,{className:`px-4 py-5 md:px-9`,treeSlot:`task-commits-pane`,tree:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(D,{slot:`task-commits`,selectedSha:n,heading:(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:a.get(t.sha)}))}),n&&i.data&&i.data.files.length>0?(0,j.jsx)(R,{runId:e.id,sha:n,files:i.data.files,selected:c,onPick:t=>{k(e.id,t),o.reveal(t)}}):null]}),children:n?(0,j.jsx)(T,{commit:i,sha:n,slot:`task-commit-preview`,heading:`h3`,diffRef:o,loadFileText:t=>w(()=>s(e.id,n,t))}):null})}function F({runId:e,sha:t}){let n=r(e,t);return(0,j.jsx)(E,{commit:n,sha:t,diffRef:A(e,`commit:${t}`,n.data?.files),backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,loadFileText:n=>w(()=>s(e,t,n))})}var I=12;function L(e,t){let r=t.length<=I,i=a({queries:t.map(t=>({queryKey:n.runs.commit(e,t.sha),queryFn:({signal:n})=>c(e,t.sha,{signal:n}),enabled:r,retry:!1}))}),o=new Map;return i.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&o.set(r,e.data.stat)}),o}function R({runId:e,sha:t,files:n,selected:r,onPick:i}){return(0,j.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,j.jsx)(b,{sha:t,variant:`inline`,className:`text-[13px] font-medium`})]}),(0,j.jsx)(p,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,j.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,"aria-current":e.path===r?`true`:void 0,onClick:()=>i(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground aria-[current=true]:bg-muted aria-[current=true]:text-foreground`,children:[(0,j.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,j.jsx)(S,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{M as TaskCommitsRoute};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{J as t,Ut as n,X as r,Z as i,dn as a}from"./queries-CchoEEzj.js";import{Rn as o,Tt as s,wt as c}from"./toaster-zMN8cNZQ.js";import{h as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as u,M as d}from"./design-icons-QbNMZniQ.js";import{t as f}from"./run-header-Bedua8do.js";import{t as p}from"./project-router-j0uBi7Ep.js";import{b as m}from"./task-groups-CGCnVqHE.js";import{f as h,l as g,m as _}from"./page-shell-Dky5crRl.js";import{t as v}from"./centered-state-BgSV4e79.js";import{A as y,Hn as b,k as x}from"./index-TOx-AA67.js";import{t as S}from"./change-counts-wqSYI3W8.js";import{t as C}from"./code-workbench-CUkiQ1pF.js";import{t as w}from"./file-text-nGpo7MVd.js";import{i as T,r as E,t as D}from"./commit-list-FjUd56tK.js";import{i as O,n as k,r as A}from"./selected-file-CfBWFB6p.js";var j=e();function M(){let{id:e}=l(),n=t(e);return n.isPending?(0,j.jsx)(y,{tab:`changes`}):n.isError?(0,j.jsx)(x,{tab:`changes`,error:n.error}):(0,j.jsx)(N,{run:n.data})}function N({run:e}){let{sha:t}=l(),n=i(e.id,m(e)),r=_(),a=t??n.data?.commits[0]?.sha,s=t!==void 0&&(!r||n.isError||n.data?.commits.length===0);return(0,j.jsxs)(g,{route:`task-commits`,density:h(n.data?.commits.length??0),flushPadding:!0,children:[(0,j.jsx)(f,{run:e,tab:`commits`}),s?(0,j.jsx)(F,{runId:e.id,sha:t}):n.isPending?(0,j.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,j.jsx)(v,{icon:(0,j.jsx)(d,{size:16}),tone:n.error instanceof o&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof o&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,j.jsx)(v,{icon:(0,j.jsx)(d,{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,j.jsx)(P,{run:e,commits:n.data.commits,selectedSha:a})]})}function P({run:e,commits:t,selectedSha:n}){let i=r(e.id,n),a=L(e.id,t),o=A(e.id,`commit:${n??``}`,i.data?.files),c=O(e.id);return(0,j.jsx)(C,{className:`px-4 py-5 md:px-9`,treeSlot:`task-commits-pane`,tree:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(D,{slot:`task-commits`,selectedSha:n,heading:(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:a.get(t.sha)}))}),n&&i.data&&i.data.files.length>0?(0,j.jsx)(R,{runId:e.id,sha:n,files:i.data.files,selected:c,onPick:t=>{k(e.id,t),o.reveal(t)}}):null]}),children:n?(0,j.jsx)(T,{commit:i,sha:n,slot:`task-commit-preview`,heading:`h3`,diffRef:o,loadFileText:t=>w(()=>s(e.id,n,t))}):null})}function F({runId:e,sha:t}){let n=r(e,t);return(0,j.jsx)(E,{commit:n,sha:t,diffRef:A(e,`commit:${t}`,n.data?.files),backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,loadFileText:n=>w(()=>s(e,t,n))})}var I=12;function L(e,t){let r=t.length<=I,i=a({queries:t.map(t=>({queryKey:n.runs.commit(e,t.sha),queryFn:({signal:n})=>c(e,t.sha,{signal:n}),enabled:r,retry:!1}))}),o=new Map;return i.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&o.set(r,e.data.stat)}),o}function R({runId:e,sha:t,files:n,selected:r,onPick:i}){return(0,j.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,j.jsx)(b,{sha:t,variant:`inline`,className:`text-[13px] font-medium`})]}),(0,j.jsx)(p,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,j.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,"aria-current":e.path===r?`true`:void 0,onClick:()=>i(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground aria-[current=true]:bg-muted aria-[current=true]:text-foreground`,children:[(0,j.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,j.jsx)(S,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{M as TaskCommitsRoute};
@@ -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{d as r,h as i}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{w as a}from"./index-CXvWnyZg.js";var o=e(t(),1),s=n();function c({runId:e,children:t}){let n=r(),i=(0,o.useMemo)(()=>({runId:e}),[e]);return n?(0,s.jsx)(l,{runId:e,children:t}):(0,s.jsx)(a.Provider,{value:i,children:t})}function l({runId:e,children:t}){let{projectId:n}=i(),r=(0,o.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,s.jsx)(a.Provider,{value:r,children:t})}export{c 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{d as r,h as i}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{w as a}from"./index-TOx-AA67.js";var o=e(t(),1),s=n();function c({runId:e,children:t}){let n=r(),i=(0,o.useMemo)(()=>({runId:e}),[e]);return n?(0,s.jsx)(l,{runId:e,children:t}):(0,s.jsx)(a.Provider,{value:i,children:t})}function l({runId:e,children:t}){let{projectId:n}=i(),r=(0,o.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,s.jsx)(a.Provider,{value:r,children:t})}export{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{o as r}from"./dist-C_rn70hE.js";import{$ as i,J as a,M as o,P as s,z as c}from"./queries-CchoEEzj.js";import{Rn as l,it as u,mt as d}from"./toaster-zMN8cNZQ.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as g,E as _,Q as v,Z as ee,ct as y,d as b}from"./design-icons-QbNMZniQ.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./run-header-DE0wTSnO.js";import{a as C,i as w,n as T,o as E,r as te}from"./file-preview-BwrymAy7.js";import{t as D}from"./button-C8jUIs8Q.js";import{l as O}from"./page-shell-Dky5crRl.js";import{t as k}from"./centered-state-BgSV4e79.js";import{t as A}from"./use-search-params-writer-ClMScnNe.js";import{A as j,E as M,Vn as N,gr as P,k as F,sr as I,w as L}from"./index-CXvWnyZg.js";import{t as R}from"./task-file-scope-DLVI8zBp.js";import{t as z}from"./code-workbench-CUkiQ1pF.js";import{t as B}from"./middle-truncated-name-D41ibfXD.js";import{n as V,t as H}from"./selected-file-CfBWFB6p.js";var U=x(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ne=x(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),W=e(t(),1),G=n();function K({runId:e,path:t,artifactId:n,worktreePath:r}){let i=c(e,n?null:t),a=o(e,n),s=n?a:i,l=(0,W.useContext)(L),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=s.data,g=(0,W.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,G.jsx)(te,{runId:e,path:null,className:`min-w-0 flex-1`});if(s.isPending)return(0,G.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(s.isError)return(0,G.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,G.jsx)(`h2`,{children:`Could not load this file`}),(0,G.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:s.error.message}),(0,G.jsx)(D,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});if(!h)return(0,G.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=w(h.path,r,t);if(h.type!==`file`)return(0,G.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,G.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,G.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,G.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,G.jsx)(D,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});let v=h.artifact;return(0,G.jsx)(L.Provider,{value:g,children:(0,G.jsx)(T,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?u(e,v.id,`image`):d(e,t),...v?{downloadUrl:u(e,v.id,`download`),snapshot:(0,G.jsx)(N,{iso:v.createdAt})}:{}},v?.id??h.path)})}var q=new Map;function J(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var Y=(0,W.createContext)(null);function X(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,W.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var Z=()=>document.querySelector(`[data-slot="main"]`);function re(e,t){let n=(0,W.useRef)(null),r=f(),i=h()===`POP`?r.key:J(r.state),[a]=(0,W.useState)(()=>{let t=i?q.get(i):void 0;return t?.runId===e?t:null}),o=(0,W.useRef)(new Set(a?.folders??[])),s=(0,W.useRef)(new Set),[c,l]=(0,W.useState)(0),u=(0,W.useRef)(a===null),d=(0,W.useCallback)(()=>{u.current&&q.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:Z()?.scrollTop??0})},[r.key,e]),p=(0,W.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,W.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=Z();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,W.useEffect)(()=>{d();let e=[n.current,Z()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function ie({runId:e,selected:t,onSelect:n}){return(0,G.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,G.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,G.jsx)(Q,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Q({runId:e,path:t,depth:n,selected:r,onSelect:a}){let o=i(e,t),s=(0,W.useContext)(Y);return(0,W.useEffect)(()=>{if(!(!t||!s))return s.loading(t,o.isPending),()=>s.loading(t,!1)},[s,t,o.isPending]),o.isPending?(0,G.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):o.isError?(0,G.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:o.error.message}):o.data.type===`dir`?o.data.entries.length===0?(0,G.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,G.jsx)(G.Fragment,{children:o.data.entries.map(i=>i.type===`dir`?(0,G.jsx)(ae,{runId:e,name:i.chain??i.name,path:t===``?i.chain??i.name:`${t}/${i.chain??i.name}`,depth:n,selected:r,onSelect:a},i.name):(0,G.jsx)(oe,{name:i.name,path:t===``?i.name:`${t}/${i.name}`,size:i.size,depth:n,selected:r,onSelect:a},i.name))}):null}function ae({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,W.useContext)(Y),[c,l]=(0,W.useState)(()=>s?.isOpen(n)??!1);return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,G.jsx)(b,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,G.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{title:n,className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,G.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,G.jsx)(Q,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function oe({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=E(t)?ne:g;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,G.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(B,{name:e,path:t}),n===void 0?null:(0,G.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:C(n)})]})})}function $(){let{id:e}=m(),t=a(e),n=X();return t.isPending?(0,G.jsx)(j,{tab:`files`}):t.isError?(0,G.jsx)(F,{tab:`files`,error:t.error}):(0,G.jsx)(R,{runId:t.data.id,children:(0,G.jsx)(le,{run:t.data},`${t.data.id}:${n}`)})}function se(e,t,n,r){let i=c(e,r||n!==null?null:t),a=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function ce(e,t,n,r){let i=e.id,a=e.worktreePath,[,o]=A(),s=h(),c=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(c.current)return;c.current=!0;let e=H(i);s===`POP`||t!==null||n!==null||e===null||o(t=>(t.set(`path`,e),t))},[s,n,t,i,o]),(0,W.useEffect)(()=>{t!==null&&!r&&V(i,M(t,a))},[r,t,i,a])}function le({run:e}){let t=i(e.id,``),n=s(e.id),[r,a]=p(),o=r.get(`path`),c=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&c!==null;ce(e,o,c,u);let[d,f]=(0,W.useState)(o??``);(0,W.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),a(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=se(e.id,o,c,u),_=re(e.id,!t.isPending&&g);return(0,G.jsxs)(O,{route:`task-files`,density:ue(t.isError),flushPadding:!0,children:[(0,G.jsx)(S,{run:e,tab:`files`}),(0,G.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,G.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,G.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,G.jsx)(I,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,G.jsx)(D,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,G.jsx)(z,{className:`flex-none gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:gap-0 md:px-9`,treeRef:_.tree,treeSlot:`files-tree-pane`,treeClassName:`rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:overflow-y-auto md:overscroll-contain`,tree:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,G.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,G.jsx)(k,{icon:h?(0,G.jsx)(U,{}):(0,G.jsx)(y,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,G.jsx)(Y.Provider,{value:_.folders,children:(0,G.jsx)(ie,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,G.jsx)(de,{artifacts:n,artifactId:c,onSelect:e=>m(`artifact`,e)})]}),children:u?(0,G.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||c!==null||t.isSuccess?(0,G.jsx)(K,{runId:e.id,path:o,artifactId:c,worktreePath:e.worktreePath}):null}),(0,G.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function ue(e){return e?`empty`:`full`}function de({artifacts:e,artifactId:t,onSelect:n}){return(0,G.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,G.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,G.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,G.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,G.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,G.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,G.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,G.jsxs)(D,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,G.jsx)(ee,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ as TaskFilesRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{$ as i,J as a,M as o,P as s,z as c}from"./queries-CchoEEzj.js";import{Rn as l,it as u,mt as d}from"./toaster-zMN8cNZQ.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as g,E as _,Q as v,Z as ee,ct as y,d as b}from"./design-icons-QbNMZniQ.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./run-header-Bedua8do.js";import{a as C,i as w,n as T,o as E,r as te}from"./file-preview-DbDhvIx2.js";import{t as D}from"./button-C8jUIs8Q.js";import{l as O}from"./page-shell-Dky5crRl.js";import{t as k}from"./centered-state-BgSV4e79.js";import{t as A}from"./use-search-params-writer-ClMScnNe.js";import{A as j,E as M,Vn as N,gr as P,k as F,sr as I,w as L}from"./index-TOx-AA67.js";import{t as R}from"./task-file-scope-CFMwJrto.js";import{t as z}from"./code-workbench-CUkiQ1pF.js";import{t as B}from"./middle-truncated-name-D41ibfXD.js";import{n as V,t as H}from"./selected-file-CfBWFB6p.js";var U=x(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ne=x(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),W=e(t(),1),G=n();function K({runId:e,path:t,artifactId:n,worktreePath:r}){let i=c(e,n?null:t),a=o(e,n),s=n?a:i,l=(0,W.useContext)(L),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=s.data,g=(0,W.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,G.jsx)(te,{runId:e,path:null,className:`min-w-0 flex-1`});if(s.isPending)return(0,G.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(s.isError)return(0,G.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,G.jsx)(`h2`,{children:`Could not load this file`}),(0,G.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:s.error.message}),(0,G.jsx)(D,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});if(!h)return(0,G.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=w(h.path,r,t);if(h.type!==`file`)return(0,G.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,G.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,G.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,G.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,G.jsx)(D,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});let v=h.artifact;return(0,G.jsx)(L.Provider,{value:g,children:(0,G.jsx)(T,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?u(e,v.id,`image`):d(e,t),...v?{downloadUrl:u(e,v.id,`download`),snapshot:(0,G.jsx)(N,{iso:v.createdAt})}:{}},v?.id??h.path)})}var q=new Map;function J(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var Y=(0,W.createContext)(null);function X(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,W.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var Z=()=>document.querySelector(`[data-slot="main"]`);function re(e,t){let n=(0,W.useRef)(null),r=f(),i=h()===`POP`?r.key:J(r.state),[a]=(0,W.useState)(()=>{let t=i?q.get(i):void 0;return t?.runId===e?t:null}),o=(0,W.useRef)(new Set(a?.folders??[])),s=(0,W.useRef)(new Set),[c,l]=(0,W.useState)(0),u=(0,W.useRef)(a===null),d=(0,W.useCallback)(()=>{u.current&&q.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:Z()?.scrollTop??0})},[r.key,e]),p=(0,W.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,W.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=Z();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,W.useEffect)(()=>{d();let e=[n.current,Z()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function ie({runId:e,selected:t,onSelect:n}){return(0,G.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,G.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,G.jsx)(Q,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Q({runId:e,path:t,depth:n,selected:r,onSelect:a}){let o=i(e,t),s=(0,W.useContext)(Y);return(0,W.useEffect)(()=>{if(!(!t||!s))return s.loading(t,o.isPending),()=>s.loading(t,!1)},[s,t,o.isPending]),o.isPending?(0,G.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):o.isError?(0,G.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:o.error.message}):o.data.type===`dir`?o.data.entries.length===0?(0,G.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,G.jsx)(G.Fragment,{children:o.data.entries.map(i=>i.type===`dir`?(0,G.jsx)(ae,{runId:e,name:i.chain??i.name,path:t===``?i.chain??i.name:`${t}/${i.chain??i.name}`,depth:n,selected:r,onSelect:a},i.name):(0,G.jsx)(oe,{name:i.name,path:t===``?i.name:`${t}/${i.name}`,size:i.size,depth:n,selected:r,onSelect:a},i.name))}):null}function ae({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,W.useContext)(Y),[c,l]=(0,W.useState)(()=>s?.isOpen(n)??!1);return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,G.jsx)(b,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,G.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{title:n,className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,G.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,G.jsx)(Q,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function oe({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=E(t)?ne:g;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,G.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(B,{name:e,path:t}),n===void 0?null:(0,G.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:C(n)})]})})}function $(){let{id:e}=m(),t=a(e),n=X();return t.isPending?(0,G.jsx)(j,{tab:`files`}):t.isError?(0,G.jsx)(F,{tab:`files`,error:t.error}):(0,G.jsx)(R,{runId:t.data.id,children:(0,G.jsx)(le,{run:t.data},`${t.data.id}:${n}`)})}function se(e,t,n,r){let i=c(e,r||n!==null?null:t),a=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function ce(e,t,n,r){let i=e.id,a=e.worktreePath,[,o]=A(),s=h(),c=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(c.current)return;c.current=!0;let e=H(i);s===`POP`||t!==null||n!==null||e===null||o(t=>(t.set(`path`,e),t))},[s,n,t,i,o]),(0,W.useEffect)(()=>{t!==null&&!r&&V(i,M(t,a))},[r,t,i,a])}function le({run:e}){let t=i(e.id,``),n=s(e.id),[r,a]=p(),o=r.get(`path`),c=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&c!==null;ce(e,o,c,u);let[d,f]=(0,W.useState)(o??``);(0,W.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),a(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=se(e.id,o,c,u),_=re(e.id,!t.isPending&&g);return(0,G.jsxs)(O,{route:`task-files`,density:ue(t.isError),flushPadding:!0,children:[(0,G.jsx)(S,{run:e,tab:`files`}),(0,G.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,G.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,G.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,G.jsx)(I,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,G.jsx)(D,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,G.jsx)(z,{className:`flex-none gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:gap-0 md:px-9`,treeRef:_.tree,treeSlot:`files-tree-pane`,treeClassName:`rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:overflow-y-auto md:overscroll-contain`,tree:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,G.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,G.jsx)(k,{icon:h?(0,G.jsx)(U,{}):(0,G.jsx)(y,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,G.jsx)(Y.Provider,{value:_.folders,children:(0,G.jsx)(ie,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,G.jsx)(de,{artifacts:n,artifactId:c,onSelect:e=>m(`artifact`,e)})]}),children:u?(0,G.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||c!==null||t.isSuccess?(0,G.jsx)(K,{runId:e.id,path:o,artifactId:c,worktreePath:e.worktreePath}):null}),(0,G.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function ue(e){return e?`empty`:`full`}function de({artifacts:e,artifactId:t,onSelect:n}){return(0,G.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,G.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,G.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,G.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,G.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,G.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,G.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,G.jsxs)(D,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,G.jsx)(ee,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ as TaskFilesRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{s as t}from"./dist-C_rn70hE.js";import{J as n,Ut as r,a as i,bt as a,n as o,un as s,vt as c,xt as l}from"./queries-CchoEEzj.js";import{Y as u,vi as d}from"./toaster-zMN8cNZQ.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as p,T as m}from"./reference-chip-z7dZJVH-.js";import{I as h,ct as g,m as _}from"./design-icons-QbNMZniQ.js";import{t as v}from"./run-header-DE0wTSnO.js";import{t as y}from"./external-link-BE6y205O.js";import{t as b}from"./search-x-I9Q8pgUa.js";import{t as x}from"./button-C8jUIs8Q.js";import{t as S}from"./project-router-j0uBi7Ep.js";import{l as C}from"./page-shell-Dky5crRl.js";import{t as w}from"./centered-state-BgSV4e79.js";import{O as T,k as E,pr as D}from"./index-CXvWnyZg.js";import{l as O,n as k,t as A}from"./use-hand-to-agent-state-pINTYkY9.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:t}=f(),r=n(t);return r.isPending?(0,j.jsx)(T,{kind:e}):r.isError?(0,j.jsx)(E,{tab:`github-item`,error:r.error}):(0,j.jsx)(P,{run:r.data,kind:e})}function P({run:e,kind:t}){let{n}=f(),r=Number(n),o=a(),s=l(),u=c(),d=s.isPending||u.isPending,m=p(e,o).some(e=>e.kind===t&&e.number===r),h=i(t,r,m);return(0,j.jsxs)(C,{route:`task-github-item`,density:m?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:r}}),m?(0,j.jsx)(H,{run:e,kind:t,number:r,repoBase:o,item:h}):d?(0,j.jsx)(T,{kind:t,number:r,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(D,{size:16}),tone:`neutral`,heading:`h2`,title:`#${n} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:n}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(r.githubItem(t,n)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=m(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,j.jsxs)(j.Fragment,{children:[s,l&&t(l)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let a=d(),c=s({mutationFn:e=>u(t,n,{refresh:!0}),onSuccess:(e,t)=>a.setQueryData(t,e)}),l=F(t,i),f=o(l?[n]:[],l),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(T,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(k,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{s as t}from"./dist-C_rn70hE.js";import{J as n,Ut as r,a as i,bt as a,n as o,un as s,vt as c,xt as l}from"./queries-CchoEEzj.js";import{Y as u,vi as d}from"./toaster-zMN8cNZQ.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as p,T as m}from"./reference-chip-z7dZJVH-.js";import{I as h,ct as g,m as _}from"./design-icons-QbNMZniQ.js";import{t as v}from"./run-header-Bedua8do.js";import{t as y}from"./external-link-BE6y205O.js";import{t as b}from"./search-x-I9Q8pgUa.js";import{t as x}from"./button-C8jUIs8Q.js";import{t as S}from"./project-router-j0uBi7Ep.js";import{l as C}from"./page-shell-Dky5crRl.js";import{t as w}from"./centered-state-BgSV4e79.js";import{O as T,k as E,pr as D}from"./index-TOx-AA67.js";import{l as O,n as k,t as A}from"./use-hand-to-agent-state-Ci2rVhws.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:t}=f(),r=n(t);return r.isPending?(0,j.jsx)(T,{kind:e}):r.isError?(0,j.jsx)(E,{tab:`github-item`,error:r.error}):(0,j.jsx)(P,{run:r.data,kind:e})}function P({run:e,kind:t}){let{n}=f(),r=Number(n),o=a(),s=l(),u=c(),d=s.isPending||u.isPending,m=p(e,o).some(e=>e.kind===t&&e.number===r),h=i(t,r,m);return(0,j.jsxs)(C,{route:`task-github-item`,density:m?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:r}}),m?(0,j.jsx)(H,{run:e,kind:t,number:r,repoBase:o,item:h}):d?(0,j.jsx)(T,{kind:t,number:r,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(D,{size:16}),tone:`neutral`,heading:`h2`,title:`#${n} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:n}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(r.githubItem(t,n)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=m(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,j.jsxs)(j.Fragment,{children:[s,l&&t(l)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let a=d(),c=s({mutationFn:e=>u(t,n,{refresh:!0}),onSuccess:(e,t)=>a.setQueryData(t,e)}),l=F(t,i),f=o(l?[n]:[],l),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(T,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(k,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};