cezarion 0.18.0-dev.8565 → 0.18.0-dev.8572

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 (131) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/accounts-section-VLKEYGPj.js +1 -0
  3. package/web/dist/assets/{activity-motion-0wHCeUs7.css → activity-motion-DcKVM8fM.css} +1 -1
  4. package/web/dist/assets/activity-motion-IiyiWtXq.js +2 -0
  5. package/web/dist/assets/activity-route-QCPCR9kZ.js +1 -0
  6. package/web/dist/assets/agent-config-section-BK0gs0uc.js +7 -0
  7. package/web/dist/assets/agent-defaults-section-BoluhHkE.js +1 -0
  8. package/web/dist/assets/appearance-CEFPwlnq.js +1 -0
  9. package/web/dist/assets/archive-on-merge-field-BEt4jVZt.js +1 -0
  10. package/web/dist/assets/automations-route-CutF-cGn.css +1 -0
  11. package/web/dist/assets/automations-route-F58YdVbC.js +2 -0
  12. package/web/dist/assets/{badge-D9JrXe0o.js → badge-DQ3U69Ht.js} +1 -1
  13. package/web/dist/assets/{button-BQ2y4XRB.js → button-B7MKxYjT.js} +1 -1
  14. package/web/dist/assets/change-counts-CW7O8g5Y.js +1 -0
  15. package/web/dist/assets/check-OP-CVgZG.js +1 -0
  16. package/web/dist/assets/circle-x-7nTlobAF.js +1 -0
  17. package/web/dist/assets/{command-CDt1BsZy.js → command-KdW7aO0N.js} +1 -1
  18. package/web/dist/assets/commit-list-BZ6wfGPz.js +1 -0
  19. package/web/dist/assets/{dialog-BVF6dIeS.js → dialog-B531GGAo.js} +1 -1
  20. package/web/dist/assets/diff-BbD04q_C.js +3 -0
  21. package/web/dist/assets/diff-controls-CW1hOWET.js +1 -0
  22. package/web/dist/assets/diff-view-C3XewBZ4.js +11 -0
  23. package/web/dist/assets/dist-Czz3Y5qH.js +1 -0
  24. package/web/dist/assets/file-preview-B3r8zavn.js +2 -0
  25. package/web/dist/assets/{folder-browser-CbWAXTsX.js → folder-browser-6LK4AIPp.js} +1 -1
  26. package/web/dist/assets/format-BU7D3IfE.js +1 -0
  27. package/web/dist/assets/git-toolbar-CCZtGd6H.js +1 -0
  28. package/web/dist/assets/github-CzZZ-wwm.js +1 -0
  29. package/web/dist/assets/global-activity-route-BNyhS-a8.js +1 -0
  30. package/web/dist/assets/hourglass-CikYdGGQ.js +1 -0
  31. package/web/dist/assets/image-preview-CMk53HOX.js +1 -0
  32. package/web/dist/assets/index-CGjknHnV.css +1 -0
  33. package/web/dist/assets/index-DaJ5iats.js +21 -0
  34. package/web/dist/assets/{label-Dbp-6aiT.js → label-YDZzSz0S.js} +1 -1
  35. package/web/dist/assets/live-refetch-1_o4J83F.js +1 -0
  36. package/web/dist/assets/loader-circle-CPBhhDbB.js +1 -0
  37. package/web/dist/assets/{markdown-CzP2Mv9j.js → markdown-q0pVKAO0.js} +1 -1
  38. package/web/dist/assets/{notifications-section-BsHRSzNs.js → notifications-section-n3Xb47pL.js} +1 -1
  39. package/web/dist/assets/open-in-menu-D4ACqxcC.js +1 -0
  40. package/web/dist/assets/{preview-pane-connected-dvf7gtbB.js → preview-pane-connected-VmfC04wB.js} +3 -3
  41. package/web/dist/assets/{project-location-c1oHm2yu.js → project-location-GPzDWXuH.js} +1 -1
  42. package/web/dist/assets/projects-section-BotQxpQ6.js +1 -0
  43. package/web/dist/assets/prompt-templates-section-B8pr6Ue3.js +1 -0
  44. package/web/dist/assets/queries-DDhFFTvR.js +1 -0
  45. package/web/dist/assets/{reference-chip-1BEDWxcS.js → reference-chip-90x9Bq44.js} +1 -1
  46. package/web/dist/assets/{remote-settings-notice-BD9jRcE6.js → remote-settings-notice-F_onp6Yr.js} +1 -1
  47. package/web/dist/assets/repo-git-B5Bse6ld.js +1 -0
  48. package/web/dist/assets/{report-reader-P41jUFxW.js → report-reader-B_kyYgIY.js} +1 -1
  49. package/web/dist/assets/reports-CNFNb36Z.css +1 -0
  50. package/web/dist/assets/reports-D0E8DWXQ.js +1 -0
  51. package/web/dist/assets/resources-section-DcfHTNpN.js +1 -0
  52. package/web/dist/assets/{run-header-CC7VUTg9.css → run-header-Ccnr9k0X.css} +1 -1
  53. package/web/dist/assets/run-header-OhEYfuQX.js +2 -0
  54. package/web/dist/assets/save-cue-Cd3ZAPBS.js +1 -0
  55. package/web/dist/assets/select-r1KS5cjs.js +1 -0
  56. package/web/dist/assets/{session-context-section-BsT7MXjZ.js → session-context-section-PCOCiOTV.js} +2 -2
  57. package/web/dist/assets/settings-agent-picker-D0UKjmOj.js +1 -0
  58. package/web/dist/assets/settings-field-DP9sYv5a.js +1 -0
  59. package/web/dist/assets/settings-select-CCIMGnyA.js +1 -0
  60. package/web/dist/assets/settings-shell-BiPh5fg6.js +1 -0
  61. package/web/dist/assets/settings-shell-iSd4xMWS.css +1 -0
  62. package/web/dist/assets/{sidebar-section-ekWNCGBw.js → sidebar-section-DmOlTUs8.js} +1 -1
  63. package/web/dist/assets/skills-CSLg7E0x.js +1 -0
  64. package/web/dist/assets/{status-dot-DtAOFiIi.js → status-dot-BRzVlF2X.js} +1 -1
  65. package/web/dist/assets/switch-SP8pw5uU.js +1 -0
  66. package/web/dist/assets/task-changes-DuOb61QV.js +1 -0
  67. package/web/dist/assets/task-commits-CiGYJpqo.js +1 -0
  68. package/web/dist/assets/task-files-fJSQ4Abg.js +1 -0
  69. package/web/dist/assets/{task-github-item-aab_QTS3.js → task-github-item-CRxN82Yw.js} +1 -1
  70. package/web/dist/assets/{task-groups-Ziytm1Sm.js → task-groups-B3Z2qfE6.js} +1 -1
  71. package/web/dist/assets/task-thread-CqjKwRuV.js +9 -0
  72. package/web/dist/assets/task-thread-DzADOhZd.css +1 -0
  73. package/web/dist/assets/{tasks-table-wTQZb7nJ.js → tasks-table-Cm6YZBUB.js} +1 -1
  74. package/web/dist/assets/thread-state-DcHyKcQ-.js +4 -0
  75. package/web/dist/assets/use-hand-to-agent-state-B6h6kcQg.css +1 -0
  76. package/web/dist/assets/use-hand-to-agent-state-DuefXU2m.js +1 -0
  77. package/web/dist/assets/workflows-C6suai0L.css +1 -0
  78. package/web/dist/assets/workflows-CC3TZmBS.js +7 -0
  79. package/web/dist/assets/workspace-tools-kscvD6KC.js +1 -0
  80. package/web/dist/assets/worktrees-section-CoKimDBt.js +4 -0
  81. package/web/dist/index.html +21 -19
  82. package/web/dist/assets/accounts-section-W97a1ty2.js +0 -1
  83. package/web/dist/assets/activity-motion-zWlkG-V_.js +0 -2
  84. package/web/dist/assets/activity-route-CHfp3gWS.js +0 -1
  85. package/web/dist/assets/agent-config-section-Ulvfv3n6.js +0 -1
  86. package/web/dist/assets/agent-defaults-section-DuReu1Ob.js +0 -1
  87. package/web/dist/assets/appearance-DpMIBP4Y.js +0 -1
  88. package/web/dist/assets/archive-on-merge-field-C83q8HKD.js +0 -1
  89. package/web/dist/assets/automations-route-Kro31C3p.js +0 -1
  90. package/web/dist/assets/commit-diff-panel-CE7372Fz.js +0 -1
  91. package/web/dist/assets/diff-DUljAzi_.js +0 -3
  92. package/web/dist/assets/diff-controls-BSWICnsb.js +0 -1
  93. package/web/dist/assets/diff-view-CYusqV5H.js +0 -11
  94. package/web/dist/assets/dist-C28wFbz0.js +0 -1
  95. package/web/dist/assets/file-preview-Cj3QRSUt.js +0 -2
  96. package/web/dist/assets/format-BNCkW110.js +0 -1
  97. package/web/dist/assets/git-toolbar-B9t94bg6.js +0 -1
  98. package/web/dist/assets/github-D0U0_v8D.js +0 -1
  99. package/web/dist/assets/global-activity-route-Co9vGT5h.js +0 -1
  100. package/web/dist/assets/hourglass-B0lPAJvT.js +0 -1
  101. package/web/dist/assets/image-preview-CNBuRrK5.js +0 -1
  102. package/web/dist/assets/index-2DP8fWMQ.css +0 -1
  103. package/web/dist/assets/index-BNqZkH0S.js +0 -21
  104. package/web/dist/assets/live-refetch-CZb2VOyu.js +0 -1
  105. package/web/dist/assets/open-in-menu-mDtfa4ES.js +0 -1
  106. package/web/dist/assets/projects-section-ds7mvM9K.js +0 -1
  107. package/web/dist/assets/prompt-templates-section-DsBj0E0U.js +0 -1
  108. package/web/dist/assets/queries-dOBokhuR.js +0 -1
  109. package/web/dist/assets/repo-git-j8MdHS3x.js +0 -1
  110. package/web/dist/assets/reports-B7QAzibP.css +0 -1
  111. package/web/dist/assets/reports-C-Zop07b.js +0 -1
  112. package/web/dist/assets/resources-section-Cy0EShrb.js +0 -1
  113. package/web/dist/assets/run-header-Cd6Z_Juw.js +0 -2
  114. package/web/dist/assets/settings-agent-picker-B8jmxleN.js +0 -1
  115. package/web/dist/assets/settings-field-Bl6WuvGX.js +0 -1
  116. package/web/dist/assets/settings-shell-f9o6rKSB.js +0 -1
  117. package/web/dist/assets/settings-shell-xK8txSJo.css +0 -1
  118. package/web/dist/assets/skills-DweafQfi.js +0 -1
  119. package/web/dist/assets/switch-Bv2Zf1uU.js +0 -1
  120. package/web/dist/assets/task-changes-Db7mjsBc.js +0 -1
  121. package/web/dist/assets/task-commits-A0qKHFEp.js +0 -1
  122. package/web/dist/assets/task-files-Cf4k3GXd.js +0 -1
  123. package/web/dist/assets/task-thread-Di1O-QIZ.js +0 -9
  124. package/web/dist/assets/task-thread-DtQ6uGfQ.css +0 -1
  125. package/web/dist/assets/thread-state-BLpB8owZ.js +0 -4
  126. package/web/dist/assets/use-hand-to-agent-state-C7esPJ-N.css +0 -1
  127. package/web/dist/assets/use-hand-to-agent-state-Dkln0aUg.js +0 -1
  128. package/web/dist/assets/workflows-C21NystW.css +0 -1
  129. package/web/dist/assets/workflows-D0FFSZRo.js +0 -7
  130. package/web/dist/assets/workspace-tools-Bc-FDfxj.js +0 -1
  131. package/web/dist/assets/worktrees-section-KHsxVu0L.js +0 -4
