@hearsay-tools/squawk 0.19.0-dev.8959 → 0.19.0-dev.8965

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 (99) hide show
  1. package/dist/contract/index.js +4 -1
  2. package/dist/contract/repo.d.ts +2 -0
  3. package/dist/delegation/routes.d.ts +65 -65
  4. package/dist/features/automations/automations-routes.d.ts +150 -150
  5. package/dist/server/git-changes.d.ts +5 -0
  6. package/dist/server/git-changes.js +17 -1
  7. package/dist/server/git-changes.js.map +1 -1
  8. package/dist/server/models-routes.d.ts +12 -12
  9. package/dist/server/project-settings-routes.d.ts +107 -107
  10. package/dist/server/projects-routes.d.ts +45 -45
  11. package/dist/server/provider-sign-in-routes.d.ts +2 -2
  12. package/dist/server/reports-api.d.ts +2 -2
  13. package/dist/server/runners-routes.d.ts +10 -10
  14. package/dist/server/runs-routes.d.ts +23 -22
  15. package/dist/server/server.d.ts +1210 -1208
  16. package/package.json +4 -4
  17. package/web/dist/assets/accounts-section-Db5lzinF.js +1 -0
  18. package/web/dist/assets/{activity-motion-CNZbrIKs.js → activity-motion-DP9A-iJP.js} +1 -1
  19. package/web/dist/assets/{activity-route-HjCeTGFh.js → activity-route-CSVZG1Yk.js} +1 -1
  20. package/web/dist/assets/{agent-config-section-D3ASkT9C.js → agent-config-section-BWpBfi7r.js} +1 -1
  21. package/web/dist/assets/{agent-defaults-section-B9ooGC8t.js → agent-defaults-section-B7oMQzUO.js} +1 -1
  22. package/web/dist/assets/{appearance-OFbvt85o.js → appearance-DYSwuTmE.js} +1 -1
  23. package/web/dist/assets/{archive-on-merge-field-BvtuaspW.js → archive-on-merge-field-Cuw5IABu.js} +1 -1
  24. package/web/dist/assets/attention-C9zoC-gL.js +1 -0
  25. package/web/dist/assets/{automations-route-C6uMU-W3.js → automations-route-BgdxYmqh.js} +2 -2
  26. package/web/dist/assets/{commit-list-Dg-dPG_J.js → commit-list-D-eUAETe.js} +1 -1
  27. package/web/dist/assets/{diff-2NATw62W.js → diff-BFrqQZmo.js} +2 -2
  28. package/web/dist/assets/{diff-controls-DkJTGyU5.js → diff-controls-x4n0YQLg.js} +1 -1
  29. package/web/dist/assets/{diff-view-CW-GN8t7.js → diff-view-BUofv-IL.js} +1 -1
  30. package/web/dist/assets/discard-changes-dialog-CO98KAfo.js +1 -0
  31. package/web/dist/assets/{file-preview-BJ6Q-VPN.js → file-preview-lIaIJUZK.js} +1 -1
  32. package/web/dist/assets/{folder-browser-BSGB9hhQ.js → folder-browser-DiQGbqCN.js} +1 -1
  33. package/web/dist/assets/git-toolbar-BlwZtWla.js +1 -0
  34. package/web/dist/assets/github-Dc3nfijN.js +1 -0
  35. package/web/dist/assets/{global-activity-route-CoxiPpqk.js → global-activity-route-9kNmmkcm.js} +1 -1
  36. package/web/dist/assets/{index-MCtGGYNa.js → index-CwaCfhQn.js} +7 -7
  37. package/web/dist/assets/index-j7fiJmmF.css +1 -0
  38. package/web/dist/assets/{label-CV8tuTOO.js → label-B1zf-eXb.js} +1 -1
  39. package/web/dist/assets/{markdown-Vws-ZDQC.js → markdown-CdlTRkrR.js} +1 -1
  40. package/web/dist/assets/middle-truncated-name-TQxp8NxE.js +1 -0
  41. package/web/dist/assets/{open-in-menu-BTa2aBQh.js → open-in-menu-DfTnT8YF.js} +1 -1
  42. package/web/dist/assets/{option-select-C7M2fzIw.js → option-select-CpZhQQ4x.js} +1 -1
  43. package/web/dist/assets/{preferences-section-C_T_KjBg.js → preferences-section-BNZaZoHj.js} +1 -1
  44. package/web/dist/assets/preview-pane-connected-DtjCqQCW.js +3 -0
  45. package/web/dist/assets/{project-location-Db8_ITcg.js → project-location-BkThFjg5.js} +1 -1
  46. package/web/dist/assets/{project-router-BHFXTx5l.js → project-router-onKnSy5a.js} +1 -1
  47. package/web/dist/assets/{projects-section-CFTrO5BI.js → projects-section-BdK2iGn2.js} +1 -1
  48. package/web/dist/assets/{prompt-templates-section-DtlXhJiK.js → prompt-templates-section-K8tGcjHO.js} +2 -2
  49. package/web/dist/assets/{queries-CIeJg62Y.js → queries-CII6fTHH.js} +1 -1
  50. package/web/dist/assets/{reference-chip-Br0H2srF.js → reference-chip-Cv3i1kxz.js} +1 -1
  51. package/web/dist/assets/{remote-settings-notice-BVvV6edA.js → remote-settings-notice-BjVD9Tpd.js} +1 -1
  52. package/web/dist/assets/repo-git-83M_eSW4.js +1 -0
  53. package/web/dist/assets/{report-reader-c0AG1n4k.js → report-reader-C9faqNxp.js} +1 -1
  54. package/web/dist/assets/{report-selection-dYsm1HEf.js → report-selection-CmEfaDz7.js} +1 -1
  55. package/web/dist/assets/{reports-BTVWwMou.js → reports-_MEq44e-.js} +1 -1
  56. package/web/dist/assets/{resources-section-BmLG8Lm0.js → resources-section-B9AnYDT1.js} +1 -1
  57. package/web/dist/assets/{review-panel-B1Mt1hrO.js → review-panel-QkkXnNl6.js} +4 -4
  58. package/web/dist/assets/{run-detail-refresh-DTnwaDy2.js → run-detail-refresh-Caj4BPPd.js} +1 -1
  59. package/web/dist/assets/run-header-C6-a8K7X.js +2 -0
  60. package/web/dist/assets/{select-dpKLmgZ_.js → select-BG2mryTI.js} +1 -1
  61. package/web/dist/assets/{session-context-section-CXb8kIYJ.js → session-context-section-DoPTAAaF.js} +2 -2
  62. package/web/dist/assets/{settings-agent-picker-NGLgXFte.js → settings-agent-picker-PVoldhz2.js} +1 -1
  63. package/web/dist/assets/{settings-save-bar-CfUNcwW4.js → settings-save-bar-DrJyUlGR.js} +1 -1
  64. package/web/dist/assets/{settings-shell-Dcv1oVB4.js → settings-shell-C-eZ0DiM.js} +1 -1
  65. package/web/dist/assets/{sidebar-section-BeXW9JPy.js → sidebar-section-iVSpyRZ0.js} +1 -1
  66. package/web/dist/assets/{skills-BcCvvz3d.js → skills-Cvskb0Fk.js} +1 -1
  67. package/web/dist/assets/{tab-link-BYYXdpLn.js → tab-link-B2k-zaeP.js} +1 -1
  68. package/web/dist/assets/task-changes-gGRvQ3NB.js +1 -0
  69. package/web/dist/assets/{task-commits-CgjVHKLR.js → task-commits-DGPH3gFX.js} +1 -1
  70. package/web/dist/assets/{task-file-scope-CPI1TQ21.js → task-file-scope-Z2smLv09.js} +1 -1
  71. package/web/dist/assets/task-files-905jN7TA.js +1 -0
  72. package/web/dist/assets/{task-github-item-Bybg0bs5.js → task-github-item-xrfEri2x.js} +1 -1
  73. package/web/dist/assets/{task-groups-C9pTQm-2.js → task-groups-dEzH1nMg.js} +1 -1
  74. package/web/dist/assets/{task-thread-CIl3Uj6Y.js → task-thread-Dsm-48-n.js} +2 -2
  75. package/web/dist/assets/{tasks-table-CvZ2ZyCa.js → tasks-table-CPAY1N-E.js} +1 -1
  76. package/web/dist/assets/thread-state-CrCMnkHo.js +4 -0
  77. package/web/dist/assets/{toaster-D0HMoto5.js → toaster-Bs1mVYf9.js} +1 -1
  78. package/web/dist/assets/use-hand-to-agent-state-D2mTcKQq.js +1 -0
  79. package/web/dist/assets/use-path-bases-DIMmnJTH.js +1 -0
  80. package/web/dist/assets/use-workspace-config-save-0Mtdwfrd.js +1 -0
  81. package/web/dist/assets/{workflows-aqvasP6w.js → workflows-BM4nrPVB.js} +3 -3
  82. package/web/dist/assets/{workspace-tools-BwjfFjb2.js → workspace-tools-DHMaUd94.js} +1 -1
  83. package/web/dist/assets/{worktrees-section-BcuizqIq.js → worktrees-section-VBLWYgdm.js} +1 -1
  84. package/web/dist/index.html +14 -14
  85. package/web/dist/assets/accounts-section-Iuso5EHy.js +0 -1
  86. package/web/dist/assets/attention-V1gJ7gKo.js +0 -1
  87. package/web/dist/assets/discard-changes-dialog-BXfDdnph.js +0 -1
  88. package/web/dist/assets/git-toolbar-C68CnIDL.js +0 -1
  89. package/web/dist/assets/github-Dqk0cII6.js +0 -1
  90. package/web/dist/assets/index-CM_iAvs4.css +0 -1
  91. package/web/dist/assets/preview-pane-connected-CXUd2utJ.js +0 -3
  92. package/web/dist/assets/repo-git-ymL5_ed2.js +0 -1
  93. package/web/dist/assets/run-header-DyEbB88q.js +0 -2
  94. package/web/dist/assets/task-changes-Bj7JpmR_.js +0 -1
  95. package/web/dist/assets/task-files-nBsD7Mvo.js +0 -1
  96. package/web/dist/assets/thread-state-DQUYVbcr.js +0 -4
  97. package/web/dist/assets/use-hand-to-agent-state-CUDqVWwY.js +0 -1
  98. package/web/dist/assets/use-path-bases-BbEKGJNh.js +0 -1
  99. package/web/dist/assets/use-workspace-config-save-bZksgjRK.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{It as t}from"./queries-CIeJg62Y.js";import{n}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{A as r}from"./design-icons-QbNMZniQ.js";import{t as i}from"./switch-CAKeV99j.js";import{t as a}from"./centered-state-BgSV4e79.js";import{t as o}from"./option-select-C7M2fzIw.js";import{n as s}from"./save-cue-CpHgT93o.js";import{n as c,t as l}from"./settings-field-Bhh8I9fJ.js";import{t as u}from"./use-workspace-config-save-bZksgjRK.js";import{r as d}from"./settings-save-bar-CfUNcwW4.js";import{n as f}from"./saved-draft-BwzBc-_Y.js";var p=e(),m=1,h=16,g=16,_=1,v=60,y=5,b=256;function x(){let e=t();return e.isPending?(0,p.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,p.jsx)(a,{icon:(0,p.jsx)(r,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,p.jsx)(S,{config:e.data})}function S({config:e}){let t=u(),n=s(),r=s(),a=s(),o=s(),l=s(),m=(e,n)=>t.mutate(e,{onSuccess:n}),h=e.resources.monitoringWakeIntervalMinutes??null,g=h===null?`park`:`interval`,[x,S]=f(String(h??y)),D=Number(x),O=!Number.isInteger(D)||D<_||D>v,k=g===`interval`&&O,j=e=>m({resources:{monitoringWakeIntervalMinutes:e===`park`?null:y}},()=>{S(String(y)),a.flash()});d({dirty:h!==null&&x!==String(h),invalid:O,busy:t.isPending,save:()=>t.mutateAsync({resources:{monitoringWakeIntervalMinutes:D}}),discard:()=>S(String(h??y))});let M=e.resources.autoResumeOnUsageLimit??!0,N=e=>m({resources:{autoResumeOnUsageLimit:e}},o.flash),P=e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``,[F,I]=f(P),L=F.trim()===``?0:Number(F),R=F.trim()!==``&&(!Number.isInteger(L)||L<b);d({dirty:(e.resources.memoryLimitMb??0)!==(R?-1:L),invalid:R,busy:t.isPending,save:()=>t.mutateAsync({resources:{memoryLimitMb:L===0?null:L}}),discard:()=>I(P)});let z=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,p.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,p.jsx)(C,{maxParallel:e.resources.maxParallel,onSelect:e=>m({resources:{maxParallel:e}},n.flash),disabled:t.isPending,saved:n.saved}),(0,p.jsx)(w,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>m({resources:{maxMonitoringSessions:e}},r.flash),disabled:t.isPending,saved:r.saved}),(0,p.jsx)(T,{wakeMode:g,setWakeMode:j,wakeInterval:x,setWakeInterval:S,showInvalid:k,saved:a.saved,saveIsPending:t.isPending}),(0,p.jsx)(c,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,saved:o.saved,children:(0,p.jsx)(i,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:t.isPending,onCheckedChange:N})}),(0,p.jsx)(E,{memory:F,setMemory:I,memoryInvalid:R,saveIsPending:t.isPending}),(0,p.jsx)(A,{composerDefaults:z,saveComposerDefault:(e,t)=>m({composerDefaults:{[e]:t===`inherit`?null:t===`on`}},l.flash),saveIsPending:t.isPending,saved:l.saved})]})}function C({maxParallel:e,onSelect:t,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:r,onValueChange:e=>t(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(m,h)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,p.jsx)(n,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function w({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onValueChange:e=>n(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(0,g)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function T({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:a,saved:o,saveIsPending:s}){return(0,p.jsxs)(c,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,saved:o,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(i,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${l}`,children:`Wake interval`}),(0,p.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:_,max:v,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null]}),a?(0,p.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function E({memory:e,setMemory:t,memoryInvalid:n,saveIsPending:r}){return(0,p.jsxs)(c,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:b,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:r,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`})]}),n?(0,p.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,b,` MiB, or leave empty for no limit.`]}):null]})}var D=[{value:`inherit`,label:`Inherit environment`},{value:`on`,label:`On`},{value:`off`,label:`Off`}];function O(e,t){return Array.from({length:t-e+1},(t,n)=>({value:String(e+n),label:String(e+n)}))}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n,saved:r}){return(0,p.jsxs)(c,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,saved:r,children:[(0,p.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Autonomous by default`}),(0,p.jsx)(o,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onValueChange:e=>t(`autonomous`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Use a worktree by default`}),(0,p.jsx)(o,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onValueChange:e=>t(`worktree`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{x as ResourcesSection};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{It as t}from"./queries-CII6fTHH.js";import{n}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{A as r}from"./design-icons-QbNMZniQ.js";import{t as i}from"./switch-CAKeV99j.js";import{t as a}from"./centered-state-BgSV4e79.js";import{t as o}from"./option-select-CpZhQQ4x.js";import{n as s}from"./save-cue-CpHgT93o.js";import{n as c,t as l}from"./settings-field-Bhh8I9fJ.js";import{t as u}from"./use-workspace-config-save-0Mtdwfrd.js";import{r as d}from"./settings-save-bar-DrJyUlGR.js";import{n as f}from"./saved-draft-BwzBc-_Y.js";var p=e(),m=1,h=16,g=16,_=1,v=60,y=5,b=256;function x(){let e=t();return e.isPending?(0,p.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,p.jsx)(a,{icon:(0,p.jsx)(r,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,p.jsx)(S,{config:e.data})}function S({config:e}){let t=u(),n=s(),r=s(),a=s(),o=s(),l=s(),m=(e,n)=>t.mutate(e,{onSuccess:n}),h=e.resources.monitoringWakeIntervalMinutes??null,g=h===null?`park`:`interval`,[x,S]=f(String(h??y)),D=Number(x),O=!Number.isInteger(D)||D<_||D>v,k=g===`interval`&&O,j=e=>m({resources:{monitoringWakeIntervalMinutes:e===`park`?null:y}},()=>{S(String(y)),a.flash()});d({dirty:h!==null&&x!==String(h),invalid:O,busy:t.isPending,save:()=>t.mutateAsync({resources:{monitoringWakeIntervalMinutes:D}}),discard:()=>S(String(h??y))});let M=e.resources.autoResumeOnUsageLimit??!0,N=e=>m({resources:{autoResumeOnUsageLimit:e}},o.flash),P=e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``,[F,I]=f(P),L=F.trim()===``?0:Number(F),R=F.trim()!==``&&(!Number.isInteger(L)||L<b);d({dirty:(e.resources.memoryLimitMb??0)!==(R?-1:L),invalid:R,busy:t.isPending,save:()=>t.mutateAsync({resources:{memoryLimitMb:L===0?null:L}}),discard:()=>I(P)});let z=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,p.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,p.jsx)(C,{maxParallel:e.resources.maxParallel,onSelect:e=>m({resources:{maxParallel:e}},n.flash),disabled:t.isPending,saved:n.saved}),(0,p.jsx)(w,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>m({resources:{maxMonitoringSessions:e}},r.flash),disabled:t.isPending,saved:r.saved}),(0,p.jsx)(T,{wakeMode:g,setWakeMode:j,wakeInterval:x,setWakeInterval:S,showInvalid:k,saved:a.saved,saveIsPending:t.isPending}),(0,p.jsx)(c,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,saved:o.saved,children:(0,p.jsx)(i,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:t.isPending,onCheckedChange:N})}),(0,p.jsx)(E,{memory:F,setMemory:I,memoryInvalid:R,saveIsPending:t.isPending}),(0,p.jsx)(A,{composerDefaults:z,saveComposerDefault:(e,t)=>m({composerDefaults:{[e]:t===`inherit`?null:t===`on`}},l.flash),saveIsPending:t.isPending,saved:l.saved})]})}function C({maxParallel:e,onSelect:t,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:r,onValueChange:e=>t(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(m,h)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,p.jsx)(n,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function w({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onValueChange:e=>n(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(0,g)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function T({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:a,saved:o,saveIsPending:s}){return(0,p.jsxs)(c,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,saved:o,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(i,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${l}`,children:`Wake interval`}),(0,p.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:_,max:v,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null]}),a?(0,p.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function E({memory:e,setMemory:t,memoryInvalid:n,saveIsPending:r}){return(0,p.jsxs)(c,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:b,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:r,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`})]}),n?(0,p.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,b,` MiB, or leave empty for no limit.`]}):null]})}var D=[{value:`inherit`,label:`Inherit environment`},{value:`on`,label:`On`},{value:`off`,label:`Off`}];function O(e,t){return Array.from({length:t-e+1},(t,n)=>({value:String(e+n),label:String(e+n)}))}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n,saved:r}){return(0,p.jsxs)(c,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,saved:r,children:[(0,p.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Autonomous by default`}),(0,p.jsx)(o,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onValueChange:e=>t(`autonomous`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Use a worktree by default`}),(0,p.jsx)(o,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onValueChange:e=>t(`worktree`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{x as ResourcesSection};
@@ -1,11 +1,11 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{m as r,o as i,s as a}from"./dist-C_rn70hE.js";import{$ as o,$t as s,Ct as c,P as l,Wt as u,Xt as d,Yt as f,_ as p,dn as m,lt as h,rn as g,un as _}from"./queries-CIeJg62Y.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as C,pt as w,rr as T}from"./toaster-D0HMoto5.js";import{f as E,n as D,p as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{I as te,J as O,Q as k,V as A,c as ne,d as j,l as M,mt as re,pt as ie,st as ae,y as oe}from"./design-icons-QbNMZniQ.js";import{t as N}from"./createLucideIcon-BHp8sXmF.js";import{t as se}from"./check-OP-CVgZG.js";import{t as ce}from"./chevron-right-BENZ-1ZN.js";import{t as le}from"./external-link-BE6y205O.js";import{t as ue}from"./eye-B8okNWXU.js";import{n as de}from"./smartphone-Lr8Ug2z_.js";import{t as fe}from"./loader-circle-CPBhhDbB.js";import{t as pe}from"./message-square-B-MD-8rD.js";import{n as me,t as he}from"./tool-display-B9NN44oU.js";import{t as ge}from"./square-terminal-B6RYYieR.js";import{t as P}from"./button-C8jUIs8Q.js";import{n as F,r as I,t as L}from"./collapsible-Bx2vViFx.js";import{t as R}from"./project-router-BHFXTx5l.js";import{O as _e}from"./task-groups-C9pTQm-2.js";import{a as ve,c as ye,i as be,l as xe,o as Se,s as Ce,t as we}from"./report-selection-dYsm1HEf.js";import{n as Te}from"./centered-state-BgSV4e79.js";import{L as Ee,Q as De,an as Oe,ar as ke,fn as Ae,gn as je,gr as Me,hn as Ne,rn as Pe,tn as Fe,ur as z,xn as Ie}from"./index-MCtGGYNa.js";import{i as Le,r as Re}from"./highlighter-Cfo7mLVB.js";import{t as ze}from"./zoomable-image-BUTgYpld.js";import{i as Be,r as Ve,t as B}from"./markdown-Vws-ZDQC.js";import{r as He}from"./html-report-BX3msvci.js";import{t as V}from"./textarea-vEsJAUAV.js";import{t as Ue}from"./task-file-scope-CPI1TQ21.js";import{t as We}from"./report-title-D4Mbu2Er.js";var Ge=N(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Ke=N(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),qe=N(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Je=N(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ye=N(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Xe=N(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),H=e(t(),1),U=n();function Ze(e,t){if(e.length===1)return[t.replace(RegExp(`^${Qe(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $e(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var et=`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{m as r,o as i,s as a}from"./dist-C_rn70hE.js";import{$ as o,$t as s,Ct as c,P as l,Wt as u,Xt as d,Yt as f,_ as p,dn as m,lt as h,rn as g,un as _}from"./queries-CII6fTHH.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as C,pt as w,rr as T}from"./toaster-Bs1mVYf9.js";import{f as E,n as D,p as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{I as te,J as O,Q as k,V as A,c as ne,d as j,l as M,mt as re,pt as ie,st as ae,y as oe}from"./design-icons-QbNMZniQ.js";import{t as N}from"./createLucideIcon-BHp8sXmF.js";import{t as se}from"./check-OP-CVgZG.js";import{t as ce}from"./chevron-right-BENZ-1ZN.js";import{t as le}from"./external-link-BE6y205O.js";import{t as ue}from"./eye-B8okNWXU.js";import{n as de}from"./smartphone-Lr8Ug2z_.js";import{t as fe}from"./loader-circle-CPBhhDbB.js";import{t as pe}from"./message-square-B-MD-8rD.js";import{n as me,t as he}from"./tool-display-B9NN44oU.js";import{t as ge}from"./square-terminal-B6RYYieR.js";import{t as P}from"./button-C8jUIs8Q.js";import{n as F,r as I,t as L}from"./collapsible-Bx2vViFx.js";import{t as R}from"./project-router-onKnSy5a.js";import{O as _e}from"./task-groups-dEzH1nMg.js";import{a as ve,c as ye,i as be,l as xe,o as Se,s as Ce,t as we}from"./report-selection-CmEfaDz7.js";import{n as Te}from"./centered-state-BgSV4e79.js";import{Cn as Ee,L as De,Q as Oe,_n as ke,an as Ae,fr as z,mn as je,rn as Me,sn as Ne,sr as Pe,vn as Fe,vr as Ie}from"./index-CwaCfhQn.js";import{i as Le,r as Re}from"./highlighter-Cfo7mLVB.js";import{t as ze}from"./zoomable-image-BUTgYpld.js";import{i as Be,r as Ve,t as B}from"./markdown-CdlTRkrR.js";import{r as He}from"./html-report-BX3msvci.js";import{t as V}from"./textarea-vEsJAUAV.js";import{t as Ue}from"./task-file-scope-Z2smLv09.js";import{t as We}from"./report-title-D4Mbu2Er.js";var Ge=N(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Ke=N(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),qe=N(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Je=N(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ye=N(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Xe=N(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),H=e(t(),1),U=n();function Ze(e,t){if(e.length===1)return[t.replace(RegExp(`^${Qe(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $e(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var et=`
2
2
 
3
3
  Additional comments:
4
- `;function tt(e){let t=e.indexOf(et);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function nt({ask:e}){let t=e.answer===void 0?void 0:tt(e.answer),n=t===void 0?void 0:Ze(e.questions,t.body);return(0,U.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=$e(t,i),o=i!==void 0&&a.length===0;return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,U.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,U.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,U.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,U.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,U.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,U.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,U.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,U.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,U.jsx)(W,{text:i}):null]})]}):i===void 0?null:(0,U.jsx)(W,{text:i})]},t.id??r)}),n&&t?.comment?(0,U.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,U.jsx)(W,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,U.jsx)(W,{text:e.answer}):null]})}function W({text:e}){return(0,U.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function G(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function rt(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function it({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,U.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,U.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:a}):null,(0,U.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,U.jsxs)(P,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,U.jsx)(z,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,U.jsx)(dt,{onShowOrigin:l}):null,r?(0,U.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,U.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,U.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function at({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,U.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,a)=>{let s=t===a,c=G(a,n,r);return(0,U.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,U.jsx)(se,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,U.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,U.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:a?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(Ye,{"aria-hidden":`true`,className:`size-3`}),(0,U.jsx)(`span`,{children:`Comment`})]})]})}function ot({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,H.useId)();return(0,U.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,U.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,U.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,U.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=G(r,t,n);return(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,U.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:rt(r,t,n)})]},e.id??r)})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,U.jsx)(V,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function st({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,H.useId)();return r?(0,U.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,U.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,U.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,U.jsx)(V,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function ct({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,U.jsxs)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,U.jsx)(Me,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,U.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,a=G(n,p,m);return(0,U.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,U.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,U.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,U.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,U.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,U.jsxs)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:l,children:[`Next`,(0,U.jsx)(ce,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:s||!r,onClick:d,children:v}):null]})]})}function lt({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,U.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 min-w-11 px-2 text-xs text-muted-foreground hover:text-foreground md:min-h-8 md:min-w-0`,onClick:s,children:[(0,U.jsx)(Ye,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,U.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,U.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function ut({blockedBy:e,reason:t,error:n}){return(0,U.jsxs)(U.Fragment,{children:[t?(0,U.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function dt({onShowOrigin:e,className:t}){return(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,t),children:`Show where it was asked`})}function ft({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,H.useRef)(!1);return(0,U.jsx)(be,{open:e,onOpenChange:t,children:(0,U.jsxs)(Se,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,U.jsxs)(ye,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,U.jsx)(xe,{children:`Question context`}),(0,U.jsx)(Ce,{children:`Your selections and drafts stay intact while you read.`}),(0,U.jsx)(ve,{asChild:!0,children:(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2 size-11 md:size-9`,children:(0,U.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,U.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,U.jsx)(Ue,{runId:n,children:(0,U.jsx)(B,{breaks:!0,children:r})})}),i?(0,U.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,className:`min-h-11 md:min-h-8`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function pt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mt=/^[A-Za-z0-9_./:=+,@%-]+$/;function ht(e){return e.replaceAll(`'`,`'\\''`)}function gt(e){return e===``?`''`:mt.test(e)?e:`\u0027${ht(e)}\u0027`}function _t(e){if(!pt(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(gt).join(` `)}}function vt(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function yt(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function bt(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function K(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function xt(e){let t=vt(yt(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))K(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){K(e[2])&&i.push({label:bt(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:bt(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&K(t)&&i.push({label:t,href:t})}return i}var St=(0,H.createContext)(void 0),Ct=(0,H.createContext)(void 0);function wt(e,t){let n=new Map;for(let r of xt(e)){let e=Be(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Tt(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Et({text:e,messageKey:t}){let n=(0,H.useContext)(Ve),r=(0,H.useContext)(Ct),i=t??r;if(!n||i===void 0)return null;let a=wt(e,n);return a.length===0?null:(0,U.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,U.jsx)(Dt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Dt({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,H.useContext)(St),s=(0,H.useContext)(we);(0,H.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=l(r,n),u=E(),d=ee();if(c.isError)return(0,U.jsx)(D,{id:Tt(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=c.data?.artifact;if(f&&!He(f.name))return null;let p=new URLSearchParams(u.search);p.set(`report`,n),p.set(`card`,t);let m=new URLSearchParams(u.search).has(`report`)?u.state:null,h=new URLSearchParams(u.search);h.delete(`report`),h.delete(`card`);let g=`${u.pathname}${h.size?`?${h}`:``}`,_=window.navigation,v={reportCardEntry:!0,reportReturnTo:m?.reportReturnTo??g,reportReturnKey:m?.reportReturnKey??_?.currentEntry?.key,reportScrollTop:m?.reportScrollTop},y={pathname:u.pathname,search:`?${p}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,U.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,U.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?We(f):i}),(0,U.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,U.jsx)(D,{id:Tt(t,n),to:y,state:v,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=v.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;d(y,{state:{...v,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Ot={message:!0,reasoning:!0,tool:!0,hook:!0};function kt(e){return Object.hasOwn(Ot,e)&&Ot[e]}var At=e=>e.kind===`tool`,jt=e=>e.kind===`conversation`,Mt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Nt=(e,t,n)=>`${e} ${e===1?t:n}`;function Pt(e,t){let n=[];return e>0&&n.push(Nt(e,`file`,`files`)),t>0&&n.push(Nt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Ft(e){return`${e} earlier tool call${e===1?``:`s`}`}var It=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Lt(e){for(let t of It)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var Rt=new WeakMap;function zt(e){let t=Rt.get(e);if(t)return t;let n=Bt(e);return Rt.set(e,n),n}function Bt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(At).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=kt(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Pt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of Vt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(jt(e)){s(),c.push(e);continue}l(),At(e)&&Mt(e)&&!r.has(e.id)?o.push(e):(s(),At(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function Vt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var Ht=new Map,Ut=(0,H.createContext)(null);function Wt(){return(0,H.useContext)(Ut)}function Gt({runId:e,children:t}){let n=(0,H.useMemo)(()=>({get:t=>Ht.get(e)?.get(t),set:(t,n)=>{let r=Ht.get(e)??new Map;r.set(t,n),Ht.set(e,r)}}),[e]);return(0,U.jsx)(Ut.Provider,{value:n,children:t})}function Kt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function qt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Jt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Yt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Xt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Zt=new Map;function Qt(e,t){Zt.set(e,t)}function $t(e){return Zt.get(e)}var en=new Map;function tn(e,t){en.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function nn(e){return en.get(e)}function rn(e,t,n){let r=en.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var an=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),on=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),sn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),cn=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),ln=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function q(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function J(e){let t=q(e);return t===void 0?void 0:an.format(t)}function un(e){let t=q(e);return t===void 0?void 0:on.format(t)}var Y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function dn(e){let t=q(e);return t===void 0?void 0:Y(t)}function fn(e,t=new Date){let n=q(e);if(n===void 0)return;let r=Y(n);return r===Y(t)?`Today`:r===Y(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?sn:cn).format(n)}function pn(e,t){let n=q(e),r=q(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function mn({ts:e}){let t=J(e);return t===void 0?null:(0,U.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:un(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function hn({startedAt:e,completedAt:t}){let n=J(t);if(n===void 0)return null;let r=pn(e,t);return(0,U.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,U.jsx)(`time`,{dateTime:t,title:un(t),children:n}),r===void 0?null:(0,U.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function gn({ts:e}){let t=fn(e),n=q(e);if(t===void 0||n===void 0)return null;let r=ln.format(n);return(0,U.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,U.jsx)(`time`,{dateTime:dn(e),title:r,children:t}),(0,U.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var _n={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function vn({note:e}){return e.icon===`handoff`?(0,U.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,U.jsx)(ke,{className:`size-3`})}),(0,U.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,U.jsxs)(L,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,U.jsxs)(I,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,U.jsx)(j,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,U.jsx)(F,{children:(0,U.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,U.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,U.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[_n[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,U.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var yn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function X({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=yn[e],c=r===void 0?void 0:J(r);return(0,U.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,U.jsxs)(`p`,{className:i(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,U.jsx)(pe,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,U.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,U.jsx)(mn,{ts:r})})]}),(0,U.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var bn=[],xn=(0,H.memo)(function({text:e,imageCount:t=0,images:n=bn,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(e),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(),y=()=>{m(e),v(void 0),f(!0)},x=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,U.jsxs)(X,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,U.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,U.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,U.jsx)(fe,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,U.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,U.jsxs)(X,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,U.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,U.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(Xe,{className:`size-3.5`})}):null,o?(0,U.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(ae,{className:`size-3.5`})}):null]}):null,_?(0,U.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,U.jsx)(B,{breaks:!0,children:e}),n.length>0?(0,U.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>b(e.split(`/`).pop()??``)?(0,U.jsx)(ze,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,U.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,U.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),Sn=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Cn=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function wn(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Cn).forEach(e=>e.remove());let r=xt(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!K(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Tn(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=wn(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var En=(0,H.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,H.useRef)(null),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),c=(0,H.useRef)(null);(0,H.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Tn(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,U.jsxs)(X,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,U.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Sn,children:[(0,U.jsx)(oe,{className:`size-3.5`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Sn,children:[(0,U.jsx)(z,{className:`size-3.5`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,U.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,U.jsx)(`div`,{ref:r,children:(0,U.jsx)(B,{breaks:!0,children:e})}),(0,U.jsx)(Et,{text:e,messageKey:n})]})});function Dn({incident:e}){let t=g().data;if(!t)return null;let n=d(t,e.provider);return(0,U.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,U.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var On=(0,H.memo)(function({text:e}){let t=(0,H.useId)();if(e.trim()===``)return null;let n=e.split(`
4
+ `;function tt(e){let t=e.indexOf(et);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function nt({ask:e}){let t=e.answer===void 0?void 0:tt(e.answer),n=t===void 0?void 0:Ze(e.questions,t.body);return(0,U.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=$e(t,i),o=i!==void 0&&a.length===0;return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,U.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,U.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,U.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,U.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,U.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,U.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,U.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,U.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,U.jsx)(W,{text:i}):null]})]}):i===void 0?null:(0,U.jsx)(W,{text:i})]},t.id??r)}),n&&t?.comment?(0,U.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,U.jsx)(W,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,U.jsx)(W,{text:e.answer}):null]})}function W({text:e}){return(0,U.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function G(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function rt(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function it({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,U.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,U.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:a}):null,(0,U.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,U.jsxs)(P,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,U.jsx)(z,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,U.jsx)(dt,{onShowOrigin:l}):null,r?(0,U.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,U.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,U.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function at({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,U.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,a)=>{let s=t===a,c=G(a,n,r);return(0,U.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,U.jsx)(se,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,U.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,U.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:a?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(Ye,{"aria-hidden":`true`,className:`size-3`}),(0,U.jsx)(`span`,{children:`Comment`})]})]})}function ot({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,H.useId)();return(0,U.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,U.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,U.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,U.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=G(r,t,n);return(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,U.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:rt(r,t,n)})]},e.id??r)})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,U.jsx)(V,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function st({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,H.useId)();return r?(0,U.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,U.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,U.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,U.jsx)(V,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function ct({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,U.jsxs)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,U.jsx)(Ie,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,U.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,a=G(n,p,m);return(0,U.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,U.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,U.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,U.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,U.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,U.jsxs)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:l,children:[`Next`,(0,U.jsx)(ce,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:s||!r,onClick:d,children:v}):null]})]})}function lt({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,U.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 min-w-11 px-2 text-xs text-muted-foreground hover:text-foreground md:min-h-8 md:min-w-0`,onClick:s,children:[(0,U.jsx)(Ye,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,U.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,U.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function ut({blockedBy:e,reason:t,error:n}){return(0,U.jsxs)(U.Fragment,{children:[t?(0,U.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function dt({onShowOrigin:e,className:t}){return(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,t),children:`Show where it was asked`})}function ft({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,H.useRef)(!1);return(0,U.jsx)(be,{open:e,onOpenChange:t,children:(0,U.jsxs)(Se,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,U.jsxs)(ye,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,U.jsx)(xe,{children:`Question context`}),(0,U.jsx)(Ce,{children:`Your selections and drafts stay intact while you read.`}),(0,U.jsx)(ve,{asChild:!0,children:(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2 size-11 md:size-9`,children:(0,U.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,U.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,U.jsx)(Ue,{runId:n,children:(0,U.jsx)(B,{breaks:!0,children:r})})}),i?(0,U.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,className:`min-h-11 md:min-h-8`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function pt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mt=/^[A-Za-z0-9_./:=+,@%-]+$/;function ht(e){return e.replaceAll(`'`,`'\\''`)}function gt(e){return e===``?`''`:mt.test(e)?e:`\u0027${ht(e)}\u0027`}function _t(e){if(!pt(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(gt).join(` `)}}function vt(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function yt(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function bt(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function K(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function xt(e){let t=vt(yt(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))K(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){K(e[2])&&i.push({label:bt(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:bt(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&K(t)&&i.push({label:t,href:t})}return i}var St=(0,H.createContext)(void 0),Ct=(0,H.createContext)(void 0);function wt(e,t){let n=new Map;for(let r of xt(e)){let e=Be(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Tt(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Et({text:e,messageKey:t}){let n=(0,H.useContext)(Ve),r=(0,H.useContext)(Ct),i=t??r;if(!n||i===void 0)return null;let a=wt(e,n);return a.length===0?null:(0,U.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,U.jsx)(Dt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Dt({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,H.useContext)(St),s=(0,H.useContext)(we);(0,H.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=l(r,n),u=E(),d=ee();if(c.isError)return(0,U.jsx)(D,{id:Tt(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=c.data?.artifact;if(f&&!He(f.name))return null;let p=new URLSearchParams(u.search);p.set(`report`,n),p.set(`card`,t);let m=new URLSearchParams(u.search).has(`report`)?u.state:null,h=new URLSearchParams(u.search);h.delete(`report`),h.delete(`card`);let g=`${u.pathname}${h.size?`?${h}`:``}`,_=window.navigation,v={reportCardEntry:!0,reportReturnTo:m?.reportReturnTo??g,reportReturnKey:m?.reportReturnKey??_?.currentEntry?.key,reportScrollTop:m?.reportScrollTop},y={pathname:u.pathname,search:`?${p}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,U.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,U.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?We(f):i}),(0,U.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,U.jsx)(D,{id:Tt(t,n),to:y,state:v,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=v.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;d(y,{state:{...v,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Ot={message:!0,reasoning:!0,tool:!0,hook:!0};function kt(e){return Object.hasOwn(Ot,e)&&Ot[e]}var At=e=>e.kind===`tool`,jt=e=>e.kind===`conversation`,Mt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Nt=(e,t,n)=>`${e} ${e===1?t:n}`;function Pt(e,t){let n=[];return e>0&&n.push(Nt(e,`file`,`files`)),t>0&&n.push(Nt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Ft(e){return`${e} earlier tool call${e===1?``:`s`}`}var It=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Lt(e){for(let t of It)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var Rt=new WeakMap;function zt(e){let t=Rt.get(e);if(t)return t;let n=Bt(e);return Rt.set(e,n),n}function Bt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(At).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=kt(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Pt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of Vt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(jt(e)){s(),c.push(e);continue}l(),At(e)&&Mt(e)&&!r.has(e.id)?o.push(e):(s(),At(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function Vt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var Ht=new Map,Ut=(0,H.createContext)(null);function Wt(){return(0,H.useContext)(Ut)}function Gt({runId:e,children:t}){let n=(0,H.useMemo)(()=>({get:t=>Ht.get(e)?.get(t),set:(t,n)=>{let r=Ht.get(e)??new Map;r.set(t,n),Ht.set(e,r)}}),[e]);return(0,U.jsx)(Ut.Provider,{value:n,children:t})}function Kt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function qt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Jt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Yt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Xt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Zt=new Map;function Qt(e,t){Zt.set(e,t)}function $t(e){return Zt.get(e)}var en=new Map;function tn(e,t){en.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function nn(e){return en.get(e)}function rn(e,t,n){let r=en.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var an=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),on=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),sn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),cn=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),ln=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function q(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function J(e){let t=q(e);return t===void 0?void 0:an.format(t)}function un(e){let t=q(e);return t===void 0?void 0:on.format(t)}var Y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function dn(e){let t=q(e);return t===void 0?void 0:Y(t)}function fn(e,t=new Date){let n=q(e);if(n===void 0)return;let r=Y(n);return r===Y(t)?`Today`:r===Y(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?sn:cn).format(n)}function pn(e,t){let n=q(e),r=q(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function mn({ts:e}){let t=J(e);return t===void 0?null:(0,U.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:un(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function hn({startedAt:e,completedAt:t}){let n=J(t);if(n===void 0)return null;let r=pn(e,t);return(0,U.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,U.jsx)(`time`,{dateTime:t,title:un(t),children:n}),r===void 0?null:(0,U.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function gn({ts:e}){let t=fn(e),n=q(e);if(t===void 0||n===void 0)return null;let r=ln.format(n);return(0,U.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,U.jsx)(`time`,{dateTime:dn(e),title:r,children:t}),(0,U.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var _n={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function vn({note:e}){return e.icon===`handoff`?(0,U.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,U.jsx)(Pe,{className:`size-3`})}),(0,U.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,U.jsxs)(L,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,U.jsxs)(I,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,U.jsx)(j,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,U.jsx)(F,{children:(0,U.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,U.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,U.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[_n[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,U.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var yn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function X({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=yn[e],c=r===void 0?void 0:J(r);return(0,U.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,U.jsxs)(`p`,{className:i(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,U.jsx)(pe,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,U.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,U.jsx)(mn,{ts:r})})]}),(0,U.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var bn=[],xn=(0,H.memo)(function({text:e,imageCount:t=0,images:n=bn,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(e),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(),y=()=>{m(e),v(void 0),f(!0)},x=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,U.jsxs)(X,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,U.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,U.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,U.jsx)(fe,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,U.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,U.jsxs)(X,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,U.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,U.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(Xe,{className:`size-3.5`})}):null,o?(0,U.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(ae,{className:`size-3.5`})}):null]}):null,_?(0,U.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,U.jsx)(B,{breaks:!0,children:e}),n.length>0?(0,U.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>b(e.split(`/`).pop()??``)?(0,U.jsx)(ze,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,U.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,U.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),Sn=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Cn=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function wn(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Cn).forEach(e=>e.remove());let r=xt(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!K(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Tn(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=wn(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var En=(0,H.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,H.useRef)(null),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),c=(0,H.useRef)(null);(0,H.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Tn(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,U.jsxs)(X,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,U.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Sn,children:[(0,U.jsx)(oe,{className:`size-3.5`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Sn,children:[(0,U.jsx)(z,{className:`size-3.5`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,U.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,U.jsx)(`div`,{ref:r,children:(0,U.jsx)(B,{breaks:!0,children:e})}),(0,U.jsx)(Et,{text:e,messageKey:n})]})});function Dn({incident:e}){let t=g().data;if(!t)return null;let n=d(t,e.provider);return(0,U.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,U.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var On=(0,H.memo)(function({text:e}){let t=(0,H.useId)();if(e.trim()===``)return null;let n=e.split(`
5
5
  `,1)[0]??``,r=n.length<e.length;return(0,U.jsxs)(L,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,U.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,U.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,U.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,U.jsx)(B,{inline:!0,children:n})}),r?(0,U.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,U.jsx)(I,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,U.jsx)(F,{children:(0,U.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,U.jsx)(B,{children:e})})})]})});function kn(){return(0,U.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,U.jsx)(fe,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,U.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var An={read:z,edit:Xe,delete:ae,move:Je,search:k,execute:ge,think:Ke,fetch:de,task:ne,plan:A,other:ie},jn=e=>e.split(`
6
6
  `).length;function Mn({text:e,streaming:t}){let[n,r]=(0,H.useState)(!1),a=(0,H.useRef)(null),o=(0,H.useRef)(!0);(0,H.useEffect)(()=>{let e=a.current;t&&e&&o.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=jn(e),c=!t&&!n&&s>12;return(0,U.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`div`,{ref:a,onScroll:t?e=>{o.current=Yt(e.currentTarget)}:void 0,className:i(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,U.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,U.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&s>12?(0,U.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${s} lines`}):null]})}function Nn({diffs:e}){return(0,U.jsx)(U.Fragment,{children:e.map((e,t)=>(0,U.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-xs wrap-anywhere text-muted-foreground`,children:e.path}),(0,U.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Pn(e.oldText).map((e,t)=>(0,U.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Pn(e.newText).map((e,t)=>(0,U.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
7
7
  `).map((e,t)=>(0,U.jsx)(Fn,{text:e},t))})]},`${e.path}:${t}`))})}function Pn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
8
8
  `)}function Fn({text:e}){return(0,U.jsx)(`span`,{className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function In(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Ln(e){let t=e.status===`running`||e.status===`pending`,n=Lt(e.title),{verb:r,detail:i}=e.toolKind===`execute`&&n.detail===void 0?{verb:`Ran`,detail:e.title}:n;return{busy:t,verb:r,detail:i,expandedCommand:(e.toolKind===`execute`?_t(e.input):me(e.name).toolKind===e.toolKind?he(e.name,e.input):void 0)??i,Icon:An[e.toolKind]??ie}}function Rn(e,t){return e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t>0}function zn({item:e,busy:t}){return(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,U.jsx)(fe,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,U.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,U.jsx)(`span`,{"data-slot":`tool-exit`,className:i(`rounded-full px-2 py-px font-mono text-xs font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})}function Bn({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,U.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,U.jsx)(`pre`,{"data-slot":`tool-command`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:t}),e.error!==void 0&&e.error!==``?(0,U.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap wrap-anywhere text-signal-word-red`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,U.jsx)(Nn,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,U.jsx)(Mn,{text:e.output,streaming:n}):null,r.length>0?(0,U.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:a?.(r,i??e.id)}):null]})}function Vn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let a=Wt(),[o,s]=(0,H.useState)(()=>n===void 0?null:a?.get(n)??null),c=e=>{n!==void 0&&a?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=Ln(e),m=Rn(e,t.length),h=f!==void 0||m,g=h&&(o??(m&&In(e)));return(0,U.jsxs)(L,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:g,onOpenChange:c,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,U.jsxs)(I,{disabled:!h,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:i(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,U.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:i(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,U.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,U.jsx)(zn,{item:e,busy:l})]}),(0,U.jsx)(F,{children:(0,U.jsx)(Bn,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function Hn(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function Un({item:e,cacheKey:t}){let n=Wt(),[r,a]=(0,H.useState)(()=>t===void 0?!1:n?.get(t)??!1),o=e=>{t!==void 0&&n?.set(t,e),a(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=Hn(e);return(0,U.jsxs)(L,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:o,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,U.jsxs)(I,{className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] hover:bg-muted`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,U.jsx)(Ge,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,U.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,U.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,U.jsx)(`span`,{"data-slot":`hook-exit`,className:`rounded-full bg-danger/10 px-2 py-px font-mono text-xs font-semibold text-danger`,children:e.exitCode}):null]})]}),(0,U.jsx)(F,{children:(0,U.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,U.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:i(`px-3 py-2 font-mono text-xs leading-[1.7] whitespace-pre-wrap [overflow-wrap:anywhere]`,(e.kind===`error`||e.kind===`stop`)&&`text-signal-word-red`),children:e.text},t)),e.source===void 0?null:(0,U.jsx)(`p`,{"data-slot":`hook-source`,className:`px-3 pb-2 font-mono text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.source}),l?(0,U.jsxs)(L,{className:`border-t border-border`,children:[(0,U.jsxs)(I,{"data-slot":`hook-raw-toggle`,className:`group flex w-full items-center gap-1 px-3 py-1 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),`Raw output${typeof e.exitCode==`number`?` · exit ${e.exitCode}`:``}`]}),(0,U.jsxs)(F,{children:[e.stdout?(0,U.jsx)(`pre`,{"data-slot":`hook-stdout`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.stdout}):null,e.stderr?(0,U.jsx)(`pre`,{"data-slot":`hook-stderr`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-signal-word-red [overflow-wrap:anywhere]`,children:e.stderr}):null]})]}):null]})})]})}function Wn({group:e,scope:t}){return(0,U.jsxs)(L,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,U.jsxs)(I,{className:`group flex h-[34px] tabular-nums w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,U.jsx)(F,{children:(0,U.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,U.jsx)(Vn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function Gn({count:e,children:t}){return(0,U.jsxs)(L,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,U.jsxs)(I,{className:`group flex items-center gap-1.5 rounded-md p-0.5 tabular-nums text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,U.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),Ft(e)]}),(0,U.jsx)(F,{children:(0,U.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function Kn({image:e}){return(0,U.jsx)(ze,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}var qn={finish:`Closed when the task finished`,superseded:`Closed when the worker went on`,"parent-stopped":`Closed when the parent stopped`,"worker-stopped":`Closed when the worker stopped`,undeliverable:`Closed: not delivered`};function Jn(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function Yn(e,t,n,r=``){let i=e.map((e,r)=>Jn(e,t[r]??[],n[r])).join(`
9
- `),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function Xn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,U.jsx)(Zn,{text:e.context}):null;if(e.resolved)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,U.jsx)(Zn,{text:e.context}):null,(0,U.jsxs)(X,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,U.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?qn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,U.jsx)(nt,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,U.jsx)(Qn,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,U.jsx)(nr,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Zn({text:e}){return(0,U.jsx)(X,{role:`agent`,children:(0,U.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,U.jsx)(B,{breaks:!0,children:e})})})}function Qn({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,U.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,U.jsx)(P,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,U.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,U.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,U.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,U.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,U.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,U.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,U.jsxs)(`li`,{className:`break-words`,children:[(0,U.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,U.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,U.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,U.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,U.jsx)(R,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,U.jsx)(dt,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,U.jsx)(ft,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function $n(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,H.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,H.useState)(0),[h,g]=(0,H.useState)({}),[_,v]=(0,H.useState)({}),[y,b]=(0,H.useState)(``),[x,S]=(0,H.useState)(!1),[C,w]=(0,H.useState)(``),[T,E]=(0,H.useState)(!1),D=s&&p===c,ee=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;je(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let te=(e,t)=>g(n=>({...n,[e]:t})),O=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),k=e=>{te(e,[]),v(t=>({...t,[e]:t[e]??``}))},A=o.some((e,t)=>!e.options||_[t]!==void 0),ne=o.filter((e,t)=>G(t,h,_)).length,j=ne===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:E,onCommentStep:D,oneTap:ee,setQuestion:te,clearOtherAnswer:O,selectOther:k,hasOtherAnswer:A,answeredCount:ne,allAnswered:j,deliver:M,sendAll:()=>void M(Yn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function er({state:e,renderFreeTextReply:t}){let n=(0,H.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,U.jsx)(st,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,U.jsx)(ot,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(or,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(Jn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,U.jsxs)(`div`,{className:`pt-1`,children:[(0,U.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,U.jsx)(V,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function tr({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function nr(e){return e.delivery===void 0?(0,U.jsx)(rr,{...e}):(0,U.jsx)(ir,{...e,delivery:e.delivery})}function rr(e){let t=Fe(e.run,e.projectId);return(0,U.jsx)(ir,{...e,delivery:t})}function ir({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=$n(e,m,d,f,a),[g,_]=(0,H.useState)(void 0),v=(0,H.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,U.jsx)(tr,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,U.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:i(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,U.jsx)(it,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,U.jsx)(at,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,U.jsx)(er,{state:h,renderFreeTextReply:o})}),(0,U.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,U.jsx)(ar,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,U.jsx)(ut,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,U.jsx)(ft,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function ar({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,U.jsx)(ct,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,U.jsx)(lt,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function or({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,H.useId)(),u=(0,H.useRef)(null),d=(0,H.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,H.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,U.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,U.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,U.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,U.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,U.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:i(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,U.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,U.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,U.jsx)(P,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:i(`h-auto min-h-11 w-full justify-start px-2.5 py-1.5 text-left`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,U.jsx)(V,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,U.jsx)(V,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}var sr=/^diff --git /;function cr(e){let t=e.replace(sr,``),n=t.lastIndexOf(` b/`);return Z(n>=0?t.slice(n+3):t)}function Z(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function lr(e){let t=Z(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function ur(e){return{path:cr(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function dr(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=Z(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=Z(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=lr(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=lr(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function fr(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function pr(e){let t=[],n=null,r=!1;for(let i of e.split(`
9
+ `),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function Xn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,U.jsx)(Zn,{text:e.context}):null;if(e.resolved)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,U.jsx)(Zn,{text:e.context}):null,(0,U.jsxs)(X,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,U.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?qn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,U.jsx)(nt,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,U.jsx)(Qn,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,U.jsx)(nr,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Zn({text:e}){return(0,U.jsx)(X,{role:`agent`,children:(0,U.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,U.jsx)(B,{breaks:!0,children:e})})})}function Qn({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,U.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,U.jsx)(P,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,U.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,U.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,U.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,U.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,U.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,U.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,U.jsxs)(`li`,{className:`break-words`,children:[(0,U.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,U.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,U.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,U.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,U.jsx)(R,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,U.jsx)(dt,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,U.jsx)(ft,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function $n(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,H.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,H.useState)(0),[h,g]=(0,H.useState)({}),[_,v]=(0,H.useState)({}),[y,b]=(0,H.useState)(``),[x,S]=(0,H.useState)(!1),[C,w]=(0,H.useState)(``),[T,E]=(0,H.useState)(!1),D=s&&p===c,ee=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;Fe(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let te=(e,t)=>g(n=>({...n,[e]:t})),O=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),k=e=>{te(e,[]),v(t=>({...t,[e]:t[e]??``}))},A=o.some((e,t)=>!e.options||_[t]!==void 0),ne=o.filter((e,t)=>G(t,h,_)).length,j=ne===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:E,onCommentStep:D,oneTap:ee,setQuestion:te,clearOtherAnswer:O,selectOther:k,hasOtherAnswer:A,answeredCount:ne,allAnswered:j,deliver:M,sendAll:()=>void M(Yn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function er({state:e,renderFreeTextReply:t}){let n=(0,H.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,U.jsx)(st,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,U.jsx)(ot,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(or,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(Jn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,U.jsxs)(`div`,{className:`pt-1`,children:[(0,U.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,U.jsx)(V,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function tr({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,U.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function nr(e){return e.delivery===void 0?(0,U.jsx)(rr,{...e}):(0,U.jsx)(ir,{...e,delivery:e.delivery})}function rr(e){let t=Me(e.run,e.projectId);return(0,U.jsx)(ir,{...e,delivery:t})}function ir({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=$n(e,m,d,f,a),[g,_]=(0,H.useState)(void 0),v=(0,H.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,U.jsx)(tr,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,U.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:i(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,U.jsx)(it,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,U.jsx)(at,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,U.jsx)(er,{state:h,renderFreeTextReply:o})}),(0,U.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,U.jsx)(ar,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,U.jsx)(ut,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,U.jsx)(ft,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function ar({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,U.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,U.jsx)(ct,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,U.jsx)(lt,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function or({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,H.useId)(),u=(0,H.useRef)(null),d=(0,H.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,H.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,U.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,U.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,U.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,U.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,U.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:i(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,U.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,U.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,U.jsx)(P,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:i(`h-auto min-h-11 w-full justify-start px-2.5 py-1.5 text-left`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,U.jsx)(V,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,U.jsx)(V,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}var sr=/^diff --git /;function cr(e){let t=e.replace(sr,``),n=t.lastIndexOf(` b/`);return Z(n>=0?t.slice(n+3):t)}function Z(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function lr(e){let t=Z(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function ur(e){return{path:cr(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function dr(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=Z(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=Z(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=lr(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=lr(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function fr(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function pr(e){let t=[],n=null,r=!1;for(let i of e.split(`
10
10
  `)){if(sr.test(i)){n=ur(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):dr(n,i);continue}fr(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function mr(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var hr=20,gr=300;function _r({runId:e,projectId:t}){let n=x(),r=o(e,t);(0,H.useEffect)(()=>{let r=t?[t,`runs`,`diff`,e]:u.runs.diff(e);n.invalidateQueries({queryKey:r})},[t,n,e]);let i=(0,H.useMemo)(()=>pr(r.data??``),[r.data]),[a,s]=(0,H.useState)(!1);if(r.isPending)return(0,U.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(r.isError)return(0,U.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:r.error.message});if(i.length===0)return(0,U.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:r.data.trim()||`(no changes)`});let c=mr(i),l=a?i:i.slice(0,hr);return(0,U.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{children:[c.files,` `,c.files===1?`file`:`files`,` changed`]}),(0,U.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,c.additions]}),` `,(0,U.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,c.deletions]})]})]}),l.map(e=>(0,U.jsx)(yr,{file:e},`${e.oldPath??``}→${e.path}`)),i.length>l.length?(0,U.jsxs)(P,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>s(!0),children:[`Show `,i.length-l.length,` more files`]}):null]})}var vr={added:`added`,deleted:`deleted`,renamed:`renamed`};function yr({file:e}){let[t,n]=(0,H.useState)(!0),r=vr[e.status],a=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,U.jsxs)(L,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-card-edge bg-card shadow-card`,children:[(0,U.jsxs)(I,{className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,U.jsx)(ce,{className:i(`mbs-[1px] size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,U.jsx)(`span`,{"data-slot":`diff-file-path`,title:a,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:e.oldPath?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,U.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,U.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,U.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-xs font-semibold tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.additions]}),` `,(0,U.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,e.deletions]})]})]}),(0,U.jsx)(F,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,U.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,U.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,U.jsx)(br,{lines:e.lines})})})]})}function br({lines:e}){let[t,n]=(0,H.useState)(!1),r=t?e:e.slice(0,gr),a=r.join(`
11
- `),[o,s]=(0,H.useState)(null);(0,H.useEffect)(()=>{let e=!1;return Re(a,`diff`).then(t=>{e||s({text:a,tokens:t.tokens})}),()=>{e=!0}},[a]);let c=o?.text===a?o.tokens:Le(a,`diff`)?.tokens??null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,U.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,U.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>gr?(0,U.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}function xr(e,t,n,r){return _e(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function Sr(e,t,n){let r=new Set;for(let i of e.workflowDef?.steps??[]){if(i.command!==void 0||i.kind===`plugin`)continue;let a=i.runner??t,o=i.agentProfile??(a===(e.runner??t)?e.agentProfile:void 0)??n.repoAccount?.[a];n.readyOn(a,o)||r.add(a)}return[...r]}function Cr(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function wr(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function Tr(){let e=c(),t=g();return{providers:e,registered:t,providersPending:e.isPending||t.isPending,providersError:e.isError||t.isError,providersReady:e.isSuccess&&t.isSuccess}}function Er(e,t=null,n){let{registered:r,providersPending:i,providersError:a,providersReady:o}=Tr(),c=p(n),l=Oe(e),u=e.removedRunner!==void 0,d=l&&!e.runner||u,m=Ie(n),h=e.delegation?.role===`worker`,g=c.data?.defaultRunner,_=xr(e,l,u,f(g,s(r.data))??g),v=(t,n)=>Ae(e,t,m.repoAccount,{original:_,target:n},l),{runners:y,signedOut:b}=m.runnersOn(e=>v(e,e)),x=h?_:Ee(t,y,_),S=y.includes(_),C=l?T(e.workflowDef,x,s(r.data)):[x],w=l&&h&&e.workflowDef?Sr(e,x,m):C.filter(e=>!m.readyOn(e,v(e,x))),E=o&&(!d||c.isSuccess)&&w.length===0,D=wr({needsConfig:d,configPending:c.isPending,configError:c.isError,providersPending:i,providersError:a,canContinue:E,untouched:l,missing:w});return{runners:y,signedOut:b,currentRunner:_,runner:x,currentRunnerConnected:S,canContinue:E,providerPending:i||d&&c.isPending,providerError:a,reason:D,runnerOverride:Cr(h,t,S,u,x)}}var Dr={open:!1,notes:``},Q=new Map,Or=new Set,$=null;function kr(){let e=[...Q.values()].some(e=>e.notes.trim()!==``);e&&$===null&&($=Ne()),!e&&$!==null&&($(),$=null);for(let e of Or)e()}function Ar(e){return Or.add(e),()=>{Or.delete(e)}}function jr(e){return Q.get(e)??Dr}function Mr(e,t){let n={...jr(e),...t};!n.open&&n.notes===``?Q.delete(e):Q.set(e,n),kr()}function Nr(e){Q.delete(e)&&kr()}function Pr(e){let t=(0,H.useSyncExternalStore)(Ar,()=>jr(e)),n=(0,H.useCallback)(t=>Mr(e,t),[e]),r=(0,H.useCallback)(()=>Nr(e),[e]);return{...t,update:n,clear:r}}function Fr(e,t){let n=x();return m({mutationFn:()=>w(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:u.runs.all}),t?.onSuccess?.()},onError:e=>S(e.message,{tone:`danger`})})}function Ir({run:e,projectId:t,onResolved:n}){return(0,U.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,U.jsx)(ue,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,U.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,U.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,U.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,U.jsx)(Rr,{run:e,projectId:t,onResolved:n})]})}function Lr({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,U.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,U.jsx)(Ir,{run:e,projectId:t,onResolved:n}),r?(0,U.jsx)(_r,{runId:e.id,projectId:t}):null]})}function Rr({run:e,projectId:t,onResolved:n}){let r=h(),i=x(),o=(0,H.useRef)(null),s=Pr(e.id),{notes:c,open:l,clear:d}=s,f=e=>s.update({notes:e}),[p,g]=(0,H.useState)(null),[b,w]=(0,H.useState)(null),T=Fr(e.id,{projectId:t,onSuccess:()=>{d(),n?.()}}),E=Er(e,null,t),ee=()=>i.invalidateQueries({queryKey:u.runs.all}),O=m({mutationFn:async n=>E.canContinue?C(_(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:E.runnerOverride}):null,onMutate:()=>_(e.id,{projectId:t}),onSuccess:(t,i,a)=>{t!==null&&(jr(e.id).notes.trim()===i&&d(),r.invalidateAfter(`continue`,a),n?.())},onError:e=>S(e.message,{tone:`danger`})}),k=m({mutationFn:()=>y(e.id,t),onSuccess:e=>{S(`Draft PR created — ${e.url}`),d(),ee(),n?.()},onError:e=>{e instanceof v&&e.manual!==void 0&&w(e.manual),S(e.message,{tone:`danger`})}}),A=()=>{if(!l){s.update({open:!0}),requestAnimationFrame(()=>o.current?.focus());return}let e=c.trim();if(e.length===0){g(`Write what to change first.`),o.current?.focus();return}g(null),O.mutate(e)};return(0,U.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[E.canContinue?null:(0,U.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:E.reason}),E.providerPending?null:(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button]:min-h-11 [&_a]:min-h-11`,children:[(0,U.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,U.jsxs)(D,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,U.jsx)(ue,{"aria-hidden":`true`}),`Review changes`]}):(0,U.jsxs)(R,{to:`/tasks/${e.id}/changes`,children:[(0,U.jsx)(ue,{"aria-hidden":`true`}),`Review changes`]})}),(0,U.jsxs)(P,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:E.reason??(l?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":E.canContinue?void 0:`review-provider-guidance`,"aria-expanded":l,"aria-controls":l?`review-notes`:void 0,disabled:O.isPending||!E.canContinue,onClick:A,children:[(0,U.jsx)(qe,{"aria-hidden":`true`}),l?`Send back with notes`:`Send back`]}),a(e.pullRequestUrl)?(0,U.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,children:(0,U.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,U.jsx)(le,{"aria-hidden":`true`}),`PR ↗`]})}):(0,U.jsxs)(P,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,U.jsx)(te,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,U.jsxs)(P,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:Pe(`review`),disabled:T.isPending,onClick:()=>T.mutate(),children:[(0,U.jsx)(M,{"aria-hidden":`true`}),`Accept`]}):null]}),l?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(V,{ref:o,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":p!==null||void 0,"aria-describedby":p===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:c,onChange:e=>{let t=e.target.value;f(t),p!==null&&t.trim().length>0&&g(null)},onKeyDown:e=>{De({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),A())},className:`min-h-11 text-base md:text-[13px]`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[p===null?(0,U.jsx)(`span`,{}):(0,U.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:p}),(0,U.jsx)(P,{"data-slot":`review-notes-cancel`,variant:`ghost`,size:`sm`,className:`min-h-11`,title:`Fold the notes box and drop the notes`,onClick:()=>{g(null),d()},children:`Cancel`})]})]}):null,b===null?null:(0,U.jsx)(zr,{command:b})]})}function zr({command:e}){return(0,U.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>S(`Command copied to clipboard.`)).catch(()=>S(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,U.jsx)(oe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,U.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Br(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Vr=1500;function Hr({status:e}){let t=(0,H.useRef)(e),[n,r]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Br())return;r(!0);let i=setTimeout(()=>r(!1),Vr);return()=>clearTimeout(i)},[e]),n?(0,U.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,U.jsx)(Te,{}),(0,U.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,U.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{tn as A,St as B,dn as C,nn as D,Kt as E,Wt as F,wt as H,zt as I,Lt as L,Jt as M,Xt as N,rn as O,Gt as P,kt as R,J as S,Yt as T,nt as U,Tt as V,Ye as W,kn as _,_r as a,mn as b,En as c,Kn as d,Dn as f,xn as g,Gn as h,Er as i,Qt as j,$t as k,Wn as l,Vn as m,Lr as n,Xn as o,On as p,Fr as r,Zn as s,Hr as t,Un as u,vn as v,qt as w,hn as x,gn as y,Ct as z};
11
+ `),[o,s]=(0,H.useState)(null);(0,H.useEffect)(()=>{let e=!1;return Re(a,`diff`).then(t=>{e||s({text:a,tokens:t.tokens})}),()=>{e=!0}},[a]);let c=o?.text===a?o.tokens:Le(a,`diff`)?.tokens??null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,U.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,U.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>gr?(0,U.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}function xr(e,t,n,r){return _e(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function Sr(e,t,n){let r=new Set;for(let i of e.workflowDef?.steps??[]){if(i.command!==void 0||i.kind===`plugin`)continue;let a=i.runner??t,o=i.agentProfile??(a===(e.runner??t)?e.agentProfile:void 0)??n.repoAccount?.[a];n.readyOn(a,o)||r.add(a)}return[...r]}function Cr(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function wr(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function Tr(){let e=c(),t=g();return{providers:e,registered:t,providersPending:e.isPending||t.isPending,providersError:e.isError||t.isError,providersReady:e.isSuccess&&t.isSuccess}}function Er(e,t=null,n){let{registered:r,providersPending:i,providersError:a,providersReady:o}=Tr(),c=p(n),l=Ne(e),u=e.removedRunner!==void 0,d=l&&!e.runner||u,m=Ee(n),h=e.delegation?.role===`worker`,g=c.data?.defaultRunner,_=xr(e,l,u,f(g,s(r.data))??g),v=(t,n)=>je(e,t,m.repoAccount,{original:_,target:n},l),{runners:y,signedOut:b}=m.runnersOn(e=>v(e,e)),x=h?_:De(t,y,_),S=y.includes(_),C=l?T(e.workflowDef,x,s(r.data)):[x],w=l&&h&&e.workflowDef?Sr(e,x,m):C.filter(e=>!m.readyOn(e,v(e,x))),E=o&&(!d||c.isSuccess)&&w.length===0,D=wr({needsConfig:d,configPending:c.isPending,configError:c.isError,providersPending:i,providersError:a,canContinue:E,untouched:l,missing:w});return{runners:y,signedOut:b,currentRunner:_,runner:x,currentRunnerConnected:S,canContinue:E,providerPending:i||d&&c.isPending,providerError:a,reason:D,runnerOverride:Cr(h,t,S,u,x)}}var Dr={open:!1,notes:``},Q=new Map,Or=new Set,$=null;function kr(){let e=[...Q.values()].some(e=>e.notes.trim()!==``);e&&$===null&&($=ke()),!e&&$!==null&&($(),$=null);for(let e of Or)e()}function Ar(e){return Or.add(e),()=>{Or.delete(e)}}function jr(e){return Q.get(e)??Dr}function Mr(e,t){let n={...jr(e),...t};!n.open&&n.notes===``?Q.delete(e):Q.set(e,n),kr()}function Nr(e){Q.delete(e)&&kr()}function Pr(e){let t=(0,H.useSyncExternalStore)(Ar,()=>jr(e)),n=(0,H.useCallback)(t=>Mr(e,t),[e]),r=(0,H.useCallback)(()=>Nr(e),[e]);return{...t,update:n,clear:r}}function Fr(e,t){let n=x();return m({mutationFn:()=>w(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:u.runs.all}),t?.onSuccess?.()},onError:e=>S(e.message,{tone:`danger`})})}function Ir({run:e,projectId:t,onResolved:n}){return(0,U.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,U.jsx)(ue,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,U.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,U.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,U.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,U.jsx)(Rr,{run:e,projectId:t,onResolved:n})]})}function Lr({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,U.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,U.jsx)(Ir,{run:e,projectId:t,onResolved:n}),r?(0,U.jsx)(_r,{runId:e.id,projectId:t}):null]})}function Rr({run:e,projectId:t,onResolved:n}){let r=h(),i=x(),o=(0,H.useRef)(null),s=Pr(e.id),{notes:c,open:l,clear:d}=s,f=e=>s.update({notes:e}),[p,g]=(0,H.useState)(null),[b,w]=(0,H.useState)(null),T=Fr(e.id,{projectId:t,onSuccess:()=>{d(),n?.()}}),E=Er(e,null,t),ee=()=>i.invalidateQueries({queryKey:u.runs.all}),O=m({mutationFn:async n=>E.canContinue?C(_(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:E.runnerOverride}):null,onMutate:()=>_(e.id,{projectId:t}),onSuccess:(t,i,a)=>{t!==null&&(jr(e.id).notes.trim()===i&&d(),r.invalidateAfter(`continue`,a),n?.())},onError:e=>S(e.message,{tone:`danger`})}),k=m({mutationFn:()=>y(e.id,t),onSuccess:e=>{S(`Draft PR created — ${e.url}`),d(),ee(),n?.()},onError:e=>{e instanceof v&&e.manual!==void 0&&w(e.manual),S(e.message,{tone:`danger`})}}),A=()=>{if(!l){s.update({open:!0}),requestAnimationFrame(()=>o.current?.focus());return}let e=c.trim();if(e.length===0){g(`Write what to change first.`),o.current?.focus();return}g(null),O.mutate(e)};return(0,U.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[E.canContinue?null:(0,U.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:E.reason}),E.providerPending?null:(0,U.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button]:min-h-11 [&_a]:min-h-11`,children:[(0,U.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,U.jsxs)(D,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,U.jsx)(ue,{"aria-hidden":`true`}),`Review changes`]}):(0,U.jsxs)(R,{to:`/tasks/${e.id}/changes`,children:[(0,U.jsx)(ue,{"aria-hidden":`true`}),`Review changes`]})}),(0,U.jsxs)(P,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:E.reason??(l?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":E.canContinue?void 0:`review-provider-guidance`,"aria-expanded":l,"aria-controls":l?`review-notes`:void 0,disabled:O.isPending||!E.canContinue,onClick:A,children:[(0,U.jsx)(qe,{"aria-hidden":`true`}),l?`Send back with notes`:`Send back`]}),a(e.pullRequestUrl)?(0,U.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,children:(0,U.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,U.jsx)(le,{"aria-hidden":`true`}),`PR ↗`]})}):(0,U.jsxs)(P,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,U.jsx)(te,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,U.jsxs)(P,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:Ae(`review`),disabled:T.isPending,onClick:()=>T.mutate(),children:[(0,U.jsx)(M,{"aria-hidden":`true`}),`Accept`]}):null]}),l?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(V,{ref:o,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":p!==null||void 0,"aria-describedby":p===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:c,onChange:e=>{let t=e.target.value;f(t),p!==null&&t.trim().length>0&&g(null)},onKeyDown:e=>{Oe({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),A())},className:`min-h-11 text-base md:text-[13px]`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[p===null?(0,U.jsx)(`span`,{}):(0,U.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:p}),(0,U.jsx)(P,{"data-slot":`review-notes-cancel`,variant:`ghost`,size:`sm`,className:`min-h-11`,title:`Fold the notes box and drop the notes`,onClick:()=>{g(null),d()},children:`Cancel`})]})]}):null,b===null?null:(0,U.jsx)(zr,{command:b})]})}function zr({command:e}){return(0,U.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>S(`Command copied to clipboard.`)).catch(()=>S(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,U.jsx)(oe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,U.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Br(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Vr=1500;function Hr({status:e}){let t=(0,H.useRef)(e),[n,r]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Br())return;r(!0);let i=setTimeout(()=>r(!1),Vr);return()=>clearTimeout(i)},[e]),n?(0,U.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,U.jsx)(Te,{}),(0,U.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,U.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{tn as A,St as B,dn as C,nn as D,Kt as E,Wt as F,wt as H,zt as I,Lt as L,Jt as M,Xt as N,rn as O,Gt as P,kt as R,J as S,Yt as T,nt as U,Tt as V,Ye as W,kn as _,_r as a,mn as b,En as c,Kn as d,Dn as f,xn as g,Gn as h,Er as i,Qt as j,$t as k,Wn as l,Vn as m,Lr as n,Xn as o,On as p,Fr as r,Zn as s,Hr as t,Un as u,vn as v,qt as w,hn as x,gn as y,Ct as z};
@@ -1 +1 @@
1
- import{Wt as e}from"./queries-CIeJg62Y.js";function t(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function n(n){let r=new Map,i=e=>n.getQueryCache().find({queryKey:e,exact:!0}),a=e=>{if(!e.owed||e.timer!==void 0)return;let t=i(e.key);if(!t){e.owed=!1;return}if(!t.isActive()){e.owed=!1,n.invalidateQueries({queryKey:e.key,exact:!0,refetchType:`none`});return}if(t.state.fetchStatus!==`idle`)return;let r=e.lastStart+400-Date.now();if(r>0){e.timer=setTimeout(()=>{e.timer=void 0,a(e)},r);return}e.owed=!1,e.lastStart=Date.now(),n.refetchQueries({queryKey:e.key,exact:!0,type:`active`},{cancelRefetch:!1})},o=n.getQueryCache().subscribe(e=>{if(e.type!==`updated`||r.size===0)return;let i=r.get(JSON.stringify(e.query.queryKey));if(i){if(e.action.type===`success`&&!e.action.manual){let r=e.query.promise;r&&i.preEvent.has(r)&&(i.preEvent.delete(r),t(n,i.key),i.owed=!0)}e.query.state.fetchStatus===`idle`&&a(i)}}),s=(t,n)=>n?[n,`runs`,`detail`,t]:e.runs.detail(t);return{onEvent(e,o){let c=s(e,o),l=i(c);if(!l)return;let u=JSON.stringify(c),d=r.get(u);d||(d={key:c,owed:!1,lastStart:0,preEvent:new WeakSet},r.set(u,d)),l.state.fetchStatus!==`idle`&&l.promise&&d.preEvent.add(l.promise),t(n,c),d.owed=!0,a(d)},forget(e,t){let n=JSON.stringify(s(e,t));clearTimeout(r.get(n)?.timer),r.delete(n)},cancel(){o();for(let e of r.values())clearTimeout(e.timer);r.clear()}}}function r(t){let n=new Map;return{refresh(r,i){let a=i?[i,`runs`,`detail`,r]:e.runs.detail(r);if(!t.getQueryState(a))return;let o=JSON.stringify(a);clearTimeout(n.get(o)),t.cancelQueries({queryKey:a}),n.set(o,setTimeout(()=>{n.delete(o),t.invalidateQueries({queryKey:a})},400))},cancel(){for(let e of n.values())clearTimeout(e);n.clear()}}}export{r as n,t as r,n as t};
1
+ import{Wt as e}from"./queries-CII6fTHH.js";function t(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function n(n){let r=new Map,i=e=>n.getQueryCache().find({queryKey:e,exact:!0}),a=e=>{if(!e.owed||e.timer!==void 0)return;let t=i(e.key);if(!t){e.owed=!1;return}if(!t.isActive()){e.owed=!1,n.invalidateQueries({queryKey:e.key,exact:!0,refetchType:`none`});return}if(t.state.fetchStatus!==`idle`)return;let r=e.lastStart+400-Date.now();if(r>0){e.timer=setTimeout(()=>{e.timer=void 0,a(e)},r);return}e.owed=!1,e.lastStart=Date.now(),n.refetchQueries({queryKey:e.key,exact:!0,type:`active`},{cancelRefetch:!1})},o=n.getQueryCache().subscribe(e=>{if(e.type!==`updated`||r.size===0)return;let i=r.get(JSON.stringify(e.query.queryKey));if(i){if(e.action.type===`success`&&!e.action.manual){let r=e.query.promise;r&&i.preEvent.has(r)&&(i.preEvent.delete(r),t(n,i.key),i.owed=!0)}e.query.state.fetchStatus===`idle`&&a(i)}}),s=(t,n)=>n?[n,`runs`,`detail`,t]:e.runs.detail(t);return{onEvent(e,o){let c=s(e,o),l=i(c);if(!l)return;let u=JSON.stringify(c),d=r.get(u);d||(d={key:c,owed:!1,lastStart:0,preEvent:new WeakSet},r.set(u,d)),l.state.fetchStatus!==`idle`&&l.promise&&d.preEvent.add(l.promise),t(n,c),d.owed=!0,a(d)},forget(e,t){let n=JSON.stringify(s(e,t));clearTimeout(r.get(n)?.timer),r.delete(n)},cancel(){o();for(let e of r.values())clearTimeout(e.timer);r.clear()}}}function r(t){let n=new Map;return{refresh(r,i){let a=i?[i,`runs`,`detail`,r]:e.runs.detail(r);if(!t.getQueryState(a))return;let o=JSON.stringify(a);clearTimeout(n.get(o)),t.cancelQueries({queryKey:a}),n.set(o,setTimeout(()=>{n.delete(o),t.invalidateQueries({queryKey:a})},400))},cancel(){for(let e of n.values())clearTimeout(e);n.clear()}}}export{r as n,t as r,n as t};
@@ -0,0 +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{o as r,s as i}from"./dist-C_rn70hE.js";import{Ct as a,G as o,H as s,K as c,St as l,U as u,W as d,Wt as f,Y as p,dn as m,f as h,ln as g,lt as _,rn as v,rt as ee,tt as y,un as b,xt as x,yt as te}from"./queries-CII6fTHH.js";import{An as ne,Fn as S,It as C,Lt as w,cr as T,hi as re,n as E,or as D,tt as O,ut as ie,yr as ae}from"./toaster-Bs1mVYf9.js";import{_ as oe,a as se,c as ce,f as le,h as ue,m as de,o as fe,p as pe}from"./tasks-table-CPAY1N-E.js";import{I as me,S as he,Y as ge,a as _e,m as ve,mt as ye,st as be,t as xe,u as Se,y as k}from"./design-icons-QbNMZniQ.js";import{t as A}from"./createLucideIcon-BHp8sXmF.js";import{t as Ce}from"./app-window-CSHwDX9N.js";import{n as we,r as Te,t as Ee}from"./open-in-menu-DfTnT8YF.js";import{t as De}from"./info-DA1x_4bz.js";import{t as Oe}from"./message-square-B-MD-8rD.js";import{i as ke,n as Ae,t as j}from"./reference-chip-Cv3i1kxz.js";import{t as M}from"./square-terminal-B6RYYieR.js";import{t as N}from"./button-C8jUIs8Q.js";import{a as P,i as F,l as I,n as L,p as R,r as z,t as B}from"./dropdown-menu-DjtKUK8F.js";import{i as je,r as Me,t as Ne}from"./popover-CvL6hQ5c.js";import{a as Pe,i as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dialog-DRZuXvul.js";import{c as Be,s as Ve,t as V}from"./project-router-onKnSy5a.js";import"./attention-C9zoC-gL.js";import{T as He,f as H,u as Ue}from"./task-groups-dEzH1nMg.js";import{t as We}from"./status-dot-BXf-Ubd0.js";import{t as Ge}from"./format-BU7D3IfE.js";import{$t as Ke,B as qe,Cn as Je,H as Ye,Jt as Xe,Kt as Ze,Nn as Qe,Qt as U,Tn as W,V as $e,Xn as et,Xt as tt,Yn as nt,Yt as rt,Zn as it,Zt as at,a as ot,br as st,cn as ct,cr as lt,fn as G,fr as ut,in as dt,m as ft,nn as pt,o as mt,pn as K,qt as ht,r as q,sr as gt}from"./index-CwaCfhQn.js";import{t as _t}from"./markdown-CdlTRkrR.js";import{t as vt}from"./textarea-vEsJAUAV.js";import{t as yt}from"./task-file-scope-Z2smLv09.js";import{t as J}from"./tab-link-B2k-zaeP.js";var bt=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`}]]),xt=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`}]]),St=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`}]]),Y=e(t(),1),X=n();function Ct(e){let t=_();return m({mutationFn:t=>O(b(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>g()),onError:e=>E(e.message,{tone:`danger`})})}function wt(e){return e.archived?`Unarchive`:`Archive task`}function Tt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(Ze,{open:t,onOpenChange:n,children:(0,X.jsxs)(rt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(Ke,{children:`Archive task?`}),(0,X.jsxs)(tt,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:H(e),children:H(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(at,{children:[(0,X.jsx)(Xe,{children:`Cancel`}),(0,X.jsx)(ht,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Et({run:e,className:t}){let[n,i]=(0,Y.useState)(!1),a=Ct(e.id),o=wt(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(N,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:r(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):i(!0),children:[e.archived?(0,X.jsx)(st,{"aria-hidden":`true`}):(0,X.jsx)(xe,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o})]}),(0,X.jsx)(Tt,{run:e,open:n,onOpenChange:i,onConfirm:()=>{a.mutate(!0),i(!1)}})]})}function Dt({run:e,action:t,prUrl:n,patch:r}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&i(n)?(0,X.jsx)(N,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(N,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>E(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Ot({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(N,{variant:`outline`,asChild:!0,children:(0,X.jsx)(V,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&i(t.pullRequestUrl)?(0,X.jsx)(N,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Et,{run:e}):null]})]})}function kt({run:e}){let t=o(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 s=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-card-edge bg-card p-3 shadow-card [margin-block:0.75rem]`,children:[a?(0,X.jsx)(Dt,{run:e,action:a,prUrl:s,patch:t}):null,i?(0,X.jsx)(Ot,{run:e,blocker:i,flags:n}):null]})}var At=[`running`,`queued`,`waiting`];function jt(e,{queuePosition:t,now:n=new Date}){let r=ne(e),i=Qe(e,r).label,a=t===void 0?i:`${i} #${t}`,o=At.includes(e.status)?Nt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Mt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Nt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ge(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),E(t)}catch{E(`Run manually: ${e}`)}}function Pt(e){let t=x(),n=h(),r=(0,Y.useMemo)(()=>oe(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>se(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Ft(e){return m({mutationFn:()=>w(e.id),onError:e=>{if(e instanceof S&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}E(e.message,{tone:`danger`})}})}function Q(e,t){let n=d(),r=a(),i=v(),o=m({mutationFn:t=>C(e.id,t),onError:e=>E(e.message,{tone:`danger`})}),s=Je(),c=He(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,u=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&u(ct(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=we(e.id);return t===void 0||i.isSuccess&&u(t)}).map(t=>({target:t,...dt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function It({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=v().data,s=G(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(N,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(M,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=Te(e,o);return(0,X.jsxs)(N,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(N,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>E(`Worktree path copied`)).catch(()=>E(`Path: ${t}`))},children:[(0,X.jsx)(k,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(N,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{}),`Copy resume command`]})]}):null]})}function Lt({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,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(Ee,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,X.jsxs)(F,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,X.jsxs)(N,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Z(s,`Worktree path copied`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Z(o,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Rt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Q(e,t);return!a&&o.length===0?null:r?(0,X.jsx)(F,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(N,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(ye,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(It,{run:e,canResume:t,onResume:n})})]})}function zt({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{E(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Bt({run:e}){let t=x(),n=h(),r=r=>n===void 0?void 0:pe(n,e.id,r,t),a=(0,Y.useMemo)(()=>oe(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(j,{reference:t,to:r(t),taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(pt,{run:e,prNumber:t.number})},ce(t)));let l=ue(e);l&&i(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(j,{reference:{kind:`PR`,url:l},taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(j,{reference:t,to:r(t),taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},ce(t)));let d=le(e,t);if(d&&i(d)&&!u.some(e=>e.url===d)){let t=fe(d);s.push((0,X.jsx)(j,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Vt(){let e=Ve(),t=l();return qe(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Ht=e=>e.map(e=>`${e.name}: ${$e(e.url)}`).join(`
2
+ `);function Ut(e){return Vt().length>0||e.notify===!0}function $({run:e}){let t=Vt(),n=t.length>0,r=u(e.id),[i,a]=(0,Y.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsxs)(B,{children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${Ye(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Ht(t):void 0,children:[(0,X.jsx)(We,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(z,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,X.jsx)(P,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-xs font-normal text-muted-foreground`,children:t.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:$e(e.url),children:e.name},e.id))}):null,n?(0,X.jsxs)(F,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,X.jsx)(Oe,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(F,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>E(`Stopped notifying the webhook`),onError:e=>E(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,X.jsx)(bt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,X.jsx)(gt,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,X.jsx)(Wt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),E(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>E(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Wt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,Y.useId)(),o=(0,Y.useId)(),[s,c]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=Ye(t);return(0,X.jsx)(ze,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,X.jsx)(Le,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,X.jsxs)(Ie,{className:`text-left`,children:[(0,X.jsx)(Re,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)(Fe,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:Ht(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(vt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,X.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(De,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(Pe,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,X.jsx)(N,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(N,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,X.jsx)(gt,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Gt({id:e}){return(0,X.jsxs)(V,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(_e,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Kt({id:e}){let t=p(e),n=t.data?H(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(V,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(_e,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(N,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var qt=3,Jt=(e,t)=>e.kind===t.kind&&e.number===t.number;function Yt(e,t,n=qt){let r=t?e.findIndex(e=>Jt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Xt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Zt({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?me:ve,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(Ae,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Qt(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function $t({servers:e}){let t=ft();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,X.jsx)(Ce,{"aria-hidden":`true`}),Qt(e,n),t.live?(0,X.jsx)(We,{tone:`success`,"aria-label":`Preview is live`}):null]})}function en(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function tn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,X.jsx)(Gt,{id:n}):(0,X.jsx)(Kt,{id:n})}function nn({isDesktop:e,desktopActivitySlot:t,attention:n,statusLine:r}){return e&&t?(0,X.jsx)(X.Fragment,{children:t}):(0,X.jsx)(q,{dot:n.tone,shape:n.shape,pulse:n.pulse,className:`max-md:hidden`,children:Mt(r)})}function rn(e,t,n){return n&&!e.archiveBlocker&&t.archive?(0,X.jsx)(Et,{run:e}):null}function an({archived:e,className:t}){return e?(0,X.jsx)(q,{"data-slot":`run-archived-pill`,dot:W.tone,shape:W.shape,className:t,children:W.label}):null}function on({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function sn({shown:e,run:t,previewToggle:n}){let r=Ut(t);return e&&(n||r)?(0,X.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,X.jsx)($,{run:t})]}):null}function cn({isDesktop:e,phoneBar:t,run:n,previewToggle:i,mobileActivitySlot:a}){let o=Ut(n);if(e||!a)return null;let s=t&&(!!i||o);return(0,X.jsxs)(`div`,{"data-slot":s?`run-mobile-actions`:void 0,"data-mobile-session-bar":t||void 0,className:r(`flex flex-wrap items-center gap-2 md:hidden`,t&&`border-t border-border py-1`),children:[a,s?(0,X.jsxs)(`span`,{className:`ms-auto flex shrink-0 flex-wrap items-center gap-2`,children:[i,(0,X.jsx)($,{run:n})]}):null]})}function ln({run:e,tab:t,activeItem:n,inlineItemTabs:i,overflowItemTabs:a,phoneBar:o,isDesktop:s}){let c=(0,Y.useRef)(null),[l,u]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let e=c.current;if(!e||s){u(!1);return}let t=()=>u(e.scrollWidth-e.clientWidth-e.scrollLeft>1),n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{n.disconnect(),e.removeEventListener(`scroll`,t)}},[s,i,a,e.diffStat?.files]);let d=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!d||s||c.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[d,i.map(e=>`${e.kind}#${e.number}`).join(`,`),s]),(0,X.jsxs)(`div`,{ref:c,"data-slot":`run-tabs`,"data-phone-bar":o||void 0,"data-overflow-end":l||void 0,className:r(`flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-2 max-md:[&>a]:text-[13.5px]`,o?`mt-0`:`mt-3`),children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:o,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:o,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:o,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:o,children:`Files`}),i.map(t=>(0,X.jsx)(J,{to:Xt(e.id,t),active:n!==null&&Jt(t,n),replace:o,children:(0,X.jsx)(Zt,{tab:t})},`${t.kind}-${t.number}`)),a.length>0?(0,X.jsxs)(B,{children:[(0,X.jsxs)(R,{"data-slot":`run-tabs-more`,"aria-label":`${a.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,a.length]}),(0,X.jsx)(z,{align:`end`,children:a.map(t=>(0,X.jsx)(F,{asChild:!0,children:(0,X.jsx)(V,{to:Xt(e.id,t),replace:o,children:(0,X.jsx)(Zt,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function un({run:e,tab:t=`session`,onMarkedUnread:n,desktopActivitySlot:i,mobileActivitySlot:a}){let o=ne(e),s=K(e),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),f=dn(e,n),p=ee(),m=te(),h=jt(e,{queuePosition:e.status===`queued`?Ue(p.data??[]).get(e.id):void 0}),g=it(),_=et(),v=g!==null&&!_?g:null,y=v!==null,{referenceProjectId:b,repoBase:x,requests:S}=Pt(e),C=(0,Y.useMemo)(()=>de(e,x),[e,x]),w=typeof t==`object`?t:null,{inline:T,overflow:re}=Yt(C,w),E=m.data?.capabilities?.preview===!0,D=e.worktreePath&&E?(0,X.jsx)($t,{servers:e.previewServers??[]}):null,O=(0,X.jsx)(hn,{run:e,actions:f,onOpenChooser:()=>d(!0),onToggleNotes:()=>l(e=>!e)}),ie=rn(e,s,_);return(0,X.jsx)(ke,{projectId:b,repoBase:x,requests:S,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:r(`relative z-20 shrink-0 bg-background px-4 md:px-9 md:pt-7`,y?`pt-0`:`pt-[18px]`,t===`session`&&`border-b border-border`),children:[(0,X.jsx)(on,{run:e}),(0,X.jsx)(kt,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(tn,{run:e}),v?(0,X.jsxs)(nt,{slot:v,children:[(0,X.jsx)(mn,{run:e,status:(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(q,{"data-slot":`mobile-run-status`,dot:o.tone,shape:o.shape,pulse:o.pulse,className:`max-w-full self-start truncate px-2 py-px text-xs leading-4`,children:h.label}),(0,X.jsx)(an,{archived:e.archived,className:`px-2 py-px text-xs leading-4`})]})}),(0,X.jsx)(tn,{run:e,compact:!0}),O]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:en(e.delegation)}),(0,X.jsx)(pn,{run:e}),(0,X.jsx)(nn,{isDesktop:_,desktopActivitySlot:i,attention:o,statusLine:h}),(0,X.jsx)(an,{archived:e.archived,className:`max-md:hidden`}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[ie,D,(0,X.jsx)($,{run:e}),O]})]}),(0,X.jsx)(sn,{shown:v!==null&&!a,run:e,previewToggle:D}),(0,X.jsx)(ln,{run:e,tab:t,activeItem:w,inlineItemTabs:T,overflowItemTabs:re,phoneBar:y,isDesktop:_}),(0,X.jsx)(cn,{isDesktop:_,phoneBar:y,run:e,previewToggle:D,mobileActivitySlot:a}),c?(0,X.jsx)(vn,{runId:e.id,onClose:()=>l(!1)}):null,u?(0,X.jsx)(Rt,{run:e,canResume:K(e).terminal,onResume:()=>f.terminal.mutate(),onClose:()=>d(!1)}):null]}),(0,X.jsx)(_n,{run:e,actions:f})]})})}function dn(e,t){let n=re(),r=Be(),[i,a]=(0,Y.useState)(null),o=()=>n.invalidateQueries({queryKey:f.runs.all}),l=e=>E(e.message,{tone:`danger`}),u=c(),d={isPending:u.isPending,mutate:()=>u.mutate({id:e.id,pinned:!e.pinned})},p=s();return{pin:d,markUnread:{isPending:p.isPending,mutate:()=>{t?.(),p.mutate(e.id,{onError:l})}},delete:m({mutationFn:()=>ie(e.id),onSuccess:()=>{o(),r(`/`)},onError:l}),terminal:Ft(e),confirming:i,setConfirming:a}}function fn(e){let t=o(e.id),n=H(e);return{title:n,editor:mt(n,e=>t.mutate({title:e},{onError:e=>E(e.message,{tone:`danger`})}))}}function pn({run:e}){let{title:t,editor:n}=fn(e);return n.editing?(0,X.jsx)(ot,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(lt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function mn({run:e,status:t}){let{title:n,editor:r}=fn(e);return(0,X.jsxs)(Ne,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,X.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,X.jsx)(je,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(lt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Me,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,X.jsx)(ot,{editor:r,className:`text-[16px] font-semibold`})})]})}function hn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=K(e),a=G(e),s=et(),c=Ct(e.id),[l,u]=(0,Y.useState)(!1),d=o(e.id),f=(0,Y.useId)();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tt,{run:e,open:l,onOpenChange:u,onConfirm:()=>{c.mutate(!0),u(!1)}}),(0,X.jsxs)(B,{children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsx)(N,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,X.jsx)(he,{"aria-hidden":`true`})})}),(0,X.jsxs)(z,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,X.jsx)(P,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!s&&i.archive&&!e.archiveBlocker?(0,X.jsx)(F,{disabled:c.isPending,onSelect:()=>e.archived?c.mutate(!1):u(!0),children:wt(e)}):null,(0,X.jsxs)(F,{onSelect:n,children:[(0,X.jsx)(ut,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(Rt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,X.jsxs)(F,{onSelect:()=>void Z(a,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,X.jsxs)(F,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(xt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,X.jsxs)(L,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(St,{"aria-hidden":`true`}):(0,X.jsx)(ge,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,X.jsx)(I,{}),(0,X.jsx)(P,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(L,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:d.isPending,onCheckedChange:e=>d.mutate({archiveWhenDone:e},{onError:e=>E(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(L,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:d.isPending,"aria-describedby":f,onCheckedChange:e=>d.mutate({autoMergePr:e},{onError:e=>E(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:f,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)(gn,{run:e,patch:d}),i.deleteRun?(0,X.jsx)(I,{}):null,i.deleteRun?(0,X.jsxs)(F,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(be,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function gn({run:e,patch:t}){let n=(0,Y.useId)(),r=(0,Y.useId)(),i=(0,Y.useId)(),a=e=>E(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I,{}),(0,X.jsx)(P,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsx)(L,{"data-slot":`allow-workers`,className:`min-h-11`,checked:T(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,X.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,X.jsx)(L,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:D(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function _n({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(Ze,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(rt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(Ke,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(tt,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:H(e),children:H(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!ae(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,X.jsxs)(at,{children:[(0,X.jsx)(Xe,{children:`Cancel`}),(0,X.jsx)(ht,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function vn({runId:e,onClose:t}){let n=y(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 flex max-h-[min(45dvh,420px)] flex-col overflow-hidden rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(N,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(ye,{})})]}),(0,X.jsx)(`div`,{"data-slot":`notes-panel-body`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(yt,{runId:e,children:(0,X.jsx)(_t,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})}),(0,X.jsxs)(`div`,{className:`mt-4 flex shrink-0 gap-3`,children:[(0,X.jsx)(N,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(N,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Ft as a,Lt as i,zt as n,Pt as o,Bt as r,jt as s,un as t};