@qodeca/xezar 0.11.2 → 0.13.0

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 (138) hide show
  1. package/README.md +69 -18
  2. package/dist/agent-config/catalog.d.ts +10 -0
  3. package/dist/agent-config/catalog.js.map +1 -1
  4. package/dist/automations/coordinator.js +8 -0
  5. package/dist/automations/coordinator.js.map +1 -1
  6. package/dist/automations/types.d.ts +2 -0
  7. package/dist/contract/automations.d.ts +8 -0
  8. package/dist/contract/events.test.d.ts +1 -0
  9. package/dist/contract/index.js +87 -3
  10. package/dist/contract/runs.d.ts +25 -0
  11. package/dist/contract/runs.test.d.ts +1 -0
  12. package/dist/contract/skills.d.ts +1 -0
  13. package/dist/contract/workflows.d.ts +6 -0
  14. package/dist/contract/workspace.d.ts +37 -4
  15. package/dist/core/agent-env.js +8 -1
  16. package/dist/core/agent-env.js.map +1 -1
  17. package/dist/core/agent-runner.d.ts +13 -0
  18. package/dist/core/agent-runner.js +22 -0
  19. package/dist/core/agent-runner.js.map +1 -1
  20. package/dist/core/backend-detect.js +11 -1
  21. package/dist/core/backend-detect.js.map +1 -1
  22. package/dist/core/claude-cli-runner.js +8 -2
  23. package/dist/core/claude-cli-runner.js.map +1 -1
  24. package/dist/core/codex-app-server-runner.js +6 -2
  25. package/dist/core/codex-app-server-runner.js.map +1 -1
  26. package/dist/core/opencode-server-runner.d.ts +12 -0
  27. package/dist/core/opencode-server-runner.js +326 -17
  28. package/dist/core/opencode-server-runner.js.map +1 -1
  29. package/dist/core/pi-model-catalog.d.ts +52 -0
  30. package/dist/core/pi-model-catalog.js +135 -0
  31. package/dist/core/pi-model-catalog.js.map +1 -0
  32. package/dist/core/pi-runner.d.ts +3 -0
  33. package/dist/core/pi-runner.js +139 -12
  34. package/dist/core/pi-runner.js.map +1 -1
  35. package/dist/core/pi-ui-mapper.js +39 -3
  36. package/dist/core/pi-ui-mapper.js.map +1 -1
  37. package/dist/core/runner-model-catalog.js +11 -2
  38. package/dist/core/runner-model-catalog.js.map +1 -1
  39. package/dist/index.js +2 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/paths.d.ts +7 -0
  42. package/dist/paths.js +8 -0
  43. package/dist/paths.js.map +1 -1
  44. package/dist/runs/event-corrections.d.ts +12 -0
  45. package/dist/runs/event-corrections.js +141 -0
  46. package/dist/runs/event-corrections.js.map +1 -0
  47. package/dist/runs/event-history.d.ts +5 -1
  48. package/dist/runs/event-history.js +66 -5
  49. package/dist/runs/event-history.js.map +1 -1
  50. package/dist/runs/project-writer.d.ts +11 -0
  51. package/dist/runs/project-writer.js +115 -0
  52. package/dist/runs/project-writer.js.map +1 -0
  53. package/dist/runs/store.d.ts +2 -0
  54. package/dist/runs/store.js +13 -2
  55. package/dist/runs/store.js.map +1 -1
  56. package/dist/runs/task-markers.d.ts +4 -0
  57. package/dist/runs/task-markers.js +63 -5
  58. package/dist/runs/task-markers.js.map +1 -1
  59. package/dist/server/capabilities.d.ts +7 -5
  60. package/dist/server/capabilities.js +11 -7
  61. package/dist/server/capabilities.js.map +1 -1
  62. package/dist/server/project-context.js +2 -0
  63. package/dist/server/project-context.js.map +1 -1
  64. package/dist/server/server.d.ts +199 -47
  65. package/dist/server/server.js +195 -11
  66. package/dist/server/server.js.map +1 -1
  67. package/dist/workflows/run.d.ts +67 -2
  68. package/dist/workflows/run.js +190 -44
  69. package/dist/workflows/run.js.map +1 -1
  70. package/dist/workflows/types.d.ts +41 -0
  71. package/dist/workflows/types.js +72 -0
  72. package/dist/workflows/types.js.map +1 -1
  73. package/dist/workspace/config.d.ts +42 -0
  74. package/dist/workspace/config.js +132 -3
  75. package/dist/workspace/config.js.map +1 -1
  76. package/dist/workspace/semaphore.d.ts +63 -3
  77. package/dist/workspace/semaphore.js +76 -3
  78. package/dist/workspace/semaphore.js.map +1 -1
  79. package/package.json +3 -3
  80. package/web/dist/assets/{alert-dialog-CGskMvgc.js → alert-dialog-BVsVcbFy.js} +1 -1
  81. package/web/dist/assets/arrow-down-CYgAlZtW.js +1 -0
  82. package/web/dist/assets/arrow-left-BOqE0a3k.js +1 -0
  83. package/web/dist/assets/{centered-state-B_V_Ai2h.js → centered-state-Djgly6Ni.js} +1 -1
  84. package/web/dist/assets/chevron-right-Cc9BWnbN.js +1 -0
  85. package/web/dist/assets/{collapsible-B_8uYwHb.js → collapsible-DZ4D-DHG.js} +1 -1
  86. package/web/dist/assets/{commit-list-C4Dv6vUL.js → commit-list-B-z1JL9G.js} +1 -1
  87. package/web/dist/assets/{compare-variants-et0mplGi.js → compare-variants-CdS8r8E2.js} +1 -1
  88. package/web/dist/assets/{diff-CbozNUJq.js → diff-BKew9rQX.js} +2 -2
  89. package/web/dist/assets/{diff-stat-btAmKFJr.js → diff-stat-D0mc5V6Z.js} +1 -1
  90. package/web/dist/assets/{diff-view-BpFTcG3R.js → diff-view-xpIcuLIC.js} +1 -1
  91. package/web/dist/assets/{dropdown-menu-Z80KMInL.js → dropdown-menu-CEQziH7X.js} +1 -1
  92. package/web/dist/assets/editable-title-BCX3T2BY.js +1 -0
  93. package/web/dist/assets/{ellipsis-vertical-Bmi2u2TG.js → ellipsis-vertical-ByVdDc4z.js} +1 -1
  94. package/web/dist/assets/{file-DKoYWRsv.js → file-xBSB5hXO.js} +1 -1
  95. package/web/dist/assets/{folder-u01HScRT.js → folder-CldgbZ5A.js} +1 -1
  96. package/web/dist/assets/{git-toolbar-Q2kk2F7v.js → git-toolbar-BYlnf4qf.js} +1 -1
  97. package/web/dist/assets/github-CqGK62Lw.js +1 -0
  98. package/web/dist/assets/{image-preview-BR3iIIhf.js → image-preview-Cv5mZr0n.js} +1 -1
  99. package/web/dist/assets/index-3nxVmdn5.css +2 -0
  100. package/web/dist/assets/index-qX7n11FX.js +9 -0
  101. package/web/dist/assets/{markdown-5FuCZDA4.js → markdown-CgEEE2ND.js} +1 -1
  102. package/web/dist/assets/{new-task-form-BydHBbef.js → new-task-form-1r2bgsdD.js} +1 -1
  103. package/web/dist/assets/{pill-vNzaaYxj.js → pill-q-x22_ej.js} +1 -1
  104. package/web/dist/assets/{project-router-BbCzrHKs.js → project-router-VDN4jQM8.js} +1 -1
  105. package/web/dist/assets/{prompt-templates-B7Fs2b1S.js → prompt-templates-BmZtCe-L.js} +1 -1
  106. package/web/dist/assets/{refresh-cw-DGliez3E.js → refresh-cw-DcNCj2nu.js} +1 -1
  107. package/web/dist/assets/{repo-git-h1RFfly3.js → repo-git-C2On8SlI.js} +1 -1
  108. package/web/dist/assets/{run-diff-Bq9vkSNK.js → run-diff-vguEMJzh.js} +1 -1
  109. package/web/dist/assets/{run-header-Cd8mSKBG.js → run-header-DM7MiKj9.js} +1 -1
  110. package/web/dist/assets/{search-x-69n_672Y.js → search-x-QmhaAbg5.js} +1 -1
  111. package/web/dist/assets/{skill-empty-hint-CL0g7WBL.js → skill-empty-hint-BrzUwByZ.js} +1 -1
  112. package/web/dist/assets/{skills-BqAzyGS3.js → skills-Bj-uG_Hz.js} +1 -1
  113. package/web/dist/assets/{sparkles-B8agSxBZ.js → sparkles-CP8QDOgX.js} +1 -1
  114. package/web/dist/assets/{square-terminal-Cf4Og6ct.js → square-terminal-CGypshSD.js} +1 -1
  115. package/web/dist/assets/{tab-link-Cp2-CJS8.js → tab-link-D4lFzzI1.js} +1 -1
  116. package/web/dist/assets/{task-changes-DwXPFXqG.js → task-changes-6aopqAmV.js} +1 -1
  117. package/web/dist/assets/{task-commits-Bessua-c.js → task-commits-u-dwaCyw.js} +1 -1
  118. package/web/dist/assets/{task-files-DxFIhRPP.js → task-files-IMOZnIUK.js} +1 -1
  119. package/web/dist/assets/task-thread-CbMPmrWq.js +9 -0
  120. package/web/dist/assets/{textarea--cpYshee.js → textarea-CyBCyKIk.js} +1 -1
  121. package/web/dist/assets/{thread-loading-ZhJref0J.js → thread-loading-Cuq2jchC.js} +1 -1
  122. package/web/dist/assets/{trash-2--ZtrzUx3.js → trash-2-B6Dp3ZNs.js} +1 -1
  123. package/web/dist/assets/{triangle-alert-D5tJwRD2.js → triangle-alert-xBya8FUp.js} +1 -1
  124. package/web/dist/assets/{upload-SnwVxKOA.js → upload-D6MXEB9p.js} +1 -1
  125. package/web/dist/assets/{use-desktop-Sr1QlxhT.js → use-desktop-fLDKEJoB.js} +1 -1
  126. package/web/dist/assets/{use-submit-shortcut-JY8M_MPL.js → use-submit-shortcut-JTpNzU-u.js} +1 -1
  127. package/web/dist/assets/{utils-Bb8ohcr3.js → utils--z9hRtl3.js} +1 -1
  128. package/web/dist/assets/{workflows-9HC240Wx.js → workflows-BY3KTkFw.js} +3 -3
  129. package/web/dist/assets/{zoomable-image-0G3IBXWC.js → zoomable-image-GTYwLtkS.js} +1 -1
  130. package/web/dist/index.html +23 -23
  131. package/web/dist/assets/arrow-down-G8adPhbu.js +0 -1
  132. package/web/dist/assets/arrow-left-BJsIW6A0.js +0 -1
  133. package/web/dist/assets/chevron-right-CFzn-von.js +0 -1
  134. package/web/dist/assets/editable-title-wS5NWwob.js +0 -1
  135. package/web/dist/assets/github-DjEYCxwt.js +0 -1
  136. package/web/dist/assets/index-BcI5hug3.css +0 -2
  137. package/web/dist/assets/index-Cz4GSAqV.js +0 -7
  138. package/web/dist/assets/task-thread-Dhkupf1-.js +0 -9
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,Tt as i,Vr as a,br as o,t as s,wn as c}from"./centered-state-B_V_Ai2h.js";import{r as l,t as u}from"./utils-Bb8ohcr3.js";import{t as d}from"./chevron-right-CFzn-von.js";import{t as f}from"./run-header-Cd8mSKBG.js";import{t as p}from"./file-DKoYWRsv.js";import{t as m}from"./folder-u01HScRT.js";import{t as h}from"./triangle-alert-D5tJwRD2.js";import{a as g,i as _,r as v}from"./highlighter-C8DK1_sG.js";import{n as y,r as b}from"./index-Cz4GSAqV.js";var x=l(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),S=l(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),C=l(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),w=l(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),T=l(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),E=l(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),D=e(t(),1),O=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function k(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:O.has(t.slice(n+1).toLowerCase())}function A(e){return e.tooLarge?`too-large`:k(e.path)?`image`:e.binary?`binary`:`text`}function j(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var M=n();function N({runId:e,path:t,className:n}){let i=r(e,t??void 0);if(t===null)return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(s,{icon:(0,M.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(i.isPending)return(0,M.jsx)(F,{className:n,children:(0,M.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(i.isError){let e=i.error instanceof c&&i.error.status===409;return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(s,{icon:e?(0,M.jsx)(C,{}):(0,M.jsx)(h,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:i.error.message})})}return i.data.type===`file`?(0,M.jsx)(P,{runId:e,entry:i.data,className:n}):null}function P({runId:e,entry:t,className:n}){let r=A(t);return(0,M.jsxs)(F,{className:n,children:[(0,M.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:j(t.size)})]}),r===`image`?(0,M.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,M.jsx)(`img`,{"data-slot":`file-preview-image`,src:o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,M.jsx)(s,{icon:(0,M.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${j(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,M.jsx)(s,{icon:(0,M.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${j(t.size)} of binary data — no text preview.`}):(0,M.jsx)(R,{path:t.path,text:t.content??``})]})}function F({className:e,children:t}){return(0,M.jsx)(`section`,{"data-slot":`file-preview`,className:u(`overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var I=1500;function L(e,t){let n=(0,D.useMemo)(()=>t.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,Tt as i,Vr as a,br as o,t as s,wn as c}from"./centered-state-Djgly6Ni.js";import{r as l,t as u}from"./utils--z9hRtl3.js";import{t as d}from"./chevron-right-Cc9BWnbN.js";import{t as f}from"./run-header-DM7MiKj9.js";import{t as p}from"./file-xBSB5hXO.js";import{t as m}from"./folder-CldgbZ5A.js";import{t as h}from"./triangle-alert-xBya8FUp.js";import{a as g,i as _,r as v}from"./highlighter-C8DK1_sG.js";import{n as y,r as b}from"./index-qX7n11FX.js";var x=l(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),S=l(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),C=l(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),w=l(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),T=l(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),E=l(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),D=e(t(),1),O=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function k(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:O.has(t.slice(n+1).toLowerCase())}function A(e){return e.tooLarge?`too-large`:k(e.path)?`image`:e.binary?`binary`:`text`}function j(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var M=n();function N({runId:e,path:t,className:n}){let i=r(e,t??void 0);if(t===null)return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(s,{icon:(0,M.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(i.isPending)return(0,M.jsx)(F,{className:n,children:(0,M.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(i.isError){let e=i.error instanceof c&&i.error.status===409;return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(s,{icon:e?(0,M.jsx)(C,{}):(0,M.jsx)(h,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:i.error.message})})}return i.data.type===`file`?(0,M.jsx)(P,{runId:e,entry:i.data,className:n}):null}function P({runId:e,entry:t,className:n}){let r=A(t);return(0,M.jsxs)(F,{className:n,children:[(0,M.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:j(t.size)})]}),r===`image`?(0,M.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,M.jsx)(`img`,{"data-slot":`file-preview-image`,src:o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,M.jsx)(s,{icon:(0,M.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${j(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,M.jsx)(s,{icon:(0,M.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${j(t.size)} of binary data — no text preview.`}):(0,M.jsx)(R,{path:t.path,text:t.content??``})]})}function F({className:e,children:t}){return(0,M.jsx)(`section`,{"data-slot":`file-preview`,className:u(`overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var I=1500;function L(e,t){let n=(0,D.useMemo)(()=>t.split(`
2
2
  `).map(e=>[{content:e}]),[t]),r=(0,D.useMemo)(()=>g(e),[e]),i=n.length>I,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let n=!1;return v(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:_(t,r)?.tokens??n}function R({path:e,text:t}){let n=L(e,t);return(0,M.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":g(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex px-4`,children:[(0,M.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,M.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function z({runId:e,selected:t,onSelect:n}){return(0,M.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function B({runId:e,path:t,depth:n,selected:i,onSelect:a}){let o=r(e,t);return o.isPending?(0,M.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Loading…`}):o.isError?(0,M.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${24+n*14}px`},children:o.error.message}):o.data.type===`dir`?o.data.entries.length===0?(0,M.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Empty directory`}):(0,M.jsx)(M.Fragment,{children:o.data.entries.map(r=>r.type===`dir`?(0,M.jsx)(V,{runId:e,name:r.name,path:t===``?r.name:`${t}/${r.name}`,depth:n,selected:i,onSelect:a},r.name):(0,M.jsx)(H,{name:r.name,path:t===``?r.name:`${t}/${r.name}`,size:r.size,depth:n,selected:i,onSelect:a},r.name))}):null}function V({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,s]=(0,D.useState)(!1);return(0,M.jsxs)(`li`,{children:[(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":o?`open`:`closed`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,M.jsx)(d,{"aria-hidden":`true`,className:u(`size-3.5 shrink-0 transition-transform`,o&&`rotate-90`)}),(0,M.jsx)(m,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t})]}),o?(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function H({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=k(t)?T:p;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:u(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+r*14}px`},children:[(0,M.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,M.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:j(n)})]})})}function U(){let{id:e}=a(),t=i(e);return t.isPending?(0,M.jsx)(b,{tab:`files`}):t.isError?(0,M.jsx)(y,{tab:`files`,error:t.error}):(0,M.jsx)(W,{run:t.data})}function W({run:e}){let t=r(e.id,``),[n,i]=(0,D.useState)(null),a=t.isError&&t.error instanceof c&&t.error.status===409;return(0,M.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,M.jsx)(f,{run:e,tab:`files`}),t.isPending?(0,M.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`}):t.isError?(0,M.jsx)(s,{icon:a?(0,M.jsx)(w,{}):(0,M.jsx)(h,{}),tone:a?`neutral`:`danger`,heading:`h2`,title:a?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,M.jsx)(`aside`,{"data-slot":`files-tree-pane`,className:`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:(0,M.jsx)(z,{runId:e.id,selected:n,onSelect:i})}),(0,M.jsx)(N,{runId:e.id,path:n,className:`min-w-0 flex-1`})]})]})}export{U as TaskFilesRoute};
@@ -0,0 +1,9 @@
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,A as i,Fn as a,Gr as o,Lt as s,Mr as c,Nt as l,Pt as u,Qr as d,Tt as f,U as p,Ur as m,Vr as h,Wr as g,Yr as _,Zr as v,a as y,an as b,at as x,bt as S,er as C,i as w,j as T,k as E,kn as D,n as O,on as k,qr as A,st as ee,t as j,tt as te,wn as M,z as ne,zn as re,zr as ie}from"./centered-state-Djgly6Ni.js";import{_ as N,a as P,c as ae,n as oe,r as F,t as I}from"./utils--z9hRtl3.js";import{D as se,P as L,b as ce,c as le,d as R,g as ue,j as de,o as fe,p as pe}from"./editable-title-BCX3T2BY.js";import{t as me}from"./arrow-down-CYgAlZtW.js";import{c as he,i as ge,l as _e,m as ve,n as ye,o as be,s as xe,t as Se}from"./thread-loading-Cuq2jchC.js";import{C as Ce,_ as we,a as Te,c as Ee,o as De}from"./new-task-form-1r2bgsdD.js";import{t as z}from"./chevron-right-Cc9BWnbN.js";import{i as Oe,n as ke,r as Ae,t as je}from"./run-header-DM7MiKj9.js";import{b as Me,y as Ne}from"./dropdown-menu-CEQziH7X.js";import{n as Pe,t as Fe}from"./trash-2-B6Dp3ZNs.js";import{C as Ie,S as Le,c as Re,d as ze,f as Be,s as Ve}from"./prompt-templates-BmZtCe-L.js";import{t as He}from"./search-x-QmhaAbg5.js";import{t as Ue}from"./square-terminal-CGypshSD.js";import{t as We}from"./textarea-CyBCyKIk.js";import{n as B,r as Ge,t as V}from"./collapsible-DZ4D-DHG.js";import{t as Ke}from"./use-submit-shortcut-JTpNzU-u.js";import{t as H}from"./project-router-VDN4jQM8.js";import{c as U}from"./pill-q-x22_ej.js";import{t as W}from"./markdown-CgEEE2ND.js";import{t as qe}from"./lib-BQXq3kEf.js";import{t as Je}from"./zoomable-image-GTYwLtkS.js";import{t as Ye}from"./run-diff-vguEMJzh.js";var Xe=120;function G(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Xe?`${t.slice(0,Xe-1)}…`:t}function q(e,...t){if(G(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return K(t)}}function Ze(e){if(!G(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return K(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return K(e.join(` `))}}function Qe(e){if(!G(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)G(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function $e(e){return q(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function J(e,t){return t?`${e} ${t}`:e}function et(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:J(`Ran`,Ze(t)),subtitle:q(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:J(`Write`,q(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Qe(t);return{toolKind:`edit`,title:J(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:J(`Read`,q(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:J(`View image`,q(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:J(`Search`,q(t,`pattern`,`query`)),subtitle:q(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:J(`Fetch`,q(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:J(`Web search`,q(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=q(t,`subagent_type`,`subagentType`),i=q(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=q(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:q(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=q(t,`server`),n=q(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:$e(t)}}}if(n.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()!==``?K(e):`Tool`,subtitle:$e(t)}}var tt=class extends _{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,f=o&&c===`backward`,p=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:d(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:s&&!l&&!f,isRefetching:a&&!u&&!p}}};function nt(e,t){return o(e,tt,t)}var rt=F(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),it=F(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),at=F(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ot=F(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),st=F(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),ct=F(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),lt=F(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Y=e(t(),1),ut=[`run-event`,`ui-event`];function dt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function ft(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,Y.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=dt(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(P(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of ut)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var pt=5,mt=200,ht=5e3;function gt(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function _t(e){let t=ae(),n=A(),i=[`run-history`,t,e],a=[`run-history-context`,t,e],o=nt({queryKey:i,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>r(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:pt,retry:1}),s=g({queryKey:a,enabled:e!==void 0,queryFn:({signal:t})=>C(e,{signal:t}),retry:1}),c=o.isError||s.isError,l=ft(c?e:void 0),u=o.data?.pages??[],d=u.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),f=(0,Y.useRef)(!1),p=(0,Y.useCallback)(()=>{e===void 0||f.current||(f.current=!0,r(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>pt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{f.current=!1}))},[n,e,t]),m=ft(!c&&d?e:void 0,{cursor:d?.liveCursor,afterSeq:d?.asOfSeq,maxEvents:ht,compactAt:mt,onCompact:p}),h=(0,Y.useMemo)(()=>gt(...u.map(e=>e.events)),[u]),_=(0,Y.useMemo)(()=>c?l:gt(h,m),[c,l,h,m]),v=(0,Y.useMemo)(()=>{if(c)return l;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return gt(e,_.filter(({seq:e})=>e>t))},[s.data,c,l,_]),y=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),b=(0,Y.useCallback)(async()=>{await n.resetQueries({queryKey:i,exact:!0})},[i,n]);return{visibleEvents:_,currentEvents:v,isPending:!c&&o.isPending,contextPending:!c&&s.isPending,fallback:c,hasOlder:!c&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:y,jumpToLatest:b,retainedPages:u.length}}var X=n();function vt({run:e}){let t=A(),n=m({mutationFn:()=>D(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:T.runs.detail(e.id)}),t.invalidateQueries({queryKey:T.runs.list()}),w(`This task will not resume itself`)},onError:e=>w(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,X.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(U,{tone:`pending`,pulse:!0}),(0,X.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,X.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,X.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,X.jsx)(c,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var yt=e=>e.kind===`tool`,bt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,xt=(e,t,n)=>`${e} ${e===1?t:n}`;function St(e,t){let n=[];return e>0&&n.push(xt(e,`file`,`files`)),t>0&&n.push(xt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Ct(e){return`${e} earlier tool call${e===1?``:`s`}`}var wt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Tt(e){for(let t of wt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function Et(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(yt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:St(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)yt(e)&&bt(e)&&!r.has(e.id)?o.push(e):(s(),yt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var Dt=new Map,Ot=(0,Y.createContext)(null);function kt(){return(0,Y.useContext)(Ot)}function At({runId:e,children:t}){let n=(0,Y.useMemo)(()=>({get:t=>Dt.get(e)?.get(t),set:(t,n)=>{let r=Dt.get(e)??new Map;r.set(t,n),Dt.set(e,r)}}),[e]);return(0,X.jsx)(Ot.Provider,{value:n,children:t})}function Z(e){return e.scrollTop<Math.max(600,e.clientHeight)}function jt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Mt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Nt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Pt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Ft=new Map;function It(e,t){Ft.set(e,t)}function Lt(e){return Ft.get(e)}var Rt=new Map;function zt(e,t){Rt.set(e,t)}function Bt(e,t){let n=Rt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Vt({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(e),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(),g=()=>{d(e),h(void 0),l(!0)},_=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}p(!0),h(void 0);try{await r?.(t),l(!1)}catch(e){h(e instanceof Error?e.message:`Could not save the message`)}finally{p(!1)}},v=async()=>{p(!0),h(void 0);try{await i?.()}catch(e){h(e instanceof Error?e.message:`Could not remove the message`)}finally{p(!1)}};return c?(0,X.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,X.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,X.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:f,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:f?(0,X.jsx)(E,{className:`size-3.5 animate-spin`}):`Save`})]}),m?(0,X.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:m}):null]}):(0,X.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[r||i?(0,X.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,X.jsx)(`button`,{type:`button`,"aria-label":a,onClick:g,disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(ct,{className:`size-3.5`})}):null,i?(0,X.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void v(),disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Fe,{className:`size-3.5`})}):null]}):null,m?(0,X.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:m}):null,(0,X.jsx)(W,{breaks:!0,children:e}),n.length>0?(0,X.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>N(e.split(`/`).pop()??``)?(0,X.jsx)(Je,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,X.jsxs)(`a`,{href:e,download:!0,"data-slot":`user-file`,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(ve,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,s>0?(0,X.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function Ht({text:e}){return(0,X.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,X.jsx)(W,{children:e})})}function Ut({note:e}){return(0,X.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:I(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function Wt({incident:e}){let t=ce[e.provider];return(0,X.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,X.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Gt({text:e}){let t=(0,Y.useId)();if(e.trim()===``)return null;let n=e.split(`
2
+ `,1)[0]??``,r=n.length<e.length;return(0,X.jsxs)(V,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,X.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,X.jsx)(z,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,X.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,X.jsx)(W,{inline:!0,children:n})}),r?(0,X.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,X.jsx)(Ge,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,X.jsx)(B,{children:(0,X.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,X.jsx)(W,{children:e})})})]})}function Kt(){return(0,X.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,X.jsx)(E,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,X.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var qt={read:Oe,edit:ct,delete:Fe,move:at,search:Le,execute:Ue,think:rt,fetch:de,task:L,plan:ot,other:lt},Jt=e=>e.split(`
3
+ `).length;function Yt({text:e,streaming:t}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(null),a=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Jt(e),s=!t&&!n&&o>12;return(0,X.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Nt(e.currentTarget)}:void 0,className:I(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,X.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,X.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,X.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Xt({diffs:e}){return(0,X.jsx)(X.Fragment,{children:e.map((e,t)=>(0,X.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,X.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Zt(e.oldText).map((e,t)=>(0,X.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Zt(e.newText).map((e,t)=>(0,X.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
4
+ `).map((e,t)=>(0,X.jsx)(Qt,{text:e},t))})]},`${e.path}:${t}`))})}function Zt(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
5
+ `)}function Qt({text:e}){return(0,X.jsx)(`span`,{className:I(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function $t(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function en({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=kt(),[a,o]=(0,Y.useState)(()=>n===void 0?null:i?.get(n)??null),s=e=>{n!==void 0&&i?.set(n,e),o(e)},c=e.status===`running`||e.status===`pending`,l=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,u=l&&(a??$t(e)),{verb:d,detail:f}=Tt(e.title),p=qt[e.toolKind]??lt;return(0,X.jsxs)(V,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:u,onOpenChange:s,className:I(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,X.jsxs)(Ge,{disabled:!l,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,X.jsx)(z,{"aria-hidden":!0,className:I(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!l&&`invisible`)}),(0,X.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`span`,{className:I(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:d}),f===void 0?null:(0,X.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:f}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,X.jsx)(E,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,X.jsx)(`span`,{"data-slot":`tool-exit`,className:I(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,X.jsx)(B,{children:(0,X.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,X.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,X.jsx)(Xt,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,X.jsx)(Yt,{text:e.output,streaming:c}):null,t.length>0?(0,X.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:r?.(t,n??e.id)}):null]})})]})}function tn({group:e,scope:t}){return(0,X.jsxs)(V,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,X.jsxs)(Ge,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(z,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,X.jsx)(B,{children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,X.jsx)(en,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function nn({count:e,children:t}){return(0,X.jsxs)(V,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,X.jsxs)(Ge,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,X.jsx)(z,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),Ct(e)]}),(0,X.jsx)(B,{children:(0,X.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function rn({image:e}){return(0,X.jsx)(Je,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function an(e){let t=A(),n=pe(e).continueRun,r=ne(),[i,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),f=Ae(e,i),{runners:p,canContinue:h,currentRunner:g,runner:_}=f,v=l(_,n),y=r.data?.modelsLocked===!0,b=_!==g,x=!y&&!b&&e.model?{...r.data?.defaultModels,[_]:e.model}:r.data?.defaultModels,S=y?null:s,C=De(_,v.data,[S,x?.[_]]),w=Ee(S,_,x,v.data),{accounts:E,repoAccount:D}=Be(),O=[...e.steps].reverse().find(e=>e.profileId)?.profileId??e.agentProfile??`default`,k=b?D:{...D,[g]:O},ee=E.some(e=>e.provider===_&&e.id===u)?u:null,j=m({mutationFn:({text:t,images:n})=>h?a(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:f.runnerOverride,model:!y&&s!==null?w:void 0,agentProfile:ee??void 0}):Promise.reject(Error(f.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:T.runs.all})});return{available:n,canContinue:h,reason:f.reason,providerPending:f.providerPending,pills:(0,X.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[p.length>1||p.some(e=>ze(E,e))?(0,X.jsx)(Re,{runners:p,value:_,accounts:E,account:ee,repoAccount:k,onPick:(e,t)=>{d(t),e!==_&&(o(e),c(null))}}):null,(0,X.jsx)(Ve,{slot:`follow-up-model-pill`,ariaLabel:`Model`,label:C.find(e=>e.id===w)?.label??`auto`,value:w,readOnly:y,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>c(e),options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Te(_,v.data,v.isError)})]}),continueWith:(e,t)=>j.mutateAsync({text:e,images:t})}}var on=120,sn=e=>e!==`pending`&&e!==`running`,cn=e=>e.kind===`tool`&&e.toolKind===`task`,Q=e=>cn(e)&&e.parentItemId===void 0,ln=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function un(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Q(e)&&t.has(e.id)))return n;return 0}function dn(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function fn(e){if(e.kind===`tool`)return pn(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
6
+ `);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return pn(n)}}}function pn(e){return e.length>on?`${e.slice(0,on-1).trimEnd()}…`:e}function mn(e,t=!1){let n=yn(e,e=>e.items.some(Q));if(n===-1)return[];let r=e=>!t&&!sn(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Q);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Q)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?un(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!ln(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>hn(e,c.get(e.id)??[],t))}function hn(e,t,n){let r={id:e.id,title:Tt(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=dn(e);i!==void 0&&(r.agentType=i),n&&!sn(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=fn(t[e]);if(n!==void 0){r.activity=n;break}}return r}function gn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function _n(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function vn(e){return e.find(e=>!sn(e.status))??e[0]}function yn(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function bn(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&Q(e));if(i!==void 0)return hn(i,xn(e,t),n)}}function xn(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Q(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)ln(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var Sn=new Map,Cn=!1;function wn({runId:e,agents:t,onSelect:n}){let[r,i]=(0,Y.useState)(()=>Sn.get(e)??Cn);if(t.length===0)return null;let{done:a,total:o}=gn(t),s=vn(t);return(0,X.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,X.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(Sn.set(e,!t),!t)),"aria-expanded":r,className:I(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,X.jsx)(L,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,X.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),!r&&s!==void 0?(0,X.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,_n(s)]}):null,(0,X.jsx)(Ce,{"aria-hidden":!0,className:I(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,X.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,X.jsx)(Tn,{agent:e,onSelect:n},e.id))}):null]})}function Tn({agent:e,onSelect:t}){let n=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(En,{status:e.status,stalled:e.stalled===!0}),(0,X.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,X.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,X.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:_n(e)}),(0,X.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,X.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,X.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,X.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function En({status:e,stalled:t=!1}){return t?(0,X.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,X.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,X.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,X.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var Dn=new Map;function On(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function kn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function An(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function jn({runId:e,entries:t}){let[n,r]=(0,Y.useState)(()=>Dn.get(e)??On());if(t.length===0)return null;let{done:i,total:a}=kn(t),o=An(t);return(0,X.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":n?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,X.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-0.5 md:h-[3px]`,style:{background:`var(--grad)`}}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(t=>(Dn.set(e,!t),!t)),"aria-expanded":n,className:I(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,n?`pt-2 pb-1.5`:`py-2`),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,X.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,i,`/`,a]}),!n&&o!==void 0?(0,X.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,o.activeForm??o.content]}):null,(0,X.jsx)(Ce,{"aria-hidden":!0,className:I(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!n&&`rotate-180`)})]}),n?(0,X.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,X.jsx)(Mn,{entry:e},`${t}:${e.content}`))}):null]})}function Mn({entry:e}){return(0,X.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:I(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,X.jsx)(Nn,{status:e.status}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,X.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function Nn({status:e}){return e===`cancelled`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,X.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,X.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,X.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,X.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function Pn(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(0,Y.useRef)(!0),f=(0,Y.useRef)(null),p=(0,Y.useRef)(null),m=(0,Y.useRef)(null),h=(0,Y.useCallback)(e=>{let t=o.current;if(!t)return;let n=m.current;n?n.scrollTo(e):t.scrollTop=e},[]),g=(0,Y.useCallback)(()=>{let e=o.current;e&&h(e.scrollHeight-e.clientHeight)},[h]),_=(0,Y.useCallback)(()=>{if(o.current){if(p.current!==e){p.current=e;let t=Lt(e);t&&!t.atBottom?(d.current=!1,f.current=t.top):(d.current=!0,f.current=null)}f.current===null?d.current&&g():h(f.current)}},[e,h,g]),v=(0,Y.useCallback)(e=>{c(e),e&&(o.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),_())},[n,_]),y=(0,Y.useCallback)(()=>{d.current&&g()},[g]),b=(0,Y.useRef)(!1),x=(0,Y.useRef)(!1),S=(0,Y.useRef)(void 0),C=(0,Y.useRef)(!1),w=(0,Y.useRef)(!1),T=(0,Y.useRef)(a);T.current=a;let E=(0,Y.useCallback)(e=>[...e.querySelectorAll(`[data-slot="thread-row"][data-row-key]`)].map(e=>{let t=e.getBoundingClientRect();return{key:e.dataset.rowKey,top:t.top,bottom:t.bottom}}),[]),D=(0,Y.useCallback)(()=>{let e=o.current;if(!e||!r||b.current)return;b.current=!0;let t=e.scrollHeight,n=e.scrollTop,i=e.getBoundingClientRect().top,a=jt(i,E(e));r().finally(()=>{requestAnimationFrame(()=>{let e=o.current;if(e){let r=n+Math.max(0,e.scrollHeight-t),i=e.getBoundingClientRect().top,o=a===void 0?-1:T.current.indexOf(a.key),s=m.current;s&&o>=0?s.scrollToIndex(o,{align:`start`,offset:-a.offset}):h(Mt(e.scrollTop,i,a,E(e),r))}b.current=!1})})},[E,r,h]);(0,Y.useEffect)(()=>()=>clearTimeout(S.current),[]);let O=(0,Y.useCallback)(()=>{let t=o.current;t&&(f.current=null,d.current=!0,It(e,{top:t.scrollHeight-t.clientHeight,atBottom:!0}),(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{let e=o.current;e?.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:`smooth`})})}))},[i,e]);return(0,Y.useLayoutEffect)(()=>{!o.current||!s||_()},[s,_]),(0,Y.useEffect)(()=>{let t=o.current,n=s;if(!t||!n)return;let r=0,i=null,a=!1,c=t.scrollTop,l=()=>{f.current=null,d.current=!1,r=0},p=()=>{r=Date.now()},m=e=>{if(e.deltaY<0){l();let e=!x.current;x.current=!0,clearTimeout(S.current),S.current=setTimeout(()=>{x.current=!1},180),e&&Z(t)&&D()}else p()},_=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(l(),!e.repeat&&Z(t)&&D()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&p()},v=()=>{a=!0,w.current=!1,c=t.scrollTop,Nt(t,80)||(l(),p())},y=()=>{a=!1},b=e=>{C.current=!1,i=e.touches[0]?.clientY??null},T=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(i!==null&&n>i+1?(l(),!C.current&&Z(t)&&(C.current=!0,D())):i!==null&&n<i-1&&p(),i=n)},E=()=>{a&&!w.current&&t.scrollTop<c&&Z(t)&&(w.current=!0,D()),c=t.scrollTop;let n=Nt(t,80);n&&f.current===null&&(d.current||Date.now()-r<2e3)&&(d.current=!0),u(!n),f.current===null&&It(e,{top:t.scrollTop,atBottom:n})};t.addEventListener(`scroll`,E,{passive:!0}),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,b,{passive:!0}),t.addEventListener(`touchmove`,T,{passive:!0}),t.addEventListener(`pointerdown`,v,{passive:!0}),window.addEventListener(`pointerup`,y,{passive:!0}),t.addEventListener(`keydown`,_);let O,k=-1;return typeof ResizeObserver<`u`&&(O=new ResizeObserver(()=>{let e=f.current,n=t.scrollHeight,r=n===k;if(k=n,e!==null){let i=n-t.clientHeight;h(Math.min(e,i)),i>=e&&r&&(f.current=null)}else d.current&&g()}),O.observe(n)),()=>{t.removeEventListener(`scroll`,E),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,b),t.removeEventListener(`touchmove`,T),t.removeEventListener(`pointerdown`,v),window.removeEventListener(`pointerup`,y),t.removeEventListener(`keydown`,_),O?.disconnect()}},[e,s,D,h,g]),{attachContent:v,scrollElRef:o,virtualizerRef:m,pillVisible:l,jumpToLatest:O,loadOlder:D,restickIfStuck:y}}function Fn({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,X.jsx)(In,{runId:e,rows:t,controls:r}):(0,X.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,X.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function In({runId:e,rows:t,controls:n}){let r=(0,Y.useRef)(null),[i]=(0,Y.useState)(()=>Bt(e,t.length)),a=(0,Y.useRef)(t.length);a.current=t.length;let o=(0,Y.useRef)(null),s=(0,Y.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(zt(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,Y.useState)(0);return(0,Y.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||l(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,X.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,X.jsx)(qe,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,X.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))})})}function Ln({onJump:e}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-8 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,X.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function Rn(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[]},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[]},entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images}},entries:e.items});return n}function zn(e,t){return[{id:`agent:${e}`,entries:t}]}function Bn(e,t){let n=[];for(let t of e){t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of Et([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}})}return n}function Vn({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c}){let l=(0,Y.useMemo)(()=>Bn(n,e),[n,e]),u=Pn(`${e}:${t}`,{surface:r}),d=s??u,f=(0,Y.useMemo)(()=>l.map(e=>({key:e.key,node:e.content.kind===`user-message`?(0,X.jsx)(Hn,{message:e.content.message,actions:o?.[e.key]}):(0,X.jsx)(Un,{block:e.content.block,scope:e.scope,renderAsk:a})})),[o,a,l]),p=c??Pt(``,f.length),m=f.length===0?i??null:(0,X.jsx)(Fn,{runId:`${e}:${t}`,rows:f,mode:p,controls:d});return(0,X.jsx)(At,{runId:e,children:r===`panel`?(0,X.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,X.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:m}),d.pillVisible?(0,X.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,X.jsx)(Ln,{onJump:d.jumpToLatest})}):null]}):m})}function Hn({message:e,actions:t}){return(0,X.jsx)(Vt,{text:e.text,imageCount:e.imageCount,images:e.images,onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel})}function Un({block:e,scope:t,renderAsk:n}){switch(e.kind){case`entry`:return(0,X.jsx)(Gn,{entry:e.entry,scope:t,renderAsk:n});case`tool-card`:return(0,X.jsx)(en,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,X.jsx)(Wn,{entries:e,scope:t,renderAsk:n})});case`context-group`:return(0,X.jsx)(tn,{group:e,scope:t});case`streak`:return(0,X.jsx)(nn,{count:e.count,children:e.blocks.map(e=>(0,X.jsx)(Un,{block:e,scope:t,renderAsk:n},e.id))});default:return Kn(e)}}function Wn({entries:e,scope:t,renderAsk:n}){return Et([...e]).map(e=>(0,X.jsx)(Un,{block:e,scope:t,renderAsk:n},e.id))}function Gn({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,X.jsx)(Ht,{text:e.text}):(0,X.jsx)(Vt,{text:e.text});case`reasoning`:return(0,X.jsx)(Gt,{text:e.text});case`tool`:return(0,X.jsx)(en,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,X.jsx)(Ut,{note:e});case`image`:return(0,X.jsx)(rn,{image:e});case`ask`:return n===void 0?(0,X.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`provider-auth-required`:return(0,X.jsx)(Wt,{incident:e});default:return Kn(e)}}function Kn(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function qn({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,X.jsx)(ge,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,X.jsx)(be,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,X.jsx)(Jn,{runId:e,renderAsk:t,agent:n,entries:r})})})}function Jn({runId:e,renderAsk:t,agent:n,entries:r}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(he,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,X.jsxs)(_e,{className:`flex min-w-0 items-center gap-2 pr-8 text-[15px]`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,X.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,X.jsxs)(xe,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(Yn,{status:n.status}),(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,X.jsx)(Vn,{runId:e,viewId:`agent:${n.id}`,sections:zn(n.id,r),mode:`panel`,renderAsk:t,empty:(0,X.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function Yn({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,X.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:I(`rounded-full px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function Xn({run:e}){return(0,X.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-violet/30 bg-violet/10 px-3.5 py-2.5`,children:[(0,X.jsx)(Ie,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,X.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,X.jsx)(Ye,{runId:e.id}),(0,X.jsx)(Zn,{run:e})]})}function Zn({run:e}){let t=A(),n=(0,Y.useRef)(null),[r,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(null),l=ke(e.id),u=Ae(e),d=()=>t.invalidateQueries({queryKey:T.runs.all}),f=m({mutationFn:async t=>u.canContinue?a(e.id,{text:`Review feedback:\n${t}`,runner:u.runnerOverride}):null,onSuccess:e=>{e!==null&&(o(``),d())},onError:e=>w(e.message,{tone:`danger`})}),p=m({mutationFn:()=>re(e.id),onSuccess:e=>{w(`Draft PR created — ${e.url}`),d()},onError:e=>{e instanceof M&&e.manual!==void 0&&c(e.manual),w(e.message,{tone:`danger`})}}),h=()=>{let e=r.trim();if(e.length===0){w(`Write what to change first.`),n.current?.focus();return}f.mutate(e)};return(0,X.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,X.jsx)(We,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:r,onChange:e=>o(e.target.value),onKeyDown:e=>{Ke({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(),h())},className:`min-h-[52px] text-[13px]`}),u.canContinue?null:(0,X.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:u.reason}),u.providerPending?null:(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(y,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:u.reason??`Send the notes back into the agent's session`,"aria-describedby":u.canContinue?void 0:`review-provider-guidance`,disabled:f.isPending||!u.canContinue,onClick:h,children:[(0,X.jsx)(it,{"aria-hidden":`true`}),`Send back`]}),oe(e.pullRequestUrl)?(0,X.jsx)(y,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,X.jsx)(Me,{"aria-hidden":`true`}),`PR ↗`]})}):(0,X.jsxs)(y,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:p.isPending,onClick:()=>p.mutate(),children:[(0,X.jsx)(Ne,{"aria-hidden":`true`}),`Draft PR`]}),(0,X.jsxs)(y,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:le(`review`),disabled:l.isPending,onClick:()=>l.mutate(),children:[(0,X.jsx)(i,{"aria-hidden":`true`}),`Accept`]})]}),s===null?null:(0,X.jsx)(Qn,{command:s})]})}function Qn({command:e}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>w(`Command copied to clipboard.`)).catch(()=>w(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(Pe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function $n(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var er=1500;function tr({status:e}){let t=(0,Y.useRef)(e),[n,r]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||$n())return;r(!0);let i=setTimeout(()=>r(!1),er);return()=>clearTimeout(i)},[e]),n?(0,X.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,X.jsx)(O,{}),(0,X.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,X.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-[13px] font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}function nr(e,t){return`${e.header}: ${t.join(`, `)}`}function rr({ask:e,run:t}){return e.resolved?(0,X.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,X.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,X.jsx)(ir,{ask:e,run:t})}function ir({ask:e,run:t}){let n=fe(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,Y.useState)({}),c=(e,t)=>s(n=>({...n,[e]:t})),l=i.every((e,t)=>(o[t]?.length??0)>0),u=()=>void n.send(i.map((e,t)=>nr(e,o[t]??[])).join(`
7
+ `)),d=n.mode===`resume`;return(0,X.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-primary/25 bg-primary/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,X.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,X.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`The agent is asking`})}),(0,X.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,X.jsx)(ar,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(nr(e,i)):c(t,i))}},e.id??t))}),a?d?(0,X.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,X.jsx)(y,{size:`sm`,disabled:n.isPending||r||!l,onClick:u,children:d?`Send answer & reopen`:`Send answer`}),(0,X.jsx)(`span`,{"data-slot":d?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:d?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,X.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:n.reason}),(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,X.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,X.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function ar({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,X.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,X.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground`,children:e.header}),i?(0,X.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,X.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,X.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:I(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-primary/50 hover:bg-primary/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-primary/60 bg-primary/[0.06]`:`border-border bg-card`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,X.jsx)(`span`,{"aria-hidden":!0,className:I(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-primary bg-primary text-primary-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,X.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var or=2e3;function sr(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function cr(e,t){let n=A(),r=(0,Y.useMemo)(()=>sr(t),[t]),i=e?.id,a=e?.status;(0,Y.useEffect)(()=>{if(r===0||i===void 0||a!==`running`&&a!==`waiting`)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:T.runs.detail(i)}),n.invalidateQueries({queryKey:T.runs.list()})},or);return()=>clearTimeout(e)},[r,i,a,n])}function lr(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function ur(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=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function dr(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label: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 fr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return typeof e==`string`?e:void 0}function pr(e){return e===`claude`||e===`codex`||e===`opencode`||e===`pi`?e:void 0}function mr(e,t){let n=e.replace(/\s*XEZ:DONE\s*$/,``).replace(/\s*XEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*XEZ:ASK[ \t]+\{[\s\S]*\}\s*$/,``)),n.includes(`XEZ:`)?n.split(`
8
+ `).filter(e=>!/^XEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
9
+ `):n}function hr(e){let t=e=>mr(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function gr(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var _r=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,vr=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function yr(e){if(!fr(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!fr(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:vr.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function br(e,t={}){let n=[],r=new Map,i,a=0,o,s=e=>{a+=1;let t={id:e===void 0?`turn-fallback-${a}`:`turn-seq-${e}`,entries:[],v2Items:!1};return n.push(t),t},c=()=>n.at(-1)??s(),l=(e,t)=>{let n=$(e.stepId);return n===void 0?t:`${n}:${t}`},u=(e,t,n)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})};for(let t of e)switch(t.type){case`user-message`:{let e=$(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=s(t.seq);n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[]};break}case`turn.started`:{let e=$(t.turnId),r=n.at(-1);r&&r.turnId===void 0&&!r.v2Items?r.turnId=e:s(t.seq).turnId=e;break}case`turn.completed`:{let e=$(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);i&&(i.completed={stopReason:$(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{}});break}case`item.started`:case`item.updated`:case`item.completed`:{if(!fr(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=l(t,i.id);u(r.get(a)?.turn??c(),i,a);break}case`item.delta`:{let e=$(t.itemId)??``,n=r.get(l(t,e)),i=$(t.delta)??``;if(!n||i===``||!_r(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=c(),n=$(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=c();if(e.v2Items)break;let n=$(t.tool)??`Tool`;if(xr.has(n))break;let i=et(n,t.input);if(i.toolKind===`plan`){let n=yr(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:$(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get($(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=gr(t.result);break}case`note`:case`lifecycle`:{let e=$(t.message)??``;if(e===``)break;let n=t.tone===`danger`?`danger`:`dim`;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:n}});break}case`error`:{let e=$(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=$(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=$(t.error)?` — ${$(t.error)}`:``;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${$(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=$(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:$(t.text)??``,exitCode:n};c().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=pr(t.provider),n=$(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;c().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=$(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=$(t.name);r!==void 0&&(n.name=r),c().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(c().planEntries=t.entries);break;case`session.ended`:i={reason:$(t.reason)??`end_turn`,...$(t.message)===void 0?{}:{message:$(t.message)}};break;case`ask.requested`:{let e=$(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions.filter(e=>fr(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(n.length===0)break;let r={kind:`ask`,id:e,questions:n,resolved:!1};c().entries.push({origin:`meta`,entry:r}),o=r;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add(mr(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has(mr(e.entry.text,!0).trim()))),hr(e))}return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:mr(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i}}}var xr=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function Sr(){let{id:e}=h(),t=f(e),n=_t(e),r=t.data?.status,i=(0,Y.useMemo)(()=>br(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,Y.useMemo)(()=>br(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),o=(0,Y.useRef)(void 0),s=(0,Y.useCallback)(e=>{o.current=e},[]),{mutate:c}=te();if((0,Y.useEffect)(()=>{t.data&&o.current!==t.data.id&&se(t.data)&&c(t.data.id)},[c,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),cr(t.data,n.visibleEvents),t.isPending)return(0,X.jsx)(Se,{});if(t.isError){let e=t.error instanceof M&&t.error.status===404;return(0,X.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(j,{icon:e?(0,X.jsx)(He,{}):(0,X.jsx)(st,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,X.jsx)(y,{asChild:!0,variant:`outline`,children:(0,X.jsx)(H,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,X.jsx)(Se,{}):(0,X.jsx)(Cr,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:s})}function Cr({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){let a=dr(e.status,e.error),o=lr(n),c=o!==void 0&&o.length>0?kn(o):void 0,l=e.status===`running`||e.status===`waiting`,u=e.status===`queued`,d=an(e),f=!l&&!u&&d.available,m=f&&d.canContinue,h=!l&&e.status!==`queued`,g=(0,Y.useMemo)(()=>mn(n.turns,h),[n.turns,h]),[_,v]=(0,Y.useState)(void 0),[y,C]=(0,Y.useState)(e.id);y!==e.id&&(C(e.id),v(void 0));let w=(0,Y.useMemo)(()=>_===void 0?void 0:bn(n.turns,_,h),[n.turns,_,h]),T=(0,Y.useMemo)(()=>_===void 0?[]:xn(n.turns,_),[n.turns,_]),E=s(e.id),D=ue(e),O=l&&!D.usable,A=f&&!d.canContinue,j=O||A,te=O?D.reason:d.reason,{mutateAsync:M}=x(e.id),{mutateAsync:ne}=p(e.id),{mutateAsync:re}=S(e.id),N=(0,Y.useMemo)(()=>u?{onEditTask:async e=>{await M({task:e})},onEditMessage:(e,t)=>ne({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>re(e).then(()=>void 0)}:void 0,[u,M,ne,re]),P=(0,Y.useMemo)(()=>Rn(e,t),[e,t]),ae=(0,Y.useMemo)(()=>Bn(P,e.id),[P,e.id]),F=(0,Y.useCallback)(t=>(0,X.jsx)(rr,{ask:t,run:e}),[e]),se=(0,Y.useMemo)(()=>{if(N===void 0)return;let t={task:{onEdit:N.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>N.onEditMessage(n.id,e),onRemove:()=>N.onRemoveMessage(n.id)};return t},[N,e.queuedMessages]),L=b(e,ee()),{search:ce}=ie(),le=Pt(ce,ae.length),R=Pn(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:ae.map(({key:e})=>e)});return we(R.restickIfStuck),(0,X.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(je,{run:e,planTally:c,onMarkedUnread:()=>i?.(e.id)}),(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-2.5 px-3 py-3 md:gap-3.5 md:px-6 md:py-5`,children:[r?(0,X.jsx)(wr,{hasOlder:r.hasOlder,loading:r.isFetchingOlder,error:r.olderError,fallback:r.fallback,retainedPages:r.retainedPages,onLoad:R.loadOlder}):null,(0,X.jsx)(Vn,{runId:e.id,viewId:`main`,sections:P,mode:`document`,renderAsk:F,messageActions:se,scrollControls:R,renderMode:le}),t.turns.length===0?e.status===`queued`?(0,X.jsx)(Tr,{run:e}):(0,X.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`?(0,X.jsx)(Kt,{}):null,a&&a.state===`closed`?(0,X.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":a.state,className:I(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,a.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[a.label,oe(k(e))?(0,X.jsx)(`a`,{"data-slot":`pr-link`,href:k(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,oe(L)?(0,X.jsx)(`a`,{"data-slot":`issue-link`,href:L,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,X.jsx)(Xn,{run:e}):null]}),(0,X.jsx)(tr,{status:e.status}),(0,X.jsx)(qn,{runId:e.id,renderAsk:F,agent:w,entries:T,onClose:()=>v(void 0)}),(0,X.jsxs)(`div`,{"data-slot":`thread-dock`,className:`sticky bottom-[var(--kb,0px)] z-10 bg-background px-3 pt-1 pb-2 max-md:border-t max-md:border-border md:px-6 md:pt-1.5 md:pb-4`,children:[R.pillVisible?(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,X.jsx)(Ln,{onJump:R.jumpToLatest})}):null,(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-1.5 md:gap-2.5`,children:[(0,X.jsx)(wn,{runId:e.id,agents:g,onSelect:v},`agents:${e.id}`),o!==void 0&&o.length>0?(0,X.jsx)(jn,{runId:e.id,entries:o},e.id):null,(0,X.jsx)(vt,{run:e}),e.status===`waiting`?(0,X.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(U,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`]}):null,u?(0,X.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(U,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,(0,X.jsx)(ye,{onSubmit:m?(e,t)=>d.continueWith(e,t):(e,t)=>E.mutateAsync({text:e,images:t}),disabled:j||!l&&!u&&!m,disabledReason:j?te:`Session closed — no session to resume.`,footerEnd:j&&!d.providerPending?(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):m?d.pills:void 0,allowEmptySubmit:m,sendAriaLabel:m?`Continue`:`Send`,placeholder:u?`Add to the prompt — sent when the run starts…`:m?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>ur(t)})]})]})]})}function wr({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,X.jsx)(`p`,{"data-slot":`history-fallback`,className:`text-center text-xs text-soft-foreground`,role:`status`,children:`Progressive history is unavailable; showing the complete session.`}):!e&&!n?(0,X.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,X.jsxs)(`div`,{"data-slot":`history-boundary`,"data-retained-pages":i,"aria-busy":t,className:`flex min-h-8 items-center justify-center text-xs text-muted-foreground`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:a,disabled:t,className:`rounded-md px-3 py-1.5 font-medium hover:bg-muted disabled:cursor-wait`,children:t?`Loading 100 earlier items…`:n?`Couldn’t load earlier items · Retry`:`Load 100 earlier items`}),(0,X.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function Tr({run:e}){let t=R(u().data??[],e.id);return(0,X.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,X.jsx)(U,{tone:`pending`,pulse:!0}),(0,X.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{Sr as TaskThreadRoute};
@@ -1 +1 @@
1
- import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./utils-Bb8ohcr3.js";var i=n(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);e();var a=t();function o({className:e,...t}){return(0,a.jsx)(`textarea`,{"data-slot":`textarea`,className:r(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-card px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}export{i as n,o as t};
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./utils--z9hRtl3.js";var i=n(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);e();var a=t();function o({className:e,...t}){return(0,a.jsx)(`textarea`,{"data-slot":`textarea`,className:r(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-card px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}export{i as n,o as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Rt as i,Vt as a,a as o,i as s,j as ee,k as c,pr as te,qr as ne,t as l}from"./centered-state-B_V_Ai2h.js";import{g as re,h as u,r as d,t as f,v as p}from"./utils-Bb8ohcr3.js";import{h as ie,m as ae,p as oe}from"./new-task-form-BydHBbef.js";import{p as se,r as ce,v as le,y as ue}from"./prompt-templates-B7Fs2b1S.js";import{n as m}from"./textarea--cpYshee.js";import{d as de,f as fe,g as h,h as g,l as _,m as pe,p as me,u as v}from"./alert-dialog-CGskMvgc.js";import{t as he}from"./use-submit-shortcut-JY8M_MPL.js";import{i as ge,n as _e,r as ve,t as ye}from"./skills-D4P-Hgey.js";var y=d(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),be=d(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),b=d(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),x=n(),S=e(t(),1);function C(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function w(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function T(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||C(e.target)&&!w(e.target))}function E(e,t){let n=S.useRef(t);S.useLayoutEffect(()=>{n.current=t}),S.useEffect(()=>{let t=t=>{T(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function D(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||C(e.target))}function O(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function k(e,t){let n=S.useRef(t);S.useLayoutEffect(()=>{n.current=t}),S.useEffect(()=>{let t=t=>{D(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function A({...e}){return(0,x.jsx)(_,{"data-slot":`sheet`,...e})}function j({...e}){return(0,x.jsx)(h,{"data-slot":`sheet-trigger`,...e})}function M({...e}){return(0,x.jsx)(v,{"data-slot":`sheet-close`,...e})}function N({...e}){return(0,x.jsx)(pe,{"data-slot":`sheet-portal`,...e})}function P({className:e,...t}){return(0,x.jsx)(me,{"data-slot":`sheet-overlay`,className:f(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function F({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,x.jsxs)(N,{children:[(0,x.jsx)(P,{}),(0,x.jsxs)(de,{"data-slot":`sheet-content`,className:f(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,x.jsxs)(v,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,x.jsx)(m,{className:`size-4`}),(0,x.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function I({className:e,...t}){return(0,x.jsx)(`div`,{"data-slot":`sheet-header`,className:f(`flex flex-col gap-1.5 p-4`,e),...t})}function L({className:e,...t}){return(0,x.jsx)(g,{"data-slot":`sheet-title`,className:f(`font-semibold text-foreground`,e),...t})}function R({className:e,...t}){return(0,x.jsx)(fe,{"data-slot":`sheet-description`,className:f(`text-sm text-muted-foreground`,e),...t})}function z(e){let[t,n]=S.useState(()=>Date.now());return S.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var B={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function V(e){return re(e.type)?e.type:B[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function xe(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=V(e)??`application/octet-stream`,a=p(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${u(i)}`),isImage:a}}function Se(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(V(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var H=new Set([`/`,`@`]);function Ce(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(H.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function we(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function U(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Te(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Ee(e){let[t,n]=S.useState(null),r=S.useRef(null),i=S.useRef(``),[a]=S.useState(()=>U()!==void 0),o=S.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return S.useEffect(()=>o,[o]),{supported:a,recording:t,start:S.useCallback(()=>{if(r.current)return;let t=U();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=Te(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:S.useCallback(()=>o(),[o]),finish:S.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function W(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var De={KeyA:`Yes, approved.`,KeyC:`Continue.`};function G({onSubmit:e,value:t,onValueChange:n,autoFocus:r=!1,footerStart:c,footerEnd:l,sendAriaLabel:re=`Send`,disabled:u=!1,disabledReason:d=`Session closed — Continue to reopen.`,allowEmptySubmit:p=!1,placeholder:de=`Reply — / for skills, @ for files…`,ariaLabel:fe=`Reply to the agent`,autocompleteSkills:h=!0,quickReplies:g=!1,getMentionCandidates:_,ref:pe}){let[me,v]=(0,S.useState)(``),w=t??me,T=(0,S.useRef)(w);T.current=w;let E=(0,S.useRef)(n);E.current=n;let D=(0,S.useCallback)(e=>{let t=typeof e==`function`?e(T.current):e;v(t),E.current?.(t)},[]),[O,k]=(0,S.useState)([]),A=(0,S.useRef)(O);A.current=O;let[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(null),[F,I]=(0,S.useState)(``),[L,R]=(0,S.useState)(!1),z=(0,S.useRef)(null),B=(0,S.useRef)(null),V=(0,S.useRef)(null),H=i(h&&L),U=a(),Te=ne(),W=Ee(e=>s(e,{tone:`danger`}));(0,S.useEffect)(()=>{r&&z.current?.focus()},[]),(0,S.useImperativeHandle)(pe,()=>({insertAtCaret:e=>{let t=z.current,n=ce(T.current,t?.selectionStart??T.current.length,e);D(n.text),V.current=n.caret,t?.focus()}}),[D]);let G=(0,S.useCallback)(()=>{let e=z.current;if(!e||u){P(null);return}let t=Ce(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!h||t?.trigger===`@`&&_===void 0)return P(null);t?.trigger===`/`&&R(!0),P(t)},[h,u,_]),K=(0,S.useRef)(()=>{});K.current=()=>{let e=z.current;!e||e.value===T.current||(T.current=e.value,D(e.value),G())},(0,S.useEffect)(()=>{let e=z.current;if(!e)return;let t=()=>K.current();return e.addEventListener(`input`,t),()=>e.removeEventListener(`input`,t)},[]);let q=(0,S.useMemo)(()=>N===null?[]:N.trigger===`/`?_e(H.data??[],N.query,U.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:ge(e)})):(_?.()??[]).filter(e=>ve(e,N.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[_,H.data,N,U.data?.skillUsage]),J=q.some(e=>e.value===F)?F:q[0]?.value,Ae=N!==null,Y=(0,S.useCallback)(()=>P(null),[]),je=e=>{let t=z.current;if(!t||N===null)return;let n=t.selectionStart??t.value.length,r=we(t.value,N,n,e.insert);N.trigger===`/`&&U.data!==void 0&&te({skillUsage:ye(U.data.skillUsage,e.insert)}).then(()=>Te.invalidateQueries({queryKey:ee.uiState})).catch(()=>{}),D(r.text),V.current=r.caret,P(null),t.focus()};(0,S.useLayoutEffect)(()=>{let e=V.current,t=z.current;e!==null&&t&&(t.setSelectionRange(e,e),V.current=null)},[w]),(0,S.useLayoutEffect)(()=>{let e=z.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[w]);let X=(0,S.useCallback)(e=>{if(u)return;let t=Se(e,A.current.length);for(let e of t.rejected)s(e,{tone:`danger`});for(let e of t.accepted)xe(e).then(e=>k(t=>t.length>=4?t:[...t,e]))},[u]),Me=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),X(t))},Ne=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),X(t))},Z=(0,S.useCallback)(async(t,n,r)=>{let i=t.trim();if(!(u||j)&&!(i===``&&n.length===0&&!p)){M(!0);try{await e(i,n.map(({mediaType:e,data:t})=>({mediaType:e,data:t})))}catch(e){s(e instanceof Error?e.message:String(e),{tone:`danger`}),r&&(D(e=>e===``?t:`${t}\n${e}`),k(e=>[...n,...e].slice(0,4)))}finally{M(!1)}}},[p,j,u,e]),Pe=(0,S.useCallback)(()=>{if(w.trim()===``&&O.length===0&&!p)return;let e=w,t=O;D(``),k([]),P(null),Z(e,t,!0)},[p,O,Z,w]),Fe=e=>{if(Ae){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),q.length===0)return;let t=q.findIndex(e=>e.value===J),n=e.key===`ArrowDown`?1:-1,r=q[(t+n+q.length)%q.length];I(r.value);return}if(e.key===`Escape`){e.preventDefault(),Y();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=q.find(e=>e.value===J);if(t){e.preventDefault(),je(t);return}Y()}}he({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Pe())};(0,S.useEffect)(()=>{if(!g||u)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||C(e.target))return;let t=De[e.code];t!==void 0&&(e.preventDefault(),Z(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,g,Z]);let Q=e=>{let t=W.finish();if(t===``)return;let n=w.trim()===``?t:`${w.replace(/\s*$/,``)} ${t}`;if(e){D(``),k([]),Z(n,O,!0);return}D(n),V.current=n.length,z.current?.focus()},$=W.recording;return(0,x.jsxs)(oe,{open:Ae,onOpenChange:e=>e?void 0:Y(),children:[(0,x.jsx)(ae,{asChild:!0,children:(0,x.jsxs)(`div`,{ref:B,"data-slot":`composer`,"data-disabled":u||void 0,onDrop:Ne,onDragOver:e=>e.preventDefault(),className:f(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,u&&`opacity-80`),children:[O.length>0?(0,x.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap items-center gap-2 px-4 pt-3`,children:O.map((e,t)=>(0,x.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:f(`group relative overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>k(e=>e.filter((e,n)=>n!==t)),children:[e.isImage?(0,x.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,x.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,x.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,x.jsx)(m,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,x.jsx)(`textarea`,{ref:z,rows:1,value:w,disabled:u,"aria-label":fe,placeholder:u?d:de,className:`block max-h-[220px] min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,onChange:e=>{e.target.value!==T.current&&D(e.target.value),G()},onKeyDown:Fe,onSelect:G,onPaste:Me}),$?(0,x.jsx)(ke,{transcript:$.transcript,startedAt:$.startedAt,onCancel:W.cancel,onInsert:()=>Q(!1),onInsertAndSend:()=>Q(!0)}):(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[(0,x.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,x.jsx)(Oe,{disabled:u,onFiles:X}),c]}),(0,x.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[W.supported?(0,x.jsxs)(o,{type:`button`,variant:`ghost`,size:`sm`,disabled:u,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:W.start,children:[(0,x.jsx)(be,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,l?(0,x.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:l}):null,(0,x.jsx)(o,{type:`button`,size:`icon-sm`,"aria-label":re,disabled:u||j||w.trim()===``&&O.length===0&&!p,className:`size-8`,onClick:Pe,children:(0,x.jsx)(y,{"aria-hidden":`true`})})]})]})]})}),(0,x.jsx)(ie,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{B.current?.contains(e.target)&&e.preventDefault()},children:(0,x.jsx)(se,{shouldFilter:!1,value:J??``,onValueChange:I,children:(0,x.jsx)(ue,{"data-slot":`composer-menu`,"data-trigger":N?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:q.length===0?(0,x.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:N?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:H.isPending?`Loading skills…`:`No matching skills.`}):q.map(e=>(0,x.jsxs)(le,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>je(e),children:[(0,x.jsx)(`span`,{className:f(`shrink-0 truncate`,e.emphasized&&`font-semibold`,N?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Oe({disabled:e,onFiles:t}){let n=(0,S.useRef)(null);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,x.jsx)(b,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,x.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function ke({transcript:e,startedAt:t,onCancel:n,onInsert:i,onInsertAndSend:a}){let s=z(1e3);return(0,x.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,x.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:W(t,s)}),(0,x.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,x.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,x.jsx)(m,{"aria-hidden":`true`})}),(0,x.jsx)(o,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:i,children:(0,x.jsx)(r,{"aria-hidden":`true`})}),(0,x.jsx)(o,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:a,children:(0,x.jsx)(y,{"aria-hidden":`true`})})]})}function K(){return(0,x.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,x.jsx)(l,{icon:(0,x.jsx)(c,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{M as a,I as c,O as d,E as f,y as h,A as i,L as l,b as m,G as n,F as o,k as p,z as r,R as s,K as t,j as u};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Rt as i,Vt as a,a as o,i as s,j as ee,k as c,pr as te,qr as ne,t as l}from"./centered-state-Djgly6Ni.js";import{g as re,h as u,r as d,t as f,v as p}from"./utils--z9hRtl3.js";import{h as ie,m as ae,p as oe}from"./new-task-form-1r2bgsdD.js";import{p as se,r as ce,v as le,y as ue}from"./prompt-templates-BmZtCe-L.js";import{n as m}from"./textarea-CyBCyKIk.js";import{d as de,f as fe,g as h,h as g,l as _,m as pe,p as me,u as v}from"./alert-dialog-BVsVcbFy.js";import{t as he}from"./use-submit-shortcut-JTpNzU-u.js";import{i as ge,n as _e,r as ve,t as ye}from"./skills-D4P-Hgey.js";var y=d(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),be=d(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),b=d(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),x=n(),S=e(t(),1);function C(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function w(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function T(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||C(e.target)&&!w(e.target))}function E(e,t){let n=S.useRef(t);S.useLayoutEffect(()=>{n.current=t}),S.useEffect(()=>{let t=t=>{T(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function D(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||C(e.target))}function O(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function k(e,t){let n=S.useRef(t);S.useLayoutEffect(()=>{n.current=t}),S.useEffect(()=>{let t=t=>{D(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function A({...e}){return(0,x.jsx)(_,{"data-slot":`sheet`,...e})}function j({...e}){return(0,x.jsx)(h,{"data-slot":`sheet-trigger`,...e})}function M({...e}){return(0,x.jsx)(v,{"data-slot":`sheet-close`,...e})}function N({...e}){return(0,x.jsx)(pe,{"data-slot":`sheet-portal`,...e})}function P({className:e,...t}){return(0,x.jsx)(me,{"data-slot":`sheet-overlay`,className:f(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function F({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,x.jsxs)(N,{children:[(0,x.jsx)(P,{}),(0,x.jsxs)(de,{"data-slot":`sheet-content`,className:f(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,x.jsxs)(v,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,x.jsx)(m,{className:`size-4`}),(0,x.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function I({className:e,...t}){return(0,x.jsx)(`div`,{"data-slot":`sheet-header`,className:f(`flex flex-col gap-1.5 p-4`,e),...t})}function L({className:e,...t}){return(0,x.jsx)(g,{"data-slot":`sheet-title`,className:f(`font-semibold text-foreground`,e),...t})}function R({className:e,...t}){return(0,x.jsx)(fe,{"data-slot":`sheet-description`,className:f(`text-sm text-muted-foreground`,e),...t})}function z(e){let[t,n]=S.useState(()=>Date.now());return S.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var B={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function V(e){return re(e.type)?e.type:B[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function xe(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=V(e)??`application/octet-stream`,a=p(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${u(i)}`),isImage:a}}function Se(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(V(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var H=new Set([`/`,`@`]);function Ce(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(H.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function we(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function U(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Te(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Ee(e){let[t,n]=S.useState(null),r=S.useRef(null),i=S.useRef(``),[a]=S.useState(()=>U()!==void 0),o=S.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return S.useEffect(()=>o,[o]),{supported:a,recording:t,start:S.useCallback(()=>{if(r.current)return;let t=U();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=Te(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:S.useCallback(()=>o(),[o]),finish:S.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function W(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var De={KeyA:`Yes, approved.`,KeyC:`Continue.`};function G({onSubmit:e,value:t,onValueChange:n,autoFocus:r=!1,footerStart:c,footerEnd:l,sendAriaLabel:re=`Send`,disabled:u=!1,disabledReason:d=`Session closed — Continue to reopen.`,allowEmptySubmit:p=!1,placeholder:de=`Reply — / for skills, @ for files…`,ariaLabel:fe=`Reply to the agent`,autocompleteSkills:h=!0,quickReplies:g=!1,getMentionCandidates:_,ref:pe}){let[me,v]=(0,S.useState)(``),w=t??me,T=(0,S.useRef)(w);T.current=w;let E=(0,S.useRef)(n);E.current=n;let D=(0,S.useCallback)(e=>{let t=typeof e==`function`?e(T.current):e;v(t),E.current?.(t)},[]),[O,k]=(0,S.useState)([]),A=(0,S.useRef)(O);A.current=O;let[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(null),[F,I]=(0,S.useState)(``),[L,R]=(0,S.useState)(!1),z=(0,S.useRef)(null),B=(0,S.useRef)(null),V=(0,S.useRef)(null),H=i(h&&L),U=a(),Te=ne(),W=Ee(e=>s(e,{tone:`danger`}));(0,S.useEffect)(()=>{r&&z.current?.focus()},[]),(0,S.useImperativeHandle)(pe,()=>({insertAtCaret:e=>{let t=z.current,n=ce(T.current,t?.selectionStart??T.current.length,e);D(n.text),V.current=n.caret,t?.focus()}}),[D]);let G=(0,S.useCallback)(()=>{let e=z.current;if(!e||u){P(null);return}let t=Ce(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!h||t?.trigger===`@`&&_===void 0)return P(null);t?.trigger===`/`&&R(!0),P(t)},[h,u,_]),K=(0,S.useRef)(()=>{});K.current=()=>{let e=z.current;!e||e.value===T.current||(T.current=e.value,D(e.value),G())},(0,S.useEffect)(()=>{let e=z.current;if(!e)return;let t=()=>K.current();return e.addEventListener(`input`,t),()=>e.removeEventListener(`input`,t)},[]);let q=(0,S.useMemo)(()=>N===null?[]:N.trigger===`/`?_e(H.data??[],N.query,U.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:ge(e)})):(_?.()??[]).filter(e=>ve(e,N.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[_,H.data,N,U.data?.skillUsage]),J=q.some(e=>e.value===F)?F:q[0]?.value,Ae=N!==null,Y=(0,S.useCallback)(()=>P(null),[]),je=e=>{let t=z.current;if(!t||N===null)return;let n=t.selectionStart??t.value.length,r=we(t.value,N,n,e.insert);N.trigger===`/`&&U.data!==void 0&&te({skillUsage:ye(U.data.skillUsage,e.insert)}).then(()=>Te.invalidateQueries({queryKey:ee.uiState})).catch(()=>{}),D(r.text),V.current=r.caret,P(null),t.focus()};(0,S.useLayoutEffect)(()=>{let e=V.current,t=z.current;e!==null&&t&&(t.setSelectionRange(e,e),V.current=null)},[w]),(0,S.useLayoutEffect)(()=>{let e=z.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[w]);let X=(0,S.useCallback)(e=>{if(u)return;let t=Se(e,A.current.length);for(let e of t.rejected)s(e,{tone:`danger`});for(let e of t.accepted)xe(e).then(e=>k(t=>t.length>=4?t:[...t,e]))},[u]),Me=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),X(t))},Ne=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),X(t))},Z=(0,S.useCallback)(async(t,n,r)=>{let i=t.trim();if(!(u||j)&&!(i===``&&n.length===0&&!p)){M(!0);try{await e(i,n.map(({mediaType:e,data:t})=>({mediaType:e,data:t})))}catch(e){s(e instanceof Error?e.message:String(e),{tone:`danger`}),r&&(D(e=>e===``?t:`${t}\n${e}`),k(e=>[...n,...e].slice(0,4)))}finally{M(!1)}}},[p,j,u,e]),Pe=(0,S.useCallback)(()=>{if(w.trim()===``&&O.length===0&&!p)return;let e=w,t=O;D(``),k([]),P(null),Z(e,t,!0)},[p,O,Z,w]),Fe=e=>{if(Ae){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),q.length===0)return;let t=q.findIndex(e=>e.value===J),n=e.key===`ArrowDown`?1:-1,r=q[(t+n+q.length)%q.length];I(r.value);return}if(e.key===`Escape`){e.preventDefault(),Y();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=q.find(e=>e.value===J);if(t){e.preventDefault(),je(t);return}Y()}}he({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Pe())};(0,S.useEffect)(()=>{if(!g||u)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||C(e.target))return;let t=De[e.code];t!==void 0&&(e.preventDefault(),Z(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,g,Z]);let Q=e=>{let t=W.finish();if(t===``)return;let n=w.trim()===``?t:`${w.replace(/\s*$/,``)} ${t}`;if(e){D(``),k([]),Z(n,O,!0);return}D(n),V.current=n.length,z.current?.focus()},$=W.recording;return(0,x.jsxs)(oe,{open:Ae,onOpenChange:e=>e?void 0:Y(),children:[(0,x.jsx)(ae,{asChild:!0,children:(0,x.jsxs)(`div`,{ref:B,"data-slot":`composer`,"data-disabled":u||void 0,onDrop:Ne,onDragOver:e=>e.preventDefault(),className:f(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,u&&`opacity-80`),children:[O.length>0?(0,x.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap items-center gap-2 px-4 pt-3`,children:O.map((e,t)=>(0,x.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:f(`group relative overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>k(e=>e.filter((e,n)=>n!==t)),children:[e.isImage?(0,x.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,x.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,x.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,x.jsx)(m,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,x.jsx)(`textarea`,{ref:z,rows:1,value:w,disabled:u,"aria-label":fe,placeholder:u?d:de,className:`block max-h-[220px] min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,onChange:e=>{e.target.value!==T.current&&D(e.target.value),G()},onKeyDown:Fe,onSelect:G,onPaste:Me}),$?(0,x.jsx)(ke,{transcript:$.transcript,startedAt:$.startedAt,onCancel:W.cancel,onInsert:()=>Q(!1),onInsertAndSend:()=>Q(!0)}):(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[(0,x.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,x.jsx)(Oe,{disabled:u,onFiles:X}),c]}),(0,x.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[W.supported?(0,x.jsxs)(o,{type:`button`,variant:`ghost`,size:`sm`,disabled:u,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:W.start,children:[(0,x.jsx)(be,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,l?(0,x.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:l}):null,(0,x.jsx)(o,{type:`button`,size:`icon-sm`,"aria-label":re,disabled:u||j||w.trim()===``&&O.length===0&&!p,className:`size-8`,onClick:Pe,children:(0,x.jsx)(y,{"aria-hidden":`true`})})]})]})]})}),(0,x.jsx)(ie,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{B.current?.contains(e.target)&&e.preventDefault()},children:(0,x.jsx)(se,{shouldFilter:!1,value:J??``,onValueChange:I,children:(0,x.jsx)(ue,{"data-slot":`composer-menu`,"data-trigger":N?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:q.length===0?(0,x.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:N?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:H.isPending?`Loading skills…`:`No matching skills.`}):q.map(e=>(0,x.jsxs)(le,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>je(e),children:[(0,x.jsx)(`span`,{className:f(`shrink-0 truncate`,e.emphasized&&`font-semibold`,N?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Oe({disabled:e,onFiles:t}){let n=(0,S.useRef)(null);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,x.jsx)(b,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,x.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function ke({transcript:e,startedAt:t,onCancel:n,onInsert:i,onInsertAndSend:a}){let s=z(1e3);return(0,x.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,x.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:W(t,s)}),(0,x.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,x.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,x.jsx)(m,{"aria-hidden":`true`})}),(0,x.jsx)(o,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:i,children:(0,x.jsx)(r,{"aria-hidden":`true`})}),(0,x.jsx)(o,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:a,children:(0,x.jsx)(y,{"aria-hidden":`true`})})]})}function K(){return(0,x.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,x.jsx)(l,{icon:(0,x.jsx)(c,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{M as a,I as c,O as d,E as f,y as h,A as i,L as l,b as m,G as n,F as o,k as p,z as r,R as s,K as t,j as u};
@@ -1 +1 @@
1
- import{r as e}from"./utils-Bb8ohcr3.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),n=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t as n,n as t};
1
+ import{r as e}from"./utils--z9hRtl3.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),n=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t as n,n as t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-Bb8ohcr3.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
1
+ import{r as e}from"./utils--z9hRtl3.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-Bb8ohcr3.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{t};
1
+ import{r as e}from"./utils--z9hRtl3.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-B_V_Ai2h.js";import{r as i,t as a}from"./utils-Bb8ohcr3.js";import{x as o}from"./index-Cz4GSAqV.js";var s=i(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=n();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:i}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,l.jsx)(d,{current:e,value:`unified`,onModeChange:n}),(0,l.jsx)(d,{current:e,value:`split`,onModeChange:n})]}),(0,l.jsx)(r,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:a(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,l.jsx)(c,{"aria-hidden":`true`})})]})}function d({current:e,value:t,onModeChange:n}){let r=e===t;return(0,l.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:a(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function f({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}var p=e(t(),1);function m(){let[e,t]=(0,p.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,p.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{s as i,f as n,u as r,m as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-Djgly6Ni.js";import{r as i,t as a}from"./utils--z9hRtl3.js";import{x as o}from"./index-qX7n11FX.js";var s=i(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=n();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:i}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,l.jsx)(d,{current:e,value:`unified`,onModeChange:n}),(0,l.jsx)(d,{current:e,value:`split`,onModeChange:n})]}),(0,l.jsx)(r,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:a(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,l.jsx)(c,{"aria-hidden":`true`})})]})}function d({current:e,value:t,onModeChange:n}){let r=e===t;return(0,l.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:a(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function f({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}var p=e(t(),1);function m(){let[e,t]=(0,p.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,p.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{s as i,f as n,u as r,m as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{a as n}from"./centered-state-B_V_Ai2h.js";import{t as r}from"./utils-Bb8ohcr3.js";import{n as i}from"./textarea--cpYshee.js";import{d as a,f as o,h as s,l as c,m as l,p as u,u as d}from"./alert-dialog-CGskMvgc.js";e();var f=t();function p({...e}){return(0,f.jsx)(c,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(l,{"data-slot":`dialog-portal`,...e})}function h({...e}){return(0,f.jsx)(d,{"data-slot":`dialog-close`,...e})}function g({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _({className:e,children:t,showCloseButton:n=!0,...o}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(g,{}),(0,f.jsxs)(a,{"data-slot":`dialog-content`,className:r(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...o,children:[t,n&&(0,f.jsxs)(d,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:r(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function y({className:e,showCloseButton:t=!1,children:i,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:r(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,t&&(0,f.jsx)(d,{asChild:!0,children:(0,f.jsx)(n,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(s,{"data-slot":`dialog-title`,className:r(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function S(e){return!(e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing)}function C(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}export{_ as a,v as c,h as i,b as l,C as n,x as o,p as r,y as s,S as t};
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{a as n}from"./centered-state-Djgly6Ni.js";import{t as r}from"./utils--z9hRtl3.js";import{n as i}from"./textarea-CyBCyKIk.js";import{d as a,f as o,h as s,l as c,m as l,p as u,u as d}from"./alert-dialog-BVsVcbFy.js";e();var f=t();function p({...e}){return(0,f.jsx)(c,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(l,{"data-slot":`dialog-portal`,...e})}function h({...e}){return(0,f.jsx)(d,{"data-slot":`dialog-close`,...e})}function g({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _({className:e,children:t,showCloseButton:n=!0,...o}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(g,{}),(0,f.jsxs)(a,{"data-slot":`dialog-content`,className:r(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...o,children:[t,n&&(0,f.jsxs)(d,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:r(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function y({className:e,showCloseButton:t=!1,children:i,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:r(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,t&&(0,f.jsx)(d,{asChild:!0,children:(0,f.jsx)(n,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(s,{"data-slot":`dialog-title`,className:r(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function S(e){return!(e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing)}function C(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}export{_ as a,v as c,h as i,b as l,C as n,x as o,p as r,y as s,S as t};