@@ -1,4 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{$r as n,mr as r,pr as i}from"./project-scope-context-C912rTJP.js";import{_ as a,g as o,h as s,k as c,p as l,v as ee}from"./live-protocol-DMhTnCmf.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./app-window-CSHwDX9N.js";import{i as re}from"./format-BNCkW110.js";import{t as ie}from"./play-CmVAj_fu.js";import{t as ae}from"./square-terminal-B6RYYieR.js";import{t as oe}from"./button-BQ2y4XRB.js";import{t as se}from"./status-dot-DtAOFiIi.js";import{$n as ce,f as le,p as ue}from"./index-BNqZkH0S.js";var de=te(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),fe=te(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),u=e(),pe={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function me(e){let{text:t,...n}=ue(e),r={...n,status:t},i=pe[e.state](e);return i?{...r,action:i}:r}var he={"Run and open":ie,Open:ne,View:ce,"Start again":de};function ge({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=me(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=le(i.command),l=re(i.registeredAt);return(0,u.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,u.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,u.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,u.jsx)(fe,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,u.jsx)(`span`,{children:`worktree removed`}):l?(0,u.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,u.jsx)(se,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,u.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,u.jsx)(_e,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,u.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,u.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,u.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,u.jsx)(`span`,{children:`cwd`}),(0,u.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,u.jsx)(d,{icon:(0,u.jsx)(ae,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,u.jsx)(d,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function _e({entry:e,inPreview:t,action:n,onOpen:r}){let{server:i}=e,a=t&&n!==void 0&&!n.run,o=a?`In preview`:n?.label,s=a?ne:n?he[n.label]:null;return n&&o&&s?(0,u.jsxs)(oe,{variant:a||n.label===`View`||n.label===`Open`&&e.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>r?.({port:i.port,run:n.run}),children:[(0,u.jsx)(s,{"aria-hidden":`true`}),o]}):null}function d({icon:e,children:t}){return(0,u.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,u.jsx)(`span`,{children:t})]})}function f(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var p=120;function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h(e){let t=e.replace(/\s+/g,` `).trim();return t.length>p?`${t.slice(0,p-1)}…`:t}var g=e=>e===void 0?void 0:h(e);function _(e,...t){if(m(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function v(e,...t){return g(_(e,...t))}function ve(e){if(!m(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.join(` `)}}function y(e){if(!m(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)m(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function b(e){return v(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function x(e,t){return t?`${e} ${t}`:e}var S=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`spawnagent`,`task`],[`subtask`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function C(e,t){switch(e){case`notebookedit`:return _(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=y(t);return e.length===1?e[0]:void 0}default:return _(t,`file_path`,`filePath`,`path`)}}function ye(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:x(n,g(C(e,t)))};let r=y(t);return{toolKind:`edit`,title:x(n,r.length>1?`${r.length} files`:r[0])}}function w(e,t){return e===`imageview`?_(t,`path`):_(t,`file_path`,`filePath`,`path`)}function be(e,t){return{toolKind:`read`,title:x(e===`imageview`?`View image`:`Read`,g(w(e,t)))}}function T(e){return _(e,`pattern`,`query`)}function E(e,t){return e===`webfetch`?_(t,`url`):_(t,`query`)}function xe(e,t){return{toolKind:`fetch`,title:x(e===`webfetch`?`Fetch`:`Web search`,g(E(e,t)))}}var D=e=>_(e,`skill`,`name`,`command`),O=e=>_(e,`subagent_type`,`subagentType`);function Se(e,t){return e===`skill`?D(t):_(t,`prompt`,`task`,`description`)??O(t)}function Ce(e,t){if(e===`skill`){let e=g(D(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:v(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=g(O(t)),i=v(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function we(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=v(n,`server`),t=v(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:b(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?h(e):`Tool`,subtitle:b(n)}}function k(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(S.get(n)){case`execute`:return{toolKind:`execute`,title:x(`Ran`,g(ve(t))),subtitle:v(t,`description`)};case`edit`:return ye(n,t);case`read`:return be(n,t);case`search`:return{toolKind:`search`,title:x(`Search`,g(T(t))),subtitle:v(t,`path`)};case`fetch`:return xe(n,t);case`task`:return Ce(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return we(e,n,t)}}function Te(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(S.get(n)){case`execute`:return ve(t);case`edit`:return C(n,t);case`read`:return w(n,t);case`search`:return T(t);case`fetch`:return E(n,t);case`task`:return Se(n,t);default:return}}function Ee(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&c.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?a:o).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function De(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function Oe(e){let t=De(e);return t&&{seq:e.seq,...t}}function ke(e,t){let n=Ee(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?Oe(t):n===void 0?void 0:e}function Ae(e){let t;for(let n of e)t=ke(t,n);return t}function je(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function Me(){return{turns:[],itemsById:new Map,turnSeq:0,eventSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function A(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function j(e){return typeof e==`string`?e:void 0}function M(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function N(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Ne(e){return n.safeParse(e).data}function P(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function F(e){return e.turns.at(-1)??P(e)}function I(e,t){let n={origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq};return F(e).entries.push(n),n}var Pe=[/^run failed\s+[—-]\s+/,/^continue failed(?:\s+[—-]\s+|:\s+)/,/^step\s+"[^"]+"\s+failed:\s+/,/^step\s+\S+\s+failed\s+[—-]\s+/],Fe=/^(?:run failed\s+[—-]\s+|continue failed(?:\s+[—-]\s+|:\s+))/;function L(e){return e.trim().replace(/\s+/g,` `)}function R(e){let t=e.trim(),n=!0;for(;n;){n=!1;for(let e of Pe){let r=t.replace(e,``).trim();r!==t&&r!==``&&(t=r,n=!0)}}return L(t)}function z(e,t,n){if(t===e.primarySource&&n===e.primaryText||e.draft.entry.kind!==`note`)return;let r=e.draft.entry;r.details?.some(e=>e.source===t&&e.text===n)||(r.details=[...r.details??[],{source:t,text:n}])}function B(e,t,n){let r=e.failures;if(r)for(let e=r.length-1;e>=0;--e){let i=r[e];if(t!==``&&i.cause===t||t===``&&i.fatal&&(n===void 0||i.stepId===void 0||i.stepId===n))return i}}function V(e,t,n){let r=F(e),i=B(r,n.cause,n.stepId);if(i){i.draft.lastSeq=Math.max(i.draft.lastSeq,t.seq),n.fatal&&(i.fatal=!0),n.stepId!==void 0&&i.stepId===void 0&&(i.stepId=n.stepId),z(i,n.source,n.text);return}let a={draft:I(e,{kind:`note`,id:n.id,text:n.text,tone:`danger`}),cause:n.cause,primarySource:n.source,primaryText:n.text,...n.stepId===void 0?{}:{stepId:n.stepId},fatal:n.fatal};r.failures=[...r.failures??[],a]}function Ie(e,t,n){if(!Fe.test(n))return!1;let r=e.turns.at(-1);if(!r)return!1;let i=R(n);if(i===``)return!1;let a=B(r,i,j(t.stepId));return a?(a.draft.lastSeq=Math.max(a.draft.lastSeq,t.seq),a.fatal=!0,z(a,`lifecycle`,n),!0):!1}function Le(e,t,n){let r=e.turns.at(-1);if(!r)return;let i=B(r,n?R(n):``,j(t.stepId));i&&(i.fatal=!0)}function H(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function U(e,t){let n=j(e.stepId);return n===void 0?t:`${n}:${t}`}function Re(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function ze(e,t,n,r,i,a=!1){let o=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&o.kind!==`hook`&&Re(e,t);let s=e.itemsById.get(r);if(s&&s.turn===t){s.entry.entry=o,s.entry.lastSeq=e.eventSeq,s.entry.streaming=a;return}let c={origin:`v2`,entry:o,firstSeq:e.eventSeq,lastSeq:e.eventSeq,streaming:a};t.entries.push(c),e.itemsById.set(r,{turn:t,entry:c})}var W={"not-delivered":0,queued:1,delivered:2,consumed:3},Be=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function G(e){let t={};for(let n of Be)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function K(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Ve(e,t){let n=e.conversationEntries.get(t);n&&K(e,n)}function He(e,t,n,r){(W[e.delivery]<W.delivered||W[n]>W[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,G(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function q(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){He(i,t,n,r),K(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...G(t)};K(e,a),e.conversationEntries.set(t.id,a),I(e,a)}function Ue(e,t){let n=M(t.ts),r=j(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,I(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function We(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=j(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${j(t.event)?` (${j(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${j(t.error)??`unknown error`}`;I(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Ge(e,t){let n=j(t.webhookName)??`webhook`,r=j(t.title),i=`v1:${t.seq}`;if(t.ok===!1){I(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${j(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${M(t.ts)}${r?` — ${r}`:``}`;I(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function Ke(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${j(t.event)??`delivery`}${j(n.status)?` · ${j(n.status)}`:``}`;I(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function qe(e,t){let n=i.safeParse(t.server);if(!n.success)return;let r=e.previewByPort.get(n.data.port);r&&(r.turn.entries=r.turn.entries.filter(e=>e!==r.draft));let a=F(e),o={origin:`meta`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Je(e,t){let n=r.safeParse(t.state),i=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!i||i.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=i.draft.entry;i.draft.lastSeq=t.seq,i.draft.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function Ye(e,t){let n=s.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:c}=n.data;q(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:c})}function Xe(e,t){let n=ee.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Ve(e,r.requestId))}function Ze(e,t){let n=l.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){q(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}I(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Qe(e,t){let n=j(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=P(e,t.seq),a=N(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function $e(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:P(e,t.seq);r.turnId=j(t.turnId),r.startedAt??=N(t.ts)}function et(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function tt(e,t){H(e);let n=et(e,j(t.turnId));if(!n)return;let r=N(t.ts);n.completed={stopReason:j(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var J=new Set([`message`,`reasoning`,`tool`,`hook`]),nt=e=>J.has(e.kind);function rt(e){if(!(!A(e)||!J.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function Y(e,t){let n=rt(t.item);if(!n)return;let r=U(t,n.id),i=e.itemsById.get(r),a=t.type===`item.completed`,o=!a&&(n.kind===`message`||n.kind===`reasoning`);ze(e,i?.turn??F(e),n,r,a?N(t.ts):void 0,o)}function it(e,t){let n=e.itemsById.get(U(t,j(t.itemId)??``)),r=j(t.delta)??``;if(!n||r===``||!nt(n.entry.entry))return;let i=n.entry.entry;n.entry.lastSeq=t.seq,t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function at(e,t){let n=F(e),r=j(t.text)??``;if(r===``)return;let i=N(t.ts);n.entries.push({origin:`v1`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var ot=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function st(e){if(!A(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!A(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:ot.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var ct=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function lt(e,t){let n=F(e),r=j(t.tool)??`Tool`;if(n.v2Items||ct.has(r))return;let i=k(r,t.input),a=i.toolKind===`plan`?st(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:j(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o,firstSeq:t.seq,lastSeq:t.seq};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function ut(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function dt(e,t){let n=e.itemsById.get(j(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(n.entry.lastSeq=t.seq,r.status=`completed`,r.output=ut(t.result))}function ft(e,t,n,r){let i=j(t.message)??``;i!==``&&I(e,{kind:`note`,id:n,text:i,tone:r})}function pt(e,t){let n=j(t.message)??``;t.type===`lifecycle`&&n!==``&&Ie(e,t,n)||ft(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function mt(e,t){let n=j(t.message)??``;n!==``&&V(e,t,{id:`v1:${t.seq}`,source:`error`,text:n,cause:R(n),stepId:j(t.stepId),fatal:!1})}function ht(e,t){let n=j(t.message)??``;n!==``&&V(e,t,{id:`v2:${t.seq}`,source:`session.error`,text:n,cause:R(n),stepId:j(t.stepId),fatal:t.fatal===!0})}function gt(e,t){if(t.status!==`failed`)return;let n=j(t.stepId),r=j(t.error),i=r?` — ${r}`:``;V(e,t,{id:`v1:${t.seq}`,source:`step-end`,text:`step ${n??`?`} failed${i}`,cause:r?R(r):``,stepId:n,fatal:!0})}function _t(e,t){let n=j(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;I(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:j(t.text)??``,exitCode:r})}function vt(e,t){let n=Ne(t.provider),r=j(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||I(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function yt(e,t){let n=j(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=j(t.name);i!==void 0&&(r.name=i),I(e,r)}function bt(e,t){Array.isArray(t.entries)&&(F(e).planEntries=t.entries)}function xt(e,t){H(e);let n=j(t.reason)??`end_turn`,r=j(t.message);n===`error`&&Le(e,t,r),e.sessionEnded={reason:n,...r===void 0?{}:{message:r}}}var St=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function Ct(e){return A(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&St.has(e.kind)}function wt(e){if(!(!Array.isArray(e)||e.length===0||!e.every(Ct)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function Tt(e,t){let n=j(t.requestId),r=j(t.title),i=wt(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=j(t.itemId),o=j(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),I(e,s)}function Et(e,t){let n=e.permissions.get(j(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=j(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=j(t.reason);i!==void 0&&(n.reason=i)}function Dt(e,t){let n=Oe(t),r=n&&je(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};I(e,i),e.pendingAsk=i}function X(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function Ot(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=j(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function kt(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function At(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var jt=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Mt(e,t){let n=X(e,t);n&&jt.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function Nt(e,t){let n=X(e,t);if(n){if(t.source===`cezar`){Z(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},Pt=new Map([[`handoff`,Ue],[`webhook.failed`,We],[`webhook.dry-run`,Ke],[`webhook.report`,Ge],[`preview.server-registered`,qe],[`preview.server-state`,Je],[`conversation-message`,Ye],[`request-outcome`,Xe],[`agent-input`,Ze],[`user-message`,Qe],[`turn.started`,$e],[`turn.completed`,tt],[`item.started`,Y],[`item.updated`,Y],[`item.completed`,Y],[`item.delta`,it],[`text`,at],[`tool-call`,lt],[`tool-result`,dt],[`note`,pt],[`lifecycle`,pt],[`error`,mt],[`session.error`,ht],[`step-end`,gt],[`check-output`,_t],[`provider-auth-required`,vt],[`image`,yt],[`plan.updated`,bt],[`session.started`,e=>H(e)],[`session.ended`,xt],[`permission.requested`,Tt],[`permission.resolved`,Et],[`ask.requested`,Dt],[`worker-question-routed`,Ot],[`worker-question-fallback`,kt],[`worker-question-undelivered`,At],[`human-ask-closed`,Mt],[`human-input-delivered`,Nt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function Ft(e,t){e.eventSeq=t.seq,Pt.get(t.type)?.(e,t)}function It(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Lt(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=new Set;for(let e=t.length-1;e>=0;--e)n.add(t[e]);return[...n]}function Rt(e,t){let n=e?.turns.at(-1);if(!n)return!1;let r=R(t);return r!==``&&n.items.some(e=>e.kind===`note`&&e.tone===`danger`&&R(e.text)===r)}function zt(e,t,n){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t!==void 0&&t!==``&&!Rt(n,t)?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
2
- `)+1;/^CEZ:ASK[ \t]+.+$/.test(e.slice(t))&&(n=e.slice(0,t).trimEnd())}return n.includes(`CEZ:`)?n.split(`
3
- `).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
4
- `):n}var Bt=/\s*(?:^|\n)C(?:E(?:Z(?::.*)?)?)?$/,Vt=/[ \t]+CEZ(?::[A-Z]*)?$/;function Ht(e){return e.replace(Bt,``).replace(Vt,``)}function Ut(e,t,n){return t!==``&&e.some(e=>e.norm===``?n>e.firstSeq:e.norm.startsWith(t)||t.startsWith(e.norm))}function Wt(e,t){let n=e=>$(e,!0).replace(/\s+/g,``),r=new Set,i=[],a=[];for(let{origin:o,entry:s,firstSeq:c,streaming:l}of e.entries)if(o===`v2`&&s.kind===`message`){let e=n(s.text);r.add(e),i.push(e),t&&l===!0&&a.push({norm:e,firstSeq:c})}if(i.length===0)return;r.add(i.join(``));let o=[],s={entries:[],texts:[]},c=()=>{let e=n(s.texts.join(``)),t=s.entries[0],i=s.entries.length>=2&&r.has(e);if(t&&(i||Ut(a,e,t.firstSeq))){s={entries:[],texts:[]};return}o.push(...s.entries),s={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(s.entries.push(t),s.texts.push(t.entry.text)):(c(),o.push(t));c(),e.entries=o}function Gt(e,t){let n=new Set;for(let{origin:t,entry:r}of e.entries)t===`v2`&&r.kind===`message`&&n.add($(r.text,!0).trim());n.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&n.has($(e.entry.text,!0).trim()))),Wt(e,t))}function Kt(e){let t=e.failures?.filter(e=>e.fatal&&e.cause!==``);if(!t||t.length===0)return;let n=new Map;for(let e of t)n.set(e.cause,e);e.entries=e.entries.filter(e=>{if(e.entry.kind!==`message`||e.entry.role!==`assistant`)return!0;let t=$(e.entry.text,!0).trim();if(t===``)return!0;let r=n.get(L(t));return r?(r.draft.firstSeq=Math.min(r.draft.firstSeq,e.firstSeq),r.draft.lastSeq=Math.max(r.draft.lastSeq,e.lastSeq),z(r,`assistant`,t),!1):!0})}function qt(e){e.userMessage&&(e.entries=e.entries.filter(({entry:e})=>!f(e,`human`)))}function Jt(e){for(let t of e.conversationEntries.values())t.messageKind!==`request`||t.outcome!==void 0||t.delivery!==`not-delivered`&&(t.state!==void 0&&t.state!==`accepted`||(t.outcome={status:`pending`}))}function Yt(e,t,n){let{entry:r}=e;if(r.kind!==`message`||r.role!==`assistant`)return r;let i=$(r.text,t);return n&&e.streaming===!0?{...r,text:Ht(i),streaming:!0}:{...r,text:i}}function Xt(e,t){let n=t||e.entries.some(({entry:e})=>e.kind===`ask`);return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(e=>Yt(e,n,t)),itemSeqs:Zt(e.entries)}}function Zt(e){let t=new Map;for(let{entry:n,firstSeq:r,lastSeq:i}of e)t.has(n.id)||t.set(n.id,{first:r,last:i});return t}function Qt(e,t={}){let n=Me();for(let t of e)Ft(n,t);let r=n.turns.length-1;for(let[e,i]of n.turns.entries())i.v2Items&&Gt(i,t.activeTurn===!0&&e===r),Kt(i),qt(i);return Jt(n),{turns:n.turns.map((e,n)=>Xt(e,t.activeTurn===!0&&n===r)),...n.sessionEnded===void 0?{}:{sessionEnded:n.sessionEnded}}}export{Ae as a,f as c,de as d,zt as i,ge as l,Qt as n,Te as o,Lt as r,k as s,It as t,fe as u};
@@ -1 +0,0 @@
1
- [data-route=github]{width:100%}[data-slot=gh-workspace][data-stacked=true]{height:auto}[data-slot=gh-workspace][data-stacked=true] [data-slot=gh-panes]{flex-direction:column;flex:none;overflow:visible}[data-slot=gh-workspace][data-stacked=true] :is([data-slot=gh-list],[data-slot=gh-detail]){flex:none;width:100%;overflow:visible}[data-slot=gh-workspace][data-stacked=true] [data-slot=gh-list-resize-handle]{display:none}[data-slot=gh-hand]{border-color:color-mix(in oklch, var(--accent-strong) 24%, var(--border));background:var(--background);border-radius:12px;flex-direction:column;gap:16px;padding:20px;display:flex}[data-slot=gh-hand]>h3{margin:0}.gh-handoff-settings{flex-direction:column;gap:16px;display:flex}.gh-field{flex-direction:column;gap:6px;min-width:0;display:flex}.gh-field>span{color:var(--muted-foreground);font-size:11px}.gh-field>button,.gh-field>select{border:1px solid var(--border);background:var(--card);width:100%;min-height:44px;color:var(--foreground);text-align:start;border-radius:8px;padding-block:0;padding-inline:12px;font-size:12px}.gh-field>button>svg:last-child{margin-inline-start:auto}[data-slot=gh-custom-prompt]{min-height:150px;margin-block-start:0;padding:16px;font-size:14px}[data-slot=gh-merge-box]{border-radius:12px;margin-block:22px;padding:24px}[data-slot=gh-merge-box] select{flex:none;min-height:44px}@media (width<=767px){[data-slot=gh-panes]{flex-direction:column;display:flex}[data-slot=gh-list]{width:100%}[data-slot=gh-hand],[data-slot=gh-merge-box]{padding:16px}}[data-slot=gh-tabs]>a,.gh-utility{border:1px solid var(--border);background:var(--card);min-height:44px;color:var(--foreground);border-radius:8px;align-items:center;gap:8px;padding-block:10px;padding-inline:16px;font-size:12px;display:inline-flex}[data-slot=gh-tabs]>a[aria-current=page]{background:var(--accent-strong);color:var(--accent-strong-foreground);border-color:var(--accent-strong)}.gh-utility:disabled{opacity:.5}@media (width<=767px){[data-slot=gh-tabs]{flex-direction:column;align-items:flex-start}}[data-slot=gh-hand]>[data-slot=prompt-template-trigger]{border-radius:8px;align-self:flex-start;min-height:44px;padding-block:0;padding-inline:12px}@media (width<=767px){[data-slot=gh-list][data-mobile-preview] [data-slot=gh-row-item][data-compact-hidden]{display:none}}[data-slot=gh-merge-box]>div>svg{display:none}[data-slot=gh-merge-box] h3{font-size:18px;font-weight:400}[data-slot=gh-merge-box] ul{margin-block-start:20px;font-size:13px}[data-slot=gh-merge-box] ul>li+li{margin-block-start:16px}[data-slot=gh-merge-box] select+button{background:var(--accent-strong);color:var(--accent-strong-foreground)}[data-route=github] [data-slot=gh-tabs]>a{border:none;color:var(--muted-foreground);background:0 0;border-block-end:2px solid #0000;border-radius:0;padding-inline:0}[data-route=github] [data-slot=gh-tabs]>a[aria-current=page]{color:var(--accent-text);border-color:var(--accent-strong)}[data-route=github] [data-slot=gh-tabs]{flex-flow:wrap}[data-slot=gh-merge-confirm] [data-variant=primary]{background:var(--accent-strong);color:var(--accent-strong-foreground)}[data-slot=gh-merge-box]:not([data-eligibility=ready]) h3{color:var(--pending-strong)}[data-slot=gh-tabs] .gh-utility:first-of-type{margin-inline-start:auto}[data-route=github] [data-slot=gh-tabs]{border-block-end:1px solid var(--border);gap:24px}[data-slot=gh-header]>div:first-child{row-gap:8px}[data-slot=gh-search]{border-radius:8px;padding-inline-start:36px;font-size:12px}[data-slot=gh-rows]{gap:0}[data-slot=gh-row-item][data-divided]{border-block-start:1px solid var(--border)}[data-slot=gh-row]{border-radius:8px;padding-block:14px;padding-inline:12px}[data-slot=gh-row][data-kind=issue]>span:first-child>svg{display:none}[data-slot=gh-row][data-kind=issue]>span{padding-inline-start:0}[data-slot=gh-row]>span:first-child>span{white-space:normal;font-weight:400}[data-slot=gh-row]>span:nth-child(2){font-family:inherit;font-size:11px}[data-slot=gh-detail-inner]{padding:24px}[data-slot=gh-hand]{border-color:color-mix(in oklch, var(--accent-strong) 24%, var(--border))}.gh-prompt-field{gap:8px}.gh-prompt-field [data-slot=gh-custom-prompt]{border:1px solid var(--border);background:var(--card);border-radius:8px;min-height:96px;padding:12px}.gh-field [data-slot=account-pill]{width:100%}@media (width<=767px){[data-slot=gh-tabs] .gh-utility:first-of-type{margin-inline-start:0}[data-slot=gh-detail-inner]{padding:16px}}[data-slot=gh-row][data-kind=issue]>span:first-child{color:var(--foreground)}[data-slot=gh-row-labels]{order:1}[data-slot=gh-row-labels]>span+span:before{content:"·";margin-inline-end:4px}[data-slot=gh-row]>span:nth-child(2){order:2}[data-slot=gh-merge-box] [data-variant=primary]{background:var(--accent-strong);color:var(--accent-strong-foreground)}[data-slot=gh-merge-box][data-conflicting=true] h3{color:var(--conflict)}[data-slot=gh-bypass-warning]{color:var(--pending-strong)}@media (width<=767px){[data-route=github] [data-slot=gh-tabs]{gap:12px}[data-route=github] [data-slot=gh-filter-toolbar]>div:first-child{flex-basis:auto;width:100%}}@media (width>=768px){[data-route=github] [data-slot=gh-tabs]{gap:22px;min-height:0;margin-inline:-28px;padding-inline:28px}[data-route=github] [data-slot=gh-tabs]>a:not(.gh-utility){min-height:0;margin-block-end:-1px;padding-block:0 10px;padding-inline:0;font-size:13px;font-weight:600}[data-route=github] [data-slot=gh-tabs]>a:not([aria-current=page]){color:var(--muted-foreground);font-weight:500}[data-route=github] [data-slot=gh-tabs]>a[aria-current=page]{color:var(--foreground);border-color:var(--foreground)}[data-route=github] [data-slot=gh-tabs] .gh-utility{border-radius:7px;min-height:28px;margin-block-end:8px;padding-block:0;padding-inline:10px;font-size:12px}[data-route=github] [data-slot=gh-filter-toolbar]{gap:8px}[data-route=github] [data-slot=gh-filter-toolbar] :is(input,button,select){border-radius:7px;height:32px;min-height:32px;padding-block:0;font-size:12.5px}[data-route=github] [data-slot=gh-filter-toolbar] :is(button,select):not([aria-pressed=true]){color:var(--muted-foreground)}[data-route=github] [data-slot=gh-filter-toolbar] [data-slot=gh-search]{color:var(--foreground);padding-inline-start:32px}}[data-slot=engine-row-box]{width:100%;min-width:0;container:engine-row/inline-size}.engine-row{grid-template-columns:max-content minmax(0,1fr) max-content;gap:10px;display:grid}.engine-row>:is([data-slot$=pill],:has(>[data-slot$=pill])){min-width:0}.engine-row [data-slot$=pill]{border-color:var(--border);border-radius:9px;width:100%;min-width:0;min-height:44px}.engine-row [data-slot=model-pill]{justify-content:flex-start}.engine-row [data-slot$=pill]>svg:last-child{margin-inline-start:auto}@container engine-row (width>=550px){.engine-row:not(:has([data-slot=runner-pill])){grid-template-columns:minmax(0,1fr) max-content}}@container engine-row (width<=549.99px){.engine-row{grid-template-columns:max-content minmax(0,1fr)}.engine-row>:is([data-slot=model-pill],:has(>[data-slot=model-pill])){grid-area:2/1/auto/-1}.engine-row>:is([data-slot=effort-pill],:has(>[data-slot=effort-pill])){grid-area:1/2}.engine-row:not(:has([data-slot=runner-pill]))>:is([data-slot=effort-pill],:has(>[data-slot=effort-pill])){grid-column:1/-1}.engine-row :is([data-slot=runner-pill],[data-slot=effort-pill])>svg:first-child{display:none}}@media (width<=767px){.engine-row{grid-template-columns:max-content minmax(0,1fr)}.engine-row>:is([data-slot=model-pill],:has(>[data-slot=model-pill])){grid-area:2/1/auto/-1}.engine-row>:is([data-slot=effort-pill],:has(>[data-slot=effort-pill])){grid-area:1/2}.engine-row:not(:has([data-slot=runner-pill]))>:is([data-slot=effort-pill],:has(>[data-slot=effort-pill])){grid-column:1/-1}}
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{K as a,Mr as o,P as s,Z as c,at as l,di as u,q as d,r as f}from"./project-scope-context-C912rTJP.js";import{$t as p,A as m,Bt as h,St as g,Wt as _,_ as v,a as y,c as b,f as x,k as S,rn as C,sn as w}from"./queries-dOBokhuR.js";import{t as T}from"./useQuery-BOEhMTCg.js";import{n as E}from"./toaster-Bo5vCbz-.js";import{Y as D,c as O,ct as k,ft as A,g as j,it as M,k as N,l as ee,m as te,ot as P,r as F,tt as I,u as ne,ut as L,y as re}from"./design-icons-CzEoMH9c.js";import{t as R}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{a as ae,i as z}from"./format-BNCkW110.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-BQ2y4XRB.js";import{i as ce,r as le,t as ue}from"./popover-BPgUYFyu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-BVF6dIeS.js";import{t as V}from"./project-router-DucFIl_x.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-CDt1BsZy.js";import{d as xe,f as W,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{$ as Oe,F as ke,G as Ae,H as je,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,N as Le,P as Re,Sn as ze,U as Be,Un as G,W as K,X as Ve,Z as He,et as Ue,ir as We,it as Ge,j as Ke,nt as qe,rt as Je,xt as q,yn as Ye}from"./index-BNqZkH0S.js";import{t as Xe}from"./markdown-CzP2Mv9j.js";import{t as Ze}from"./textarea-vJt9undk.js";import{t as Qe}from"./diff-DUljAzi_.js";import{t as $e}from"./tab-link-Bh6CcIR7.js";var J=e(t(),1),Y=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function X({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-success`)}):e===`failing`?(0,Y.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-danger`)}):e===`pending`?(0,Y.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-warning`)}):(0,Y.jsx)(te,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function tt(e){return e?.available?e.mergeState:null}function nt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function rt(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function it(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function at(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ot(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function st(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ct(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function lt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function Z(e){return e?et[e]:`Merge`}function ut(e){return e===`conflicting`?`true`:void 0}function dt({check:e}){return(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(X,{state:e.state}),(0,Y.jsxs)(`span`,{children:[e.name,` · `,e.state,st(e.required)]})]}),e.url&&r(e.url)?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ft({reason:e}){return(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function pt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=rt(e),f=it(e.reviewDecision),p=at(e.mergeable);return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Y.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Y.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Y.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Y.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:f}),(0,Y.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:p}),(0,Y.jsxs)(`span`,{children:[`Conflicts: `,ot(e.mergeable)]})]}),e.checks.length===0?(0,Y.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Y.jsx)(dt,{check:e},e.name)),e.blockers.map(e=>(0,Y.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Y.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Y.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Y.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>l(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,Y.jsx)(`option`,{value:e,children:et[e]},e))}),(0,Y.jsx)(B,{disabled:!r,onClick:c,children:Z(t)})]}):null]})]})}function mt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Y.jsx)(ge,{open:r,onOpenChange:s,children:(0,Y.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Y.jsxs)(pe,{children:[(0,Y.jsxs)(he,{children:[Z(n),` pull request #`,e,`?`]}),(0,Y.jsx)(fe,{asChild:!0,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Y.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Y.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Y.jsxs)(de,{children:[(0,Y.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Y.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:Z(n)})]})]})})}function ht({number:e,onRunAgent:t}){let n=u(),r=x(),i=T({queryKey:h.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=tt(i.data),[o,s]=(0,J.useState)(null),[l,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),g=w({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>E(e instanceof Error?e.message:String(e),{tone:`danger`})}),_=nt(o,a),v=()=>({mergeState:h.githubMergeState(e),list:h.githubPages(50),comments:h.githubComments(`pr`,e),item:h.githubItem(`pr`,e),refStatus:r===void 0?void 0:h.githubRefStatusOf(r)}),y=w({mutationFn:t=>{if(!a||!_)throw Error(`No merge method is available.`);return c(e,{method:_,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{f(!1),E(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{E(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Y.jsx)(G,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ut(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(pt,{state:a,selectedMethod:_,overrideRules:p,mergeEnabled:lt(_,a,p),refreshPending:g.isPending,onRefresh:()=>g.mutate(h.githubMergeState(e)),onRunAgent:t,onConfirm:()=>f(!0),onMethodChange:s,onOverrideChange:m}),(0,Y.jsx)(mt,{number:e,state:a,selectedMethod:_,confirming:l,overrideRules:p,mergePending:y.isPending,mergeError:y.error,onOpenChange:f,onMerge:()=>y.mutate(v())})]}):(0,Y.jsx)(ft,{reason:ct(i.data)})}function gt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function _t(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function vt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function Q(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function yt({label:e,color:t,plain:n=!1}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:Q(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function bt(e){return e===`pr`?`pull request`:`issue`}function xt(e,t,n){return e===`pr`&&!!(t||n)}function St({backLink:e}){return e?(0,Y.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ct({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:t}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[z(e.createdAt),` ago`]}),n?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsx)(Kt,{count:n})]}):null,i?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,r(e.url)?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Y.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function wt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Y.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Y.jsx)($e,{to:q(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Y.jsx)($e,{to:q(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Y.jsx)(V,{to:q(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function Tt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)(yt,{label:e,color:t[e]},e)),n?(0,Y.jsx)(qt,{checks:n,url:e.url}):null]}):null}function Et({item:e,colors:t,body:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,Y.jsx)(Xe,{children:n}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Y.jsx)(kt,{item:e,colors:t})]})}function Dt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=bt(e.kind),d=y(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=xt(e.kind,p,m),g=r??e.comments;return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsx)(St,{backLink:i}),(0,Y.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Y.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Y.jsx)(Ct,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,Y.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,Y.jsx)(wt,{item:e,subNav:a,changes:l}),(0,Y.jsx)(Tt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,Y.jsx)(Ot,{item:e}):(0,Y.jsx)(Et,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,Y.jsx)(ht,{number:e.number,onRunAgent:o}):null,c]})}function Ot({item:e}){let t=u(),n=b(e.number),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),d=n.data,f=e=>d?.available?d.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(o),m=p.some(e=>e.path===c)?c:p[0]?.path??null,g=p.findIndex(e=>e.path===m),_=e=>{s(e);let t=f(e),n=m??c,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==c&&l(r)},v=async()=>{let n=d?.available?d.headSha:null,r=h.githubPrChanges(e.number),i=await a(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),E(`The reviewed revision changed.`))};if(n.isPending)return(0,Y.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!d)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!d.available)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:d.reason});let y=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),x=r(e.url)?`${e.url}/files`:null,S=p.find(e=>e.path===m);return(0,Y.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Y.jsxs)(`strong`,{children:[d.files.length,` changed files`]}),(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,d.additions]}),(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.deletions]}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:d.headSha,children:[`head `,d.headSha.slice(0,8)]}),(0,Y.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void v(),children:`Refresh`})]}),d.truncated?(0,Y.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[d.reason??`This response is incomplete.`,` `,x?(0,Y.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Y.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Y.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Y.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>_(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Y.jsx)(`select`,{"aria-label":`Select changed file`,value:m??``,onChange:e=>l(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,Y.jsx)(`option`,{children:e.path},e.path))}),(0,Y.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Y.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<=0,onClick:()=>l(p[g-1]?.path??null),children:(0,Y.jsx)(We,{})}),(0,Y.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<0||g>=p.length-1,onClick:()=>l(p[g+1]?.path??null),children:(0,Y.jsx)(ne,{size:16})})]}),p.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Qe,{files:y.filter(e=>e.path===m),wrap:!0,className:`min-w-0`}),S&&!S.patch?(0,Y.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,S.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=y(e.kind,e.number),r=n.data,i=(0,J.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(At(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsx)(G,{className:`mb-3 h-3 w-24`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(G,{className:`h-14 w-full`}),(0,Y.jsx)(G,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,Y.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Y.jsx)(Ht,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Y.jsx)(Nt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Mt({commits:e,colors:t}){let[n,r]=(0,J.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:$.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Y.jsx)(Nt,{event:e,colors:t},e.id))]}):(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:$.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:z(e[e.length-1].createdAt)})]})})}var $={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Nt({event:e,colors:t}){return(0,Y.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:$[e.kind]}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Y.jsx)(zt,{event:e,colors:t}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:z(e.createdAt)}),e.url?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Pt({event:e}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Y.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Y.jsx)(Bt,{checks:e.checks})]})}function Ft({event:e,colors:t}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Y.jsx)(`span`,{"data-slot":`gh-event-label`,style:Q(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Y.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function It({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Lt({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Rt={committed:e=>(0,Y.jsx)(Pt,{event:e}),labeled:(e,t)=>(0,Y.jsx)(Ft,{event:e,colors:t}),unlabeled:(e,t)=>(0,Y.jsx)(Ft,{event:e,colors:t}),assigned:e=>(0,Y.jsx)(It,{event:e}),unassigned:e=>(0,Y.jsx)(It,{event:e}),merged:()=>(0,Y.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Y.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Y.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Y.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Y.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Y.jsx)(Lt,{event:e})};function zt({event:e,colors:t}){return Rt[e.kind]?.(e,t)??null}function Bt({checks:e}){return e?(0,Y.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,Gt[e]),children:Wt[e]}):null}var Vt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Ht({comment:e}){let t=e.reviewState?Vt[e.reviewState]:null;return(0,Y.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(Ut,{url:e.avatarUrl,login:e.author}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Y.jsx)(`span`,{children:z(e.createdAt)}),t?(0,Y.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:i(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Y.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Y.jsx)(Xe,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Ut({url:e,login:t}){let[n,r]=(0,J.useState)(!1);return e&&!n?(0,Y.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Y.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Wt={passing:`✓`,failing:`✗`,pending:`○`},Gt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Kt({count:e}){return e?(0,Y.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function qt({checks:e,url:t}){let n=i(`text-[11px] font-medium`,Gt[e],t&&`hover:underline`),r=`${Wt[e]} checks ${e}`;return t?(0,Y.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Jt({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:i(`shrink-0 font-sans text-[11px] font-semibold`,Gt[e]),children:Wt[e]})}function Yt(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Xt(e,t=[]){let n=Yt(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Zt(t)),n}function Zt(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Qt(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function $t(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function en(e,t,n){let r=(n??``).trim();if(!r)return Xt(e,t);let i=Yt(e),a=r.startsWith(i)?i+Qt(r.slice(i.length),e):Qt(r,e),o=$t(a,e)?a:`${i}\n\n${a}`;return t.length?o+Zt(t):o}function tn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function nn(e,t,n,r,i={}){return t?{...i,workflow:t,task:en(e,n.map(e=>e.id),r)}:n.length?{...i,steps:tn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:en(e,[],r)}:{...i,workflow:`quick-task`,task:en(e,[],r)}}function rn(e){let t=g(),n=v(),r=p(),{runners:i,uninstalled:a,signedOut:o,accounts:s,repoAccount:c,accountFor:l}=ze(),u=n.data?.defaultRunner,d=Me(e.runner,i,u??i[0]??`claude`),f=n.data?.modelsLocked===!0,m=l(d,e.account),h=C(d,!0,m??c?.[d]),_=ke(f?null:e.model,d,r.data,n.data?.defaultModels,h.data),y=Ie(_,h.data);return{runner:d,runnerExplicit:e.runner!==null,model:_,effort:f?``:Re(e.effort,y),effortOptions:y,runners:i,uninstalled:a,signedOut:o,defaultRunner:u,canRun:t.isSuccess&&i.length>0,modelsLocked:f,providerPending:t.isPending,providerError:t.isError,accounts:s,account:m,repoAccount:c}}function an(e){return{runner:Fe(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function on(e){return{...an(e),...e.account?{agentProfile:e.account}:{}}}function sn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Ye(t,e))}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,J.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,J.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=rn(e),{runner:u,model:d,effort:f,effortOptions:m,runners:h,canRun:g,modelsLocked:_}=l,y=v(),b=p(),x=C(u,!0,l.account??l.repoAccount?.[u]),S=Le(u,b.data,x.data,[e.model,y.data?.defaultModels?.[u]]),w=n||!g,T=r?l.accounts:[],E=sn(l,T)?(0,Y.jsx)(Pe,{icon:(0,Y.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:h,uninstalled:l.uninstalled,signedOut:l.signedOut,value:u,accounts:T,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Y.jsx)(K,{icon:(0,Y.jsx)(re,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:S.find(e=>e.id===d).label,value:d,disabled:w,readOnly:_===!0,disabledHint:_?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,x.data);t({...e,model:n,effort:e.effort===null?null:Re(e.effort,r)})},options:S.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ke(u,b.data,x)},`model`),O=(0,Y.jsx)(K,{icon:(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===f)?.label??`auto`,value:f,disabled:w,readOnly:_===!0,disabledHint:_?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Y.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,Y.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Y.jsx)(Ae,{children:s?[E,O,D]:[E,D,O]})})}):(0,Y.jsxs)(Ae,{children:[E,D,O]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var mn=`cez-followup-prompt:`;function hn(e){try{return localStorage.getItem(mn+e)??``}catch{return``}}function gn(e,t){try{t===``?localStorage.removeItem(mn+e):localStorage.setItem(mn+e,t)}catch{}}function _n({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:c,engine:d,onEngineChange:f,queuedRunId:p,onQueued:m}){let g=u(),v=S(),y=e.kind===`pr`?`PR`:`issue`,b=rn(d),x=_(b.runner,b.account),C=o.filter(e=>x.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),T=C.length!==o.length,[D]=(0,J.useState)(()=>Yt(e)),[k,A]=(0,J.useState)(()=>hn(e.url)||D),j=(0,J.useRef)(null),M=(0,J.useRef)(null);(0,J.useEffect)(()=>{gn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,J.useMemo)(()=>qe(v.data?.promptTemplates),[v.data?.promptTemplates]),ee=e=>{let t=j.current,n=Ge({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=Ue(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},te=Oe(N,C.map(e=>e.id)),P=(0,J.useRef)(k);P.current=k;let F=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=Je(P.current,F.current,te,D);F.current=e.applied,e.text!==P.current&&A(e.text)},[te,D]);let I=w({mutationFn:async()=>!b.canRun||T?null:l(nn(e,i,C,k,on(b))),onSuccess:t=>{if(t===null)return;let n=t;n&&m(e.url,n.id),E(`Added to the queue — ${y} #${e.number}`),C.length>0&&v.data!==void 0&&s({skillUsage:C.reduce((e,t)=>Ee(e,t.id),v.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:h.uiState})).catch(()=>{}),gn(e.url,``),A(D),F.current=``,g.invalidateQueries({queryKey:h.runs.all})},onError:e=>E(e.message,{tone:`danger`})}),ne=e=>{Ve({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(),!I.isPending&&b.canRun&&I.mutate())},L=e=>c(o.some(t=>W(t)===W(e))?o.filter(t=>W(t)!==W(e)):[...o,Te(e)]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Y.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Y.jsx)(`span`,{children:`Instructions for the agent`}),(0,Y.jsx)(Ze,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:k,onChange:e=>A(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:ne,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Y.jsx)(Be,{templates:N,onInsert:ee}),(0,Y.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Workflow`}),(0,Y.jsx)(yn,{workflows:t,value:i,onChange:a})]}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Skills · select one or more`}),(0,Y.jsx)(xn,{skills:n,skillUsage:v.data?.skillUsage,selected:o,onToggle:L})]}),o.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Y.jsx)(vn,{skill:e,skills:n,unchecked:x.unchecked,onRemove:()=>L(e)},W(e)))}):null,T?(0,Y.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Y.jsx)(cn,{layout:`row`,pick:d,onChange:f,disabled:I.isPending||!b.canRun,accounts:!0}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Account`}),(0,Y.jsx)(bn,{resolved:b,disabled:I.isPending||!b.canRun,onPick:e=>f({...d,account:e})})]}),!b.providerPending&&!b.canRun?(0,Y.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[b.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Y.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Y.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Y.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Y.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:I.isPending||!b.canRun||T,onClick:()=>I.mutate(),children:[(0,Y.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:He()}),p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function vn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Y.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function yn({workflows:e,value:t,onChange:n}){let[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=(0,J.useRef)(null),l=xe(e,o);return(0,Y.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Y.jsx)(ce,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Y.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Y.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(be,{shouldFilter:!1,children:[(0,Y.jsx)(_e,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Y.jsxs)(ye,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Y.jsx)(ve,{children:`Nothing matches.`}):null,(0,Y.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Y.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function bn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:o,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Y.jsx)(K,{icon:(0,Y.jsx)(k,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function xn({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),d=(0,J.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>W(t)===W(e));return(0,Y.jsxs)(U,{value:W(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Y.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},W(e))};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Y.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Y.jsx)(ce,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:i(Ne,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Y.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(be,{shouldFilter:!1,children:[(0,Y.jsx)(_e,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Y.jsxs)(ye,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Y.jsx)(H,{children:(0,Y.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Y.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Y.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Y.jsxs)(Y.Fragment,{children:[f.length>0?(0,Y.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Y.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Y.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Sn=new WeakMap;function Cn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function wn(){let e=u(),{projectId:t}=f(),n=Sn.get(e);n||Sn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Cn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,J.useSyncExternalStore)(a,i,i),c=m(),l=rn(s.engine),d=_(l.runner,l.account),p=S(),h=c.data?.workflows;(0,J.useEffect)(()=>{h&&s.workflow!==null&&!h.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,h,s.workflow]);let g=(0,J.useMemo)(()=>Ce(d.data??[],p.data?.skillUsage),[d.data,p.data?.skillUsage]);return{...s,workflows:c,skillList:g,skillsUnchecked:d.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{Kt as a,jt as c,Q as d,vt as f,Jt as i,gt as l,_n as n,Dt as o,Xt as r,yt as s,wn as t,_t as u};
@@ -1 +0,0 @@
1
- [data-route=skills] h1,[data-route=workflows] h1{line-height:1.5}[data-route=skills] :is([data-slot=skills-list],[data-slot=skills-detail]),[data-route=workflows] :is([data-slot=wb-main],[data-slot=wb-aside],[data-slot=wb-auto-panel],[data-slot=wb-import-panel]){border-radius:10px}[data-slot=skills-section]>header a{gap:8px}[data-slot=skills-refresh]{color:var(--foreground);border-radius:8px;gap:8px;padding-inline:12px}[data-slot=skills-refresh] svg{width:16px;height:16px}[data-slot=skill-row]{gap:10px;min-height:0}[data-slot=skill-row]>span:nth-child(2){font-size:11px;line-height:1.65}[data-slot=skill-detail]{flex-direction:column;gap:16px;display:flex}[data-slot=skill-detail]>:is(p,section){margin-block-start:0}.sw-detail-source{background:color-mix(in oklch, var(--accent-strong) 10%, transparent);height:26px;color:var(--link-foreground);white-space:pre;border-radius:5px;align-items:center;padding-inline:8px;font-weight:500;display:inline-flex}.sw-detail-source [data-slot=skill-source]{color:inherit;font-size:inherit;font-weight:inherit;background:0 0;padding:0}[data-slot=skill-used-by]>p{margin-block-start:16px;line-height:1.6}[data-slot=skill-body]{margin-block-start:0;font-size:13px;line-height:1.65}[data-slot=skill-body] h1,[data-slot=skill-body] h2{font-size:18px;font-weight:600}[data-slot=skill-body] h3{font-size:14px;font-weight:600}[data-slot=wb-metadata]{gap:14px}[data-slot=wb-load]{margin-block-end:-6px}[data-slot=wb-load] label{font-size:11px}[data-slot=wb-name]{padding-inline:14px}[data-slot=wb-actions] button{border-radius:8px;gap:8px;padding-inline:12px}[data-slot=wb-actions] svg{width:16px;height:16px}[data-slot=wb-auto-panel]{border-color:color-mix(in oklch, var(--accent-strong) 35%, var(--border))}[data-slot=wb-auto-cancel]{border:1px solid var(--border);background:var(--card)}[data-slot=wb-palette]{gap:16px;margin-block-start:16px}[data-slot=wb-skill]{padding:0}[data-slot=wb-skill-add]{width:24px}[data-slot=wb-aside] h2{font-size:16px}[data-slot=wb-aside] h3{margin-block-start:16px}[data-slot=wb-step-grip] span{justify-content:center;align-items:center;width:26px;height:26px;padding:0;font-family:inherit;display:inline-flex}[data-slot=wb-step-heading]>div{font-weight:400}[data-slot=wb-main]>p:last-of-type{font-size:11px}[data-slot=wb-import-panel]>div{flex-direction:row-reverse;justify-content:flex-end;gap:12px;margin-block-start:16px}[data-slot=wb-import-run],[data-slot=wb-add-dialog] button[data-variant=primary]{background:var(--accent-strong);color:var(--accent-strong-foreground)}[data-slot=wb-import-cancel]{border:1px solid var(--border)}[data-slot=wb-import-panel]{flex-direction:column;display:flex}[data-slot=wb-import-error]{order:1;margin-block-start:16px;font-size:12px}@media (width<=767px){[data-route=skills],[data-route=workflows]{padding-block-end:32px}[data-route=workflows]>header{flex-direction:column;align-items:flex-start}[data-slot=skills-section]>header a{gap:10px;padding-inline:14px}[data-slot=wb-import-panel]{z-index:50;max-height:calc(100dvh - 57px);position:fixed;inset-block:57px auto;inset-inline:0;overflow-y:auto}}@container (width<=649px){[data-slot=skill-row][aria-current=page]{border-color:var(--border);background:0 0}}[data-route=skills] h1,[data-route=workflows] h1{letter-spacing:-.7px;line-height:1.2}[data-route=skills] header p,[data-route=workflows] header p{color:var(--soft-foreground);line-height:1.6}[data-slot=skill-row]{gap:8px;padding-block:14px}[data-slot=skill-row]:before{display:none}[data-slot=skill-row]:has([data-source=team])>span:first-child>span{font-weight:500;line-height:1.6}[data-slot=skill-row] [data-source=team]{font-weight:400}[data-slot=skill-row][aria-current=page],[data-slot=skill-row][data-highlighted],[data-slot=skills-section]>header a[aria-current=page]{background:var(--task-brand-selected)}[data-slot=skill-detail]>div:first-child{gap:16px}[data-slot=skill-detail]>div:first-child :is(h2,h3),[data-slot=skill-path]{line-height:1.6}[data-slot=skill-body] .thread-markdown{flex-direction:column;gap:16px;display:flex}[data-slot=skill-body] .thread-markdown>*{margin:0}[data-slot=skill-body] .thread-markdown :is(p,ul,ol){color:var(--muted-foreground)}[data-slot=skill-body] .thread-markdown ul{flex-direction:column;gap:16px;padding-inline-start:12px;font-size:12px;display:flex}[data-slot=skill-body] .thread-markdown li{margin:0;padding:0}[data-slot=wb-skill]>span{color:var(--muted-foreground);font-weight:400}@container (width<=649px){[data-slot=skill-row][aria-current=page]{background:0 0}}[data-slot=wb-import-panel]{gap:0}.sw-workflow-confirm{border-radius:12px;padding:24px}.sw-workflow-confirm [data-slot=alert-dialog-title]{font-size:20px;font-weight:400}.sw-workflow-confirm [data-slot=alert-dialog-footer]{justify-content:flex-start}.sw-workflow-confirm button{min-height:44px}@media (width<=767px){[data-slot=dialog-overlay]:has(+[data-slot=wb-import-panel]){background:0 0}[data-slot=wb-import-panel]{width:100%;max-width:100%;inset-block-start:57px;inset-inline-start:0;transform:none}}[data-slot=skills-section]>header a{font-size:13px;font-weight:600}.sw-detail-source,[data-slot=wb-step-grip] span{background:var(--task-brand-selected)}[data-route=workflows] button{border-radius:8px;font-size:12px;font-weight:500}:is([data-slot=wb-import-panel],[data-slot=wb-add-dialog],.sw-workflow-confirm) button{border-radius:8px;font-size:12px;font-weight:400}.sw-workflow-confirm [data-slot=alert-dialog-title]{line-height:1.6}.sw-workflow-confirm [data-slot=alert-dialog-description]{font-size:13px;line-height:1.6}.sw-workflow-confirm [data-slot=alert-dialog-header]{text-align:start;gap:16px}[data-slot=wb-step-actions] svg,[data-slot=wb-skill-add] svg{width:18px;height:18px}[data-slot=wb-save] svg,[data-slot=wb-auto-run] svg{width:16px;height:16px}[data-slot=skill-row] [data-slot=skill-source]{line-height:1.5}:is([data-slot=wb-import-panel],[data-slot=wb-add-dialog],.sw-workflow-confirm){box-shadow:none}[data-slot=wb-import-panel] [data-slot=dialog-title]{line-height:1.6}[data-slot=wb-add-dialog] [data-slot=dialog-header]{text-align:start}[data-slot=skills-section]>header a{padding-inline:11px}[data-slot=skill-body] .thread-markdown :is(h1,h2,h3){line-height:1.5}[data-slot=skill-body] .thread-markdown :is(p,ul,ol){line-height:1.6}[data-slot=skill-body] .thread-markdown ul{padding-inline-start:0;list-style-position:inside}:is([data-slot=skills-filter],[data-route=workflows] :is(input,textarea,select)){border-color:var(--border);border-radius:8px}:is([data-slot=skills-filter],[data-route=workflows] :is(input,textarea)):focus-visible{border-color:var(--ring)}[data-slot=wb-filter]{background:var(--card)}[data-slot=wb-metadata]>label{line-height:1.5}[data-slot=wb-auto-panel]{border-color:var(--composer-border);padding:19px}[data-slot=wb-auto-panel]>h2,[data-slot=wb-auto-panel]>p{line-height:1.6}[data-slot=wb-auto-panel]>div{gap:8px;margin-block-start:16px}[data-slot=wb-auto-text]{border-radius:8px;padding:15px}@media (width<=767px){[data-slot=skills-section]>header a{padding-inline:13px}}[data-slot=skill-body] .thread-markdown :is(h1,h2){font-size:18px}[data-slot=skill-body] .thread-markdown h3{font-size:14px}[data-slot=wb-step-heading] :is([data-slot=wb-step-grip],[data-slot=wb-step-actions]){width:26px;min-width:26px;height:26px;min-height:26px;position:relative}[data-slot=wb-step-heading] :is([data-slot=wb-step-grip],[data-slot=wb-step-actions]):after{content:"";position:absolute;inset:-9px}@media (width<=767px){[data-slot=wb-import-panel]{gap:18px;padding:19px}[data-slot=wb-import-panel]>*{margin:0}[data-slot=wb-import-panel] [data-slot=dialog-title]{line-height:1.5}[data-slot=wb-import-panel]>p{font-size:12px;line-height:1.5}[data-slot=wb-import-text]{border-radius:12px;padding:15px;line-height:1.8}[data-slot=wb-import-panel]>div{margin-block-start:0}[data-slot=wb-import-panel] button{height:50px;min-height:50px;padding-inline:15px}}[data-slot=wb-step-grip] span{border-radius:5px}[data-slot=wb-main],[data-slot=wb-aside]{padding:19px}[data-slot=wb-step]{padding:15px}[data-slot=wb-step-heading]>div{line-height:24px}[data-slot=wb-step-summary],[data-slot=wb-main]>p:first-child,[data-slot=wb-main] footer p,[data-slot=wb-aside]>p{line-height:19px}[data-slot=wb-main]>p:last-of-type{line-height:18px}[data-slot=wb-main] footer{padding-block-start:15px}[data-slot=wb-aside]>p{margin-block-start:16px}[data-slot=wb-aside] h3{line-height:21px}[data-slot=wb-load] label{line-height:16px}[data-slot=wb-new],[data-slot=wb-save],[data-slot=wb-auto-run]{gap:8px;padding-inline:12px}[data-slot=wb-actions] button,[data-slot=wb-main]>button,[data-slot=wb-step]>div:last-child button,[data-slot=wb-auto-cancel],[data-slot=wb-yaml-toggle]{gap:8px;padding-inline:11px}[data-slot=skills-refresh]{padding-inline:11px}[data-slot=skills-section]>header a{gap:10px;height:43px;min-height:43px;padding-inline:13px;position:relative}[data-slot=skills-section]>header a:after{content:"";position:absolute;inset-block:-.5px;inset-inline:0}[data-slot=skill-row]>span:first-child{font-size:13px;line-height:21px}[data-slot=skill-row]:has([data-source=team])>span:first-child>span{line-height:21px}[data-slot=skill-row]>span:nth-child(2){line-height:18px}[data-slot=skill-detail]>div:first-child :is(h2,h3){line-height:30px}[data-slot=skill-used-by]>h3,[data-slot=skill-used-by]>p{line-height:19px}[data-slot=skill-body] .thread-markdown p{line-height:21px}[data-slot=skill-body] .thread-markdown :is(ul,ol){line-height:19px}[data-slot=skill-body] .thread-markdown ul{list-style:none}[data-slot=skill-body] .thread-markdown ul>li:before{content:"• ";white-space:pre}@media (width<=639px){[data-slot=wb-main] footer{gap:14px}}@media (width>=768px){[data-slot=skill-detail]>div:first-child :is(h2,h3){line-height:38px}}[data-slot=wb-auto-panel]>h2{line-height:29px}[data-slot=wb-auto-panel]>p{line-height:21px}[data-slot=wb-auto-panel]>p:last-child{font-size:11px;line-height:18px}[data-slot=wb-auto-text]{line-height:22px}@container (width<=649px){[data-slot=skill-row][aria-current=page]{box-shadow:inset 0 -1px var(--border)}}[data-slot=wb-yaml-toggle] svg{margin-inline-end:0}[data-slot=wb-description]{field-sizing:content;color:var(--muted-foreground);padding:13px;font-size:13px;line-height:21px}
@@ -1,7 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{D as i,Nn as a,O as o,c as s,d as c,di as l}from"./project-scope-context-C912rTJP.js";import{A as u,Bt as d,Wt as f,k as ee,sn as p}from"./queries-dOBokhuR.js";import{h as m}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as h}from"./toaster-Bo5vCbz-.js";import{J as te,S as g,X as _,at as v,b as ne,c as re,ft as ie,i as y,l as ae,lt as b,n as oe,ot as se,st as x,tt as ce,v as S,x as C}from"./design-icons-CzEoMH9c.js";import{t as w}from"./button-BQ2y4XRB.js";import{i as T,p as le,r as E,t as D}from"./dropdown-menu-4e2iKSMT.js";import{i as O,o as k,r as A,s as ue,t as j}from"./dialog-BVF6dIeS.js";import{i as de,l as fe,o as pe}from"./skills-pM_PouEs.js";import{t as me}from"./centered-state-V15AR_qo.js";import{Gn as M,Gt as N,Ht as P,Jt as F,Kt as I,T as he,Ut as L,Vt as R,Wt as z,qt as B}from"./index-BNqZkH0S.js";import{_ as V,a as ge,c as _e,f as ve,g as ye,h as be,i as xe,m as H,n as Se,o as Ce,p as U,r as W,t as G,u as we}from"./sortable.esm-CAVTYaA3.js";import{t as K}from"./textarea-vJt9undk.js";var q=e(t(),1);function J(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Te(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ee(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function De(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Oe(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
2
- `)?[`${r}${e}: |`,...t.split(`
3
- `).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function ke(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Ae(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function Z(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function je(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Me(e){return[` - id: ${Y(e.id)}`,...ke(e),...e.prompt?X(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${Y(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Ae(e),...Z(e),...e.command?X(`command`,e.command,4):[],...je(e)]}function Ne(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Me(e))}else r.push(`skills: []`);return`${r.join(`
4
- `)}\n`}function Pe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Fe(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ie(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Le(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n();function Re({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(M,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(K,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function ze({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(w,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(w,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,Q.jsx)(ne,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(w,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:i,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(w,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:a,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Be({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(K,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(w,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(w,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function Ve({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,Q.jsx)(j,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(ue,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(O,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(K,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
5
- skills:
6
- - test-conventions
7
- - commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(w,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,Q.jsx)(w,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function He({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(M,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(nt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(it,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function Ue({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(tt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function We({open:e,onOpenChange:t,query:n,onQueryChange:r,matches:i,skillsCount:a,error:o,selectedSkill:s,onSelectSkill:c,stepsCount:l,onCloseAutoFocus:u,onCancel:d,onAdd:f}){return(0,Q.jsx)(j,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:u,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(k,{children:[(0,Q.jsx)(ue,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(O,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(M,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:n,onChange:e=>r(e.target.value)}),o===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[i.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:s===e.id,onChange:()=>c(e.id)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),i.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,o]}),n.trim()&&!i.some(e=>e.id===n.trim())?(0,Q.jsxs)(w,{onClick:()=>c(n.trim()),children:[`Use skill id “`,n.trim(),`” (unchecked)`]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(w,{variant:`outline`,onClick:d,children:`Cancel`}),(0,Q.jsx)(w,{variant:`primary`,disabled:!s||l>=8,onClick:()=>{s&&f(s)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),l>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ge({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(R,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(z,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(B,{children:[(0,Q.jsxs)(F,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(N,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(L,{children:`Keep the file`}),(0,Q.jsx)(P,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(R,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(z,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(B,{children:[(0,Q.jsxs)(F,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(N,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(L,{children:`Keep the file`}),(0,Q.jsx)(P,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function Ke(e){return e.name??e.skill??e.id}function qe(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Je(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Ye(e,t){return qe(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function Xe(e,t){return e.command?Je(e):e.skill?Ye(e,t):e.prompt??``}function Ze(e,t){return e.skill&&!t?`unknown`:null}function Qe(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function $e({index:e,title:t,badge:n,onRemove:i,gripProps:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...a,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,i?(0,Q.jsxs)(D,{children:[(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(w,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(E,{align:`end`,children:(0,Q.jsxs)(T,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:i,children:[(0,Q.jsx)(v,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function et({index:e,onMoveUp:t,onMoveDown:n}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(w,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(w,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!n,onClick:n,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function tt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.id===e.skill),u=Ke(e),d=Xe(e,l),f=Ze(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)($e,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:Qe(e)}),c?null:(0,Q.jsx)(et,{index:t,onMoveUp:o,onMoveDown:s})]})}function nt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=fe(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(rt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function rt({skill:e,inFlow:t,onAdd:n}){let{attributes:i,listeners:a,setNodeRef:o,isDragging:s}=U({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...i,...a,children:[(0,Q.jsxs)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,de(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(te,{"aria-hidden":`true`,className:`size-3.5`})})]})}function it({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var at=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function ot(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function st(){let{name:e}=m();return(0,Q.jsx)(ct,{routeName:e},e??``)}function ct({routeName:e}){let t=u(),n=f(),r=ee(),m=l(),[g,_]=(0,q.useState)(null),[v,ne]=(0,q.useState)(``),[ie,y]=(0,q.useState)(!1),[ae,b]=(0,q.useState)(``),[oe,x]=(0,q.useState)(null),[ce,S]=(0,q.useState)(!1),[C,T]=(0,q.useState)(``),[le,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(``),[ue,j]=(0,q.useState)(!1),[de,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=n.data??[],V=pe(B,r.data?.skillUsage),xe=fe(V,ae,r.data?.skillUsage);(0,q.useEffect)(()=>{if(g!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);_(r?ot(r):$())},[g,t.data,e]);let H=e=>_(t=>t===null?t:{...t,steps:e}),U=p({mutationFn:e=>i(e),onSuccess:e=>{_({name:e.name,description:e.description??``,steps:e.steps}),S(!1),T(``),E(``),h(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),W=p({mutationFn:e=>o(e),onSuccess:e=>{_(t=>{let n=t??$(),{name:r,steps:i}=Ie(e,n.name);return{...n,name:r,steps:i}}),O(!1),A(``),h(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??g?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=p({mutationFn:e=>s({...Le(g?.name??``,g?.description??``,g?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{j(!1),h(`Saved — ${e.path.split(`/`).pop()??e.path}`),m.invalidateQueries({queryKey:d.workflows})},onError:e=>{e instanceof a&&e.exists===!0?j(!0):h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),K=p({mutationFn:e=>c(e),onSuccess:(e,t)=>{M(!1),h(`Deleted "${t}".`),_($()),m.invalidateQueries({queryKey:d.workflows})},onError:e=>{M(!1),h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),J=ye(be(we,{activationConstraint:{distance:4}}),be(_e,{coordinateGetter:Se}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(me,{icon:(0,Q.jsx)(se,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(g===null)return(0,Q.jsx)(he,{});let Y=g.steps,X=g.name.trim(),ke=z.find(e=>e.name===X&&e.source===`file`),Ae=Ne(g.name,g.description,Y),Z=(e,t=Y.length)=>{if(Y.length>=8){h(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(Ee(Y,Te(e,Y),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(w,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>_($()),children:[(0,Q.jsx)(te,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(ge,{sensors:J,collisionDetection:ve,onDragStart:e=>{let t=e.active.data.current;P(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{P(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===at?Y.length:Y.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?Y.length:e);return}if(n.id===t.id)return;let i=Y.findIndex(e=>e.id===t.id),a=Y.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(De(Y,i,a))},onDragCancel:()=>{P(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(Re,{workflows:z,draft:g,trimmedName:X,nameRef:L,onDraft:_,onLoadWorkflow:e=>_(ot(e))}),(0,Q.jsx)(ze,{savedFile:ke,autoOpen:D,onImportToggle:()=>{E(``),O(!1),S(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Pe(g.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{S(!1),O(e=>!e)},onDeleteRequest:()=>M(!0)}),D?(0,Q.jsx)(Be,{text:k,onTextChange:A,pending:W.isPending,onRun:()=>{let e=k.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{O(!1),A(``)}}):null,(0,Q.jsx)(Ve,{open:ce,onOpenChange:S,text:C,onTextChange:T,error:le,pending:U.isPending,onRun:()=>{let e=C.trim();e!==``&&U.mutate(e)},onCancel:()=>{S(!1),T(``),E(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,Y.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Fe(Y)})]}),(0,Q.jsx)(lt,{steps:Y,skills:B,dragging:N!==null,overId:F,activeStepId:N?.type===`step`?N.step.id:null,onRemove:e=>H(Oe(Y,e)),onMove:(e,t)=>H(De(Y,e,t))}),(0,Q.jsxs)(w,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{x(null),b(``),y(!0)},children:[(0,Q.jsx)(te,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(w,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:G.isPending,onClick:()=>{if(X===``){L.current?.focus();return}if(Y.length===0){h(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(He,{paletteSkills:V,query:v,onQueryChange:ne,error:n.isError?n.error.message:null,inFlow:new Set(Y.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(Ce,{children:(0,Q.jsx)(dt,{dragging:N,steps:Y,skills:B})})]}),(0,Q.jsx)(We,{open:ie,onOpenChange:y,query:ae,onQueryChange:b,matches:xe,skillsCount:B.length,error:n.isError?n.error.message:null,selectedSkill:oe,onSelectSkill:x,stepsCount:Y.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>y(!1),onAdd:e=>{Z(e),y(!1)}}),(0,Q.jsx)(Ge,{trimmedName:X,savedFile:ke,overwriteOpen:ue,onOverwriteDismiss:()=>j(!1),deleteOpen:de,onDeleteDismiss:()=>M(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>K.mutate(X)})]})}function lt({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=H({id:at}),u=n&&i===at;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(G,{items:e.map(e=>e.id),strategy:xe,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,c)=>(0,Q.jsx)(ut,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function ut({step:e,index:t,insertBefore:n,onRemove:i,onMoveUp:a,onMoveDown:o}){let s=f(e.runner,e.agentProfile),{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:ee,isDragging:p}=W({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:V.Transform.toString(d),transition:ee},className:r(`relative`,p&&`opacity-40`),children:[n?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(tt,{step:e,index:t,skills:s.data??[],onRemove:i,onMoveUp:a,onMoveDown:o,gripProps:{...c,...l}})]})}function dt(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=f(t?.runner,t?.agentProfile,!!t);return(0,Q.jsx)(Ue,{...e,skills:t?n.data??[]:e.skills})}export{st as WorkflowsRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{vt as r,xt as i,zt as a}from"./queries-dOBokhuR.js";import{n as o}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-wTQZb7nJ.js";import{n as s}from"./toaster-Bo5vCbz-.js";import{t as c}from"./button-BQ2y4XRB.js";import{t as l}from"./status-dot-DtAOFiIi.js";import{r as u,t as d}from"./agents-settings-path-7X6_cvUg.js";import{Hn as f,Kn as p,Qt as m,Wn as h,Xt as g,Yt as _,Zt as v}from"./index-BNqZkH0S.js";var y=e(t(),1),b=n();function x({health:e,projects:t,repository:n,onAction:r}){return(0,b.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,b.jsx)(`h2`,{id:`add-project-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Add project`}),(0,b.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`}),(0,b.jsxs)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,b.jsx)(`dt`,{children:`Local folder`}),(0,b.jsx)(`dd`,{className:`min-w-0 break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,b.jsx)(`dt`,{children:`Repository`}),(0,b.jsx)(`dd`,{className:`min-w-0 break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,b.jsx)(`dt`,{children:`Checkout folder`}),(0,b.jsx)(`dd`,{className:`min-w-0 break-all`,children:t.data.projectsDir})]}):null]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>r(`local`),children:`Open local folder`}),(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function S({health:e,copying:t,onCopy:n}){return(0,b.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`h2`,{id:`tools-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Tools diagnostics`}),(0,b.jsx)(o,{to:d,"data-slot":`tools-settings`,className:_,children:`Tool settings ›`})]}),(0,b.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`}),e.isError?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,b.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,b.jsx)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let t=g(e);return(0,b.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,b.jsxs)(`dt`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(l,{tone:m(e)}),(0,b.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),(0,b.jsxs)(`dd`,{className:`flex min-w-0 flex-1 items-center gap-x-3 text-muted-foreground`,children:[(0,b.jsxs)(`span`,{className:`min-w-0 break-words`,children:[v(e),e.version?` · ${e.version}`:``]}),e.available?null:(0,b.jsx)(o,{to:u(e.name),"data-slot":`tool-setup`,className:`${_} ml-auto`,children:`Set up ›`})]}),t?(0,b.jsx)(`dd`,{"data-slot":`tool-hint`,className:`basis-full min-w-0 break-words pl-[15px] text-xs leading-snug text-muted-foreground`,children:t}):null]},e.name)})}):null,e.data?.checks.length===0?(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:!e.data||t,onClick:()=>void n(),children:t?`Copying…`:`Copy diagnostics`})]})]})}function C(){let e=r(),t=i(),n=a(e.data?.repo?.remote),[o,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1);return(0,b.jsxs)(`div`,{"data-route":`workspace-tools`,className:`w-full space-y-[22px] px-9 py-9 max-md:px-[18px] max-md:py-6`,children:[(0,b.jsx)(`h1`,{className:`text-[28px] font-normal leading-[1.5] max-md:text-[24px]`,children:`Workspace tools`}),(0,b.jsx)(x,{health:e,projects:t,repository:n,onAction:c}),(0,b.jsx)(S,{health:e,copying:l,onCopy:async()=>{if(!(!e.data||l)){u(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),s(`Diagnostics copied`)}catch{s(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{u(!1)}}}}),o===`new`?(0,b.jsx)(f,{open:!0,onOpenChange:e=>{e||c(null)}}):null,o===`local`?(0,b.jsx)(p,{open:!0,onOpenChange:e=>{e||c(null)}}):null,o===`clone`?(0,b.jsx)(h,{open:!0,onOpenChange:e=>{e||c(null)}}):null]})}export{C as WorkspaceToolsRoute};
@@ -1,4 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{Fr as t,M as n,Nn as r,Pr as i,di as a}from"./project-scope-context-C912rTJP.js";import{Bt as o,_ as s,sn as c,vt as l}from"./queries-dOBokhuR.js";import{n as u}from"./toaster-Bo5vCbz-.js";import{u as d}from"./design-icons-CzEoMH9c.js";import{t as f}from"./button-BQ2y4XRB.js";import{t as p}from"./project-router-DucFIl_x.js";import{t as m}from"./centered-state-V15AR_qo.js";import{Qn as h,_n as g}from"./index-BNqZkH0S.js";import{n as _,r as v,t as y}from"./remote-settings-notice-BD9jRcE6.js";import{n as b}from"./saved-draft-BwzBc-_Y.js";import{t as x}from"./settings-field-Bl6WuvGX.js";import{n as S}from"./project-location-c1oHm2yu.js";var C=e();function w({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,C.jsxs)(C.Fragment,{children:[t===0&&i===null?(0,C.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-sm text-foreground`,children:e.empty}):null,o,n===!1?(0,C.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,C.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,C.jsxs)(C.Fragment,{children:[`the project’s `,(0,C.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,C.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,C.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,C.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-[11px] text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,C.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-[11px] text-danger`,children:a})]})}function T(e,n){let r=e.split(`
2
- `).map(e=>e.trim()).filter(e=>e!==``),a=Number(n);return{commands:r,timeoutSeconds:a,invalid:r.length>20?`Enter at most 20 commands.`:r.some(e=>e.length>4e3)?`Keep each command under ${i.toLocaleString(`en-US`)} characters.`:n.trim()===``||!Number.isInteger(a)||a<1||a>7200?`Enter a whole number of seconds from 1 to ${t}.`:null}}var E={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in every new task and worker worktree before the agent starts, in order, stopping at the first failure. Leave commands empty to skip setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`,saved:`Worktree setup saved`,cleared:`Worktree setup cleared`,save:`Save setup`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in a worker’s worktree when the worker is destroyed, before destroy stops the worker’s processes, in order, stopping at the first failure. A failure is recorded on the worker and destroy goes on. Leave commands empty to skip teardown.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`,saved:`Worktree teardown saved`,cleared:`Worktree teardown cleared`,save:`Save teardown`}};function D({config:e,copy:i}){let s=a(),d=l(),p=v(),m=S(),h=m===null?null:`${m.replace(/\/$/,``)}/.ai/cezar/config.json`,y=d.data?.capabilities?.settingsAdmin===!0,E=e[i.key],D=e[i.issueKey],O=E?.commands??[],k=E?.timeoutSeconds??900,[A,j]=b(O.join(`
3
- `)),[M,N]=b(String(k)),{commands:P,timeoutSeconds:F,invalid:I}=T(A,M),L=P.length===O.length&&P.every((e,t)=>e===O[t])&&(P.length===0||F===k),R=D===null&&L;g(y&&!L);let z=c({mutationFn:e=>n(e),onSuccess:e=>{s.setQueryData(o.config,e),j(P.join(`
4
- `)),u(P.length===0?i.cleared:i.saved)},onError:e=>{u(e.message,{tone:`danger`}),e instanceof r&&e.status===409&&p()}}),B=()=>z.mutate({[i.key]:P.length===0?null:{commands:P,...F===900?{}:{timeoutSeconds:F}}}),V=`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 read-only:bg-muted read-only:text-muted-foreground`;return(0,C.jsxs)(x,{title:i.title,hint:i.hint,children:[(0,C.jsx)(_,{risk:`These commands run on the machine running Squawk`}),(0,C.jsxs)(w,{copy:i,savedCommandCount:O.length,settingsAdmin:d.data?.capabilities?.settingsAdmin,configPath:h,issue:D,invalid:I,children:[(0,C.jsx)(`textarea`,{"data-slot":`${i.slot}-commands`,"data-reports-dirty":``,"aria-label":i.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:A,readOnly:!y,disabled:z.isPending,onChange:e=>j(e.target.value),className:`${V} min-h-24 w-full resize-y font-mono text-[13px] leading-relaxed`}),(0,C.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`Example only: `,(0,C.jsx)(`code`,{children:i.example}),`. Commands run only after they are saved.`]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-soft-foreground`,children:[(0,C.jsx)(`span`,{children:`Timeout per command`}),(0,C.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:t,step:1,"data-slot":`${i.slot}-timeout`,"data-reports-dirty":``,value:M,readOnly:!y,disabled:z.isPending,onChange:e=>N(e.target.value),className:`${V} min-h-11 w-28 md:min-h-0`}),(0,C.jsx)(`span`,{children:`seconds`})]}),(0,C.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 self-start md:min-h-0`,"data-action":`${i.slot}-save`,disabled:!y||R||I!==null||z.isPending,onClick:B,children:i.save})]})]})]})}var O=0,k=1e3;function A(){let e=s();return e.isPending?(0,C.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,C.jsx)(m,{icon:(0,C.jsx)(h,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,C.jsx)(j,{config:e.data})}function j({config:e}){let t=a(),r=c({mutationFn:e=>n(e),onSuccess:e=>t.setQueryData(o.config,e),onError:e=>u(e.message,{tone:`danger`})}),[i,s]=b(String(e.worktreeRetention)),l=Number(i),m=i.trim()===``||!Number.isInteger(l)||l<O||l>k,h=e.worktreeRetention===(m?-1:l);return g(!h),(0,C.jsxs)(`div`,{"data-slot":`worktrees-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,C.jsxs)(x,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are reclaimed to free disk; their branch is kept so the work stays recoverable. 0 = unlimited. In-review and running tasks are never reclaimed, so the count on disk can exceed this.`,children:[(0,C.jsxs)(`div`,{"data-reports-dirty":``,className:`flex items-center gap-2`,children:[(0,C.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:O,max:k,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:i,disabled:r.isPending,onChange:e=>s(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,C.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,C.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,className:`self-start`,"data-action":`resources-save-retention`,disabled:h||m||r.isPending,onClick:()=>r.mutate({worktreeRetention:l},{onSuccess:()=>{t.invalidateQueries({queryKey:o.worktrees}),u(l===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${l} finished worktree${l===1?``:`s`}`)}}),children:`Save retention`})]}),m?(0,C.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,O,` to `,k,` (0 = unlimited).`]}):(0,C.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:l===0?`Keeping every finished worktree.`:`Keeping the last ${l} finished worktree${l===1?``:`s`} on disk.`})]}),(0,C.jsx)(D,{config:e,copy:E.setup}),(0,C.jsx)(D,{config:e,copy:E.teardown}),(0,C.jsxs)(p,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,C.jsx)(d,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}export{A as WorktreesSection};