adam-agent-server 1.16.0 → 1.17.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 (191) hide show
  1. package/dist/App-SIQUVFJY.js +14 -0
  2. package/dist/approval-handler-FONN2EGB.js +1 -0
  3. package/dist/{artifacts-S2KD6W76.js → artifacts-DMY2MI2F.js} +1 -1
  4. package/dist/audit-diagnostics-D4M4SA5O.js +1 -0
  5. package/dist/audit-manager-YEOJRE6K.js +1 -0
  6. package/dist/bree-engine-RGTBKKFE.js +1 -0
  7. package/dist/channels-VYNJFXDD.js +1 -0
  8. package/dist/channels-WFU4CVGW.js +1 -0
  9. package/dist/chat-tool-calls-WQGFYTUV.js +1 -0
  10. package/dist/{chunk-TCBGUVVU.js → chunk-2RBYM3X7.js} +1 -1
  11. package/dist/chunk-2V2H5PG5.js +182 -0
  12. package/dist/{chunk-TJTH7LHX.js → chunk-2WPUKCDA.js} +1 -1
  13. package/dist/{chunk-6Y2DN2UH.js → chunk-32D5GWJD.js} +1 -1
  14. package/dist/chunk-3GK65T2V.js +6 -0
  15. package/dist/chunk-3R7VGMAK.js +6 -0
  16. package/dist/{chunk-OXGWWSKT.js → chunk-3RITIMKB.js} +1 -1
  17. package/dist/{chunk-3UR2PN5N.js → chunk-3VUEB67V.js} +1 -1
  18. package/dist/{chunk-P5Q2UINT.js → chunk-4G2OZPP5.js} +1 -1
  19. package/dist/{chunk-NUJSTEV4.js → chunk-4N5G7ND2.js} +1 -1
  20. package/dist/{chunk-YNS5LQX5.js → chunk-4WJ2VSEJ.js} +1 -1
  21. package/dist/{chunk-TLMG5W3L.js → chunk-5G64P4KE.js} +1 -1
  22. package/dist/{chunk-245WE5AF.js → chunk-5M6IGE5G.js} +1 -1
  23. package/dist/chunk-5PELJRUQ.js +1 -0
  24. package/dist/{chunk-I44JKROJ.js → chunk-5WBFQMJL.js} +1 -1
  25. package/dist/chunk-725BGAO2.js +143 -0
  26. package/dist/{chunk-OGY42NUN.js → chunk-73GP6K5S.js} +1 -1
  27. package/dist/{chunk-HC34HJFF.js → chunk-7IXYCDUF.js} +1 -1
  28. package/dist/{chunk-H4MMEULK.js → chunk-A2S67EQG.js} +2 -2
  29. package/dist/{chunk-HXDS4NWI.js → chunk-A57SY3E4.js} +1 -1
  30. package/dist/{chunk-N2OLEUAQ.js → chunk-BRUHXRKK.js} +1 -1
  31. package/dist/{chunk-XYZVMTNN.js → chunk-CFPXWGFD.js} +1 -1
  32. package/dist/{chunk-VVQ532U2.js → chunk-D5PAJ3CB.js} +1 -1
  33. package/dist/{chunk-LQVBWVLE.js → chunk-DCTNMUQ5.js} +1 -1
  34. package/dist/{chunk-LVHLUAZW.js → chunk-ED2JAMEN.js} +8 -7
  35. package/dist/{chunk-BLCNUT53.js → chunk-EZLBMUQD.js} +1 -1
  36. package/dist/{chunk-ASPPM7TQ.js → chunk-FJ3DUJXO.js} +1 -1
  37. package/dist/chunk-FMJVKJJE.js +1 -0
  38. package/dist/{chunk-NLTYJUQG.js → chunk-HL373H4P.js} +1 -1
  39. package/dist/chunk-K3HWZBE5.js +10 -0
  40. package/dist/{chunk-R24YRJRG.js → chunk-MQTK4Q6M.js} +1 -1
  41. package/dist/chunk-NV5ZXKKF.js +61 -0
  42. package/dist/chunk-OH6VBBDV.js +1 -0
  43. package/dist/{chunk-SCUPWMI5.js → chunk-OII5SDMS.js} +1 -1
  44. package/dist/{chunk-MTQI6B7T.js → chunk-P76VP2UH.js} +3 -3
  45. package/dist/{chunk-AQAHVNNG.js → chunk-PBKZDNNV.js} +5 -5
  46. package/dist/{chunk-HJICGOD4.js → chunk-QWIBCFPC.js} +1 -1
  47. package/dist/{chunk-AG5SADAI.js → chunk-SJTIMT5U.js} +1 -1
  48. package/dist/chunk-TNBQFCXR.js +14 -0
  49. package/dist/chunk-TO27F23C.js +2 -0
  50. package/dist/chunk-UAF4KNXE.js +32 -0
  51. package/dist/{chunk-FYULPPFR.js → chunk-UUJ24BNJ.js} +1 -1
  52. package/dist/{chunk-QL2ZOLMC.js → chunk-VARIYH6K.js} +92 -6
  53. package/dist/{chunk-WBAPIPST.js → chunk-VO24C673.js} +1 -1
  54. package/dist/{chunk-52FETPCI.js → chunk-VSSKQAG5.js} +1 -1
  55. package/dist/{chunk-VKKDSXMR.js → chunk-VVBN35YG.js} +1 -1
  56. package/dist/chunk-WDSCTXT7.js +1 -0
  57. package/dist/chunk-YEBC67DJ.js +1 -0
  58. package/dist/cli.js +2 -2
  59. package/dist/config-GRL6O2ZY.js +1 -0
  60. package/dist/config-ZDKMTZJC.js +1 -0
  61. package/dist/db-LIKGSZCL.js +1 -0
  62. package/dist/{delivery-log-3O3OHKY4.js → delivery-log-2ILFP673.js} +1 -1
  63. package/dist/engine-JVPM3XE5.js +1 -0
  64. package/dist/evolution-audit-BDQM6NAX.js +1 -0
  65. package/dist/execution-tools-7MK257DY.js +1 -0
  66. package/dist/{external-api-YMEFVZGG.js → external-api-7GB3U775.js} +1 -1
  67. package/dist/index.js +41 -41
  68. package/dist/learner-V2HBTRAE.js +1 -0
  69. package/dist/logger-TEZSHFTZ.js +1 -0
  70. package/dist/{memories-2DY5G6ZN.js → memories-B3QGTYLX.js} +1 -1
  71. package/dist/memory-extractor-RYZ3VU7A.js +1 -0
  72. package/dist/memory-gc-5AYND3RL.js +1 -0
  73. package/dist/memory-service-XI3JZQ4E.js +1 -0
  74. package/dist/outbound-gateway-O27KKVOI.js +1 -0
  75. package/dist/presets-UAH3OG3C.js +1 -0
  76. package/dist/reflection-job-P6GIQVQN.js +23 -0
  77. package/dist/role-presets-RVYTO5FS.js +1 -0
  78. package/dist/role-workspace-KOTVFJD3.js +1 -0
  79. package/dist/roles-B6YC4GDC.js +1 -0
  80. package/dist/{runtime-TWLGJSL6.js → runtime-C3XN33A3.js} +1 -1
  81. package/dist/server-bus-6QGH2AVL.js +1 -0
  82. package/dist/session-manager-HO2ZCB47.js +1 -0
  83. package/dist/skill-registry-X2GY7SMI.js +1 -0
  84. package/dist/target-resolution-RLNUCT6M.js +1 -0
  85. package/dist/{task-templates-4YPKFFKG.js → task-templates-MNCF7JON.js} +1 -1
  86. package/dist/template-dispatch-BAMKX3QH.js +1 -0
  87. package/dist/trace-context-NVCN6UPC.js +1 -0
  88. package/package.json +2 -1
  89. package/web/dist/assets/{ArtifactDetail-9DJdEqCz.js → ArtifactDetail-Dt_xkaYJ.js} +2 -2
  90. package/web/dist/assets/{Artifacts-CQ6SAemH.js → Artifacts-DlPMk9VQ.js} +1 -1
  91. package/web/dist/assets/{Button-xVc-P0vm.js → Button-CRNb8sD3.js} +1 -1
  92. package/web/dist/assets/{Card-WUD1cwG6.js → Card-Cwvv0An8.js} +1 -1
  93. package/web/dist/assets/{ChannelDetail-B21nBQwi.js → ChannelDetail-kYtMmy6P.js} +1 -1
  94. package/web/dist/assets/{Channels-CAeGE1r7.js → Channels-BppR0Qc_.js} +2 -2
  95. package/web/dist/assets/{Chat-KpFWchPp.js → Chat-BLVREMCu.js} +2 -2
  96. package/web/dist/assets/{Dashboard-DkRwHNmr.js → Dashboard-XURc0f15.js} +1 -1
  97. package/web/dist/assets/{EmptyState-BLB33cKG.js → EmptyState-BvQA1o5K.js} +1 -1
  98. package/web/dist/assets/{EnvVarEditor-BchUNrmz.js → EnvVarEditor-DR-bSU0w.js} +1 -1
  99. package/web/dist/assets/{EventDefDetail-DnBwWWfT.js → EventDefDetail-DtkbGbQ0.js} +1 -1
  100. package/web/dist/assets/{Events-ByIzPIs2.js → Events-C_J4jvDh.js} +1 -1
  101. package/web/dist/assets/{Evolution-Vh9RKdma.js → Evolution-CEaSpRAm.js} +1 -1
  102. package/web/dist/assets/{ExtensionDetail-0CtJh5rF.js → ExtensionDetail-D5Qfq-W4.js} +1 -1
  103. package/web/dist/assets/{Extensions--O1ulwlC.js → Extensions-B_egkUP1.js} +1 -1
  104. package/web/dist/assets/{FeatureRequests-XhQbGg_q.js → FeatureRequests-D8WEYtoU.js} +1 -1
  105. package/web/dist/assets/{GoalDetail-DIOxf7ES.js → GoalDetail-DnMS_WWw.js} +1 -1
  106. package/web/dist/assets/{Goals-CZnHu9qC.js → Goals-BeKwpAss.js} +1 -1
  107. package/web/dist/assets/Logs-BfXBv-dV.js +1 -0
  108. package/web/dist/assets/{Memories-D-EAODUg.js → Memories-QRH7O8qP.js} +1 -1
  109. package/web/dist/assets/{Mistakes-wW78K3cP.js → Mistakes-mXU9PXft.js} +1 -1
  110. package/web/dist/assets/{NotFound-BsxIP-Xm.js → NotFound-DuH6sFz7.js} +1 -1
  111. package/web/dist/assets/{PageHeader-D8pqg_wk.js → PageHeader-acLQTYct.js} +1 -1
  112. package/web/dist/assets/Plugins-C8v4AsvM.js +1 -0
  113. package/web/dist/assets/{RoleDetail-CU3G9j_q.js → RoleDetail-Ct-k3uoK.js} +3 -3
  114. package/web/dist/assets/Roles-B8dQCKuS.js +1 -0
  115. package/web/dist/assets/{SectionHeader-DZo4QVWr.js → SectionHeader-NZWZgoOs.js} +1 -1
  116. package/web/dist/assets/Settings-CqtCBP6I.js +1 -0
  117. package/web/dist/assets/{Strategies-Bg4qlLei.js → Strategies-DFUWEKfU.js} +1 -1
  118. package/web/dist/assets/{Switch-WWPXnSOG.js → Switch-BcS5rOWb.js} +1 -1
  119. package/web/dist/assets/{Table-XjSmrOyn.js → Table-D2K039zr.js} +1 -1
  120. package/web/dist/assets/{Tabs-CSbcG_5T.js → Tabs-BwyLSH2c.js} +1 -1
  121. package/web/dist/assets/TaskDetail-BdhBhvKg.js +2 -0
  122. package/web/dist/assets/Work-D-t80Ekv.js +1 -0
  123. package/web/dist/assets/api-BRfbZQSW.js +1 -0
  124. package/web/dist/assets/{es2015-BgPT8VkR.js → es2015-BkFSNOYE.js} +1 -1
  125. package/web/dist/assets/index-DWU9AURw.css +2 -0
  126. package/web/dist/assets/index-PIFMZAPo.js +12 -0
  127. package/web/dist/assets/{useIsMobileLayout-DF2fEEM9.js → useIsMobileLayout-BogOiFTv.js} +1 -1
  128. package/web/dist/assets/{usePluginsWithUsage-CjU8Lkdn.js → usePluginsWithUsage-DE13JW16.js} +1 -1
  129. package/web/dist/assets/{vendor-icons-H7p0EuQJ.js → vendor-icons-Bc_e_XXa.js} +1 -1
  130. package/web/dist/assets/{vendor-react-C1yKjxEP.js → vendor-react-bQ_cvNuA.js} +1 -1
  131. package/web/dist/assets/{vendor-state-D0TNAbOY.js → vendor-state-BMVR_B0I.js} +1 -1
  132. package/web/dist/index.html +8 -8
  133. package/dist/App-Z2GJAMX3.js +0 -14
  134. package/dist/approval-handler-6NPN24UN.js +0 -1
  135. package/dist/audit-diagnostics-2MDM3IQT.js +0 -1
  136. package/dist/audit-manager-QG7CMBV2.js +0 -1
  137. package/dist/bree-engine-3QSLZF3W.js +0 -1
  138. package/dist/channels-S4AAOOTN.js +0 -1
  139. package/dist/channels-TYXSSI7D.js +0 -1
  140. package/dist/chat-tool-calls-2C7O4B2X.js +0 -1
  141. package/dist/chunk-32LOJEHE.js +0 -32
  142. package/dist/chunk-3UZIEE2D.js +0 -6
  143. package/dist/chunk-4234WJJD.js +0 -178
  144. package/dist/chunk-C2XFPUFV.js +0 -1
  145. package/dist/chunk-DRO3DG7X.js +0 -1
  146. package/dist/chunk-EWYXVBOG.js +0 -61
  147. package/dist/chunk-FCV2DPZQ.js +0 -1
  148. package/dist/chunk-FHESRUJY.js +0 -9
  149. package/dist/chunk-K2TZW4DU.js +0 -132
  150. package/dist/chunk-K4IE6DPX.js +0 -6
  151. package/dist/chunk-MNSZE3NV.js +0 -1
  152. package/dist/chunk-WVHN54MA.js +0 -14
  153. package/dist/chunk-Z6LHGA27.js +0 -1
  154. package/dist/config-HDAAV5FV.js +0 -1
  155. package/dist/config-VHWLMFIN.js +0 -1
  156. package/dist/db-HFBXO2O5.js +0 -1
  157. package/dist/dist-HCSYRPJU.js +0 -1
  158. package/dist/engine-J43ECCH7.js +0 -1
  159. package/dist/evolution-audit-BSGPFGFK.js +0 -1
  160. package/dist/execution-tools-HHUPWLCF.js +0 -1
  161. package/dist/learner-TQQZKRSB.js +0 -1
  162. package/dist/logger-PAMNFWI3.js +0 -1
  163. package/dist/memory-extractor-TUOOFST2.js +0 -1
  164. package/dist/memory-gc-MRO53MEY.js +0 -1
  165. package/dist/memory-service-23WVAW7T.js +0 -1
  166. package/dist/onnxruntime_binding-2BPLI7ZQ.node +0 -0
  167. package/dist/onnxruntime_binding-5J67DTMJ.node +0 -0
  168. package/dist/onnxruntime_binding-7ZZLEQ2F.node +0 -0
  169. package/dist/onnxruntime_binding-KDCXAPN5.node +0 -0
  170. package/dist/onnxruntime_binding-R73P2IQW.node +0 -0
  171. package/dist/outbound-gateway-VXODXSQR.js +0 -1
  172. package/dist/presets-KJV6SNNB.js +0 -1
  173. package/dist/reflection-job-EFFW3WOR.js +0 -23
  174. package/dist/role-presets-PHHL3OEN.js +0 -1
  175. package/dist/role-workspace-USY47ZPQ.js +0 -1
  176. package/dist/roles-3JXNHL7K.js +0 -1
  177. package/dist/server-bus-GEGVMSCA.js +0 -1
  178. package/dist/session-manager-PI3JEINK.js +0 -1
  179. package/dist/skill-registry-ROGU2WED.js +0 -1
  180. package/dist/target-resolution-PSSBM4LX.js +0 -1
  181. package/dist/template-dispatch-46TN534D.js +0 -1
  182. package/dist/trace-context-UR7DI5ME.js +0 -1
  183. package/web/dist/assets/Logs-DdeG3GiY.js +0 -1
  184. package/web/dist/assets/Plugins-DDUdX51_.js +0 -1
  185. package/web/dist/assets/Roles-BCoSzDBg.js +0 -1
  186. package/web/dist/assets/Settings-K3usfV-2.js +0 -1
  187. package/web/dist/assets/TaskDetail-C5roukcV.js +0 -2
  188. package/web/dist/assets/Work-DGTWSgtc.js +0 -1
  189. package/web/dist/assets/api-BkdixMz9.js +0 -1
  190. package/web/dist/assets/index-KNUbHDLy.css +0 -2
  191. package/web/dist/assets/index-iD-HOtIu.js +0 -12
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,n,w as r,xt as i}from"./vendor-icons-Bc_e_XXa.js";import{r as a,t as o}from"./vendor-react-bQ_cvNuA.js";import{t as s}from"./Button-CRNb8sD3.js";import{f as c,p as l,t as u}from"./index-PIFMZAPo.js";import{t as d}from"./Card-Cwvv0An8.js";import{t as f}from"./PageHeader-acLQTYct.js";import{t as p}from"./SectionHeader-NZWZgoOs.js";import{a as m}from"./format-ZWN4JNj-.js";import{t as h}from"./EmptyState-BvQA1o5K.js";import{t as g}from"./useIsMobileLayout-BogOiFTv.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./Table-D2K039zr.js";var C=e(i(),1),w=o();function T(){let e=c(e=>e.roles),i=c(e=>e.fetchRoles),o=c(e=>e.createRole),[T,E]=(0,C.useState)(!1),[D,O]=(0,C.useState)(!1),[k,A]=(0,C.useState)(``),[j,M]=(0,C.useState)(``),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(null),L=g(),R=(0,C.useCallback)(async()=>{E(!0),await i(),E(!1)},[i]),z=()=>{A(``),M(``),I(null),P(!1)},B=async()=>{let e=k.trim();if(!e){I(`Name is required.`);return}P(!0),I(null);try{await o({name:e,cagPrompt:j.trim()}),await i(),O(!1),z(),l.success(`Role created`)}catch(e){I(e instanceof Error?e.message:`Failed to create role`)}finally{P(!1)}};(0,C.useEffect)(()=>{R()},[R]);let V=e=>e===`active`?`success`:e===`inactive`?`secondary`:e===`retired`?`destructive`:e===`probation`?`warning`:`secondary`,H=e.filter(e=>e.status===`active`).length,U=e.filter(e=>e.status===`probation`).length,W=e.filter(e=>e.memoryStreamId).length;return(0,w.jsxs)(`div`,{className:`space-y-5`,children:[(0,w.jsx)(f,{eyebrow:`Identities`,title:`Roles`,description:`Registry for role status, memory linkage, and edit actions.`,metrics:[{label:`Active`,value:H},{label:`Probation`,value:U},{label:`Linked Memory`,value:W}],compact:!0,actions:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void R(),disabled:T,children:(0,w.jsx)(r,{size:14,className:T?`animate-spin`:``})}),(0,w.jsxs)(s,{size:`sm`,onClick:()=>O(!0),children:[(0,w.jsx)(t,{size:14}),`New Role`]})]})}),(0,w.jsx)(p,{title:`Registry`,description:`Open a role to inspect prompts, performance, and bindings.`,compact:!0,action:(0,w.jsxs)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[e.length,` role`,e.length===1?``:`s`]})}),e.length===0&&!T?(0,w.jsx)(d,{children:(0,w.jsx)(h,{title:`No roles yet`,description:`Create a role to define agent behavior and bind plugins.`})}):L?(0,w.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,w.jsxs)(d,{children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,w.jsx)(a,{to:`/roles/${e.id}`,className:`font-medium text-[var(--app-accent)] hover:text-[var(--app-accent)]`,children:e.name}),e.presetId&&(0,w.jsx)(u,{variant:`info`,children:`Preset`}),(0,w.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:m(e.createdAt)})]}),(0,w.jsx)(u,{variant:V(e.status),children:e.status})]}),(0,w.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-[var(--app-text-subtle)] sm:grid-cols-2`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Score`}),(0,w.jsx)(`div`,{className:`mt-1 font-mono text-[var(--app-text)]`,children:e.performanceScore==null?`—`:`${(e.performanceScore*100).toFixed(0)}%`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Memory`}),(0,w.jsx)(`div`,{className:`mt-1 text-[var(--app-text)]`,children:e.memoryStreamId?e.memoryStreamId.slice(0,8):`—`})]})]})]},e.id))}):(0,w.jsx)(d,{padding:!1,children:(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{children:`Name`}),(0,w.jsx)(v,{children:`Status`}),(0,w.jsx)(v,{children:`Score`}),(0,w.jsx)(v,{children:`Memories`}),(0,w.jsx)(v,{children:`Created`})]})}),(0,w.jsx)(y,{children:e.map(e=>(0,w.jsxs)(b,{children:[(0,w.jsx)(x,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(a,{to:`/roles/${e.id}`,className:`font-medium text-[var(--app-accent)] hover:text-[var(--app-accent)]`,children:e.name}),e.presetId&&(0,w.jsx)(u,{variant:`info`,children:`Preset`})]})}),(0,w.jsx)(x,{children:(0,w.jsx)(u,{variant:V(e.status),children:e.status})}),(0,w.jsx)(x,{children:e.performanceScore==null?(0,w.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`—`}):(0,w.jsxs)(`span`,{className:`font-mono text-xs text-[var(--app-text)]`,children:[(e.performanceScore*100).toFixed(0),`%`]})}),(0,w.jsx)(x,{children:(0,w.jsx)(`span`,{className:`text-sm text-[var(--app-text-muted)]`,children:e.memoryStreamId?e.memoryStreamId.slice(0,8):`—`})}),(0,w.jsx)(x,{className:`text-xs text-[var(--app-text-subtle)]`,children:m(e.createdAt)})]},e.id))})]})}),D&&(0,w.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,onClick:e=>{e.target===e.currentTarget&&(O(!1),z())},children:(0,w.jsxs)(`div`,{className:`w-full max-w-md rounded-lg border border-[var(--app-border)] bg-[var(--app-panel)] p-6 shadow-lg`,children:[(0,w.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-[var(--app-text)]`,children:`Create Role`}),(0,w.jsx)(`button`,{className:`text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,onClick:()=>{O(!1),z()},children:(0,w.jsx)(n,{size:16})})]}),(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`label`,{className:`mb-1 block text-sm font-medium text-[var(--app-text)]`,htmlFor:`role-name`,children:[`Name `,(0,w.jsx)(`span`,{className:`text-[var(--app-danger)]`,children:`*`})]}),(0,w.jsx)(`input`,{id:`role-name`,className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-2 text-sm text-[var(--app-text)] placeholder-slate-500 focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`e.g. Engineer, Reviewer`,value:k,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&B()},autoFocus:!0})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-[var(--app-text)]`,htmlFor:`role-cag-prompt`,children:`CAG Prompt`}),(0,w.jsx)(`textarea`,{id:`role-cag-prompt`,className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-2 text-sm text-[var(--app-text)] placeholder-slate-500 focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Character and Guidance prompt for this role...`,rows:5,value:j,onChange:e=>M(e.target.value)})]}),F&&(0,w.jsx)(`p`,{className:`text-sm text-[var(--app-danger)]`,children:F}),(0,w.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,w.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>{O(!1),z()},children:`Cancel`}),(0,w.jsx)(s,{size:`sm`,onClick:()=>void B(),disabled:N,children:N?`Creating...`:`Create`})]})]})]})})]})}export{T as Roles};
@@ -1 +1 @@
1
- import{t as e}from"./vendor-react-C1yKjxEP.js";import{n as t}from"./dist-CgGno8kE.js";var n=e();function r({title:e,description:r,action:i,compact:a=!1,className:o}){return(0,n.jsxs)(`div`,{className:t(`flex flex-col sm:flex-row sm:justify-between`,a?`gap-2 sm:items-start`:`gap-3 sm:items-end`,o),children:[(0,n.jsxs)(`div`,{className:t(a?`space-y-0.5`:`space-y-1`),children:[(0,n.jsx)(`p`,{className:`text-section-label`,children:e}),r?(0,n.jsx)(`p`,{className:t(`text-sm text-[var(--app-text-muted)]`,a?`leading-5`:`leading-6`),children:r}):null]}),i?(0,n.jsx)(`div`,{className:`flex items-center gap-2`,children:i}):null]})}export{r as t};
1
+ import{t as e}from"./vendor-react-bQ_cvNuA.js";import{n as t}from"./dist-CgGno8kE.js";var n=e();function r({title:e,description:r,action:i,compact:a=!1,className:o}){return(0,n.jsxs)(`div`,{className:t(`flex flex-col sm:flex-row sm:justify-between`,a?`gap-2 sm:items-start`:`gap-3 sm:items-end`,o),children:[(0,n.jsxs)(`div`,{className:t(a?`space-y-0.5`:`space-y-1`),children:[(0,n.jsx)(`p`,{className:`text-section-label`,children:e}),r?(0,n.jsx)(`p`,{className:t(`text-sm text-[var(--app-text-muted)]`,a?`leading-5`:`leading-6`),children:r}):null]}),i?(0,n.jsx)(`div`,{className:`flex items-center gap-2`,children:i}):null]})}export{r as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{R as t,S as n,b as r,f as i,n as a,w as o,xt as s,y as c}from"./vendor-icons-Bc_e_XXa.js";import{l,t as u}from"./vendor-react-bQ_cvNuA.js";import"./es2015-BkFSNOYE.js";import{t as d}from"./Button-CRNb8sD3.js";import{_ as f,a as p,g as m,l as h,t as g,v as _,x as v}from"./api-BRfbZQSW.js";import{a as y,c as b,f as x,i as S,l as C,o as w,r as T,s as E,u as D}from"./index-PIFMZAPo.js";import{t as O}from"./Card-Cwvv0An8.js";import{t as k}from"./PageHeader-acLQTYct.js";import{t as ee}from"./SectionHeader-NZWZgoOs.js";import{i as A}from"./format-ZWN4JNj-.js";import{t as te}from"./EmptyState-BvQA1o5K.js";import{t as j}from"./ui-D1crlGpt.js";import{t as ne}from"./EnvVarEditor-DR-bSU0w.js";var M=e(s(),1),N=u(),re={emailGateway:{label:`Email Gateway`,paths:[`emailGateway.enabled`,`emailGateway.address`,`emailGateway.displayName`,`emailGateway.imap.host`,`emailGateway.imap.port`,`emailGateway.imap.secure`,`emailGateway.imap.auth.user`,`emailGateway.imap.auth.pass`,`emailGateway.imap.mailbox`,`emailGateway.smtp.host`,`emailGateway.smtp.port`,`emailGateway.smtp.secure`,`emailGateway.smtp.auth.user`,`emailGateway.smtp.auth.pass`,`emailGateway.smtp.from`,`emailGateway.subjectPrefix`]},anthropic:{label:`Anthropic`,paths:[`anthropic.apiKey`,`anthropic.baseUrl`,`anthropic.model`,`anthropic.defaultOpusModel`,`anthropic.defaultSonnetModel`,`anthropic.defaultHaikuModel`,`anthropic.smallFastModel`]},defaults:{label:`Defaults`,paths:[`defaults.model`,`defaults.effort`,`defaults.maxTurns`,`defaults.maxBudgetUsd`,`defaults.timeout`,`defaults.approvalTimeout`]},server:{label:`Server`,paths:[`server.port`,`server.host`],mutablePaths:[`server.timezone`]},logging:{label:`Logging`,paths:[`logging.level`]},evolution:{label:`Evolution`,paths:[`roles.evolution.triggerEvery`,`roles.evolution.reflectionThreshold`]},chat:{label:`Chat`,paths:[`chat.sessionTimeoutMinutes`,`chat.maxSessionTurns`,`chat.autoTitle`,`chat.archiveExtractMemory`]},templateExecutionArtifacts:{label:`Execution Artifacts`,paths:[`watchdog.rules.artifactCleanup.enabled`,`watchdog.rules.artifactCleanup.ttlDays`,`watchdog.rules.artifactCleanup.orphanGcMinAgeHours`]},memory:{label:`Memory`,paths:[],mutablePaths:[`memory.embeddingModel`]}},ie={emailGateway:`Central mailbox used by Mail channels for inbound and outbound delivery.`,anthropic:`Model endpoints and provider-specific defaults.`,defaults:`Global execution defaults applied when a role does not override them.`,server:`Network surface and host-level configuration.`,logging:`Verbosity and runtime observability controls.`,evolution:`Thresholds that govern role adaptation over time.`,chat:`Session lifecycle and archive behavior for chat mode.`,templateExecutionArtifacts:`Cleanup rules and artifact retention for TemplateExecution files.`,memory:`Embedding model used for belief and memory vector search.`},ae=[`defaults.deniedReadPaths`,`defaults.approvalRequired`],oe=new Set([`anthropic.apiKey`,`server.apiKey`,`emailGateway.imap.auth.pass`,`emailGateway.smtp.auth.pass`]),P={"anthropic.apiKey":`API Key`,"anthropic.baseUrl":`Base URL`,"anthropic.model":`Model`,"anthropic.defaultOpusModel":`Default Opus Model`,"anthropic.defaultSonnetModel":`Default Sonnet Model`,"anthropic.defaultHaikuModel":`Default Haiku Model`,"anthropic.smallFastModel":`Small Fast Model`,"defaults.model":`Default Model`,"defaults.effort":`Effort Level`,"defaults.maxTurns":`Max Turns`,"defaults.maxBudgetUsd":`Max Budget (USD)`,"defaults.timeout":`Timeout (seconds)`,"defaults.approvalTimeout":`Approval Timeout (seconds)`,"server.port":`Port`,"server.host":`Host`,"server.apiKey":`API Key (server auth)`,"server.timezone":`Timezone`,"logging.level":`Log Level`,"roles.evolution.triggerEvery":`Evolution Trigger Every (tasks)`,"roles.evolution.reflectionThreshold":`Reflection Threshold (tokens)`,"chat.sessionTimeoutMinutes":`Session Timeout (minutes)`,"chat.maxSessionTurns":`Max Session Turns`,"chat.autoTitle":`Auto-generate Session Title`,"chat.archiveExtractMemory":`Extract Memory on Archive`,"watchdog.rules.artifactCleanup.enabled":`Template Execution Artifact Cleanup Enabled`,"watchdog.rules.artifactCleanup.ttlDays":`Artifact Retention (days)`,"watchdog.rules.artifactCleanup.orphanGcMinAgeHours":`Orphan File GC Min Age (hours)`,"memory.embeddingModel":`Embedding Model`,"emailGateway.enabled":`Enabled`,"emailGateway.address":`Central Email Address`,"emailGateway.displayName":`Display Name`,"emailGateway.imap.host":`IMAP Host`,"emailGateway.imap.port":`IMAP Port`,"emailGateway.imap.secure":`IMAP Secure`,"emailGateway.imap.auth.user":`IMAP User`,"emailGateway.imap.auth.pass":`IMAP Password`,"emailGateway.imap.mailbox":`IMAP Mailbox`,"emailGateway.smtp.host":`SMTP Host`,"emailGateway.smtp.port":`SMTP Port`,"emailGateway.smtp.secure":`SMTP Secure`,"emailGateway.smtp.auth.user":`SMTP User`,"emailGateway.smtp.auth.pass":`SMTP Password`,"emailGateway.smtp.from":`SMTP From Address`,"emailGateway.subjectPrefix":`Subject Prefix`},se={"defaults.effort":[`low`,`medium`,`high`,`max`],"logging.level":[`debug`,`info`,`warn`,`error`],"memory.embeddingModel":[`bge-small-zh-v1.5`,`paraphrase-multilingual-MiniLM-L12-v2`],"server.timezone":[`system`,`Asia/Shanghai`,`Asia/Tokyo`,`Asia/Singapore`,`America/New_York`,`America/Los_Angeles`,`America/Chicago`,`Europe/London`,`Europe/Berlin`,`Europe/Paris`,`UTC`]};function F(e){return e?e.enabled?e.configured?e.lastStatus===`stopped`?`disconnected`:e.lastStatus===`error`?`failed`:e.lastStatus:`not_configured`:`disabled`:`not_checked`}function I(e){let t=`inline-flex rounded-full border px-2 py-0.5 text-xs font-medium`;return e===`connected`?`${t} border-[var(--app-success-soft-border)] bg-[var(--app-success-soft-bg)] text-[var(--app-success-soft-text)]`:e===`degraded`||e===`starting`||e===`connecting`?`${t} border-[var(--app-warning-soft-border)] bg-[var(--app-warning-soft-bg)] text-[var(--app-warning-soft-text)]`:e===`failed`?`${t} border-[var(--app-danger-soft-border)] bg-[var(--app-danger-soft-bg)] text-[var(--app-danger-soft-text)]`:`${t} border-[var(--app-border)] bg-black/10 text-[var(--app-text-muted)]`}function L(){let[e,a]=(0,M.useState)({}),[s,u]=(0,M.useState)([]),[f,p]=(0,M.useState)({}),[m,h]=(0,M.useState)(new Set),[_,v]=(0,M.useState)(!1),[j,L]=(0,M.useState)(null),[de,fe]=(0,M.useState)(!0),[R,z]=(0,M.useState)(null),[B,V]=(0,M.useState)({}),[H,U]=(0,M.useState)(new Set),[pe,me]=(0,M.useState)({}),[W,G]=(0,M.useState)(null),[K,he]=(0,M.useState)(null),[q,J]=(0,M.useState)(null),Y=x(e=>e.configVersion);(0,M.useEffect)(()=>{if(m.size===0)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[m.size]);let X=l(({currentLocation:e,nextLocation:t})=>m.size>0&&e.pathname!==t.pathname),Z=(0,M.useCallback)(async()=>{try{let e=await g(`/config`);a(e.config),u(e.mutable);let t={};for(let[n,r]of Object.entries(e.config))t[n]=String(r.value??``);p(t),h(new Set);let n=e.config[`server.timezone`]?.value;n&&A(n);let r={};for(let t of ae){let n=e.config[t];n&&(r[t]=Array.isArray(n.value)?n.value:[])}V(r),U(new Set),z(await g(`/config/env-diff`)),me((await g(`/config/env`)).env),he(await g(`/config/email-gateway/status`))}catch(e){L({type:`error`,text:e instanceof Error?e.message:`Failed to load config`})}finally{fe(!1)}},[]);(0,M.useEffect)(()=>{Z()},[Z]),(0,M.useEffect)(()=>{Y>0&&Z()},[Y,Z]);let ge=async()=>{await g(`/config/sync-to-env`,{method:`POST`}),L({type:`success`,text:`Synced DB values to .env`}),z(null)},_e=async()=>{await g(`/config/load-from-env`,{method:`POST`}),L({type:`success`,text:`Loaded .env values to DB`}),Z()},Q=(e,t)=>{p(n=>({...n,[e]:t})),h(t=>new Set(t).add(e)),L(null)},$=async e=>{let t=e===`imap`?`/config/email-gateway/test-imap`:e===`smtp`?`/config/email-gateway/test-smtp`:`/config/email-gateway/test-roundtrip`;J(e),L(null);try{G(await g(t,{method:`POST`}))}catch(t){G({ok:!1,stage:e,code:`unknown_error`,message:t instanceof Error?t.message:`Email Gateway test failed`})}finally{J(null)}},ve=async()=>{if(m.size!==0){v(!0),L(null);try{let t={};for(let n of m){let r=e[n],i=f[n];if(r&&typeof r.value==`number`){if(i=Number(i),isNaN(i)){L({type:`error`,text:`"${P[n]??n}" must be a number`}),v(!1);return}}else r&&typeof r.value==`boolean`&&n.startsWith(`emailGateway.`)&&(i=i===`true`);t[n]=i}let n=await g(`/config`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...Object.fromEntries(Array.from(H).map(e=>[e,B[e]??[]]))})});if(n.updated.length>0&&(L({type:`success`,text:`Updated ${n.updated.length} setting(s)`}),n.updated.includes(`server.timezone`))){let e=f[`server.timezone`];A(e)}n.errors.length>0&&L({type:`error`,text:n.errors.join(`; `)}),h(new Set),Z()}catch(e){L({type:`error`,text:e instanceof Error?e.message:`Save failed`})}finally{v(!1)}}};return de?(0,N.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,N.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):Object.keys(e).length===0?(0,N.jsx)(te,{icon:(0,N.jsx)(c,{size:32}),title:`No configuration`,description:`Config API not available`}):(0,N.jsxs)(`div`,{className:`space-y-5`,children:[(0,N.jsx)(k,{eyebrow:`Configuration`,title:`Settings`,compact:!0,description:`Mutable fields, pending edits, and environment drift.`,metrics:[{label:`Editable`,value:s.length},{label:`Pending`,value:m.size+H.size},{label:`Env Drift`,value:R?.diffs.length??0}],actions:(0,N.jsxs)(`div`,{className:`flex w-full justify-end gap-2`,children:[(0,N.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>void Z(),children:(0,N.jsx)(o,{size:14})}),m.size>0&&(0,N.jsxs)(d,{size:`sm`,onClick:()=>void ve(),disabled:_,children:[(0,N.jsx)(n,{size:14}),_?`Saving...`:`Save (${m.size})`]})]})}),(0,N.jsx)(ee,{title:`Configuration Groups`,compact:!0,description:`Fields stay in place while changeable, restart-required, and pending state are clarified.`}),j&&(0,N.jsx)(`div`,{className:`rounded-lg border px-4 py-3 text-sm ${j.type===`success`?`border-[var(--app-success-soft-border)] bg-[var(--app-success-soft-bg)] text-[var(--app-success-soft-text)]`:`border-[var(--app-danger-soft-border)] bg-[var(--app-danger-soft-bg)] text-[var(--app-danger-soft-text)]`}`,children:j.text}),R&&R.diffs.length>0&&(0,N.jsx)(O,{className:`surface-accent`,children:(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`p`,{className:`text-sm font-medium text-[var(--app-text)]`,children:[`.env and DB have `,R.diffs.length,` different value(s)`]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-[var(--app-text-muted)]`,children:R.diffs.map(e=>e.envKey).join(`, `)})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-end`,children:[(0,N.jsx)(d,{variant:`ghost`,size:`sm`,onClick:ge,children:`Sync DB → .env`}),(0,N.jsx)(d,{variant:`ghost`,size:`sm`,onClick:_e,children:`Load .env → DB`})]})]})}),Object.entries(re).map(([n,{label:a,paths:o,mutablePaths:c}])=>{let l=[...o,...c??[]],u=l.filter(e=>s.includes(e)).length;return(0,N.jsxs)(O,{children:[(0,N.jsxs)(`div`,{className:`mb-4 flex items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-medium text-[var(--app-text)]`,children:a}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-[var(--app-text-muted)]`,children:ie[n]??`Configuration values for this system area.`})]}),(0,N.jsxs)(`div`,{className:`rounded-full border border-[var(--app-border)] bg-black/10 px-3 py-1.5 text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:[u,`/`,l.length,` editable`]})]}),(0,N.jsx)(`div`,{className:`space-y-3`,children:l.map(n=>{let r=e[n];if(!r)return null;let i=s.includes(n),a=P[n]??n,o=f[n]??String(r.value??``),c=m.has(n),l=se[n],u=n.startsWith(`emailGateway.`)&&typeof r.value==`boolean`,d=`setting-${n.replace(/[^A-Za-z0-9_-]/g,`-`)}`;return(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-[var(--app-border)] bg-black/10 px-3 py-3 md:flex-row md:items-center md:gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 md:w-56 md:shrink-0`,children:[!i&&(0,N.jsx)(t,{size:12,className:`text-[var(--app-text-subtle)]`}),(0,N.jsx)(`label`,{htmlFor:d,className:`text-sm text-[var(--app-text-muted)]`,children:a}),!i&&(0,N.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`restart required`})]}),(0,N.jsx)(`div`,{className:`min-w-0 flex-1`,children:l?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`select`,{id:d,className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none disabled:opacity-50`,value:o,onChange:e=>Q(n,e.target.value),disabled:!i,children:l.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))}),n===`memory.embeddingModel`&&o===`paraphrase-multilingual-MiniLM-L12-v2`&&(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-[var(--app-warning)]`,children:`切换模型后建议清空候选 belief 的 embedding 重算(384 维与现存 512 维向量混用会导致余弦计算维度不匹配)`})]}):u?(0,N.jsxs)(`select`,{id:d,className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none disabled:opacity-50`,value:o,onChange:e=>Q(n,e.target.value),disabled:!i,children:[(0,N.jsx)(`option`,{value:`true`,children:`true`}),(0,N.jsx)(`option`,{value:`false`,children:`false`})]}):(0,N.jsx)(`input`,{id:d,className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none disabled:opacity-50`,type:oe.has(n)?`password`:`text`,value:o,onChange:e=>Q(n,e.target.value),disabled:!i,placeholder:oe.has(n)?`Enter to update`:void 0})}),(0,N.jsx)(`div`,{className:`text-left md:w-16 md:text-right`,children:c&&i&&(0,N.jsx)(`span`,{className:`text-[10px] text-[var(--app-warning)]`,children:`modified`})})]},n)})}),n===`emailGateway`&&(0,N.jsxs)(`div`,{className:`mt-4 border-t border-[var(--app-border)] pt-4`,children:[(0,N.jsxs)(`div`,{className:`mb-3 grid gap-2 text-sm md:grid-cols-3`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Runtime status`}),(0,N.jsx)(`p`,{children:(0,N.jsx)(`span`,{className:I(F(K)),children:F(K)})})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Last test`}),(0,N.jsx)(`p`,{children:W?(0,N.jsxs)(`span`,{className:I(W.ok?`connected`:`failed`),children:[W.stage,` `,W.code??``,`: `,W.message]}):(0,N.jsx)(`span`,{className:I(`not_checked`),children:`Not checked`})})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Last checked`}),(0,N.jsx)(`p`,{className:`text-[var(--app-text-muted)]`,children:K?.lastCheckedAt?new Date(K.lastCheckedAt).toLocaleString():`Never`})]})]}),(0,N.jsxs)(`div`,{className:`mb-3 text-sm`,children:[(0,N.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Last error`}),(0,N.jsx)(`p`,{className:`text-[var(--app-danger-soft-text)]`,children:K?.lastError??`None`})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsxs)(d,{variant:`ghost`,size:`sm`,onClick:()=>void $(`imap`),disabled:q!==null,children:[(0,N.jsx)(i,{size:14}),q===`imap`?`Testing IMAP...`:`Test IMAP`]}),(0,N.jsxs)(d,{variant:`ghost`,size:`sm`,onClick:()=>void $(`smtp`),disabled:q!==null,children:[(0,N.jsx)(i,{size:14}),q===`smtp`?`Testing SMTP...`:`Test SMTP`]}),(0,N.jsxs)(d,{variant:`ghost`,size:`sm`,onClick:()=>void $(`roundtrip`),disabled:q!==null,children:[(0,N.jsx)(r,{size:14}),q===`roundtrip`?`Sending probe...`:`Send test email`]})]})]})]},n)}),(0,N.jsx)(ne,{envVars:pe,onSave:()=>void Z(),mode:`global`,title:`Environment Variables`}),(0,N.jsx)(ue,{}),(0,N.jsx)(ce,{mutablePaths:s,listValues:B,listDirty:H,setListValues:V,setListDirty:e=>U(e),dirty:m}),(0,N.jsx)(le,{}),(0,N.jsx)(T,{open:X.state===`blocked`,children:(0,N.jsxs)(w,{children:[(0,N.jsxs)(C,{children:[(0,N.jsx)(D,{children:`Unsaved Changes`}),(0,N.jsxs)(E,{children:[`You have `,m.size+H.size,` unsaved change(s). Discard and leave?`]})]}),(0,N.jsxs)(b,{children:[(0,N.jsx)(y,{onClick:()=>X.reset?.(),children:`Stay`}),(0,N.jsx)(S,{onClick:()=>X.proceed?.(),children:`Discard`})]})]})})]})}function ce({mutablePaths:e,listValues:n,listDirty:r,setListValues:i,setListDirty:o,dirty:s}){let[c,l]=(0,M.useState)(``),[u,f]=(0,M.useState)(``),p=e.includes(`defaults.deniedReadPaths`),m=e.includes(`defaults.approvalRequired`),h=n[`defaults.deniedReadPaths`]??[],g=n[`defaults.approvalRequired`]??[],_=[`~/.ssh`,`~/.aws`,`~/.gnupg`,`/etc/shadow`],v=[`rm -rf *`,`git push*`,`git reset*`,`curl * -X POST*`,`curl * --request POST*`],y=e=>_.some(t=>e===(t.startsWith(`~/`),t)||e===t),b=e=>v.includes(e),x=()=>{let e=c.trim();!e||h.includes(e)||(i(t=>({...t,"defaults.deniedReadPaths":[...h,e]})),o(e=>new Set(e).add(`defaults.deniedReadPaths`)),l(``))},S=e=>{y(e)||(i(t=>({...t,"defaults.deniedReadPaths":h.filter(t=>t!==e)})),o(e=>new Set(e).add(`defaults.deniedReadPaths`)))},C=()=>{let e=u.trim();!e||g.includes(e)||(i(t=>({...t,"defaults.approvalRequired":[...g,e]})),o(e=>new Set(e).add(`defaults.approvalRequired`)),f(``))},w=e=>{b(e)||(i(t=>({...t,"defaults.approvalRequired":g.filter(t=>t!==e)})),o(e=>new Set(e).add(`defaults.approvalRequired`)))},T=s.size+r.size;return(0,N.jsxs)(O,{children:[(0,N.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-medium text-[var(--app-text)]`,children:`Advanced`}),T>0&&(0,N.jsxs)(`span`,{className:`text-[10px] text-[var(--app-warning)]`,children:[r.size,` modified`]})]}),(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,N.jsx)(`h3`,{className:`text-xs font-medium text-[var(--app-text-muted)]`,children:`Denied Read Paths`}),!p&&(0,N.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-[var(--app-text-subtle)]`,children:[(0,N.jsx)(t,{size:j.xs}),` restart required`]})]}),(0,N.jsxs)(`p`,{className:`mb-2 text-xs text-[var(--app-text-subtle)]`,children:[`Paths blocked at both the SDK and OS layer for all roles. System defaults (locked) cannot be removed. Uses `,(0,N.jsx)(`code`,{className:`text-[var(--app-text-muted)]`,children:`*`}),` as wildcard.`]}),(0,N.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:h.map(e=>{let n=y(e);return(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs ${n?`border-[var(--app-border)] bg-[var(--app-panel-elevated)] text-[var(--app-text-subtle)]`:`border-[var(--app-danger-soft-border)] bg-[var(--app-danger-soft-bg)] text-[var(--app-danger-soft-text)]`}`,children:[n&&(0,N.jsx)(t,{size:j.xs}),e,!n&&p&&(0,N.jsx)(`button`,{type:`button`,className:`ml-0.5 text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,onClick:()=>S(e),children:(0,N.jsx)(a,{size:j.xs})})]},e)})}),p&&(0,N.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,N.jsx)(`input`,{className:`flex-1 rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1 text-xs text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`/absolute/path or ~/path`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x())}}),(0,N.jsx)(d,{variant:`ghost`,size:`sm`,className:`scale-75`,onClick:()=>x(),children:`Add`})]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,N.jsx)(`h3`,{className:`text-xs font-medium text-[var(--app-text-muted)]`,children:`Approval Required Patterns`}),!m&&(0,N.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-[var(--app-text-subtle)]`,children:[(0,N.jsx)(t,{size:j.xs}),` restart required`]})]}),(0,N.jsxs)(`p`,{className:`mb-2 text-xs text-[var(--app-text-subtle)]`,children:[`Operations matching these glob patterns require user approval before execution. Uses SDK Permission Rule glob syntax (`,(0,N.jsx)(`code`,{className:`text-[var(--app-text-muted)]`,children:`*`}),` = wildcard, e.g.,`,` `,(0,N.jsx)(`code`,{className:`text-[var(--app-text-muted)]`,children:`rm -rf *`}),`).`]}),(0,N.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:g.map(e=>{let n=b(e);return(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs ${n?`border-[var(--app-border)] bg-[var(--app-panel-elevated)] text-[var(--app-text-subtle)]`:`border-[var(--app-warning-soft-border)] bg-[var(--app-warning-soft-bg)] text-[var(--app-warning-soft-text)]`}`,children:[n&&(0,N.jsx)(t,{size:j.xs}),e,!n&&m&&(0,N.jsx)(`button`,{type:`button`,className:`ml-0.5 text-[var(--app-warning)] hover:text-[var(--app-warning-soft-text)]`,onClick:()=>w(e),children:(0,N.jsx)(a,{size:j.xs})})]},e)})}),m&&(0,N.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,N.jsx)(`input`,{className:`flex-1 rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1 text-xs text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`e.g. "curl * --request POST *"`,value:u,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),C())}}),(0,N.jsx)(d,{variant:`ghost`,size:`sm`,className:`scale-75`,onClick:()=>C(),children:`Add`})]})]})]})}function le(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(15),[u,f]=(0,M.useState)(30),[p,m]=(0,M.useState)(500),[h,_]=(0,M.useState)(!1),y=2e3,b=e.find(e=>e.presetId===`feature-mining`)?.id;(0,M.useEffect)(()=>{(async()=>{try{let e=(await g(`/task-templates`)).templates.find(e=>e.presetId===`feature-mining`);e&&(t([e]),l(e.config?.max_sessions??15),f(e.config?.max_messages_per_session??30),m(e.config?.message_char_cap??500))}catch{}finally{r(!1)}})()},[]);let x=async()=>{if(b){a(!0),s(null);try{await v(b,{max_sessions:c,max_messages_per_session:u,message_char_cap:p}),s({type:`success`,text:`Feature Miner limits saved`}),_(!1)}catch(e){s({type:`error`,text:e instanceof Error?e.message:`Save failed`})}finally{a(!1)}}};if(n||!b)return null;let S=c*u*Math.min(p,100)/4,C=`~${Math.round(S).toLocaleString()} tokens (worst case)`;return(0,N.jsxs)(O,{children:[(0,N.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-medium text-[var(--app-text)]`,children:`Feature Miner Pre-fetch Limits`}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-[var(--app-text-muted)]`,children:`Controls how many chat sessions and messages the Feature Miner scans per run. Hard ceilings prevent prompt size from exceeding the model's context window.`})]}),h&&(0,N.jsx)(d,{size:`sm`,onClick:()=>void x(),disabled:i,children:i?`Saving...`:`Save`})]}),o&&(0,N.jsx)(`div`,{className:`mb-3 rounded px-3 py-2 text-xs ${o.type===`success`?`border border-[var(--app-success-soft-border)] bg-[var(--app-success-soft-bg)] text-[var(--app-success-soft-text)]`:`border border-[var(--app-danger-soft-border)] bg-[var(--app-danger-soft-bg)] text-[var(--app-danger-soft-text)]`}`,children:o.text}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-3`,children:[(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`label`,{className:`text-xs font-medium text-[var(--app-text-muted)]`,htmlFor:`fm-max-sessions`,children:`Max Sessions`}),(0,N.jsxs)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:[`ceiling: `,50]})]}),(0,N.jsx)(`input`,{id:`fm-max-sessions`,type:`number`,min:1,max:50,value:c,onChange:e=>{l(Math.min(50,Math.max(1,parseInt(e.target.value)||1))),_(!0)},className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`}),(0,N.jsx)(`p`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`Sessions to scan (most recent first). Default: 15.`})]}),(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`label`,{className:`text-xs font-medium text-[var(--app-text-muted)]`,htmlFor:`fm-max-messages`,children:`Max Messages / Session`}),(0,N.jsxs)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:[`ceiling: `,100]})]}),(0,N.jsx)(`input`,{id:`fm-max-messages`,type:`number`,min:1,max:100,value:u,onChange:e=>{f(Math.min(100,Math.max(1,parseInt(e.target.value)||1))),_(!0)},className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`}),(0,N.jsx)(`p`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`Most recent messages per session. Default: 30.`})]}),(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`label`,{className:`text-xs font-medium text-[var(--app-text-muted)]`,htmlFor:`fm-char-cap`,children:`Message Char Cap`}),(0,N.jsxs)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:[`ceiling: `,y]})]}),(0,N.jsx)(`input`,{id:`fm-char-cap`,type:`number`,min:10,max:y,value:p,onChange:e=>{m(Math.min(y,Math.max(10,parseInt(e.target.value)||10))),_(!0)},className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`}),(0,N.jsx)(`p`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`Max characters per message. Default: 500.`})]})]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-3 py-2`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-xs font-medium text-[var(--app-text-muted)]`,children:`Estimated worst-case prompt size`}),(0,N.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:C})]}),S>15e4&&(0,N.jsx)(`span`,{className:`text-[10px] text-[var(--app-warning)]`,children:`Near context window limit`})]})]})]})}function ue(){let e=h()??``,[t,n]=(0,M.useState)(!1),[r,i]=(0,M.useState)(!1),[s,c]=(0,M.useState)(!1),[l,u]=(0,M.useState)(null),[g,v]=(0,M.useState)(null),x=e.length>12?e.slice(0,4)+`****`+e.slice(-4):`(no key in localStorage)`;async function k(){i(!0),v(null);try{let e=await f();_(e),u(e),c(!1)}catch(e){v(e instanceof Error?e.message:String(e)),c(!1)}finally{i(!1)}}function A(){p(),m()}return(0,N.jsxs)(O,{children:[(0,N.jsx)(ee,{title:`Adam API Key`,description:`Rotate or sign out`}),(0,N.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsx)(`code`,{className:`flex-1 rounded bg-[var(--app-bg)] px-3 py-2 font-mono text-sm`,children:t?e||`(no key)`:x}),(0,N.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>n(e=>!e),children:t?`Hide`:`Show`})]}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsxs)(d,{variant:`outline`,size:`sm`,onClick:()=>c(!0),disabled:r,children:[(0,N.jsx)(o,{size:j.xs,className:`mr-1`}),`Rotate key`]}),(0,N.jsxs)(d,{variant:`ghost`,size:`sm`,onClick:A,children:[(0,N.jsx)(a,{size:j.xs,className:`mr-1`}),`Log out`]})]}),g&&(0,N.jsx)(`div`,{className:`rounded border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-400`,children:g}),(0,N.jsxs)(`p`,{className:`text-xs text-[var(--app-muted)]`,children:[`Rotating generates a new key, writes it to `,(0,N.jsx)(`code`,{children:`~/.adam/adam.key`}),`, and invalidates the old key on every device that uses the Adam API (Web UI, TUI, other browsers). Channel adapters (WeChat, Telegram, Discord) keep their own credentials and are NOT affected. Only external callers of your `,(0,N.jsx)(`code`,{children:`/webhooks/:name`}),` endpoints need the new key.`]})]}),(0,N.jsx)(T,{open:s,children:(0,N.jsxs)(w,{children:[(0,N.jsxs)(C,{children:[(0,N.jsx)(D,{children:`Rotate API key?`}),(0,N.jsxs)(E,{children:[`The old key stops working immediately. Other browsers/TUI sessions and any external callers of `,(0,N.jsx)(`code`,{children:`/webhooks/:name`}),` will return 401 until updated. Channel adapters (WeChat, Telegram, Discord) use their own credentials and are not affected.`]})]}),(0,N.jsxs)(b,{children:[(0,N.jsx)(y,{onClick:()=>c(!1),children:`Cancel`}),(0,N.jsx)(S,{onClick:k,disabled:r,children:r?`Rotating...`:`Rotate`})]})]})}),(0,N.jsx)(T,{open:!!l,children:(0,N.jsxs)(w,{children:[(0,N.jsxs)(C,{children:[(0,N.jsx)(D,{children:`New API key`}),(0,N.jsx)(E,{children:`Save this somewhere safe. Other devices and channels need to be updated with this key.`})]}),(0,N.jsx)(`code`,{className:`mt-2 block break-all rounded bg-[var(--app-bg)] p-3 font-mono text-xs`,children:l}),(0,N.jsxs)(b,{children:[(0,N.jsx)(S,{onClick:()=>{l&&navigator.clipboard.writeText(l)},children:`Copy`}),(0,N.jsx)(S,{onClick:()=>u(null),children:`Done`})]})]})})]})}export{L as Settings};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{S as t,yt as n,z as r}from"./vendor-icons-H7p0EuQJ.js";import{t as i}from"./vendor-react-C1yKjxEP.js";import{t as a}from"./Button-xVc-P0vm.js";import{f as o,t as s}from"./index-iD-HOtIu.js";import{t as c}from"./Card-WUD1cwG6.js";import{t as l}from"./PageHeader-D8pqg_wk.js";import{a as u}from"./format-ZWN4JNj-.js";import{t as d}from"./EmptyState-BLB33cKG.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./Table-XjSmrOyn.js";var v=e(n(),1),y=i(),b={engineer:`info`,analyst:`warning`,content_creator:`success`,reviewer:`muted`};function x(){let e=o(e=>e.strategies),n=o(e=>e.fetchStrategies);(0,v.useEffect)(()=>{n()},[n]);let i=new Map;for(let t of e){let e=i.get(t.roleId)??[];e.push(t),i.set(t.roleId,e)}return(0,y.jsxs)(`div`,{className:`space-y-5`,children:[(0,y.jsx)(l,{compact:!0,title:`Strategies`,description:`Bandit strategies grouped by role.`,metrics:[{label:`Catalog`,value:e.length},{label:`Roles`,value:i.size},{label:`Mature`,value:e.filter(e=>e.totalTrials>=10).length}],className:`px-4 py-3 lg:px-4 lg:py-3`,actions:(0,y.jsx)(a,{variant:`ghost`,size:`sm`,onClick:()=>void n(),children:(0,y.jsx)(t,{size:14})})}),e.length===0?(0,y.jsx)(c,{className:`p-4`,children:(0,y.jsx)(d,{icon:(0,y.jsx)(r,{size:32}),title:`No strategies`,description:`Strategies are created by the Thompson Sampling engine as agents process tasks.`,compact:!0})}):Array.from(i.entries()).map(([e,t])=>(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(s,{variant:b[e]??`muted`,children:e}),(0,y.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[t.length,` strategies`]})]}),(0,y.jsx)(c,{padding:!1,children:(0,y.jsxs)(_,{children:[(0,y.jsx)(f,{children:(0,y.jsxs)(h,{children:[(0,y.jsx)(p,{children:`Name`}),(0,y.jsx)(p,{children:`Task Type`}),(0,y.jsx)(p,{children:`Alpha`}),(0,y.jsx)(p,{children:`Beta`}),(0,y.jsx)(p,{children:`Trials`}),(0,y.jsx)(p,{children:`Avg Reward`}),(0,y.jsx)(p,{children:`Created`})]})}),(0,y.jsx)(m,{children:t.map(e=>(0,y.jsxs)(h,{children:[(0,y.jsx)(g,{className:`font-medium text-[var(--app-text)]`,children:e.name}),(0,y.jsx)(g,{children:(0,y.jsx)(`span`,{className:`rounded bg-[var(--app-panel-elevated)] px-1.5 py-0.5 font-mono text-[10px] text-[var(--app-text-muted)]`,children:e.taskType})}),(0,y.jsx)(g,{className:`font-mono text-xs`,children:e.alpha.toFixed(2)}),(0,y.jsx)(g,{className:`font-mono text-xs`,children:e.beta.toFixed(2)}),(0,y.jsx)(g,{className:`font-mono text-xs`,children:e.totalTrials}),(0,y.jsx)(g,{className:`font-mono text-xs`,children:e.avgReward==null?`—`:e.avgReward.toFixed(3)}),(0,y.jsx)(g,{className:`text-xs text-[var(--app-text-subtle)]`,children:u(e.createdAt)})]},e.id))})]})})]},e))]})}export{x as Strategies};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{V as t,w as n,xt as r}from"./vendor-icons-Bc_e_XXa.js";import{t as i}from"./vendor-react-bQ_cvNuA.js";import{t as a}from"./Button-CRNb8sD3.js";import{f as o,t as s}from"./index-PIFMZAPo.js";import{t as c}from"./Card-Cwvv0An8.js";import{t as l}from"./PageHeader-acLQTYct.js";import{a as u}from"./format-ZWN4JNj-.js";import{t as d}from"./EmptyState-BvQA1o5K.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./Table-D2K039zr.js";var v=e(r(),1),y=i(),b={engineer:`info`,analyst:`warning`,content_creator:`success`,reviewer:`muted`};function x(){let e=o(e=>e.strategies),r=o(e=>e.fetchStrategies);(0,v.useEffect)(()=>{r()},[r]);let i=new Map;for(let t of e){let e=i.get(t.roleId)??[];e.push(t),i.set(t.roleId,e)}return(0,y.jsxs)(`div`,{className:`space-y-5`,children:[(0,y.jsx)(l,{compact:!0,title:`Strategies`,description:`Bandit strategies grouped by role.`,metrics:[{label:`Catalog`,value:e.length},{label:`Roles`,value:i.size},{label:`Mature`,value:e.filter(e=>e.totalTrials>=10).length}],className:`px-4 py-3 lg:px-4 lg:py-3`,actions:(0,y.jsx)(a,{variant:`ghost`,size:`sm`,onClick:()=>void r(),children:(0,y.jsx)(n,{size:14})})}),e.length===0?(0,y.jsx)(c,{className:`p-4`,children:(0,y.jsx)(d,{icon:(0,y.jsx)(t,{size:32}),title:`No strategies`,description:`Strategies are created by the Thompson Sampling engine as agents process tasks.`,compact:!0})}):Array.from(i.entries()).map(([e,t])=>(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(s,{variant:b[e]??`muted`,children:e}),(0,y.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[t.length,` strategies`]})]}),(0,y.jsx)(c,{padding:!1,children:(0,y.jsxs)(_,{children:[(0,y.jsx)(f,{children:(0,y.jsxs)(h,{children:[(0,y.jsx)(p,{children:`Name`}),(0,y.jsx)(p,{children:`Task Type`}),(0,y.jsx)(p,{children:`Alpha`}),(0,y.jsx)(p,{children:`Beta`}),(0,y.jsx)(p,{children:`Trials`}),(0,y.jsx)(p,{children:`Avg Reward`}),(0,y.jsx)(p,{children:`Created`})]})}),(0,y.jsx)(m,{children:t.map(e=>(0,y.jsxs)(h,{children:[(0,y.jsx)(g,{className:`font-medium text-[var(--app-text)]`,children:e.name}),(0,y.jsx)(g,{children:(0,y.jsx)(`span`,{className:`rounded bg-[var(--app-panel-elevated)] px-1.5 py-0.5 font-mono text-[10px] text-[var(--app-text-muted)]`,children:e.taskType})}),(0,y.jsx)(g,{className:`font-mono text-xs`,children:e.alpha.toFixed(2)}),(0,y.jsx)(g,{className:`font-mono text-xs`,children:e.beta.toFixed(2)}),(0,y.jsx)(g,{className:`font-mono text-xs`,children:e.totalTrials}),(0,y.jsx)(g,{className:`font-mono text-xs`,children:e.avgReward==null?`—`:e.avgReward.toFixed(3)}),(0,y.jsx)(g,{className:`text-xs text-[var(--app-text-subtle)]`,children:u(e.createdAt)})]},e.id))})]})})]},e))]})}export{x as Strategies};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{yt as t}from"./vendor-icons-H7p0EuQJ.js";import{t as n}from"./vendor-react-C1yKjxEP.js";import{n as r}from"./dist-CgGno8kE.js";import{_ as i,a,f as o,v as s}from"./es2015-BgPT8VkR.js";import{i as c}from"./Button-xVc-P0vm.js";import{C as l}from"./index-iD-HOtIu.js";var u=e(t(),1);function d(e){let t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var f=n(),p=`Switch`,[m,h]=i(p),[g,_]=m(p),v=u.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:l,required:d,disabled:m,value:h=`on`,onCheckedChange:_,form:v,...y}=e,[b,x]=u.useState(null),w=c(t,e=>x(e)),T=u.useRef(!1),E=b?v||!!b.closest(`form`):!0,[D,O]=a({prop:i,defaultProp:l??!1,onChange:_,caller:p});return(0,f.jsxs)(g,{scope:n,checked:D,disabled:m,children:[(0,f.jsx)(o.button,{type:`button`,role:`switch`,"aria-checked":D,"aria-required":d,"data-state":C(D),"data-disabled":m?``:void 0,disabled:m,value:h,...y,ref:w,onClick:s(e.onClick,e=>{O(e=>!e),E&&(T.current=e.isPropagationStopped(),T.current||e.stopPropagation())})}),E&&(0,f.jsx)(S,{control:b,bubbles:!T.current,name:r,value:h,checked:D,required:d,disabled:m,form:v,style:{transform:`translateX(-100%)`}})]})});v.displayName=p;var y=`SwitchThumb`,b=u.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=_(y,n);return(0,f.jsx)(o.span,{"data-state":C(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});b.displayName=y;var x=`SwitchBubbleInput`,S=u.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=u.useRef(null),s=c(o,a),p=d(n),m=l(t);return u.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(p!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[p,n,r]),(0,f.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...m,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});S.displayName=x;function C(e){return e?`checked`:`unchecked`}var w=v,T=b,E=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(w,{className:r(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--app-canvas)] disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-[var(--app-accent)] data-[state=unchecked]:bg-[var(--app-panel-muted)]`,e),...t,ref:n,children:(0,f.jsx)(T,{className:r(`pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));E.displayName=w.displayName;export{E as t};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{xt as t}from"./vendor-icons-Bc_e_XXa.js";import{t as n}from"./vendor-react-bQ_cvNuA.js";import{n as r}from"./dist-CgGno8kE.js";import{_ as i,a,f as o,v as s}from"./es2015-BkFSNOYE.js";import{i as c}from"./Button-CRNb8sD3.js";import{C as l}from"./index-PIFMZAPo.js";var u=e(t(),1);function d(e){let t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var f=n(),p=`Switch`,[m,h]=i(p),[g,_]=m(p),v=u.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:l,required:d,disabled:m,value:h=`on`,onCheckedChange:_,form:v,...y}=e,[b,x]=u.useState(null),w=c(t,e=>x(e)),T=u.useRef(!1),E=b?v||!!b.closest(`form`):!0,[D,O]=a({prop:i,defaultProp:l??!1,onChange:_,caller:p});return(0,f.jsxs)(g,{scope:n,checked:D,disabled:m,children:[(0,f.jsx)(o.button,{type:`button`,role:`switch`,"aria-checked":D,"aria-required":d,"data-state":C(D),"data-disabled":m?``:void 0,disabled:m,value:h,...y,ref:w,onClick:s(e.onClick,e=>{O(e=>!e),E&&(T.current=e.isPropagationStopped(),T.current||e.stopPropagation())})}),E&&(0,f.jsx)(S,{control:b,bubbles:!T.current,name:r,value:h,checked:D,required:d,disabled:m,form:v,style:{transform:`translateX(-100%)`}})]})});v.displayName=p;var y=`SwitchThumb`,b=u.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=_(y,n);return(0,f.jsx)(o.span,{"data-state":C(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});b.displayName=y;var x=`SwitchBubbleInput`,S=u.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=u.useRef(null),s=c(o,a),p=d(n),m=l(t);return u.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(p!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[p,n,r]),(0,f.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...m,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});S.displayName=x;function C(e){return e?`checked`:`unchecked`}var w=v,T=b,E=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(w,{className:r(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--app-canvas)] disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-[var(--app-accent)] data-[state=unchecked]:bg-[var(--app-panel-muted)]`,e),...t,ref:n,children:(0,f.jsx)(T,{className:r(`pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));E.displayName=w.displayName;export{E as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{yt as t}from"./vendor-icons-H7p0EuQJ.js";import{t as n}from"./vendor-react-C1yKjxEP.js";import{n as r}from"./dist-CgGno8kE.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{className:`overflow-x-auto`,children:(0,a.jsx)(`table`,{ref:n,className:r(`w-full text-sm`,e),...t})}));o.displayName=`Table`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`thead`,{ref:n,className:r(`border-b border-[var(--app-border)]`,e),...t}));s.displayName=`TableHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`tbody`,{ref:n,className:r(`divide-y divide-[var(--app-border)]`,e),...t}));c.displayName=`TableBody`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`tr`,{ref:n,className:r(`transition-colors hover:bg-white/[0.04]`,e),...t}));l.displayName=`TableRow`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`th`,{ref:n,className:r(`px-3 py-2.5 text-left text-[11px] font-semibold uppercase tracking-[var(--app-tracking-micro)] text-[var(--app-text-subtle)]`,e),...t}));u.displayName=`TableHead`;var d=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`td`,{ref:n,className:r(`px-3 py-2.5 align-top text-[var(--app-text)]`,e),...t}));d.displayName=`TableCell`;var f=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`caption`,{ref:n,className:r(`mt-2 text-xs text-[var(--app-text-subtle)]`,e),...t}));f.displayName=`TableCaption`;var p=s,m=c,h=l,g=u,_=d;export{p as a,g as i,m as n,h as o,_ as r,o as t};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{xt as t}from"./vendor-icons-Bc_e_XXa.js";import{t as n}from"./vendor-react-bQ_cvNuA.js";import{n as r}from"./dist-CgGno8kE.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{className:`overflow-x-auto`,children:(0,a.jsx)(`table`,{ref:n,className:r(`w-full text-sm`,e),...t})}));o.displayName=`Table`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`thead`,{ref:n,className:r(`border-b border-[var(--app-border)]`,e),...t}));s.displayName=`TableHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`tbody`,{ref:n,className:r(`divide-y divide-[var(--app-border)]`,e),...t}));c.displayName=`TableBody`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`tr`,{ref:n,className:r(`transition-colors hover:bg-white/[0.04]`,e),...t}));l.displayName=`TableRow`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`th`,{ref:n,className:r(`px-3 py-2.5 text-left text-[11px] font-semibold uppercase tracking-[var(--app-tracking-micro)] text-[var(--app-text-subtle)]`,e),...t}));u.displayName=`TableHead`;var d=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`td`,{ref:n,className:r(`px-3 py-2.5 align-top text-[var(--app-text)]`,e),...t}));d.displayName=`TableCell`;var f=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`caption`,{ref:n,className:r(`mt-2 text-xs text-[var(--app-text-subtle)]`,e),...t}));f.displayName=`TableCaption`;var p=s,m=c,h=l,g=u,_=d;export{p as a,g as i,m as n,h as o,_ as r,o as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{yt as t}from"./vendor-icons-H7p0EuQJ.js";import{t as n}from"./vendor-react-C1yKjxEP.js";import{n as r}from"./dist-CgGno8kE.js";import{_ as i,a,c as o,d as s,f as c,m as l,o as u,v as d}from"./es2015-BgPT8VkR.js";import{i as f}from"./Button-xVc-P0vm.js";var p=e(t(),1),m=n();function h(e){let t=e+`CollectionProvider`,[n,r]=i(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:t,children:n}=e,r=p.useRef(null),i=p.useRef(new Map).current;return(0,m.jsx)(a,{scope:t,itemMap:i,collectionRef:r,children:n})};s.displayName=t;let c=e+`CollectionSlot`,u=l(c),d=p.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,m.jsx)(u,{ref:f(t,o(c,n).collectionRef),children:r})});d.displayName=c;let h=e+`CollectionItemSlot`,g=`data-radix-collection-item`,_=l(h),v=p.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,a=p.useRef(null),s=f(t,a),c=o(h,n);return p.useEffect(()=>(c.itemMap.set(a,{ref:a,...i}),()=>void c.itemMap.delete(a))),(0,m.jsx)(_,{[g]:``,ref:s,children:r})});v.displayName=h;function y(t){let n=o(e+`CollectionConsumer`,t);return p.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:s,Slot:d,ItemSlot:v},y,r]}var g=p.createContext(void 0);function _(e){let t=p.useContext(g);return e||t||`ltr`}var v=`rovingFocusGroup.onEntryFocus`,y={bubbles:!1,cancelable:!0},b=`RovingFocusGroup`,[x,S,C]=h(b),[w,T]=i(b,[C]),[ee,E]=w(b),D=p.forwardRef((e,t)=>(0,m.jsx)(x.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,m.jsx)(x.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,m.jsx)(O,{...e,ref:t})})}));D.displayName=b;var O=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:h,onEntryFocus:g,preventScrollOnEntryFocus:x=!1,...C}=e,w=p.useRef(null),T=f(t,w),E=_(o),[D,O]=a({prop:l,defaultProp:u??null,onChange:h,caller:b}),[k,A]=p.useState(!1),j=s(g),M=S(n),N=p.useRef(!1),[F,I]=p.useState(0);return p.useEffect(()=>{let e=w.current;if(e)return e.addEventListener(v,j),()=>e.removeEventListener(v,j)},[j]),(0,m.jsx)(ee,{scope:n,orientation:r,dir:E,loop:i,currentTabStopId:D,onItemFocus:p.useCallback(e=>O(e),[O]),onItemShiftTab:p.useCallback(()=>A(!0),[]),onFocusableItemAdd:p.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:p.useCallback(()=>I(e=>e-1),[]),children:(0,m.jsx)(c.div,{tabIndex:k||F===0?-1:0,"data-orientation":r,...C,ref:T,style:{outline:`none`,...e.style},onMouseDown:d(e.onMouseDown,()=>{N.current=!0}),onFocus:d(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!k){let t=new CustomEvent(v,y);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=M().filter(e=>e.focusable);P([e.find(e=>e.active),e.find(e=>e.id===D),...e].filter(Boolean).map(e=>e.ref.current),x)}}N.current=!1}),onBlur:d(e.onBlur,()=>A(!1))})})}),k=`RovingFocusGroupItem`,A=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:s,...l}=e,u=o(),f=a||u,h=E(k,n),g=h.currentTabStopId===f,_=S(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:b}=h;return p.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),(0,m.jsx)(x.ItemSlot,{scope:n,id:f,focusable:r,active:i,children:(0,m.jsx)(c.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...l,ref:t,onMouseDown:d(e.onMouseDown,e=>{r?h.onItemFocus(f):e.preventDefault()}),onFocus:d(e.onFocus,()=>h.onItemFocus(f)),onKeyDown:d(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){h.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=N(e,h.orientation,h.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=_().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=h.loop?F(n,r+1):n.slice(r+1)}setTimeout(()=>P(n))}}),children:typeof s==`function`?s({isCurrentTabStop:g,hasTabStop:b!=null}):s})})});A.displayName=k;var j={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function M(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function N(e,t,n){let r=M(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return j[r]}function P(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function F(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var I=D,L=A,R=`Tabs`,[te,ne]=i(R,[T]),z=T(),[re,B]=te(R),V=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:d=`automatic`,...f}=e,p=_(u),[h,g]=a({prop:r,onChange:i,defaultProp:s??``,caller:R});return(0,m.jsx)(re,{scope:n,baseId:o(),value:h,onValueChange:g,orientation:l,dir:p,activationMode:d,children:(0,m.jsx)(c.div,{dir:p,"data-orientation":l,...f,ref:t})})});V.displayName=R;var H=`TabsList`,U=p.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=B(H,n),o=z(n);return(0,m.jsx)(I,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,m.jsx)(c.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});U.displayName=H;var W=`TabsTrigger`,G=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=B(W,n),s=z(n),l=J(o.baseId,r),u=Y(o.baseId,r),f=r===o.value;return(0,m.jsx)(L,{asChild:!0,...s,focusable:!i,active:f,children:(0,m.jsx)(c.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":u,"data-state":f?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:l,...a,ref:t,onMouseDown:d(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:d(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:d(e.onFocus,()=>{let e=o.activationMode!==`manual`;!f&&!i&&e&&o.onValueChange(r)})})})});G.displayName=W;var K=`TabsContent`,q=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=B(K,n),l=J(s.baseId,r),d=Y(s.baseId,r),f=r===s.value,h=p.useRef(f);return p.useEffect(()=>{let e=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,m.jsx)(u,{present:i||f,children:({present:n})=>(0,m.jsx)(c.div,{"data-state":f?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?`0s`:void 0},children:n&&a})})});q.displayName=K;function J(e,t){return`${e}-trigger-${t}`}function Y(e,t){return`${e}-content-${t}`}var ie=V,X=U,Z=G,Q=q,ae=ie,$=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(X,{ref:n,className:r(`surface-panel-muted inline-flex min-h-11 items-center justify-center gap-1 rounded-full p-1 text-[var(--app-text-muted)]`,e),...t}));$.displayName=X.displayName;var oe=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(Z,{ref:n,className:r(`inline-flex items-center justify-center whitespace-nowrap rounded-full px-4 py-2 text-sm font-medium ring-offset-[var(--app-canvas)] transition-[background-color,color,box-shadow] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:surface-panel data-[state=active]:text-[var(--app-text)] data-[state=active]:shadow-[var(--app-shadow-sm)]`,e),...t}));oe.displayName=Z.displayName;var se=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(Q,{ref:n,className:r(`mt-4 ring-offset-[var(--app-canvas)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2`,e),...t}));se.displayName=Q.displayName;export{L as a,_ as c,oe as i,h as l,se as n,I as o,$ as r,T as s,ae as t};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{xt as t}from"./vendor-icons-Bc_e_XXa.js";import{t as n}from"./vendor-react-bQ_cvNuA.js";import{n as r}from"./dist-CgGno8kE.js";import{_ as i,a,c as o,d as s,f as c,m as l,o as u,v as d}from"./es2015-BkFSNOYE.js";import{i as f}from"./Button-CRNb8sD3.js";var p=e(t(),1),m=n();function h(e){let t=e+`CollectionProvider`,[n,r]=i(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:t,children:n}=e,r=p.useRef(null),i=p.useRef(new Map).current;return(0,m.jsx)(a,{scope:t,itemMap:i,collectionRef:r,children:n})};s.displayName=t;let c=e+`CollectionSlot`,u=l(c),d=p.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,m.jsx)(u,{ref:f(t,o(c,n).collectionRef),children:r})});d.displayName=c;let h=e+`CollectionItemSlot`,g=`data-radix-collection-item`,_=l(h),v=p.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,a=p.useRef(null),s=f(t,a),c=o(h,n);return p.useEffect(()=>(c.itemMap.set(a,{ref:a,...i}),()=>void c.itemMap.delete(a))),(0,m.jsx)(_,{[g]:``,ref:s,children:r})});v.displayName=h;function y(t){let n=o(e+`CollectionConsumer`,t);return p.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:s,Slot:d,ItemSlot:v},y,r]}var g=p.createContext(void 0);function _(e){let t=p.useContext(g);return e||t||`ltr`}var v=`rovingFocusGroup.onEntryFocus`,y={bubbles:!1,cancelable:!0},b=`RovingFocusGroup`,[x,S,C]=h(b),[w,T]=i(b,[C]),[ee,E]=w(b),D=p.forwardRef((e,t)=>(0,m.jsx)(x.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,m.jsx)(x.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,m.jsx)(O,{...e,ref:t})})}));D.displayName=b;var O=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:h,onEntryFocus:g,preventScrollOnEntryFocus:x=!1,...C}=e,w=p.useRef(null),T=f(t,w),E=_(o),[D,O]=a({prop:l,defaultProp:u??null,onChange:h,caller:b}),[k,A]=p.useState(!1),j=s(g),M=S(n),N=p.useRef(!1),[F,I]=p.useState(0);return p.useEffect(()=>{let e=w.current;if(e)return e.addEventListener(v,j),()=>e.removeEventListener(v,j)},[j]),(0,m.jsx)(ee,{scope:n,orientation:r,dir:E,loop:i,currentTabStopId:D,onItemFocus:p.useCallback(e=>O(e),[O]),onItemShiftTab:p.useCallback(()=>A(!0),[]),onFocusableItemAdd:p.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:p.useCallback(()=>I(e=>e-1),[]),children:(0,m.jsx)(c.div,{tabIndex:k||F===0?-1:0,"data-orientation":r,...C,ref:T,style:{outline:`none`,...e.style},onMouseDown:d(e.onMouseDown,()=>{N.current=!0}),onFocus:d(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!k){let t=new CustomEvent(v,y);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=M().filter(e=>e.focusable);P([e.find(e=>e.active),e.find(e=>e.id===D),...e].filter(Boolean).map(e=>e.ref.current),x)}}N.current=!1}),onBlur:d(e.onBlur,()=>A(!1))})})}),k=`RovingFocusGroupItem`,A=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:s,...l}=e,u=o(),f=a||u,h=E(k,n),g=h.currentTabStopId===f,_=S(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:b}=h;return p.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),(0,m.jsx)(x.ItemSlot,{scope:n,id:f,focusable:r,active:i,children:(0,m.jsx)(c.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...l,ref:t,onMouseDown:d(e.onMouseDown,e=>{r?h.onItemFocus(f):e.preventDefault()}),onFocus:d(e.onFocus,()=>h.onItemFocus(f)),onKeyDown:d(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){h.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=N(e,h.orientation,h.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=_().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=h.loop?F(n,r+1):n.slice(r+1)}setTimeout(()=>P(n))}}),children:typeof s==`function`?s({isCurrentTabStop:g,hasTabStop:b!=null}):s})})});A.displayName=k;var j={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function M(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function N(e,t,n){let r=M(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return j[r]}function P(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function F(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var I=D,L=A,R=`Tabs`,[te,ne]=i(R,[T]),z=T(),[re,B]=te(R),V=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:d=`automatic`,...f}=e,p=_(u),[h,g]=a({prop:r,onChange:i,defaultProp:s??``,caller:R});return(0,m.jsx)(re,{scope:n,baseId:o(),value:h,onValueChange:g,orientation:l,dir:p,activationMode:d,children:(0,m.jsx)(c.div,{dir:p,"data-orientation":l,...f,ref:t})})});V.displayName=R;var H=`TabsList`,U=p.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=B(H,n),o=z(n);return(0,m.jsx)(I,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,m.jsx)(c.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});U.displayName=H;var W=`TabsTrigger`,G=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=B(W,n),s=z(n),l=J(o.baseId,r),u=Y(o.baseId,r),f=r===o.value;return(0,m.jsx)(L,{asChild:!0,...s,focusable:!i,active:f,children:(0,m.jsx)(c.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":u,"data-state":f?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:l,...a,ref:t,onMouseDown:d(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:d(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:d(e.onFocus,()=>{let e=o.activationMode!==`manual`;!f&&!i&&e&&o.onValueChange(r)})})})});G.displayName=W;var K=`TabsContent`,q=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=B(K,n),l=J(s.baseId,r),d=Y(s.baseId,r),f=r===s.value,h=p.useRef(f);return p.useEffect(()=>{let e=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,m.jsx)(u,{present:i||f,children:({present:n})=>(0,m.jsx)(c.div,{"data-state":f?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?`0s`:void 0},children:n&&a})})});q.displayName=K;function J(e,t){return`${e}-trigger-${t}`}function Y(e,t){return`${e}-content-${t}`}var ie=V,X=U,Z=G,Q=q,ae=ie,$=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(X,{ref:n,className:r(`surface-panel-muted inline-flex min-h-11 items-center justify-center gap-1 rounded-full p-1 text-[var(--app-text-muted)]`,e),...t}));$.displayName=X.displayName;var oe=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(Z,{ref:n,className:r(`inline-flex items-center justify-center whitespace-nowrap rounded-full px-4 py-2 text-sm font-medium ring-offset-[var(--app-canvas)] transition-[background-color,color,box-shadow] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:surface-panel data-[state=active]:text-[var(--app-text)] data-[state=active]:shadow-[var(--app-shadow-sm)]`,e),...t}));oe.displayName=Z.displayName;var se=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(Q,{ref:n,className:r(`mt-4 ring-offset-[var(--app-canvas)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2`,e),...t}));se.displayName=Q.displayName;export{L as a,_ as c,oe as i,h as l,se as n,I as o,$ as r,T as s,ae as t};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{G as t,U as n,Y as r,_t as i,at as a,o,rt as s,st as c,v as l,vt as u,xt as d}from"./vendor-icons-Bc_e_XXa.js";import{f as ee,r as f,t as p}from"./vendor-react-bQ_cvNuA.js";import{t as m}from"./Button-CRNb8sD3.js";import{s as te,t as h}from"./api-BRfbZQSW.js";import{n as ne,t as g}from"./index-PIFMZAPo.js";import{i as _,t as re}from"./ArtifactDetail-Dt_xkaYJ.js";import{a as v,i as y,r as b,t as x}from"./Card-Cwvv0An8.js";import{t as ie}from"./PageHeader-acLQTYct.js";import{t as ae}from"./SectionHeader-NZWZgoOs.js";import{a as S,n as C,r as w,t as T}from"./format-ZWN4JNj-.js";import{t as E}from"./ui-D1crlGpt.js";var D=e(d(),1),O=p(),k={reasoning:`text-[var(--app-accent)]`,tool_call:`text-[var(--app-accent-strong)]`,tool_result:`text-[var(--app-success)]`,approval_request:`text-[var(--app-warning)]`,approval_response:`text-[var(--app-warning-strong)]`,permission_denied:`text-[var(--app-indicator-alert)]`,error:`text-[var(--app-danger)]`,plugin_error:`text-[var(--app-danger)]`};function oe({logs:e}){let[t,n]=(0,D.useState)(new Set);return e.length===0?(0,O.jsx)(`p`,{className:`text-sm text-[var(--app-text-subtle)]`,children:`No execution steps yet.`}):(0,O.jsx)(`div`,{className:`space-y-0`,children:e.map((r,i)=>{let a=i>0?e[i-1].timestamp:null,o=a?r.timestamp-a:null,s=r.type===`plugin_error`,l=t.has(i)?r.content:r.content.length>200?r.content.slice(0,200)+`...`:r.content;return(0,O.jsxs)(`div`,{className:`flex gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,O.jsx)(c,{size:10,className:`mt-1.5 flex-shrink-0 fill-current ${k[r.type]??`text-[var(--app-text-subtle)]`} ${s?`rounded-full ring-2 ring-[var(--app-danger)]`:``}`}),i<e.length-1&&(0,O.jsx)(`div`,{className:`mt-0.5 w-0.5 flex-1 bg-[var(--app-border)]`})]}),(0,O.jsxs)(`div`,{className:`flex-1 pb-4 ${s?`rounded-lg border border-[var(--app-danger)]/40 bg-[var(--app-danger-soft-bg-subtle)] p-3`:``}`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,O.jsxs)(`span`,{className:`text-xs font-mono text-[var(--app-text-subtle)]`,children:[`#`,r.index]}),(0,O.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:r.toolName??r.type}),s&&(0,O.jsx)(g,{variant:`destructive`,children:`Plugin Error`}),(0,O.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:S(r.timestamp)}),o!=null&&o>0&&(0,O.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`+`,o,`ms`]}),r.truncated&&(0,O.jsx)(g,{variant:`outline`,children:`truncated`})]}),l&&(0,O.jsx)(`button`,{className:`mt-2 w-full rounded-lg border border-[var(--app-border)] bg-white/[0.03] px-3 py-3 text-left font-mono text-xs text-[var(--app-text-muted)] transition-colors hover:border-[var(--app-border-strong)] hover:text-[var(--app-text)]`,onClick:()=>{n(e=>{let t=new Set(e);return t.has(i)?t.delete(i):t.add(i),t})},children:l})]})]},r.id)})})}function A(){let{id:e}=ee(),[c,d]=(0,D.useState)(null),[p,S]=(0,D.useState)([]),[k,A]=(0,D.useState)([]),[M,N]=(0,D.useState)([]),[P,F]=(0,D.useState)(null),[I,L]=(0,D.useState)(null),[R,z]=(0,D.useState)(!1),[B,ce]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(!1),[G,K]=(0,D.useState)(`overview`),[q,J]=(0,D.useState)([]),[Y,X]=(0,D.useState)(!1),[le,Z]=(0,D.useState)(null),[Q,$]=(0,D.useState)(null),ue=(0,D.useMemo)(()=>{if(!c)return`No diagnostics yet`;let e=[];return c.error&&e.push(`error`),k.length>0&&e.push(`${k.length} steps`),M.length>0&&e.push(`${M.length} delivery events`),e.length>0?e.join(` · `):`No diagnostics yet`},[M.length,k.length,c]);(0,D.useEffect)(()=>{if(!e)return;let t=!1,n=async()=>{if(!t)try{let n=await h(`/tasks/${e}`);if(t)return;d(n.task),L(null)}catch(e){if(t)return;L(e instanceof Error?e.message:`Failed to load task`)}};n(),h(`/tasks/${e}/plan`).then(e=>{t||S(e.plans)}).catch(()=>{t||S([])}),h(`/tasks/${e}/logs?limit=200`).then(e=>{t||A(e.logs)}).catch(()=>{t||A([])}),te(e).then(e=>{t||N(e)}).catch(()=>{t||N([])});let r=setInterval(n,3e3);return()=>{t=!0,clearInterval(r)}},[e]),(0,D.useEffect)(()=>{if(!e||G!==`artifacts`)return;let t=!1;return X(!0),Z(null),h(`/tasks/${e}/artifacts`).then(e=>{t||(J(e.artifacts),X(!1))}).catch(e=>{t||(Z(e instanceof Error?e.message:`Failed to load artifacts`),X(!1))}),()=>{t=!0}},[e,G]),(0,D.useEffect)(()=>{if(!c?.roleId||!e)return;let t=!1;return h(`/roles/${c.roleId}/scores?limit=100`).then(n=>{t||F(n.scores.find(t=>t.taskId===e)??null)}).catch(()=>{t||F(null)}),()=>{t=!0}},[c?.roleId,e]);let de=async()=>{if(e){z(!0);try{await h(`/tasks/${e}/cancel`,{method:`POST`}),d(e=>e&&{...e,status:`cancelled`})}finally{z(!1)}}};if(I)return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(f,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,O.jsx)(u,{size:E.sm}),` Back to Tasks`]}),(0,O.jsx)(x,{className:`text-center text-[var(--app-danger)]`,children:I})]});if(!c)return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(f,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,O.jsx)(u,{size:E.sm}),` Back to Tasks`]}),(0,O.jsx)(x,{className:`text-center text-[var(--app-text-subtle)]`,children:`Loading...`})]});let fe=[`running`,`queued`,`pending`,`paused`].includes(c.status);return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(ie,{eyebrow:`Task`,title:`Task Detail`,compact:!0,description:`Summary, execution, result, and diagnostics.`,metrics:[{label:`Status`,value:(0,O.jsx)(g,{variant:ne(c.status),children:c.status})},{label:`Task`,value:c.id.slice(0,8)},{label:`Elapsed`,value:c.totalDurationMs?w(c.totalDurationMs):c.startedAt?w(Date.now()-c.startedAt):`—`},{label:`Spend`,value:c.costUsd==null?`—`:T(c.costUsd)}],actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(f,{to:`/work`,className:`inline-flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,O.jsx)(u,{size:E.sm}),` Back to Tasks`]}),fe&&(0,O.jsxs)(m,{variant:`destructive`,size:`sm`,onClick:()=>void de(),disabled:R,children:[(0,O.jsx)(i,{size:E.sm}),R?`Cancelling...`:`Cancel Task`]})]})}),(0,O.jsxs)(`div`,{className:`flex gap-1 border-b border-[var(--app-border)]`,"data-testid":`task-detail-tabs`,children:[(0,O.jsx)(`button`,{type:`button`,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${G===`overview`?`border-[var(--app-accent)] text-[var(--app-accent)]`:`border-transparent text-[var(--app-muted)] hover:text-[var(--app-fg)]`}`,onClick:()=>K(`overview`),"data-testid":`tab-overview`,children:`Overview`}),(0,O.jsx)(`button`,{type:`button`,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${G===`artifacts`?`border-[var(--app-accent)] text-[var(--app-accent)]`:`border-transparent text-[var(--app-muted)] hover:text-[var(--app-fg)]`}`,onClick:()=>K(`artifacts`),"data-testid":`tab-artifacts`,children:`Artifacts`})]}),G===`artifacts`&&(0,O.jsxs)(`div`,{"data-testid":`artifacts-tab-content`,children:[(0,O.jsx)(_,{artifacts:q,selectedId:Q,onSelect:$,loading:Y,error:le}),Q&&(()=>{let e=q.find(e=>e.id===Q);return e?(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,"data-testid":`artifact-modal-backdrop`,onClick:()=>$(null),children:(0,O.jsx)(`div`,{className:`bg-[var(--app-bg)] rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[90vh] overflow-auto`,onClick:e=>e.stopPropagation(),children:(0,O.jsx)(re,{artifact:e,onDeleted:()=>{$(null),J(e=>e.filter(e=>e.id!==Q))},onRedelivered:()=>{}})})}):null})()]}),G===`overview`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(x,{className:`surface-accent text-white`,children:(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`p`,{className:`text-kicker text-white/70`,children:`Summary`}),(0,O.jsx)(`p`,{className:`mt-2 text-base leading-7 text-white`,children:c.prompt.length>220&&!B?`${c.prompt.slice(0,220)}…`:c.prompt})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.prompt.length>220?(0,O.jsxs)(m,{variant:`secondary`,size:`sm`,onClick:()=>ce(e=>!e),children:[(0,O.jsx)(r,{size:E.sm}),B?`Collapse prompt`:`Show full prompt`]}):null,(0,O.jsxs)(m,{variant:`secondary`,size:`sm`,onClick:()=>W(e=>!e),children:[(0,O.jsx)(l,{size:E.sm}),U?`Hide diagnostics`:`Show diagnostics`]})]})]})}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,O.jsx)(j,{icon:a,label:`Created`,value:C(c.createdAt)}),(0,O.jsx)(j,{icon:a,label:`Duration`,value:c.totalDurationMs?w(c.totalDurationMs):c.startedAt?w(Date.now()-c.startedAt):`—`}),(0,O.jsx)(j,{icon:s,label:`Cost`,value:c.costUsd==null?`—`:T(c.costUsd)}),(0,O.jsx)(j,{icon:t,label:`Turns`,value:String(c.numTurns??`—`)})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,O.jsx)(j,{icon:o,label:`Role`,value:c.roleId??`—`,mono:!0}),(0,O.jsx)(j,{icon:n,label:`Parent`,value:c.parentId??`—`,mono:!0}),c.templateId?(0,O.jsxs)(f,{to:`/work`,className:`block`,children:[(0,O.jsx)(j,{icon:n,label:`Template`,value:c.templateId,mono:!0}),(0,O.jsx)(`span`,{className:`mt-0.5 block text-xs text-[var(--app-accent)] hover:text-[var(--app-accent)]`,children:`View in Automations →`})]}):(0,O.jsx)(j,{icon:n,label:`Template`,value:`—`,mono:!0}),c.sourceSessionId&&(0,O.jsx)(j,{icon:t,label:`Source Session`,value:c.sourceSessionId.slice(0,8),mono:!0})]}),(c.deliverTo||c.reportTo)&&(0,O.jsxs)(x,{children:[(0,O.jsx)(y,{children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(v,{children:`Delivery Targets`}),(0,O.jsx)(b,{children:`Where results and status updates are sent after execution.`})]})}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[c.deliverTo&&c.deliverTo.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] mb-1`,children:`Output`}),(0,O.jsx)(`div`,{className:`space-y-1`,children:c.deliverTo.map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-[var(--app-text)]`,children:[(0,O.jsx)(g,{variant:`outline`,children:e.type===`channel`?`Channel`:`Session`}),e.type===`channel`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,O.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,O.jsxs)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:[`session `,e.sessionId?.slice(0,8)]})]},`d-${t}`))})]}),c.reportTo&&c.reportTo.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] mb-1`,children:`Status Reports`}),(0,O.jsx)(`div`,{className:`space-y-1`,children:c.reportTo.map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-[var(--app-text)]`,children:[(0,O.jsx)(g,{variant:`outline`,children:e.type===`channel`?`Channel`:`Session`}),e.type===`channel`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,O.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,O.jsxs)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:[`session `,e.sessionId?.slice(0,8)]})]},`r-${t}`))})]})]})]}),P&&(c.status===`completed`||c.status===`failed`)&&(0,O.jsx)(se,{score:P}),c.tokenUsage&&(0,O.jsxs)(x,{children:[(0,O.jsx)(y,{children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(v,{children:`Token Usage`}),(0,O.jsx)(b,{children:`Input and output token totals for this execution.`})]})}),(0,O.jsxs)(`div`,{className:`flex gap-6 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Input:`}),` `,(0,O.jsx)(`span`,{className:`font-mono text-[var(--app-text)]`,children:c.tokenUsage.input.toLocaleString()})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Output:`}),` `,(0,O.jsx)(`span`,{className:`font-mono text-[var(--app-text)]`,children:c.tokenUsage.output.toLocaleString()})]})]})]}),p.length>0&&(()=>{let e=p[0],t=e.plan.overallRisk===`high`?`destructive`:e.plan.overallRisk===`medium`?`warning`:`secondary`;return(0,O.jsxs)(x,{children:[(0,O.jsx)(y,{children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(v,{children:`Execution Plan`}),(0,O.jsx)(b,{children:`Expected steps, risk, and permissions before execution.`})]}),(0,O.jsxs)(g,{variant:t,children:[e.plan.overallRisk.toUpperCase(),` RISK`]}),(0,O.jsx)(g,{variant:`outline`,children:e.status})]})}),(0,O.jsxs)(`h4`,{className:`text-sm font-medium text-[var(--app-text)] mb-2`,children:[`Plan Steps (`,e.plan.steps.length,`)`]}),(0,O.jsx)(`div`,{className:`space-y-2`,children:e.plan.steps.map(e=>(0,O.jsxs)(`div`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)]/50 p-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(`span`,{className:`text-xs font-mono text-[var(--app-text-subtle)]`,children:[`#`,e.index]}),(0,O.jsx)(`span`,{className:`text-sm text-[var(--app-text)]`,children:e.description})]}),(0,O.jsx)(g,{variant:e.riskLevel===`high`?`destructive`:e.riskLevel===`medium`?`warning`:`secondary`,children:e.riskLevel})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-xs text-[var(--app-text-muted)]`,children:[`Tools: `,e.toolsNeeded.join(`, `)||`none`]}),e.expectedOutput&&(0,O.jsxs)(`div`,{className:`mt-0.5 text-xs text-[var(--app-text-subtle)]`,children:[`Expected: `,e.expectedOutput]})]},e.index))}),Object.keys(e.plan.requiredPermissions).length>0&&(0,O.jsxs)(`div`,{className:`mt-2`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-[var(--app-text)] mb-1`,children:`Required Permissions`}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.keys(e.plan.requiredPermissions).map(e=>(0,O.jsx)(g,{variant:`secondary`,children:e},e))})]}),e.deviationReport&&(0,O.jsxs)(`div`,{className:`mt-3 rounded-md border border-[var(--app-warning-soft-border)] bg-[var(--app-warning-soft-bg-subtle)] p-3`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-[var(--app-warning)] mb-2`,children:`Deviation Report`}),(0,O.jsxs)(`div`,{className:`text-xs text-[var(--app-text-muted)] mb-2`,children:[`Planned: `,e.deviationReport.stepsPlanned,` | Executed: `,e.deviationReport.stepsExecuted,` | Accuracy: `,(e.deviationReport.overallAccuracy*100).toFixed(0),`%`]}),e.deviationReport.deviations.length>0&&(0,O.jsx)(`div`,{className:`space-y-1`,children:e.deviationReport.deviations.map((e,t)=>(0,O.jsxs)(`div`,{className:`text-xs`,children:[(0,O.jsxs)(`span`,{className:`text-[var(--app-warning)] font-mono`,children:[`[`,e.deviationType,`]`]}),(0,O.jsxs)(`span`,{className:`text-[var(--app-text-muted)]`,children:[` Step `,e.stepIndex,`: `]}),(0,O.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.actual})]},t))})]}),e.learnedRules&&e.learnedRules.length>0&&(0,O.jsxs)(`div`,{className:`mt-3`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-[var(--app-text)] mb-2`,children:`Learned Rules`}),(0,O.jsx)(`ul`,{className:`space-y-1`,children:e.learnedRules.map((e,t)=>(0,O.jsxs)(`li`,{className:`text-xs text-[var(--app-text-muted)] flex items-start gap-1.5`,children:[(0,O.jsx)(`span`,{className:`text-[var(--app-accent)] mt-0.5`,children:`*`}),e]},t))})]})]})})(),k.length>0&&(0,O.jsxs)(x,{children:[(0,O.jsx)(y,{children:(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(v,{children:[`Execution Timeline (`,k.length,` steps)`]}),(0,O.jsx)(b,{children:`Ordered execution events, tool calls, and error markers.`})]})}),(0,O.jsx)(oe,{logs:k})]}),c.result&&(0,O.jsxs)(x,{children:[(0,O.jsx)(y,{children:(0,O.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(v,{children:`Result`}),(0,O.jsx)(b,{children:`The final task output. Raw text stays collapsed until needed.`})]}),c.result.length>360?(0,O.jsx)(m,{variant:`ghost`,size:`sm`,onClick:()=>H(e=>!e),children:V?`Collapse`:`Expand`}):null]})}),(0,O.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-[var(--app-panel-elevated)] p-3 font-mono text-xs text-[var(--app-text)]`,children:c.result.length>360&&!V?`${c.result.slice(0,360)}…`:c.result})]}),c.error&&(()=>{let e=[`plugin`,`--plugin-dir`,`failed to load plugin`],t=c.error.toLowerCase(),n=e.some(e=>t.includes(e)),r=n?c.error.split(`
2
+ `).find(t=>e.some(e=>t.toLowerCase().includes(e))):null;return(0,O.jsxs)(x,{className:n?`border-[var(--app-danger)]`:``,children:[(0,O.jsx)(y,{children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(v,{children:`Error`}),(0,O.jsx)(b,{children:`Execution failed or returned an error condition.`})]}),n&&(0,O.jsx)(g,{variant:`warning`,children:`Plugin Issue`})]})}),n&&r&&(0,O.jsx)(`div`,{className:`mb-2 rounded bg-[var(--app-warning-soft-bg-subtle)] px-2 py-1 text-xs text-[var(--app-warning)]`,children:r}),(0,O.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-[var(--app-danger-soft-bg-subtle)] p-3 font-mono text-xs text-[var(--app-danger)]`,children:c.error})]})})(),(0,O.jsxs)(x,{children:[(0,O.jsx)(y,{children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(v,{children:`Diagnostics`}),(0,O.jsx)(b,{children:ue})]})}),U?M.length>0?(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(ae,{title:`Delivery Log`,description:`Recent delivery attempts and outcomes.`}),(0,O.jsx)(`div`,{className:`space-y-2`,children:M.map(e=>{let t=e.status===`delivered`?`success`:e.status===`pending`?`secondary`:`destructive`,n=e.target.type===`webhook`?e.target.webhookUrl:e.target.type===`channel`?`channel ${e.target.channelId.slice(0,8)}`:`session ${e.target.sessionId?.slice(0,8)}`;return(0,O.jsxs)(`div`,{className:`surface-panel-muted rounded-lg px-3 py-3 text-sm`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(g,{variant:t,children:e.status}),(0,O.jsx)(`span`,{className:`font-mono text-xs text-[var(--app-text-subtle)]`,children:n}),e.messageType?(0,O.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`(`,e.messageType,`)`]}):null]}),e.error?(0,O.jsx)(`p`,{className:`mt-2 text-xs text-[var(--app-danger-soft-text)]`,children:e.error}):null,(0,O.jsxs)(`p`,{className:`mt-2 text-xs text-[var(--app-text-subtle)]`,children:[C(e.createdAt),e.deliveredAt&&` \u2192 ${C(e.deliveredAt)}`]})]},e.id)})})]}):(0,O.jsx)(`div`,{className:`surface-panel-muted rounded-lg px-4 py-4 text-sm text-[var(--app-text-subtle)]`,children:`No delivery events recorded yet.`}):(0,O.jsx)(`div`,{className:`surface-panel-muted rounded-lg px-4 py-4 text-sm text-[var(--app-text-subtle)]`,children:`Diagnostics are hidden by default because this section can contain raw execution details and operational data.`})]})]})]})}function se({score:e}){let t=[{label:`Task Success`,value:e.scores.taskSuccess,weight:`25%`},{label:`Plan Accuracy`,value:e.scores.planAccuracy,weight:`20%`},{label:`Permission Compliance`,value:e.scores.permissionCompliance,weight:`20%`},{label:`Efficiency`,value:e.scores.efficiency,weight:`15%`},{label:`Intent Fulfillment`,value:e.scores.intentFulfillment,weight:`20%`,pending:e.scores.intentFulfillment==null}];return(0,O.jsxs)(x,{children:[(0,O.jsx)(y,{children:(0,O.jsx)(v,{children:`Quality Score`})}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[t.map(e=>(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-xs`,children:[(0,O.jsxs)(`span`,{className:`text-[var(--app-text-muted)]`,children:[e.label,` `,(0,O.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`(`,e.weight,`)`]})]}),e.pending?(0,O.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,title:`Intent eval pending or failed`,children:`—`}):(0,O.jsxs)(`span`,{className:`font-mono text-[var(--app-text)]`,children:[((e.value??0)*100).toFixed(0),`%`]})]}),!e.pending&&e.value!=null&&(0,O.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-[var(--app-panel-elevated)]`,children:(0,O.jsx)(`div`,{className:`h-full rounded-full ${e.value<.4?`bg-[var(--app-danger)]`:`bg-[var(--app-accent)]`}`,style:{width:`${e.value*100}%`}})})]},e.label)),(0,O.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-[var(--app-border)] pt-2`,children:[(0,O.jsx)(`span`,{className:`text-sm text-[var(--app-text)]`,children:`Weighted Score`}),(0,O.jsxs)(`span`,{className:`font-mono text-sm font-semibold text-[var(--app-text)]`,children:[(e.scores.weighted*100).toFixed(0),`%`]})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`span`,{className:`text-sm text-[var(--app-text)]`,children:`EMA (after this task)`}),(0,O.jsxs)(`span`,{className:`font-mono text-sm font-semibold ${e.emaScore<.4?`text-[var(--app-danger)]`:`text-[var(--app-success)]`}`,children:[(e.emaScore*100).toFixed(0),`%`]})]})]})]})}function j({icon:e,label:t,value:n,mono:r}){return(0,O.jsxs)(x,{className:`flex flex-col gap-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[var(--app-text-subtle)]`,children:[(0,O.jsx)(e,{size:12}),(0,O.jsx)(`span`,{className:`text-xs`,children:t})]}),(0,O.jsx)(`span`,{className:`text-sm text-[var(--app-text)] truncate ${r?`font-mono text-xs`:``}`,children:n})]})}export{A as TaskDetail};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,B as n,D as r,X as i,_t as a,d as o,ft as s,j as c,l,mt as u,pt as ee,u as te,w as ne,xt as d}from"./vendor-icons-Bc_e_XXa.js";import{r as f,t as p}from"./vendor-react-bQ_cvNuA.js";import"./es2015-BkFSNOYE.js";import{t as m}from"./Button-CRNb8sD3.js";import{t as h}from"./vendor-state-BMVR_B0I.js";import{h as re,t as g}from"./api-BRfbZQSW.js";import{a as _,c as ie,f as v,i as ae,l as oe,n as y,o as se,p as b,r as x,s as S,t as C,u as ce}from"./index-PIFMZAPo.js";import{t as w}from"./Card-Cwvv0An8.js";import{t as le}from"./PageHeader-acLQTYct.js";import{t as ue}from"./SectionHeader-NZWZgoOs.js";import{a as T,o as E,t as de}from"./format-ZWN4JNj-.js";import{t as fe}from"./EmptyState-BvQA1o5K.js";import{t as D}from"./ui-D1crlGpt.js";import{t as pe}from"./useIsMobileLayout-BogOiFTv.js";import{a as me,i as O,n as he,o as k,r as A,t as ge}from"./Table-D2K039zr.js";import{t as _e}from"./Switch-BcS5rOWb.js";import{Goals as j,t as ve}from"./Goals-BeKwpAss.js";import{i as M,n as N,r as ye,t as P}from"./Tabs-BwyLSH2c.js";var F=e(d(),1),I=p(),L=[{label:`All`,value:`all`},{label:`Running`,value:`running`},{label:`Pending`,value:`pending`},{label:`Completed`,value:`completed`},{label:`Failed`,value:`failed`},{label:`Cancelled`,value:`cancelled`},{label:`Blocked`,value:`blocked`}],R=new Set([`pending`,`queued`,`running`,`paused`]);function be(){let e=v(e=>e.tasks),t=v(e=>e.fetchTasks),[i,o]=(0,F.useState)(`all`),[s,c]=(0,F.useState)(!1),[l,ee]=(0,F.useState)(``),[te,d]=(0,F.useState)(!1),[p,h]=(0,F.useState)(new Set),[re,_]=(0,F.useState)(!1),ie=pe();(0,F.useEffect)(()=>{let e=i===`all`?void 0:i;t(e);let n=setInterval(()=>void t(e),5e3);return()=>clearInterval(n)},[t,i]),(0,F.useEffect)(()=>{h(new Set)},[i]);let ae=async()=>{if(l.trim()){d(!0);try{await g(`/tasks`,{method:`POST`,body:JSON.stringify({prompt:l.trim()})}),ee(``),c(!1),t(i===`all`?void 0:i)}finally{d(!1)}}},oe=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},se=()=>{let e=x.filter(e=>R.has(e.status)).map(e=>e.id);h(new Set(e))},b=async()=>{if(p.size!==0){_(!0);try{await g(`/tasks/batch-cancel`,{method:`POST`,body:JSON.stringify({taskIds:Array.from(p)})}),h(new Set),t(i===`all`?void 0:i)}finally{_(!1)}}},x=[...e].sort((e,t)=>t.createdAt-e.createdAt),S=Array.from(p).filter(t=>{let n=e.find(e=>e.id===t);return n&&R.has(n.status)});return(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(ue,{title:`Tasks`,description:`Review active execution, cancel work, or create the next task.`,compact:!0,action:(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[p.size>0&&(0,I.jsxs)(m,{variant:`destructive`,size:`sm`,onClick:()=>void b(),disabled:re||S.length===0,children:[(0,I.jsx)(a,{size:D.sm}),re?`Cancelling...`:`Cancel ${S.length} task${S.length===1?``:`s`}`]}),(0,I.jsx)(m,{variant:`ghost`,size:`sm`,onClick:()=>void t(i===`all`?void 0:i),children:(0,I.jsx)(ne,{size:D.sm})}),(0,I.jsxs)(m,{size:`sm`,onClick:()=>c(!s),children:[(0,I.jsx)(r,{size:D.sm}),`New Task`]})]})}),s&&(0,I.jsxs)(w,{className:`flex gap-2`,children:[(0,I.jsx)(`input`,{className:`flex-1 rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Enter task prompt...`,value:l,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ae()}}),(0,I.jsx)(m,{onClick:()=>void ae(),disabled:te||!l.trim(),children:te?`Creating...`:`Create`}),(0,I.jsx)(m,{variant:`ghost`,onClick:()=>c(!1),children:`Cancel`})]}),(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:justify-between`,children:[(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:L.map(e=>(0,I.jsx)(`button`,{onClick:()=>o(e.value),className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${i===e.value?`bg-[var(--app-panel-elevated)] text-[var(--app-text)]`:`text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:e.label},e.value))}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[x.some(e=>R.has(e.status))&&(0,I.jsx)(`button`,{onClick:se,className:`text-xs text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`,children:`Select all cancellable`}),p.size>0&&(0,I.jsxs)(`button`,{onClick:()=>h(new Set),className:`text-xs text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`,children:[`Clear selection (`,p.size,`)`]})]})]}),x.length===0?(0,I.jsx)(w,{padding:!1,children:(0,I.jsx)(fe,{icon:(0,I.jsx)(n,{size:32}),title:`No tasks found`,description:i===`all`?`Create a task to get started`:`No tasks with status "${i}"`})}):ie?(0,I.jsx)(`div`,{className:`space-y-3`,children:x.map(e=>(0,I.jsx)(w,{className:p.has(e.id)?`border-[var(--app-accent)]/40 bg-[var(--app-accent)]/8`:``,children:(0,I.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,I.jsx)(`div`,{className:`pt-1`,children:R.has(e.status)?(0,I.jsx)(`button`,{onClick:()=>oe(e.id),className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${p.has(e.id)?`border-[var(--app-accent-strong)] bg-[var(--app-accent)] text-white`:`border-[var(--app-border-strong)] bg-transparent hover:border-[var(--app-text-muted)]`}`,children:p.has(e.id)&&(0,I.jsx)(u,{size:12})}):(0,I.jsx)(`span`,{className:`inline-block h-4 w-4`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,I.jsx)(f,{to:`/tasks/${e.id}`,className:`break-all font-mono text-xs text-[var(--app-accent)] hover:text-[var(--app-accent)]`,children:e.id.slice(0,8)}),(0,I.jsx)(`p`,{className:`break-words text-sm font-medium leading-6 text-[var(--app-text)]`,children:E(e.prompt,140)})]}),(0,I.jsx)(C,{variant:y(e.status),children:e.status})]}),(0,I.jsxs)(`div`,{className:`grid gap-2 text-xs text-[var(--app-text-subtle)] sm:grid-cols-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Role`}),(0,I.jsx)(`div`,{className:`mt-1 font-mono text-[var(--app-text)]`,children:e.roleId?e.roleId.slice(0,12):`—`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Cost`}),(0,I.jsx)(`div`,{className:`mt-1 font-mono text-[var(--app-text)]`,children:e.costUsd==null?`—`:de(e.costUsd)})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Created`}),(0,I.jsx)(`div`,{className:`mt-1 text-[var(--app-text)]`,children:T(e.createdAt)})]})]})]})]})},e.id))}):(0,I.jsx)(w,{padding:!1,children:(0,I.jsxs)(ge,{children:[(0,I.jsx)(me,{children:(0,I.jsxs)(k,{children:[(0,I.jsx)(O,{className:`w-8`,children:(0,I.jsx)(`button`,{onClick:()=>{p.size>0&&p.size===x.filter(e=>R.has(e.status)).length?h(new Set):se()},className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${p.size>0&&p.size===x.filter(e=>R.has(e.status)).length?`border-[var(--app-accent-strong)] bg-[var(--app-accent)] text-white`:`border-[var(--app-border-strong)] bg-transparent hover:border-[var(--app-text-muted)]`}`,children:p.size>0&&p.size===x.filter(e=>R.has(e.status)).length&&(0,I.jsx)(u,{size:12})})}),(0,I.jsx)(O,{children:`ID`}),(0,I.jsx)(O,{children:`Prompt`}),(0,I.jsx)(O,{children:`Status`}),(0,I.jsx)(O,{children:`Role`}),(0,I.jsx)(O,{children:`Cost`}),(0,I.jsx)(O,{children:`Created`})]})}),(0,I.jsx)(he,{children:x.map(e=>(0,I.jsxs)(k,{className:p.has(e.id)?`bg-[var(--app-panel-elevated)]/50`:``,children:[(0,I.jsx)(A,{children:R.has(e.status)?(0,I.jsx)(`button`,{onClick:()=>oe(e.id),className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${p.has(e.id)?`border-[var(--app-accent-strong)] bg-[var(--app-accent)] text-white`:`border-[var(--app-border-strong)] bg-transparent hover:border-[var(--app-text-muted)]`}`,children:p.has(e.id)&&(0,I.jsx)(u,{size:12})}):(0,I.jsx)(`span`,{className:`inline-block w-4`})}),(0,I.jsx)(A,{children:(0,I.jsx)(f,{to:`/tasks/${e.id}`,className:`font-mono text-xs text-[var(--app-accent)] hover:text-[var(--app-accent)]`,children:e.id.slice(0,8)})}),(0,I.jsx)(A,{children:(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`break-words font-medium text-[var(--app-text)]`,children:E(e.prompt,120)}),(0,I.jsxs)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[e.totalDurationMs?de(e.costUsd??0):`Awaiting completion`,` · `,T(e.createdAt)]})]})}),(0,I.jsx)(A,{children:(0,I.jsx)(C,{variant:y(e.status),children:e.status})}),(0,I.jsx)(A,{children:(0,I.jsx)(`span`,{className:`font-mono text-xs text-[var(--app-text-subtle)]`,children:e.roleId?e.roleId.slice(0,12):`—`})}),(0,I.jsx)(A,{className:`font-mono text-xs`,children:e.costUsd==null?`—`:de(e.costUsd)}),(0,I.jsx)(A,{className:`text-xs text-[var(--app-text-subtle)]`,children:T(e.createdAt)})]},e.id))})]})})]})}function z(e,t){return e.find(e=>e.contractField===t)?.message??null}function B({label:e,status:t,tooltip:n}){let[r,i]=(0,F.useState)(!1),a=t===`pass`?`text-[var(--app-success-soft-text)]`:t===`fail`?`text-[var(--app-danger-soft-text)]`:`text-[var(--app-text-subtle)]`,o=t===`pass`?`✓`:t===`fail`?`✗`:`—`;return(0,I.jsxs)(`span`,{className:`relative inline-flex items-center gap-0.5`,children:[(0,I.jsxs)(`span`,{className:`cursor-default text-xs font-medium ${a}`,onClick:()=>i(e=>!e),title:n??void 0,children:[e,`:`,o]}),r&&n&&(0,I.jsx)(`span`,{className:`absolute bottom-full left-0 z-50 mb-1 w-48 rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1 text-xs text-[var(--app-text)] shadow-md`,children:n})]})}function xe({contract:e,retried:t}){let{violations:n,layerCPassed:r}=e,i=z(n,`lengthTarget`),a=z(n,`persona.speakAs`),o=z(n,`mustReferenceArtifacts`),s=z(n,`customAssertions`);return(0,I.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,I.jsx)(B,{label:`长度`,status:i?`fail`:`pass`,tooltip:i}),(0,I.jsx)(B,{label:`身份`,status:a?`fail`:`pass`,tooltip:a}),(0,I.jsx)(B,{label:`上游引用`,status:o?`fail`:`pass`,tooltip:o}),(0,I.jsx)(B,{label:`自定义`,status:r===null?`na`:r?`pass`:`fail`,tooltip:s}),t&&(0,I.jsx)(`span`,{className:`ml-1 rounded-full bg-[var(--app-warning-soft-bg)] px-1.5 py-0.5 text-[10px] font-medium text-[var(--app-warning-soft-text)]`,children:`重试 #1`})]})}function V(e){return`step-${e+1}`}function H(e,t,n){if(!(e===`concat-step-results`||!e)&&e===`primary-artifact`)return t?{mode:`primary-artifact`,primaryArtifact:{stepId:t,...n?{key:n}:{}}}:void 0}function Se(e,t){return{...e??{},...t}}function Ce(){let e=v(e=>e.templates),n=v(e=>e.fetchTemplates),a=v(e=>e.goals),u=v(e=>e.fetchGoals),d=v(e=>e.roles),f=v(e=>e.fetchRoles),[p,h]=(0,F.useState)(!1),[y,le]=(0,F.useState)(``),[E,de]=(0,F.useState)(`manual`),[D,pe]=(0,F.useState)(``),[j,M]=(0,F.useState)(``),[N,ye]=(0,F.useState)(``),[P,L]=(0,F.useState)([{id:`step-1`,prompt:``}]),[R,be]=(0,F.useState)(!1),[z,B]=(0,F.useState)(!1),[Ce,we]=(0,F.useState)(null),[U,Te]=(0,F.useState)(null),[W,Ee]=(0,F.useState)(null),[G,K]=(0,F.useState)(null),[De,q]=(0,F.useState)(`template_only`),[Oe,ke]=(0,F.useState)(!1),[J,Ae]=(0,F.useState)(null),[Y,je]=(0,F.useState)(``),[X,Me]=(0,F.useState)(`manual`),[Ne,Pe]=(0,F.useState)(``),[Fe,Ie]=(0,F.useState)(``),[Le,Re]=(0,F.useState)(``),[ze,Be]=(0,F.useState)(``),[Ve,He]=(0,F.useState)(``),[Ue,We]=(0,F.useState)([]),[Z,Q]=(0,F.useState)([]),[Ge,Ke]=(0,F.useState)(!1),[qe,Je]=(0,F.useState)(!1),[$,Ye]=(0,F.useState)([]),[Xe,Ze]=(0,F.useState)([]),[Qe,$e]=(0,F.useState)([]),[et,tt]=(0,F.useState)(`concat-step-results`),[nt,rt]=(0,F.useState)(``),[it,at]=(0,F.useState)(``),[ot,st]=(0,F.useState)(``),[ct,lt]=(0,F.useState)(`concat-step-results`),[ut,dt]=(0,F.useState)(``),[ft,pt]=(0,F.useState)(``),[mt,ht]=(0,F.useState)(``),[gt,_t]=(0,F.useState)(null),[vt,yt]=(0,F.useState)([]),[bt,xt]=(0,F.useState)(!1),[St,Ct]=(0,F.useState)({}),wt=(0,F.useCallback)(async e=>{xt(!0);try{let t=await g(`/template-executions?templateId=${e}&limit=5`);yt(await Promise.all(t.executions.map(async e=>{try{let t=await g(`/template-executions/${e.id}`);return{...t.execution,stepTasks:t.stepTasks}}catch{return{...e,stepTasks:[]}}})))}catch{yt([])}finally{xt(!1)}},[]),Tt=(0,F.useCallback)(async(e,t)=>{Ct(t=>({...t,[e]:`pending`}));try{await re(e,t),Ct(n=>({...n,[e]:t}))}catch{Ct(t=>{let n={...t};return delete n[e],n}),b.error(`Failed to record feedback`)}},[]),Et=(0,F.useCallback)(e=>{gt===e?(_t(null),yt([])):(_t(e),wt(e))},[gt,wt]),Dt=(0,F.useMemo)(()=>Object.fromEntries(e.map(e=>[e.id,e.name])),[e]),Ot=e=>e.type===`cron`?`Cron: ${e.cron??`—`}`:e.type===`once`?`Once at ${e.runAt?new Date(e.runAt).toLocaleString():`—`}`:e.type===`template_complete`?`When template '${Dt[e.event?.split(`:`)[1]??``]??`[deleted template]`}' completes`:e.type===`event`?`On event '${Ue.find(t=>t.id===e.eventDefId)?.name??`[deleted event]`}'`:e.type;(0,F.useEffect)(()=>{n(),u(),f(),(async()=>{try{We(await g(`/event-defs`))}catch{}})()},[n,u,f]);let kt=async()=>{if(y.trim()&&!P.every(e=>!e.prompt.trim())){B(!0);try{let e={name:y.trim(),trigger:{type:E,...E===`cron`&&j?{cron:j}:{},...E===`once`&&N?{runAt:new Date(N).toISOString()}:{},...E===`template_complete`&&D?{event:`template_complete:${D}`}:{},...E===`event`&&ze?{eventDefId:ze}:{}},enabled:!0,...Xe.length>0?{deliverTo:Xe}:{},...(()=>{let e=Se(void 0,{...R?{continueOnError:!0}:{},...H(et,nt,it)?{delivery:H(et,nt,it)}:{}});return Object.keys(e).length>0?{config:e}:{}})()};e.steps=P.filter(e=>e.prompt.trim()).map((e,t)=>({id:e.id||V(t),prompt:e.prompt.trim(),...e.roleId?{roleId:e.roleId}:{},...e.dependsOn&&e.dependsOn.length>0?{dependsOn:e.dependsOn}:{},...e.config&&(e.config.timeout!==void 0||e.config.maxTurns!==void 0)?{config:e.config}:{},...e.consumesFrom?.length?{consumesFrom:e.consumesFrom}:{},...e.consumesFromOptional?.length?{consumesFromOptional:e.consumesFromOptional}:{},...e.persona?{persona:e.persona}:{},...e.outputContract?{outputContract:e.outputContract}:{}})),$.length>0&&(e.goalIds=$),await g(`/task-templates`,{method:`POST`,body:JSON.stringify(e)}),le(``),L([{id:`step-1`,prompt:``}]),M(``),ye(``),pe(``),Be(``),Ye([]),Ze([]),tt(`concat-step-results`),rt(``),at(``),st(``),h(!1),n()}finally{B(!1)}}},At=async t=>{let n=e.find(e=>e.id===t);we(t);try{await g(`/task-templates/${t}/run`,{method:`POST`}),b.success(`Triggered: ${n?.name??t}`)}catch(e){let t=e instanceof Error?e.message:`Failed to trigger template`;b.error(`Trigger failed: ${t}`)}finally{we(null)}},jt=async e=>{Ee(e),q(`template_only`),K(null);try{K((await g(`/task-templates/${e}/dependents`)).dependents)}catch{K({executionCount:0,taskCount:0})}},Mt=async(t,r)=>{let i=e.find(e=>e.id===t);ke(!0);try{let e=await g(`/task-templates/${t}?mode=${r}`,{method:`DELETE`}),a=[];e.deletedCounts.templateExecutions>0&&a.push(`${e.deletedCounts.templateExecutions} template execution${e.deletedCounts.templateExecutions===1?``:`s`}`),e.deletedCounts.tasks>0&&a.push(`${e.deletedCounts.tasks} task${e.deletedCounts.tasks===1?``:`s`}`);let o=a.length?` (+ ${a.join(`, `)})`:``;b.success(`Deleted: ${i?.name??t}${o}`),n()}catch(e){let t=e instanceof Error?e.message:`Failed to delete template`;b.error(`Delete failed: ${t}`)}finally{ke(!1)}},Nt=async t=>{let r=e.find(e=>e.id===t);if(!r)return;if(![`cron`,`once`,`template_complete`].includes(r.trigger.type)){b.error(`Toggle not applicable for manual triggers`);return}let i=!r.enabled;try{await g(`/task-templates/${t}`,{method:`PATCH`,body:JSON.stringify({enabled:i})}),b.success(`${r.name} ${i?`enabled`:`disabled`}`),n()}catch(e){let t=e instanceof Error?e.message:`Failed to toggle template`;b.error(`Toggle failed: ${t}`)}},Pt=e=>{Ae(e.id),je(e.name),Me(e.trigger.type),Pe(e.trigger.cron??``),Ie(e.trigger.runAt?new Date(e.trigger.runAt).toISOString().slice(0,16):``),Q(e.steps.map(e=>({id:e.id,prompt:e.prompt,roleId:e.roleId,dependsOn:e.dependsOn,config:e.config,consumesFrom:e.consumesFrom,consumesFromOptional:e.consumesFromOptional,persona:e.persona,outputContract:e.outputContract,outputAs:e.outputAs}))),Ke(e.config?.continueOnError??!1),lt(e.config?.delivery?.mode??`concat-step-results`),dt(e.config?.delivery?.primaryArtifact?.stepId??``),pt(e.config?.delivery?.primaryArtifact?.key??``),ht(e.config?.delivery?.primaryArtifact?.stepId?e.steps.find(t=>t.id===e.config?.delivery?.primaryArtifact?.stepId)?.outputAs??``:``),$e(e.deliverTo??[]),Re(e.trigger.type===`template_complete`?e.trigger.event?.split(`:`)[1]??``:``),He(e.trigger.eventDefId??``)},Ft=async()=>{if(!(!J||!Y.trim()||Z.every(e=>!e.prompt.trim()))){Je(!0);try{await g(`/task-templates/${J}`,{method:`PATCH`,body:JSON.stringify({name:Y.trim(),trigger:{type:X,...X===`cron`&&Ne?{cron:Ne}:{},...X===`once`&&Fe?{runAt:new Date(Fe).toISOString()}:{},...X===`template_complete`&&Le?{event:`template_complete:${Le}`}:{},...X===`event`&&Ve?{eventDefId:Ve}:{}},steps:Z.filter(e=>e.prompt.trim()).map((e,t)=>({id:e.id||V(t),prompt:e.prompt.trim(),...e.roleId?{roleId:e.roleId}:{},...e.dependsOn&&e.dependsOn.length>0?{dependsOn:e.dependsOn}:{},...e.config&&(e.config.timeout!==void 0||e.config.maxTurns!==void 0)?{config:e.config}:{},...e.consumesFrom?.length?{consumesFrom:e.consumesFrom}:{},...e.consumesFromOptional?.length?{consumesFromOptional:e.consumesFromOptional}:{},...e.persona?{persona:e.persona}:{},...e.outputContract?{outputContract:e.outputContract}:{}})),enabled:e.find(e=>e.id===J)?.enabled??!0,...(()=>{let t=e.find(e=>e.id===J)?.config;return{config:Se(t,{...Ge?{continueOnError:!0}:{continueOnError:!1},...H(ct,ut,ft)?{delivery:H(ct,ut,ft)}:{delivery:void 0}})}})(),deliverTo:Qe.length>0?Qe:void 0})}),Ae(null),n(),b.success(`Template updated`)}catch(e){let t=e instanceof Error?e.message:`Failed to update template`;b.error(t)}finally{Je(!1)}}},It=e.find(e=>e.id===U),Lt=e.find(e=>e.id===W);return(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(ue,{title:`Automations`,description:`Reusable templates, manual triggers, and recent template executions.`,compact:!0,action:(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(m,{variant:`ghost`,size:`sm`,onClick:()=>void n(),children:(0,I.jsx)(ne,{size:14})}),(0,I.jsxs)(m,{size:`sm`,onClick:()=>h(!p),children:[(0,I.jsx)(r,{size:14}),`New Automation`]})]})}),p&&(0,I.jsxs)(w,{className:`space-y-3`,children:[(0,I.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Template name`,value:y,onChange:e=>le(e.target.value)}),(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Triggered by:`}),(0,I.jsxs)(`select`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:E,onChange:e=>de(e.target.value),children:[(0,I.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,I.jsx)(`option`,{value:`cron`,children:`Schedule (Cron)`}),(0,I.jsx)(`option`,{value:`once`,children:`One-time`}),(0,I.jsx)(`option`,{value:`template_complete`,children:`Template completion`}),(0,I.jsx)(`option`,{value:`event`,children:`Event (definition)`})]}),E===`template_complete`&&(0,I.jsxs)(`select`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:D,onChange:e=>pe(e.target.value),children:[(0,I.jsx)(`option`,{value:``,children:`-- Select target template --`}),e.filter(e=>e.id!==J).map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),E===`event`&&(0,I.jsxs)(`select`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:ze,onChange:e=>Be(e.target.value),children:[(0,I.jsx)(`option`,{value:``,children:`-- Select event --`}),Ue.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),E===`cron`&&(0,I.jsx)(`input`,{className:`flex-1 rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Cron expression (e.g. */5 * * * *)`,value:j,onChange:e=>M(e.target.value)}),E===`once`&&(0,I.jsx)(`input`,{type:`datetime-local`,className:`flex-1 rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:N,onChange:e=>ye(e.target.value)})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Steps`}),(0,I.jsxs)(m,{variant:`ghost`,size:`sm`,onClick:()=>L([...P,{id:V(P.length),prompt:``}]),children:[(0,I.jsx)(r,{size:12}),` Add Step`]})]}),P.map((e,t)=>(0,I.jsxs)(`div`,{className:`rounded-md border border-[var(--app-border)] p-2 space-y-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--app-text-subtle)]`,children:e.id}),(0,I.jsxs)(`select`,{className:`flex-1 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-xs text-[var(--app-text)]`,value:e.roleId??``,onChange:n=>{let r=[...P];r[t]={...e,roleId:n.target.value||void 0},L(r)},children:[(0,I.jsx)(`option`,{value:``,children:`Role (template default)`}),d.filter(e=>e.source!==`system`).map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),P.length>1&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>L(P.filter((e,n)=>n!==t)),className:`text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,children:(0,I.jsx)(l,{size:12})})]}),(0,I.jsx)(`textarea`,{className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Step ${t+1} prompt${t>0?` (use {{`+P[t-1].id+`.result}} for prev output)`:``}`,rows:2,value:e.prompt,onChange:n=>{let r=[...P];r[t]={...e,prompt:n.target.value},L(r)}}),t>0&&(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`depends on:`}),P.slice(0,t).map(n=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>{let r=e.dependsOn??[],i=[...P];i[t]={...e,dependsOn:r.includes(n.id)?r.filter(e=>e!==n.id):[...r,n.id]},L(i)},className:`rounded px-1.5 py-0.5 text-[10px] ${(e.dependsOn??[]).includes(n.id)?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:n.id},n.id))]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-[var(--app-text-subtle)]`,children:[`timeout(s):`,(0,I.jsx)(`input`,{type:`number`,min:0,placeholder:`default`,className:`w-20 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.config?.timeout??``,onChange:n=>{let r=[...P],i=n.target.value===``?void 0:Number(n.target.value);r[t]={...e,config:{...e.config,timeout:i}},L(r)}})]}),(0,I.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-[var(--app-text-subtle)]`,children:[`max turns:`,(0,I.jsx)(`input`,{type:`number`,min:0,placeholder:`default`,className:`w-20 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.config?.maxTurns??``,onChange:n=>{let r=[...P],i=n.target.value===``?void 0:Number(n.target.value);r[t]={...e,config:{...e.config,maxTurns:i}},L(r)}})]})]}),t>0&&(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-1 items-center`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0`,children:`Consumes:`}),P.slice(0,t).map(n=>(0,I.jsx)(`button`,{type:`button`,"aria-label":`consumes ${n.id}`,onClick:()=>{let r=e.consumesFrom??[],i=[...P];i[t]={...e,consumesFrom:r.includes(n.id)?r.filter(e=>e!==n.id):[...r,n.id]},L(i)},className:`rounded px-1.5 py-0.5 text-[10px] ${(e.consumesFrom??[]).includes(n.id)?`bg-[var(--app-danger)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:n.id},n.id)),(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0 ml-1`,children:`(opt)`}),P.slice(0,t).map(n=>(0,I.jsxs)(`button`,{type:`button`,"aria-label":`optional-consumes ${n.id}`,onClick:()=>{let r=e.consumesFromOptional??[],i=[...P];i[t]={...e,consumesFromOptional:r.includes(n.id)?r.filter(e=>e!==n.id):[...r,n.id]},L(i)},className:`rounded px-1.5 py-0.5 text-[10px] ${(e.consumesFromOptional??[]).includes(n.id)?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:[n.id,`?`]},`${n.id}-opt`))]}),(0,I.jsxs)(`div`,{className:`flex gap-1 items-center`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0`,children:`Speak as:`}),(0,I.jsx)(`input`,{type:`text`,placeholder:`e.g. 卞旸`,className:`flex-1 min-w-0 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)]`,value:e.persona?.speakAs??``,onChange:n=>{let r=[...P];r[t]={...e,persona:n.target.value?{speakAs:n.target.value,voiceConstraints:e.persona?.voiceConstraints}:void 0},L(r)}}),(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0`,children:`Voice:`}),(0,I.jsx)(`input`,{type:`text`,placeholder:`optional`,className:`flex-1 min-w-0 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)]`,value:e.persona?.voiceConstraints??``,onChange:n=>{let r=[...P];r[t]={...e,persona:e.persona?.speakAs?{speakAs:e.persona.speakAs,voiceConstraints:n.target.value||void 0}:void 0},L(r)}})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-1 items-center`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0`,children:`Contract:`}),(0,I.jsx)(`input`,{type:`number`,min:0,placeholder:`min`,className:`w-16 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.outputContract?.lengthTarget?.min??``,onChange:n=>{let r=[...P],i=n.target.value===``?void 0:Number(n.target.value);r[t]={...e,outputContract:{...e.outputContract,lengthTarget:{min:i??0,max:e.outputContract?.lengthTarget?.max??0,unit:e.outputContract?.lengthTarget?.unit??`characters`}}},L(r)}}),(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`—`}),(0,I.jsx)(`input`,{type:`number`,min:0,placeholder:`max`,className:`w-16 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.outputContract?.lengthTarget?.max??``,onChange:n=>{let r=[...P],i=n.target.value===``?void 0:Number(n.target.value);r[t]={...e,outputContract:{...e.outputContract,lengthTarget:{min:e.outputContract?.lengthTarget?.min??0,max:i??0,unit:e.outputContract?.lengthTarget?.unit??`characters`}}},L(r)}}),(0,I.jsxs)(`select`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.outputContract?.lengthTarget?.unit??`characters`,onChange:n=>{let r=[...P];r[t]={...e,outputContract:{...e.outputContract,lengthTarget:{min:e.outputContract?.lengthTarget?.min??0,max:e.outputContract?.lengthTarget?.max??0,unit:n.target.value}}},L(r)},children:[(0,I.jsx)(`option`,{value:`characters`,children:`chars`}),(0,I.jsx)(`option`,{value:`words`,children:`words`}),(0,I.jsx)(`option`,{value:`bytes`,children:`bytes`})]}),(0,I.jsxs)(`select`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.outputContract?.format??``,onChange:n=>{let r=[...P],i=n.target.value;r[t]={...e,outputContract:{...e.outputContract,format:i||void 0}},L(r)},children:[(0,I.jsx)(`option`,{value:``,children:`fmt?`}),(0,I.jsx)(`option`,{value:`markdown`,children:`md`}),(0,I.jsx)(`option`,{value:`text`,children:`txt`}),(0,I.jsx)(`option`,{value:`json`,children:`json`})]}),(0,I.jsxs)(`label`,{className:`flex items-center gap-0.5 text-[10px] text-[var(--app-text-subtle)] cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--app-accent)]`,checked:e.outputContract?.mustReferenceArtifacts??!1,onChange:n=>{let r=[...P];r[t]={...e,outputContract:{...e.outputContract,mustReferenceArtifacts:n.target.checked}},L(r)}}),`ref artifacts`]})]})]},e.id))]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Goals`}),a.length===0?(0,I.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`No goals available`}):a.map(e=>(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-[var(--app-text)] hover:text-[var(--app-text)] cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:$.includes(e.id),onChange:t=>{t.target.checked?Ye([...$,e.id]):Ye($.filter(t=>t!==e.id))},className:`rounded border-[var(--app-border-strong)] bg-[var(--app-panel-elevated)]`}),(0,I.jsx)(`span`,{className:`truncate`,children:e.name}),(0,I.jsx)(C,{variant:`muted`,className:`text-[10px]`,children:e.status})]},e.id))]}),P.length>1&&(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-[var(--app-text)] cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:R,onChange:e=>be(e.target.checked),className:`rounded border-[var(--app-border-strong)] bg-[var(--app-panel-elevated)]`}),`Continue on error (skip failed step dependents, run independent steps)`]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-xs font-medium text-[var(--app-text)]`,children:`投递格式`}),(0,I.jsxs)(`select`,{value:et,onChange:e=>tt(e.target.value),className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,children:[(0,I.jsx)(`option`,{value:`concat-step-results`,children:`拼接每步结果(默认)`}),(0,I.jsx)(`option`,{value:`primary-artifact`,children:`指定主产物`}),(0,I.jsx)(`option`,{value:`custom`,disabled:!0,children:`自定义(即将推出)`})]}),et===`primary-artifact`&&(0,I.jsxs)(`div`,{className:`space-y-2 rounded border border-[var(--app-border)] p-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:`来源 step`}),(0,I.jsxs)(`select`,{value:nt,onChange:e=>{let t=P.find(t=>t.id===e.target.value);rt(e.target.value),st(t?.outputAs??``)},className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,children:[(0,I.jsx)(`option`,{value:``,children:`选择 step...`}),P.filter(e=>e.prompt.trim()).map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),ot&&(0,I.jsxs)(`div`,{className:`text-xs text-[var(--app-accent)]`,children:[`Will use step's output: `,(0,I.jsx)(`span`,{className:`font-mono`,children:ot})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:ot?`Or specify custom key:`:`artifact key`}),(0,I.jsx)(`input`,{type:`text`,value:it,onChange:e=>at(e.target.value),placeholder:ot?`留空使用上面的自动解析值`:`手动输入 key`,className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-muted)] focus:border-[var(--app-accent)] focus:outline-none`})]})]})]}),(0,I.jsx)(ve,{value:Xe,onChange:Ze}),(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(m,{onClick:()=>void kt(),disabled:z||!y.trim()||P.every(e=>!e.prompt.trim())||E===`template_complete`&&!D,children:z?`Creating...`:`Create`}),(0,I.jsx)(m,{variant:`ghost`,onClick:()=>h(!1),children:`Cancel`})]})]}),J!==null&&(0,I.jsxs)(w,{className:`space-y-3`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:`Edit Automation`}),(0,I.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Template name`,value:Y,onChange:e=>je(e.target.value)}),(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Triggered by:`}),(0,I.jsxs)(`select`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:X,onChange:e=>Me(e.target.value),children:[(0,I.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,I.jsx)(`option`,{value:`cron`,children:`Schedule (Cron)`}),(0,I.jsx)(`option`,{value:`once`,children:`One-time`}),(0,I.jsx)(`option`,{value:`template_complete`,children:`Template completion`}),(0,I.jsx)(`option`,{value:`event`,children:`Event (definition)`})]}),X===`template_complete`&&(0,I.jsxs)(`select`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:Le,onChange:e=>Re(e.target.value),children:[(0,I.jsx)(`option`,{value:``,children:`-- Select target template --`}),e.filter(e=>e.id!==J).map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),X===`event`&&(0,I.jsxs)(`select`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:Ve,onChange:e=>He(e.target.value),children:[(0,I.jsx)(`option`,{value:``,children:`-- Select event --`}),Ue.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),X===`cron`&&(0,I.jsx)(`input`,{className:`flex-1 rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Cron expression`,value:Ne,onChange:e=>Pe(e.target.value)}),X===`once`&&(0,I.jsx)(`input`,{type:`datetime-local`,className:`flex-1 rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:Fe,onChange:e=>Ie(e.target.value)})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Steps`}),(0,I.jsxs)(m,{variant:`ghost`,size:`sm`,onClick:()=>Q([...Z,{id:V(Z.length),prompt:``}]),children:[(0,I.jsx)(r,{size:12}),` Add Step`]})]}),Z.map((e,t)=>(0,I.jsxs)(`div`,{className:`rounded-md border border-[var(--app-border)] p-2 space-y-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--app-text-subtle)]`,children:e.id}),(0,I.jsxs)(`select`,{className:`flex-1 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-xs text-[var(--app-text)]`,value:e.roleId??``,onChange:n=>{let r=[...Z];r[t]={...e,roleId:n.target.value||void 0},Q(r)},children:[(0,I.jsx)(`option`,{value:``,children:`Role (template default)`}),d.filter(e=>e.source!==`system`).map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),Z.length>1&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>Q(Z.filter((e,n)=>n!==t)),className:`text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,children:(0,I.jsx)(l,{size:12})})]}),(0,I.jsx)(`textarea`,{className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Step ${t+1} prompt`,rows:2,value:e.prompt,onChange:n=>{let r=[...Z];r[t]={...e,prompt:n.target.value},Q(r)}}),t>0&&(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`depends on:`}),Z.slice(0,t).map(n=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>{let r=e.dependsOn??[],i=[...Z];i[t]={...e,dependsOn:r.includes(n.id)?r.filter(e=>e!==n.id):[...r,n.id]},Q(i)},className:`rounded px-1.5 py-0.5 text-[10px] ${(e.dependsOn??[]).includes(n.id)?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:n.id},n.id))]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-[var(--app-text-subtle)]`,children:[`timeout(s):`,(0,I.jsx)(`input`,{type:`number`,min:0,placeholder:`default`,className:`w-20 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.config?.timeout??``,onChange:n=>{let r=[...Z],i=n.target.value===``?void 0:Number(n.target.value);r[t]={...e,config:{...e.config,timeout:i}},Q(r)}})]}),(0,I.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-[var(--app-text-subtle)]`,children:[`max turns:`,(0,I.jsx)(`input`,{type:`number`,min:0,placeholder:`default`,className:`w-20 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.config?.maxTurns??``,onChange:n=>{let r=[...Z],i=n.target.value===``?void 0:Number(n.target.value);r[t]={...e,config:{...e.config,maxTurns:i}},Q(r)}})]})]}),t>0&&(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-1 items-center`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0`,children:`Consumes:`}),Z.slice(0,t).map(n=>(0,I.jsx)(`button`,{type:`button`,"aria-label":`consumes ${n.id}`,onClick:()=>{let r=e.consumesFrom??[],i=[...Z];i[t]={...e,consumesFrom:r.includes(n.id)?r.filter(e=>e!==n.id):[...r,n.id]},Q(i)},className:`rounded px-1.5 py-0.5 text-[10px] ${(e.consumesFrom??[]).includes(n.id)?`bg-[var(--app-danger)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:n.id},n.id)),(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0 ml-1`,children:`(opt)`}),Z.slice(0,t).map(n=>(0,I.jsxs)(`button`,{type:`button`,"aria-label":`optional-consumes ${n.id}`,onClick:()=>{let r=e.consumesFromOptional??[],i=[...Z];i[t]={...e,consumesFromOptional:r.includes(n.id)?r.filter(e=>e!==n.id):[...r,n.id]},Q(i)},className:`rounded px-1.5 py-0.5 text-[10px] ${(e.consumesFromOptional??[]).includes(n.id)?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:[n.id,`?`]},`${n.id}-opt`))]}),(0,I.jsxs)(`div`,{className:`flex gap-1 items-center`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0`,children:`Speak as:`}),(0,I.jsx)(`input`,{type:`text`,placeholder:`e.g. 卞旸`,className:`flex-1 min-w-0 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)]`,value:e.persona?.speakAs??``,onChange:n=>{let r=[...Z];r[t]={...e,persona:n.target.value?{speakAs:n.target.value,voiceConstraints:e.persona?.voiceConstraints}:void 0},Q(r)}}),(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0`,children:`Voice:`}),(0,I.jsx)(`input`,{type:`text`,placeholder:`optional`,className:`flex-1 min-w-0 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)]`,value:e.persona?.voiceConstraints??``,onChange:n=>{let r=[...Z];r[t]={...e,persona:e.persona?.speakAs?{speakAs:e.persona.speakAs,voiceConstraints:n.target.value||void 0}:void 0},Q(r)}})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-1 items-center`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)] shrink-0`,children:`Contract:`}),(0,I.jsx)(`input`,{type:`number`,min:0,placeholder:`min`,className:`w-16 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.outputContract?.lengthTarget?.min??``,onChange:n=>{let r=[...Z],i=n.target.value===``?void 0:Number(n.target.value);r[t]={...e,outputContract:{...e.outputContract,lengthTarget:{min:i??0,max:e.outputContract?.lengthTarget?.max??0,unit:e.outputContract?.lengthTarget?.unit??`characters`}}},Q(r)}}),(0,I.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`—`}),(0,I.jsx)(`input`,{type:`number`,min:0,placeholder:`max`,className:`w-16 rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.outputContract?.lengthTarget?.max??``,onChange:n=>{let r=[...Z],i=n.target.value===``?void 0:Number(n.target.value);r[t]={...e,outputContract:{...e.outputContract,lengthTarget:{min:e.outputContract?.lengthTarget?.min??0,max:i??0,unit:e.outputContract?.lengthTarget?.unit??`characters`}}},Q(r)}}),(0,I.jsxs)(`select`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.outputContract?.lengthTarget?.unit??`characters`,onChange:n=>{let r=[...Z];r[t]={...e,outputContract:{...e.outputContract,lengthTarget:{min:e.outputContract?.lengthTarget?.min??0,max:e.outputContract?.lengthTarget?.max??0,unit:n.target.value}}},Q(r)},children:[(0,I.jsx)(`option`,{value:`characters`,children:`chars`}),(0,I.jsx)(`option`,{value:`words`,children:`words`}),(0,I.jsx)(`option`,{value:`bytes`,children:`bytes`})]}),(0,I.jsxs)(`select`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-xs text-[var(--app-text)]`,value:e.outputContract?.format??``,onChange:n=>{let r=[...Z],i=n.target.value;r[t]={...e,outputContract:{...e.outputContract,format:i||void 0}},Q(r)},children:[(0,I.jsx)(`option`,{value:``,children:`fmt?`}),(0,I.jsx)(`option`,{value:`markdown`,children:`md`}),(0,I.jsx)(`option`,{value:`text`,children:`txt`}),(0,I.jsx)(`option`,{value:`json`,children:`json`})]}),(0,I.jsxs)(`label`,{className:`flex items-center gap-0.5 text-[10px] text-[var(--app-text-subtle)] cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--app-accent)]`,checked:e.outputContract?.mustReferenceArtifacts??!1,onChange:n=>{let r=[...Z];r[t]={...e,outputContract:{...e.outputContract,mustReferenceArtifacts:n.target.checked}},Q(r)}}),`ref artifacts`]})]})]},e.id))]}),Z.length>1&&(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-[var(--app-text)] cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,"aria-label":`continue on error`,checked:Ge,onChange:e=>Ke(e.target.checked),className:`rounded border-[var(--app-border-strong)] bg-[var(--app-panel-elevated)]`}),`Continue on error`]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-xs font-medium text-[var(--app-text)]`,children:`投递格式`}),(0,I.jsxs)(`select`,{value:ct,onChange:e=>lt(e.target.value),className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,children:[(0,I.jsx)(`option`,{value:`concat-step-results`,children:`拼接每步结果(默认)`}),(0,I.jsx)(`option`,{value:`primary-artifact`,children:`指定主产物`}),(0,I.jsx)(`option`,{value:`custom`,disabled:!0,children:`自定义(即将推出)`})]}),ct===`primary-artifact`&&(0,I.jsxs)(`div`,{className:`space-y-2 rounded border border-[var(--app-border)] p-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:`来源 step`}),(0,I.jsxs)(`select`,{value:ut,onChange:e=>{let t=Z.find(t=>t.id===e.target.value);dt(e.target.value),ht(t?.outputAs??``)},className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,children:[(0,I.jsx)(`option`,{value:``,children:`选择 step...`}),Z.filter(e=>e.prompt.trim()).map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),mt&&(0,I.jsxs)(`div`,{className:`text-xs text-[var(--app-accent)]`,children:[`Will use step's output: `,(0,I.jsx)(`span`,{className:`font-mono`,children:mt})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:mt?`Or specify custom key:`:`artifact key`}),(0,I.jsx)(`input`,{type:`text`,value:ft,onChange:e=>pt(e.target.value),placeholder:mt?`留空使用上面的自动解析值`:`手动输入 key`,className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-muted)] focus:border-[var(--app-accent)] focus:outline-none`})]})]})]}),(0,I.jsx)(ve,{value:Qe,onChange:$e}),(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(m,{onClick:()=>void Ft(),disabled:qe||!Y.trim()||Z.every(e=>!e.prompt.trim()),children:qe?`Saving...`:`Save`}),(0,I.jsx)(m,{variant:`ghost`,onClick:()=>Ae(null),children:`Cancel`})]})]}),(0,I.jsx)(w,{padding:!1,children:e.length===0?(0,I.jsx)(fe,{icon:(0,I.jsx)(i,{size:32}),title:`No automations`,description:`Create an automation to run recurring tasks`}):(0,I.jsxs)(ge,{children:[(0,I.jsx)(me,{children:(0,I.jsxs)(k,{children:[(0,I.jsx)(O,{children:`Name`}),(0,I.jsx)(O,{children:`Trigger`}),(0,I.jsx)(O,{children:`Schedule`}),(0,I.jsx)(O,{children:`Steps`}),(0,I.jsx)(O,{children:`Enabled`}),(0,I.jsx)(O,{children:`Created`}),(0,I.jsx)(O,{children:`Webhook URL`}),(0,I.jsx)(O,{children:`Actions`})]})}),(0,I.jsx)(he,{children:e.map(e=>(0,I.jsxs)(F.Fragment,{children:[(0,I.jsxs)(k,{children:[(0,I.jsxs)(A,{className:`font-medium text-[var(--app-text)]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>Et(e.id),className:`flex items-center gap-1 hover:text-[var(--app-accent)] transition-colors`,children:[gt===e.id?(0,I.jsx)(ee,{size:12}):(0,I.jsx)(s,{size:12}),e.name]}),(e.isPreset||e.presetId)&&(0,I.jsx)(C,{variant:`info`,className:`ml-2`,children:`Preset`})]}),(0,I.jsx)(A,{children:(0,I.jsx)(C,{variant:e.trigger.type===`cron`?`info`:(e.trigger.type,`muted`),children:Ot(e.trigger)})}),(0,I.jsx)(A,{className:`font-mono text-xs`,children:e.trigger.type===`once`&&e.trigger.runAt?new Date(e.trigger.runAt).toLocaleString():e.trigger.cron??`—`}),(0,I.jsx)(A,{className:`font-mono text-xs`,children:(()=>{let t=new Set(e.steps.filter(e=>e.roleId).map(e=>e.roleId)),n=t.size>0?`${e.steps.length} steps / ${t.size} roles`:`${e.steps.length} steps`;return e.goalIds&&e.goalIds.length>0?`${n} / ${e.goalIds.length} goals`:n})()}),(0,I.jsx)(A,{children:[`cron`,`once`,`template_complete`].every(t=>e.trigger.type!==t)?(0,I.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`—`}):(0,I.jsx)(_e,{checked:e.enabled,onCheckedChange:()=>void Nt(e.id),"aria-label":`Toggle ${e.name}`})}),(0,I.jsx)(A,{className:`text-xs text-[var(--app-text-subtle)]`,children:e.createdAt?T(e.createdAt):`—`}),(0,I.jsx)(A,{className:`font-mono text-xs text-[var(--app-text-muted)]`,children:e.enabled?`POST /webhooks/${e.id}`:`—`}),(0,I.jsx)(A,{children:(0,I.jsxs)(`div`,{className:`flex gap-1`,children:[(0,I.jsx)(m,{variant:`ghost`,size:`sm`,onClick:()=>Pt(e),title:`Edit`,children:(0,I.jsx)(c,{size:12})}),(0,I.jsx)(m,{variant:`ghost`,size:`sm`,onClick:()=>Te(e.id),disabled:Ce===e.id,title:`Run now`,children:(0,I.jsx)(t,{size:12})}),(0,I.jsx)(m,{variant:`ghost`,size:`sm`,className:`text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,onClick:()=>{jt(e.id)},title:`Delete`,children:(0,I.jsx)(l,{size:12})})]})})]}),gt===e.id&&(0,I.jsx)(k,{children:(0,I.jsxs)(A,{colSpan:8,className:`bg-[var(--app-panel)]/50 p-3`,children:[(0,I.jsx)(`div`,{className:`text-xs text-[var(--app-text-muted)] mb-2 font-medium`,children:`Recent Template Executions`}),bt?(0,I.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Loading...`}):vt.length===0?(0,I.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`No template executions yet`}):(0,I.jsx)(`div`,{className:`space-y-1.5`,children:vt.map(t=>{let n=Object.entries(t.stepStatuses),r=n.filter(([,e])=>e.status===`completed`).length,i=n.filter(([,e])=>e.status===`failed`).length,a=n.filter(([,e])=>e.status===`skipped`).length,s=n.filter(([,e])=>e.status===`cancelled`).length,c=n.length,l=new Map(t.stepTasks.filter(e=>e.stepId).map(e=>[e.stepId,e])),u=[...e.steps.map(e=>e.id),...Object.keys(t.stepStatuses).filter(t=>!e.steps.some(e=>e.id===t))];return(0,I.jsxs)(`div`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-canvas)]/50 p-2.5 space-y-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,I.jsx)(C,{variant:t.status===`completed`?`success`:t.status===`failed`?`destructive`:t.status===`partial`?`warning`:t.status===`cancelled`?`secondary`:`muted`,children:t.status}),(0,I.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:new Date(t.startedAt).toLocaleString()}),c>0&&(0,I.jsxs)(`span`,{className:`text-[var(--app-text-muted)]`,children:[r,`/`,c,` steps`,(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[i>0&&(0,I.jsxs)(`span`,{className:`text-[var(--app-danger)]`,children:[i,` failed`]}),a>0&&(0,I.jsxs)(`span`,{className:`text-[var(--app-warning)]`,children:[a,` skipped`]}),s>0&&(0,I.jsxs)(`span`,{className:`text-[var(--app-text)]`,children:[s,` cancelled`]})]})]}),t.completedAt&&(0,I.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[Math.round((t.completedAt-t.startedAt)/1e3),`s`]}),(0,I.jsx)(`span`,{className:`font-mono text-[var(--app-text-subtle)] truncate max-w-[120px]`,children:t.id.slice(0,8)}),(0,I.jsx)(`div`,{className:`ml-auto flex items-center gap-1`,"data-testid":`execution-feedback-buttons`,children:St[t.id]===`good`?(0,I.jsx)(te,{size:13,className:`text-[var(--app-success)]`,"aria-label":`Good — recorded`}):St[t.id]===`bad`?(0,I.jsx)(o,{size:13,className:`text-[var(--app-danger)]`,"aria-label":`Bad — recorded`}):St[t.id]===`pending`?(0,I.jsx)(`span`,{className:`text-[var(--app-text-subtle)] text-[10px]`,children:`...`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Tt(t.id,`good`),className:`rounded p-0.5 hover:bg-[var(--app-success-soft)] text-[var(--app-text-subtle)] hover:text-[var(--app-success)] transition-colors`,"aria-label":`Rate good`,title:`Good`,children:(0,I.jsx)(te,{size:13})}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Tt(t.id,`bad`),className:`rounded p-0.5 hover:bg-[var(--app-danger-soft)] text-[var(--app-text-subtle)] hover:text-[var(--app-danger)] transition-colors`,"aria-label":`Rate bad`,title:`Bad`,children:(0,I.jsx)(o,{size:13})})]})})]}),(0,I.jsx)(`div`,{className:`space-y-1.5`,children:u.map(n=>{let r=t.stepStatuses[n];if(!r)return null;let i=e.steps.find(e=>e.id===n),a=l.get(n),o=a?.roleId??r.roleId??i?.roleId,s=d.find(e=>e.id===o)?.name??o,c=a?.error??r.error??a?.result??r.result;return(0,I.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] gap-2 rounded bg-[var(--app-panel)]/60 px-2 py-1.5 text-xs`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`font-mono text-[var(--app-text)]`,children:n}),s&&(0,I.jsxs)(`span`,{className:`text-[var(--app-warning-soft-text)]`,children:[`@`,s]}),i?.dependsOn&&i.dependsOn.length>0&&(0,I.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`after `,i.dependsOn.join(`, `)]})]}),c&&(0,I.jsx)(`div`,{className:`mt-1 truncate ${r.status===`failed`?`text-[var(--app-danger-soft-text)]`:r.status===`skipped`?`text-[var(--app-warning-soft-text)]`:r.status===`cancelled`?`text-[var(--app-text)]`:`text-[var(--app-text-muted)]`}`,children:c})]}),(0,I.jsx)(C,{variant:r.status===`completed`?`success`:r.status===`failed`?`destructive`:r.status===`skipped`?`warning`:r.status===`cancelled`?`secondary`:`muted`,children:r.status}),r.contract&&(0,I.jsx)(xe,{contract:r.contract,retried:r.contractRetried}),(0,I.jsxs)(`div`,{className:`text-right text-[var(--app-text-subtle)]`,children:[a?.completedAt&&(0,I.jsxs)(`div`,{children:[Math.max(0,Math.round((a.completedAt-a.createdAt)/1e3)),`s`]}),a?.id&&(0,I.jsx)(`div`,{className:`font-mono`,children:a.id.slice(0,8)})]})]},`${t.id}-${n}`)})})]},t.id)})})]})})]},e.id))})]})}),(0,I.jsx)(x,{open:U!==null,onOpenChange:e=>{e||Te(null)},children:(0,I.jsxs)(se,{children:[(0,I.jsxs)(oe,{children:[(0,I.jsx)(ce,{children:`Run Template`}),(0,I.jsxs)(S,{children:[`Run “`,It?.name,`” now? This will execute the template immediately.`]})]}),(0,I.jsxs)(ie,{children:[(0,I.jsx)(_,{children:`Cancel`}),(0,I.jsx)(ae,{onClick:()=>{U&&At(U),Te(null)},children:`Run Now`})]})]})}),(0,I.jsx)(x,{open:W!==null,onOpenChange:e=>{e||(Ee(null),K(null),q(`template_only`))},children:(0,I.jsxs)(se,{children:[(0,I.jsxs)(oe,{children:[(0,I.jsx)(ce,{children:`Delete Template`}),(0,I.jsx)(S,{children:G===null?(0,I.jsx)(I.Fragment,{children:`Loading…`}):G.taskCount===0&&G.executionCount===0?(0,I.jsxs)(I.Fragment,{children:[`Delete “`,Lt?.name,`”? This action cannot be undone.`]}):G.taskCount===0?(0,I.jsxs)(I.Fragment,{children:[`“`,Lt?.name,`” has `,G.executionCount,` template execution`,G.executionCount===1?``:`s`,` which will be removed. Delete?`]}):(0,I.jsxs)(I.Fragment,{children:[`“`,Lt?.name,`” has`,` `,G.executionCount>0&&(0,I.jsxs)(I.Fragment,{children:[G.executionCount,` template execution`,G.executionCount===1?``:`s`]}),G.executionCount>0&&G.taskCount>0&&` and `,G.taskCount,` task`,G.taskCount===1?``:`s`,`. Choose what to delete:`]})})]}),G!==null&&G.taskCount>0&&(0,I.jsxs)(`div`,{className:`space-y-2 px-1`,children:[(0,I.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`deleteMode`,value:`template_only`,checked:De===`template_only`,onChange:()=>q(`template_only`),className:`mt-1`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`text-sm font-medium`,children:`Template only`}),(0,I.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Removes the automation. Tasks remain under the Tasks tab as history.`})]})]}),(0,I.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`deleteMode`,value:`with_tasks`,checked:De===`with_tasks`,onChange:()=>q(`with_tasks`),className:`mt-1`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`text-sm font-medium`,children:`Template and its tasks`}),(0,I.jsxs)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`Also deletes `,G.taskCount,` task`,G.taskCount===1?``:`s`,` and their score history. Cannot be undone.`]})]})]})]}),(0,I.jsxs)(ie,{children:[(0,I.jsx)(_,{disabled:Oe,children:`Cancel`}),(0,I.jsx)(ae,{className:`bg-[var(--app-danger)] hover:bg-[var(--app-danger)]`,disabled:Oe||G===null,onClick:()=>{W&&Mt(W,G&&G.taskCount>0?De:`template_only`),Ee(null),K(null),q(`template_only`)},children:`Delete`})]})]})})]})}function we(){let{tasks:e,templates:t,goals:n}=v(h(e=>({tasks:e.tasks,templates:e.templates,goals:e.goals}))),r=v(e=>e.fetchTasks),i=v(e=>e.fetchTemplates),a=v(e=>e.fetchGoals);return(0,F.useEffect)(()=>{r(),i(),a()},[r,i,a]),(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(le,{eyebrow:`Operations`,title:`Work`,description:`Tasks, automations, and goals in one place.`,metrics:[{label:`Running`,value:e.filter(e=>e.status===`running`).length},{label:`Automations`,value:t.length},{label:`Goals`,value:n.length}],compact:!0}),(0,I.jsxs)(P,{defaultValue:`tasks`,children:[(0,I.jsxs)(ye,{children:[(0,I.jsx)(M,{value:`tasks`,children:`Tasks`}),(0,I.jsx)(M,{value:`automations`,children:`Automations`}),(0,I.jsx)(M,{value:`goals`,children:`Goals`})]}),(0,I.jsx)(N,{value:`tasks`,children:(0,I.jsx)(be,{})}),(0,I.jsx)(N,{value:`automations`,children:(0,I.jsx)(Ce,{})}),(0,I.jsx)(N,{value:`goals`,children:(0,I.jsx)(j,{})})]})]})}export{we as Work};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-Dw2cE7zH.js";var t=e({AUTH_STORAGE_KEY:()=>r,ApiError:()=>n,api:()=>c,bindRoleExtension:()=>S,clearLegacyMcpServers:()=>b,clearStoredApiKey:()=>o,deleteExtension:()=>v,fetchDeliveryLog:()=>l,getExtension:()=>g,getStoredApiKey:()=>i,listExtensions:()=>h,listLegacyMcpServers:()=>y,listMistakePatterns:()=>f,listRoleExtensions:()=>x,patchRoleExtension:()=>w,postExecutionFeedback:()=>T,redirectToLogin:()=>s,rotateApiKey:()=>d,setStoredApiKey:()=>a,unbindRoleExtension:()=>C,updateMistakePattern:()=>p,updateTaskTemplateConfig:()=>m,uploadExtension:()=>_,verifyApiKey:()=>u}),n=class extends Error{status;code;constructor(e,t,n){super(n),this.name=`ApiError`,this.status=e,this.code=t}},r=`adam_api_key`;function i(){return typeof localStorage<`u`?localStorage.getItem(r):null}function a(e){localStorage.setItem(r,e)}function o(){localStorage.removeItem(r)}function s(){if(typeof window>`u`||window.location.pathname===`/ui/login`)return;let e=encodeURIComponent(window.location.pathname+window.location.search);window.location.href=`/ui/login?returnTo=${e}`}async function c(e,t){let r=i(),a={...t?.headers,...r?{"x-api-key":r}:{}};t?.body&&(a[`Content-Type`]??=`application/json`);let c=await fetch(e,{...t,headers:a});if(!c.ok){let e=`UNKNOWN_ERROR`,t=c.statusText;try{let n=await c.json();e=n.code??e,t=n.message??t}catch{}throw c.status===401&&(o(),s()),new n(c.status,e,t)}if(c.status!==204)return c.json()}async function l(e,t=50){return(await c(`/tasks/${e}/delivery-log?limit=${t}`)).logs}async function u(e){return(await fetch(`/auth/verify`,{headers:{"x-api-key":e}})).ok}async function d(){return(await c(`/auth/rotate`,{method:`POST`})).apiKey}async function f(e){let t=new URLSearchParams;e&&t.set(`status`,e);let n=t.toString();return(await c(`/mistake-patterns${n?`?${n}`:``}`)).mistakePatterns}async function p(e,t){await c(`/mistake-patterns/${e}`,{method:`PATCH`,body:JSON.stringify({status:t})})}async function m(e,t){return c(`/task-templates/${e}`,{method:`PATCH`,body:JSON.stringify({config:t})})}async function h(){return(await c(`/extensions`)).extensions}async function g(e){return(await c(`/extensions/${e}`)).extension}async function _(e){let t=new FormData;t.append(`file`,e);let r=i(),a=await fetch(`/extensions`,{method:`POST`,headers:r?{"x-api-key":r}:{},body:t});if(!a.ok){let e=`UNKNOWN_ERROR`,t=a.statusText;try{let n=await a.json();e=n.code??e,t=n.message??t}catch{}throw new n(a.status,e,t)}return(await a.json()).extension}async function v(e){await c(`/extensions/${e}`,{method:`DELETE`})}async function y(){return c(`/extensions/legacy`)}async function b(e){await c(`/extensions/legacy/clear/${e}`,{method:`POST`})}async function x(e){return(await c(`/roles/${e}/extensions`)).bindings}async function S(e,t,n){return c(`/roles/${e}/extensions`,{method:`POST`,body:JSON.stringify({extension_name:t,config_override:n})})}async function C(e,t){await c(`/roles/${e}/extensions/${t}`,{method:`DELETE`})}async function w(e,t,n){return c(`/roles/${e}/extensions/${t}`,{method:`PATCH`,body:JSON.stringify({config_override:n.configOverride,enabled:n.enabled})})}async function T(e,t,n){await c(`/executions/${e}/feedback`,{method:`POST`,body:JSON.stringify({rating:t,...n?{stepId:n}:{}})})}export{u as C,_ as S,d as _,o as a,p as b,g as c,y as d,f,s as g,T as h,b as i,i as l,w as m,t as n,v as o,x as p,S as r,l as s,c as t,h as u,a as v,m as x,C as y};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{yt as t}from"./vendor-icons-H7p0EuQJ.js";import{h as n,t as r}from"./vendor-react-C1yKjxEP.js";import{i,r as a}from"./Button-xVc-P0vm.js";typeof window<`u`&&window.document&&window.document.createElement;function o(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var s=e(t(),1),c=r();function l(e,t){let n=s.createContext(t),r=e=>{let{children:t,...r}=e,i=s.useMemo(()=>r,Object.values(r));return(0,c.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=s.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function u(e,t=[]){let n=[];function r(t,r){let i=s.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,l=n?.[e]?.[a]||i,u=s.useMemo(()=>o,Object.values(o));return(0,c.jsx)(l.Provider,{value:u,children:r})};o.displayName=t+`Provider`;function l(n,o){let c=o?.[e]?.[a]||i,l=s.useContext(c);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,l]}let i=()=>{let t=n.map(e=>s.createContext(e));return function(n){let r=n?.[e]||t;return s.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,d(i,...t)]}function d(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function f(e){let t=p(e),n=s.forwardRef((e,n)=>{let{children:r,...i}=e,a=s.Children.toArray(r),o=a.find(g);if(o){let e=o.props.children,r=a.map(t=>t===o?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return(0,c.jsx)(t,{...i,ref:n,children:s.isValidElement(e)?s.cloneElement(e,void 0,r):null})}return(0,c.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function p(e){let t=s.forwardRef((e,t)=>{let{children:n,...r}=e;if(s.isValidElement(n)){let e=v(n),i=_(r,n.props);return n.type!==s.Fragment&&(i.ref=t?a(t,e):e),s.cloneElement(n,i)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var m=Symbol(`radix.slottable`);function h(e){let t=({children:e})=>(0,c.jsx)(c.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=m,t}function g(e){return s.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===m}function _(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function v(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var y=e(n(),1),b=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=f(`Primitive.${t}`),r=s.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,c.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function x(e,t){e&&y.flushSync(()=>e.dispatchEvent(t))}function S(e){let t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>(...e)=>t.current?.(...e),[])}function C(e,t=globalThis?.document){let n=S(e);s.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var w=`DismissableLayer`,T=`dismissableLayer.update`,ee=`dismissableLayer.pointerDownOutside`,E=`dismissableLayer.focusOutside`,te,ne=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),D=s.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...f}=e,p=s.useContext(ne),[m,h]=s.useState(null),g=m?.ownerDocument??globalThis?.document,[,_]=s.useState({}),v=i(t,e=>h(e)),y=Array.from(p.layers),[x]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),S=y.indexOf(x),w=m?y.indexOf(m):-1,ee=p.layersWithOutsidePointerEventsDisabled.size>0,E=w>=S,D=ie(e=>{let t=e.target,n=[...p.branches].some(e=>e.contains(t));!E||n||(a?.(e),u?.(e),e.defaultPrevented||d?.())},g),O=ae(e=>{let t=e.target;[...p.branches].some(e=>e.contains(t))||(l?.(e),u?.(e),e.defaultPrevented||d?.())},g);return C(e=>{w===p.layers.size-1&&(r?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))},g),s.useEffect(()=>{if(m)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(te=g.body.style.pointerEvents,g.body.style.pointerEvents=`none`),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),oe(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=te)}},[m,g,n,p]),s.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),oe())},[m,p]),s.useEffect(()=>{let e=()=>_({});return document.addEventListener(T,e),()=>document.removeEventListener(T,e)},[]),(0,c.jsx)(b.div,{...f,ref:v,style:{pointerEvents:ee?E?`auto`:`none`:void 0,...e.style},onFocusCapture:o(e.onFocusCapture,O.onFocusCapture),onBlurCapture:o(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:o(e.onPointerDownCapture,D.onPointerDownCapture)})});D.displayName=w;var O=`DismissableLayerBranch`,re=s.forwardRef((e,t)=>{let n=s.useContext(ne),r=s.useRef(null),a=i(t,r);return s.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,c.jsx)(b.div,{...e,ref:a})});re.displayName=O;function ie(e,t=globalThis?.document){let n=S(e),r=s.useRef(!1),i=s.useRef(()=>{});return s.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){se(ee,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ae(e,t=globalThis?.document){let n=S(e),r=s.useRef(!1);return s.useEffect(()=>{let e=e=>{e.target&&!r.current&&se(E,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function oe(){let e=new CustomEvent(T);document.dispatchEvent(e)}function se(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?x(i,a):i.dispatchEvent(a)}var k=globalThis?.document?s.useLayoutEffect:()=>{},ce=s.useId||(()=>void 0),le=0;function ue(e){let[t,n]=s.useState(ce());return k(()=>{e||n(e=>e??String(le++))},[e]),e||(t?`radix-${t}`:``)}var de=`Portal`,fe=s.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=s.useState(!1);k(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?y.createPortal((0,c.jsx)(b.div,{...r,ref:t}),o):null});fe.displayName=de;function pe(e,t){return s.useReducer((e,n)=>t[e][n]??e,e)}var me=e=>{let{present:t,children:n}=e,r=he(t),a=typeof n==`function`?n({present:r.isPresent}):s.Children.only(n),o=i(r.ref,ge(a));return typeof n==`function`||r.isPresent?s.cloneElement(a,{ref:o}):null};me.displayName=`Presence`;function he(e){let[t,n]=s.useState(),r=s.useRef(null),i=s.useRef(e),a=s.useRef(`none`),[o,c]=pe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return s.useEffect(()=>{let e=A(r.current);a.current=o===`mounted`?e:`none`},[o]),k(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=A(t);e?c(`MOUNT`):o===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),k(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=A(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=A(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:s.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function A(e){return e?.animationName||`none`}function ge(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _e=s.useInsertionEffect||k;function ve({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=ye({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:i;{let t=s.useRef(e!==void 0);s.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=c},[c,r])}return[l,s.useCallback(t=>{if(c){let n=be(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[c,e,a,o])]}function ye({defaultProp:e,onChange:t}){let[n,r]=s.useState(e),i=s.useRef(n),a=s.useRef(t);return _e(()=>{a.current=t},[t]),s.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function be(e){return typeof e==`function`}var j=`focusScope.autoFocusOnMount`,M=`focusScope.autoFocusOnUnmount`,N={bubbles:!1,cancelable:!0},xe=`FocusScope`,Se=s.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[u,d]=s.useState(null),f=S(a),p=S(o),m=s.useRef(null),h=i(t,e=>d(e)),g=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(r){let e=function(e){if(g.paused||!u)return;let t=e.target;u.contains(t)?m.current=t:P(m.current,{select:!0})},t=function(e){if(g.paused||!u)return;let t=e.relatedTarget;t!==null&&(u.contains(t)||P(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&P(u)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return u&&r.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,u,g.paused]),s.useEffect(()=>{if(u){ke.add(g);let e=document.activeElement;if(!u.contains(e)){let t=new CustomEvent(j,N);u.addEventListener(j,f),u.dispatchEvent(t),t.defaultPrevented||(Ce(Me(Te(u)),{select:!0}),document.activeElement===e&&P(u))}return()=>{u.removeEventListener(j,f),setTimeout(()=>{let t=new CustomEvent(M,N);u.addEventListener(M,p),u.dispatchEvent(t),t.defaultPrevented||P(e??document.body,{select:!0}),u.removeEventListener(M,p),ke.remove(g)},0)}}},[u,f,p,g]);let _=s.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=we(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&P(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&P(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,c.jsx)(b.div,{tabIndex:-1,...l,ref:h,onKeyDown:_})});Se.displayName=xe;function Ce(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(P(r,{select:t}),document.activeElement!==n)return}function we(e){let t=Te(e);return[Ee(t,e),Ee(t.reverse(),e)]}function Te(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ee(e,t){for(let n of e)if(!De(n,{upTo:t}))return n}function De(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Oe(e){return e instanceof HTMLInputElement&&`select`in e}function P(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Oe(e)&&t&&e.select()}}var ke=Ae();function Ae(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=je(e,t),e.unshift(t)},remove(t){e=je(e,t),e[0]?.resume()}}}function je(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Me(e){return e.filter(e=>e.tagName!==`A`)}var F=0;function Ne(){s.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Pe()),document.body.insertAdjacentElement(`beforeend`,e[1]??Pe()),F++,()=>{F===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),F--}},[])}function Pe(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var I=function(){return I=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},I.apply(this,arguments)};function Fe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ie(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var L=`right-scroll-bar-position`,R=`width-before-scroll-bar`,Le=`with-scroll-bars-hidden`,Re=`--removed-body-scroll-bar-size`;function z(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ze(e,t){var n=(0,s.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Be=typeof window<`u`?s.useLayoutEffect:s.useEffect,Ve=new WeakMap;function He(e,t){var n=ze(t||null,function(t){return e.forEach(function(e){return z(e,t)})});return Be(function(){var t=Ve.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||z(e,null)}),i.forEach(function(e){r.has(e)||z(e,a)})}Ve.set(n,e)},[e]),n}function Ue(e){return e}function We(e,t){t===void 0&&(t=Ue);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ge(e){e===void 0&&(e={});var t=We(null);return t.options=I({async:!0,ssr:!1},e),t}var Ke=function(e){var t=e.sideCar,n=Fe(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return s.createElement(r,I({},n))};Ke.isSideCarExport=!0;function qe(e,t){return e.useMedium(t),Ke}var Je=Ge(),B=function(){},V=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:B,onWheelCapture:B,onTouchMoveCapture:B}),i=r[0],a=r[1],o=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Fe(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=He([n,t]),w=I(I({},x),i);return s.createElement(s.Fragment,null,d&&s.createElement(S,{sideCar:Je,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?s.cloneElement(s.Children.only(c),I(I({},w),{ref:C})):s.createElement(y,I({},w,{className:l,ref:C}),c))});V.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},V.classNames={fullWidth:R,zeroRight:L};var Ye,Xe=function(){if(Ye)return Ye;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ze(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Xe();return t&&e.setAttribute(`nonce`,t),e}function Qe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $e(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var et=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ze())&&(Qe(t,n),$e(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tt=function(){var e=et();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},nt=function(){var e=tt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},rt={left:0,top:0,right:0,gap:0},H=function(e){return parseInt(e||``,10)||0},it=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[H(n),H(r),H(i)]},at=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return rt;var t=it(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ot=nt(),U=`data-scroll-locked`,st=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{xt as t}from"./vendor-icons-Bc_e_XXa.js";import{h as n,t as r}from"./vendor-react-bQ_cvNuA.js";import{i,r as a}from"./Button-CRNb8sD3.js";typeof window<`u`&&window.document&&window.document.createElement;function o(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var s=e(t(),1),c=r();function l(e,t){let n=s.createContext(t),r=e=>{let{children:t,...r}=e,i=s.useMemo(()=>r,Object.values(r));return(0,c.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=s.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function u(e,t=[]){let n=[];function r(t,r){let i=s.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,l=n?.[e]?.[a]||i,u=s.useMemo(()=>o,Object.values(o));return(0,c.jsx)(l.Provider,{value:u,children:r})};o.displayName=t+`Provider`;function l(n,o){let c=o?.[e]?.[a]||i,l=s.useContext(c);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,l]}let i=()=>{let t=n.map(e=>s.createContext(e));return function(n){let r=n?.[e]||t;return s.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,d(i,...t)]}function d(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function f(e){let t=p(e),n=s.forwardRef((e,n)=>{let{children:r,...i}=e,a=s.Children.toArray(r),o=a.find(g);if(o){let e=o.props.children,r=a.map(t=>t===o?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return(0,c.jsx)(t,{...i,ref:n,children:s.isValidElement(e)?s.cloneElement(e,void 0,r):null})}return(0,c.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function p(e){let t=s.forwardRef((e,t)=>{let{children:n,...r}=e;if(s.isValidElement(n)){let e=v(n),i=_(r,n.props);return n.type!==s.Fragment&&(i.ref=t?a(t,e):e),s.cloneElement(n,i)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var m=Symbol(`radix.slottable`);function h(e){let t=({children:e})=>(0,c.jsx)(c.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=m,t}function g(e){return s.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===m}function _(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function v(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var y=e(n(),1),b=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=f(`Primitive.${t}`),r=s.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,c.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function x(e,t){e&&y.flushSync(()=>e.dispatchEvent(t))}function S(e){let t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>(...e)=>t.current?.(...e),[])}function C(e,t=globalThis?.document){let n=S(e);s.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var w=`DismissableLayer`,T=`dismissableLayer.update`,ee=`dismissableLayer.pointerDownOutside`,E=`dismissableLayer.focusOutside`,te,ne=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),D=s.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...f}=e,p=s.useContext(ne),[m,h]=s.useState(null),g=m?.ownerDocument??globalThis?.document,[,_]=s.useState({}),v=i(t,e=>h(e)),y=Array.from(p.layers),[x]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),S=y.indexOf(x),w=m?y.indexOf(m):-1,ee=p.layersWithOutsidePointerEventsDisabled.size>0,E=w>=S,D=ie(e=>{let t=e.target,n=[...p.branches].some(e=>e.contains(t));!E||n||(a?.(e),u?.(e),e.defaultPrevented||d?.())},g),O=ae(e=>{let t=e.target;[...p.branches].some(e=>e.contains(t))||(l?.(e),u?.(e),e.defaultPrevented||d?.())},g);return C(e=>{w===p.layers.size-1&&(r?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))},g),s.useEffect(()=>{if(m)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(te=g.body.style.pointerEvents,g.body.style.pointerEvents=`none`),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),oe(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=te)}},[m,g,n,p]),s.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),oe())},[m,p]),s.useEffect(()=>{let e=()=>_({});return document.addEventListener(T,e),()=>document.removeEventListener(T,e)},[]),(0,c.jsx)(b.div,{...f,ref:v,style:{pointerEvents:ee?E?`auto`:`none`:void 0,...e.style},onFocusCapture:o(e.onFocusCapture,O.onFocusCapture),onBlurCapture:o(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:o(e.onPointerDownCapture,D.onPointerDownCapture)})});D.displayName=w;var O=`DismissableLayerBranch`,re=s.forwardRef((e,t)=>{let n=s.useContext(ne),r=s.useRef(null),a=i(t,r);return s.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,c.jsx)(b.div,{...e,ref:a})});re.displayName=O;function ie(e,t=globalThis?.document){let n=S(e),r=s.useRef(!1),i=s.useRef(()=>{});return s.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){se(ee,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ae(e,t=globalThis?.document){let n=S(e),r=s.useRef(!1);return s.useEffect(()=>{let e=e=>{e.target&&!r.current&&se(E,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function oe(){let e=new CustomEvent(T);document.dispatchEvent(e)}function se(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?x(i,a):i.dispatchEvent(a)}var k=globalThis?.document?s.useLayoutEffect:()=>{},ce=s.useId||(()=>void 0),le=0;function ue(e){let[t,n]=s.useState(ce());return k(()=>{e||n(e=>e??String(le++))},[e]),e||(t?`radix-${t}`:``)}var de=`Portal`,fe=s.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=s.useState(!1);k(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?y.createPortal((0,c.jsx)(b.div,{...r,ref:t}),o):null});fe.displayName=de;function pe(e,t){return s.useReducer((e,n)=>t[e][n]??e,e)}var me=e=>{let{present:t,children:n}=e,r=he(t),a=typeof n==`function`?n({present:r.isPresent}):s.Children.only(n),o=i(r.ref,ge(a));return typeof n==`function`||r.isPresent?s.cloneElement(a,{ref:o}):null};me.displayName=`Presence`;function he(e){let[t,n]=s.useState(),r=s.useRef(null),i=s.useRef(e),a=s.useRef(`none`),[o,c]=pe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return s.useEffect(()=>{let e=A(r.current);a.current=o===`mounted`?e:`none`},[o]),k(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=A(t);e?c(`MOUNT`):o===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),k(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=A(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=A(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:s.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function A(e){return e?.animationName||`none`}function ge(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _e=s.useInsertionEffect||k;function ve({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=ye({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:i;{let t=s.useRef(e!==void 0);s.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=c},[c,r])}return[l,s.useCallback(t=>{if(c){let n=be(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[c,e,a,o])]}function ye({defaultProp:e,onChange:t}){let[n,r]=s.useState(e),i=s.useRef(n),a=s.useRef(t);return _e(()=>{a.current=t},[t]),s.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function be(e){return typeof e==`function`}var j=`focusScope.autoFocusOnMount`,M=`focusScope.autoFocusOnUnmount`,N={bubbles:!1,cancelable:!0},xe=`FocusScope`,Se=s.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[u,d]=s.useState(null),f=S(a),p=S(o),m=s.useRef(null),h=i(t,e=>d(e)),g=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(r){let e=function(e){if(g.paused||!u)return;let t=e.target;u.contains(t)?m.current=t:P(m.current,{select:!0})},t=function(e){if(g.paused||!u)return;let t=e.relatedTarget;t!==null&&(u.contains(t)||P(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&P(u)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return u&&r.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,u,g.paused]),s.useEffect(()=>{if(u){ke.add(g);let e=document.activeElement;if(!u.contains(e)){let t=new CustomEvent(j,N);u.addEventListener(j,f),u.dispatchEvent(t),t.defaultPrevented||(Ce(Me(Te(u)),{select:!0}),document.activeElement===e&&P(u))}return()=>{u.removeEventListener(j,f),setTimeout(()=>{let t=new CustomEvent(M,N);u.addEventListener(M,p),u.dispatchEvent(t),t.defaultPrevented||P(e??document.body,{select:!0}),u.removeEventListener(M,p),ke.remove(g)},0)}}},[u,f,p,g]);let _=s.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=we(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&P(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&P(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,c.jsx)(b.div,{tabIndex:-1,...l,ref:h,onKeyDown:_})});Se.displayName=xe;function Ce(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(P(r,{select:t}),document.activeElement!==n)return}function we(e){let t=Te(e);return[Ee(t,e),Ee(t.reverse(),e)]}function Te(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ee(e,t){for(let n of e)if(!De(n,{upTo:t}))return n}function De(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Oe(e){return e instanceof HTMLInputElement&&`select`in e}function P(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Oe(e)&&t&&e.select()}}var ke=Ae();function Ae(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=je(e,t),e.unshift(t)},remove(t){e=je(e,t),e[0]?.resume()}}}function je(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Me(e){return e.filter(e=>e.tagName!==`A`)}var F=0;function Ne(){s.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Pe()),document.body.insertAdjacentElement(`beforeend`,e[1]??Pe()),F++,()=>{F===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),F--}},[])}function Pe(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var I=function(){return I=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},I.apply(this,arguments)};function Fe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ie(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var L=`right-scroll-bar-position`,R=`width-before-scroll-bar`,Le=`with-scroll-bars-hidden`,Re=`--removed-body-scroll-bar-size`;function z(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ze(e,t){var n=(0,s.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Be=typeof window<`u`?s.useLayoutEffect:s.useEffect,Ve=new WeakMap;function He(e,t){var n=ze(t||null,function(t){return e.forEach(function(e){return z(e,t)})});return Be(function(){var t=Ve.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||z(e,null)}),i.forEach(function(e){r.has(e)||z(e,a)})}Ve.set(n,e)},[e]),n}function Ue(e){return e}function We(e,t){t===void 0&&(t=Ue);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ge(e){e===void 0&&(e={});var t=We(null);return t.options=I({async:!0,ssr:!1},e),t}var Ke=function(e){var t=e.sideCar,n=Fe(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return s.createElement(r,I({},n))};Ke.isSideCarExport=!0;function qe(e,t){return e.useMedium(t),Ke}var Je=Ge(),B=function(){},V=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:B,onWheelCapture:B,onTouchMoveCapture:B}),i=r[0],a=r[1],o=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Fe(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=He([n,t]),w=I(I({},x),i);return s.createElement(s.Fragment,null,d&&s.createElement(S,{sideCar:Je,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?s.cloneElement(s.Children.only(c),I(I({},w),{ref:C})):s.createElement(y,I({},w,{className:l,ref:C}),c))});V.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},V.classNames={fullWidth:R,zeroRight:L};var Ye,Xe=function(){if(Ye)return Ye;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ze(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Xe();return t&&e.setAttribute(`nonce`,t),e}function Qe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $e(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var et=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ze())&&(Qe(t,n),$e(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tt=function(){var e=et();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},nt=function(){var e=tt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},rt={left:0,top:0,right:0,gap:0},H=function(e){return parseInt(e||``,10)||0},it=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[H(n),H(r),H(i)]},at=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return rt;var t=it(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ot=nt(),U=`data-scroll-locked`,st=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
2
  .${Le} {
3
3
  overflow: hidden ${r};
4
4
  padding-right: ${s}px ${r};