@co0ontty/wand 4.94.0 → 4.95.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 (197) hide show
  1. package/README.md +4 -1
  2. package/dist/ai-text-runner.d.ts +4 -0
  3. package/dist/ai-text-runner.js +44 -4
  4. package/dist/build-info.json +3 -3
  5. package/dist/cli-api.d.ts +1 -0
  6. package/dist/cli-api.js +7 -2
  7. package/dist/cli.js +47 -0
  8. package/dist/conversation-execution-preference.d.ts +7 -0
  9. package/dist/conversation-execution-preference.js +26 -0
  10. package/dist/conversation-organize-contract.d.ts +70 -0
  11. package/dist/conversation-organize-contract.js +1 -0
  12. package/dist/conversation-organize-service.d.ts +46 -0
  13. package/dist/conversation-organize-service.js +505 -0
  14. package/dist/conversation-organize.d.ts +41 -0
  15. package/dist/conversation-organize.js +97 -0
  16. package/dist/conversation-service.d.ts +2 -1
  17. package/dist/conversation-service.js +10 -4
  18. package/dist/core-turn-tracker.d.ts +5 -1
  19. package/dist/core-turn-tracker.js +17 -1
  20. package/dist/decision-expert-service.d.ts +2 -0
  21. package/dist/decision-expert-service.js +17 -1
  22. package/dist/decision-skill.d.ts +0 -1
  23. package/dist/decision-skill.js +5 -64
  24. package/dist/deployment-lock.js +4 -1
  25. package/dist/employee-im-config.d.ts +17 -0
  26. package/dist/employee-im-config.js +85 -0
  27. package/dist/employee-im-lifecycle.d.ts +35 -0
  28. package/dist/employee-im-lifecycle.js +168 -0
  29. package/dist/employee-im-types.d.ts +80 -0
  30. package/dist/employee-im-types.js +32 -0
  31. package/dist/employee-im.d.ts +35 -0
  32. package/dist/employee-im.js +157 -0
  33. package/dist/employee-knowledge.js +3 -2
  34. package/dist/employee-text.d.ts +1 -0
  35. package/dist/employee-text.js +28 -13
  36. package/dist/git-quick-commit.js +21 -3
  37. package/dist/managed-skill.d.ts +6 -0
  38. package/dist/managed-skill.js +99 -0
  39. package/dist/model-auto-assign.js +1 -1
  40. package/dist/process-manager.js +1 -1
  41. package/dist/prompt-optimizer.js +1 -1
  42. package/dist/scheduled-task-activity.d.ts +16 -0
  43. package/dist/scheduled-task-activity.js +42 -0
  44. package/dist/scheduled-task-agenda.d.ts +20 -0
  45. package/dist/scheduled-task-agenda.js +82 -0
  46. package/dist/scheduled-task-calendar.d.ts +37 -0
  47. package/dist/scheduled-task-calendar.js +131 -0
  48. package/dist/scheduled-task-read-range.d.ts +7 -0
  49. package/dist/scheduled-task-read-range.js +35 -0
  50. package/dist/scheduled-task-service.d.ts +6 -1
  51. package/dist/scheduled-task-service.js +61 -1
  52. package/dist/scheduled-task-state.d.ts +1 -1
  53. package/dist/scheduled-task-types.d.ts +38 -0
  54. package/dist/server-asset-routes.js +3 -2
  55. package/dist/server-conversation-organize-routes.d.ts +4 -0
  56. package/dist/server-conversation-organize-routes.js +75 -0
  57. package/dist/server-conversation-routes.js +2 -1
  58. package/dist/server-employee-im-routes.d.ts +9 -0
  59. package/dist/server-employee-im-routes.js +40 -0
  60. package/dist/server-employee-routes.js +1 -1
  61. package/dist/server-scheduled-task-routes.js +24 -0
  62. package/dist/server-session-lifecycle-routes.js +8 -3
  63. package/dist/server-session-routes.js +18 -0
  64. package/dist/server-session-worktree-routes.js +3 -3
  65. package/dist/server-workspace-routes.d.ts +3 -0
  66. package/dist/server-workspace-routes.js +14 -1
  67. package/dist/server.js +39 -5
  68. package/dist/session-ai-context.d.ts +11 -1
  69. package/dist/session-ai-context.js +21 -2
  70. package/dist/session-metadata-service.js +1 -1
  71. package/dist/session-registry.js +6 -0
  72. package/dist/session-request.js +3 -0
  73. package/dist/session-topic.js +1 -1
  74. package/dist/silicon-employee-draft.js +1 -1
  75. package/dist/speech-polisher-service.d.ts +2 -0
  76. package/dist/speech-polisher-service.js +28 -6
  77. package/dist/storage/conversation-organization-repository.d.ts +13 -0
  78. package/dist/storage/conversation-organization-repository.js +33 -0
  79. package/dist/storage/migrations.js +10 -0
  80. package/dist/storage/secrets-repository.d.ts +7 -0
  81. package/dist/storage/secrets-repository.js +28 -1
  82. package/dist/storage/tasks-repository.js +4 -0
  83. package/dist/storage-schedules.d.ts +8 -1
  84. package/dist/storage-schedules.js +24 -0
  85. package/dist/storage-schema.js +9 -0
  86. package/dist/storage.d.ts +6 -1
  87. package/dist/storage.js +13 -0
  88. package/dist/structured-session-manager.d.ts +1 -0
  89. package/dist/structured-session-manager.js +18 -4
  90. package/dist/system-ai-call.d.ts +49 -0
  91. package/dist/system-ai-call.js +28 -0
  92. package/dist/system-ai-session-recorder.d.ts +30 -0
  93. package/dist/system-ai-session-recorder.js +239 -0
  94. package/dist/system-cli.d.ts +6 -0
  95. package/dist/system-cli.js +93 -0
  96. package/dist/system-skill.d.ts +5 -0
  97. package/dist/system-skill.js +19 -0
  98. package/dist/task-organize-contract.js +2 -2
  99. package/dist/task-title-organize-service.d.ts +1 -1
  100. package/dist/task-title-organize-service.js +9 -5
  101. package/dist/task-title-organize.js +13 -6
  102. package/dist/task-title-service.js +1 -1
  103. package/dist/task-title.js +1 -1
  104. package/dist/user-memory.js +1 -1
  105. package/dist/wand-task-sync.js +2 -1
  106. package/dist/web-ui/content/ai-teams.js +12 -12
  107. package/dist/web-ui/content/module-manifest.json +1 -1
  108. package/dist/web-ui/content/modules/{0051bd3d55f10ab7/library-bridge-DTMQIHVJ.js → 09842858f9d34a4e/library-bridge.js} +2 -2
  109. package/dist/web-ui/content/modules/1021ae40c5761e3f/sha256.js +1 -0
  110. package/dist/web-ui/content/modules/134f6120c0acaf57/host.js +1 -0
  111. package/dist/web-ui/content/modules/1d518ae6ed66fe5a/chunk.js +3 -0
  112. package/dist/web-ui/content/modules/1f93b5bd70381bb6/runtime.js +539 -0
  113. package/dist/web-ui/content/modules/26c68d4decdd18b4/markdown.js +1 -0
  114. package/dist/web-ui/content/modules/2ed8bafd5b4fecc5/workspace-window.js +1 -0
  115. package/dist/web-ui/content/modules/31ffc2f05f87652c/host.js +1 -0
  116. package/dist/web-ui/content/modules/35aaa85b9d0937af/chunk.js +20 -0
  117. package/dist/web-ui/content/modules/3664d0620f124292/chunk.js +3 -0
  118. package/dist/web-ui/content/modules/3cea480770cb184c/chunk.js +1 -0
  119. package/dist/web-ui/content/modules/3d12adf54647c1e2/host-bridge.js +1 -0
  120. package/dist/web-ui/content/modules/459cca2482a9a4ba/host.js +18 -0
  121. package/dist/web-ui/content/modules/474c9647130ef3e9/task-board-host.js +2 -0
  122. package/dist/web-ui/content/modules/4f74d2517f29134c/chunk.js +15 -0
  123. package/dist/web-ui/content/modules/52a218d74002a011/host.js +30 -0
  124. package/dist/web-ui/content/modules/54f2b10659ef8475/employee-card.js +1 -0
  125. package/dist/web-ui/content/modules/703fb1c670f7b199/chunk.js +1 -0
  126. package/dist/web-ui/content/modules/75511da23f051718/host.js +1 -0
  127. package/dist/web-ui/content/modules/{0051bd3d55f10ab7/host-2IVIZ2YC.js → 799b19da948bec8d/host.js} +3 -2
  128. package/dist/web-ui/content/modules/{0051bd3d55f10ab7/host-XNIR3NTJ.js → 7ef73b6c20d2504f/host.js} +3 -2
  129. package/dist/web-ui/content/modules/8f8f7a0a8874d29a/host.js +1 -0
  130. package/dist/web-ui/content/modules/90f2cd73cdf3a2cd/chat-render.js +25 -0
  131. package/dist/web-ui/content/modules/9510efce6caaa9ec/chunk.js +1 -0
  132. package/dist/web-ui/content/modules/9a0e65188739957f/chunk.js +67 -0
  133. package/dist/web-ui/content/modules/9eae1033f47e4526/host.js +1 -0
  134. package/dist/web-ui/content/modules/a2c5b246e57fa165/panel.js +1 -0
  135. package/dist/web-ui/content/modules/a50ce28f45bfeb2e/host.js +1 -0
  136. package/dist/web-ui/content/modules/adfc53789d5bedb2/chunk.js +1 -0
  137. package/dist/web-ui/content/modules/bcecb0cc14b7d2bd/chunk.js +1 -0
  138. package/dist/web-ui/content/modules/c4706f47c23f33e4/host.js +1 -0
  139. package/dist/web-ui/content/modules/{0051bd3d55f10ab7/host-Q524TMSR.js → c7de873095c061ab/host.js} +4 -3
  140. package/dist/web-ui/content/modules/d789f84a3f8765ae/page.js +6 -0
  141. package/dist/web-ui/content/modules/db4e2dbc7aed6353/chunk.js +1 -0
  142. package/dist/web-ui/content/modules/e4fd9906521b4aa3/chunk.js +1 -0
  143. package/dist/web-ui/content/modules/eb95c3ee0d42827a/chunk.js +6 -0
  144. package/dist/web-ui/content/modules/{0051bd3d55f10ab7/host-PHHNGVNL.js → ec68d93a95c1d5d6/host.js} +2 -2
  145. package/dist/web-ui/content/modules/f33ed89d1ccd3a2d/chunk.js +1 -0
  146. package/dist/web-ui/content/modules/f6502dab121f9d91/chunk.js +1 -0
  147. package/dist/web-ui/content/modules/fac83e61c0a8c8a7/host.js +1 -0
  148. package/dist/web-ui/content/scripts.js +1 -1
  149. package/dist/web-ui/embedded-assets.d.ts +200 -27
  150. package/dist/web-ui/embedded-assets.js +5 -4
  151. package/dist/web-ui/react/workspaces/sidebar-manage.d.ts +5 -0
  152. package/dist/web-ui/react/workspaces/sidebar-manage.js +27 -3
  153. package/dist/web-ui/running-activity.d.ts +22 -9
  154. package/dist/web-ui/running-activity.js +58 -42
  155. package/dist/web-ui/running-current-action.d.ts +12 -0
  156. package/dist/web-ui/running-current-action.js +74 -0
  157. package/dist/web-ui/scripts.d.ts +4 -0
  158. package/dist/web-ui/scripts.js +17 -8
  159. package/package.json +4 -2
  160. package/scripts/recover-web-update.mjs +26 -19
  161. package/scripts/recover-web-update.sh +9 -6
  162. package/scripts/update-node.sh +3 -1
  163. package/skills/wand-system/SKILL.md +69 -0
  164. package/skills/wand-system/references/operations.md +100 -0
  165. package/skills/wand-system/scripts/wand.mjs +34 -0
  166. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chat-render-RY2I2CF3.js +0 -24
  167. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-2F6J2MKX.js +0 -1
  168. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-6C6A2RHG.js +0 -1
  169. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-7AFM245W.js +0 -1
  170. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-ECWYA3U5.js +0 -1
  171. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-MHX2QXIS.js +0 -111
  172. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-RAAPETNH.js +0 -1
  173. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-RXKBHYUR.js +0 -38
  174. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-T35D57FW.js +0 -1
  175. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-U4EDP4TI.js +0 -1
  176. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-WHXQR7JT.js +0 -20
  177. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-YOXXNXOX.js +0 -2
  178. package/dist/web-ui/content/modules/0051bd3d55f10ab7/chunk-YQJ6XYV7.js +0 -1
  179. package/dist/web-ui/content/modules/0051bd3d55f10ab7/employee-card-NV34TZIH.js +0 -1
  180. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-2AQAIUNO.js +0 -1
  181. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-AZXNFCRW.js +0 -1
  182. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-EPEQX22R.js +0 -1
  183. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-FZYIMOLC.js +0 -1
  184. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-G6GL4SNL.js +0 -1
  185. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-PEILC5NU.js +0 -1
  186. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-RO5MB6RB.js +0 -69
  187. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-WOQRK6NG.js +0 -1
  188. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-XRVOIEP6.js +0 -1
  189. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-ZDKOQEMS.js +0 -1
  190. package/dist/web-ui/content/modules/0051bd3d55f10ab7/host-bridge-PMQZRG5G.js +0 -1
  191. package/dist/web-ui/content/modules/0051bd3d55f10ab7/page-PY4JUL4W.js +0 -3
  192. package/dist/web-ui/content/modules/0051bd3d55f10ab7/panel-BBQFC55Q.js +0 -1
  193. package/dist/web-ui/content/modules/0051bd3d55f10ab7/runtime.js +0 -974
  194. package/dist/web-ui/content/modules/0051bd3d55f10ab7/sha256-ANXV72UC.js +0 -1
  195. package/dist/web-ui/content/modules/0051bd3d55f10ab7/task-board-host-PXZSWBBG.js +0 -2
  196. package/dist/web-ui/content/modules/0051bd3d55f10ab7/workspace-agent-picker-DJSECSY6.js +0 -1
  197. package/dist/web-ui/content/modules/0051bd3d55f10ab7/workspace-window-MNMKSOBG.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{c as Pt,d as xn,e as Nn}from"/assets/modules/bcecb0cc14b7d2bd/chunk.js";import{a as En}from"/assets/modules/e4fd9906521b4aa3/chunk.js";import{a as wa,b as yn}from"/assets/modules/703fb1c670f7b199/chunk.js";import{shared32_a as Ka,shared32_b as vn,shared32_c as Tn,shared32_f as In,shared32_g as wn,shared32_h as Rn,shared32_y as Cn}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared34_a as on,shared34_b as ln,shared34_e as dn}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared14_a as Sn}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{g as cn}from"/assets/modules/35aaa85b9d0937af/chunk.js";import{a as Lt,b as fn,c as bn,d as kn}from"/assets/modules/9510efce6caaa9ec/chunk.js";import{shared67_a as gn}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared37_a as O,shared37_b as $e,shared37_d as Ua,shared37_e as aa,shared37_l as un}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared15_b as Xs}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{a as Qs,b as en,c as an,d as tn,e as sn,f as nn,g as rn}from"/assets/modules/adfc53789d5bedb2/chunk.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared62_a as ea}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared47_c as me}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared77_d as hn}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared78_a as Bt}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared54_a as Ts}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared55_a as ae}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{a as pn,b as mn}from"/assets/modules/3cea480770cb184c/chunk.js";import{shared79_a as Dt}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared6_a as Ia}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared38_$ as xt,shared38_A as xs,shared38_Aa as Js,shared38_B as Ns,shared38_C as re,shared38_D as De,shared38_E as Es,shared38_F as ha,shared38_G as Le,shared38_H as As,shared38_I as Ws,shared38_J as za,shared38_K as It,shared38_L as Bs,shared38_M as Te,shared38_N as wt,shared38_O as Ds,shared38_P as Ls,shared38_Q as Ps,shared38_R as ya,shared38_T as Q,shared38_U as St,shared38_V as Fs,shared38_W as Rt,shared38_X as $s,shared38_Y as Ms,shared38_Z as Xe,shared38__ as Ct,shared38_a as ws,shared38_aa as Os,shared38_ba as _s,shared38_c as vt,shared38_ca as va,shared38_da as Pe,shared38_fa as js,shared38_ga as zs,shared38_ha as Vs,shared38_ia as Nt,shared38_ja as Et,shared38_ka as Va,shared38_la as Gs,shared38_ma as Fe,shared38_na as Ga,shared38_o as Tt,shared38_oa as Zs,shared38_pa as Hs,shared38_qa as Us,shared38_r as Ss,shared38_ra as At,shared38_sa as Ta,shared38_ta as Wt,shared38_ua as Qe,shared38_va as Za,shared38_wa as Ks,shared38_xa as Ys,shared38_y as Rs,shared38_ya as qs,shared38_z as Cs,shared38_za as Ha}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared53_l as Is}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared19_a as Be}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared24_a as yt}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared66_b as ft}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared49_a as pe}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared7_Aa as ba,shared7_Ea as Je,shared7_Fa as Y,shared7_Ga as ht,shared7_Ha as vs,shared7_Ja as ka,shared7_La as ja,shared7_V as N,shared7_W as ne,shared7_ea as bs,shared7_ja as D,shared7_ka as kt,shared7_m as ue,shared7_na as ks,shared7_pa as _a,shared7_ra as hs,shared7_t as Er,shared7_ta as ys,shared7_y as fs}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import "/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared45_a as We}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared8_Gc as bt,shared8_Kc as K,shared8_Mc as ke,shared8_Oc as T,shared8_Rc as L}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared9_a as gt}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared10_c as X}from"/assets/modules/1f93b5bd70381bb6/runtime.js";var Ya=X(gt(),1);var An=X(Er(),1),Ft=X(ke(),1);function $t({value:a,onValueChange:r,ariaLabel:l,popupOwner:c,disabled:o,className:p}){let[g,S]=Ya.useState(!1),f=Ya.useRef(null);return _a(g,()=>{S(!1),f.current?.focus()}),(0,Ft.jsx)(cn,{ref:f,open:g,onOpenChange:S,value:a?(0,An.default)(a):null,format:"YYYY-MM-DD","aria-label":l,disabled:o,className:p,onChange:b=>r(b?b.format("YYYY-MM-DD"):""),panelRender:b=>(0,Ft.jsx)("div",{"data-wand-popup-owner":c,children:b})})}var d=X(gt(),1);var ta="application/x-wand-task";function Sa(a){return Array.from(a.types).includes(ta)}function Wn(a,r){a.effectAllowed="move",a.setData("text/plain",r),a.setData(ta,r)}function Bn(a){return a.getData(ta).trim()||a.getData("text/plain").trim()}var te=X(ke(),1);function Dn({sessionId:a,taskId:r,className:l,intoNewTask:c,menuItem:o=!1,onMoved:p}){let g=wn(),[S,f]=In(),{targets:b,loading:P,busy:A,error:R,move:k,summarize:u,retry:G}=Rn({sessionId:a,taskId:r,intoNewTask:c,open:S,onMoved:()=>{f(!1),p?.()}});return(0,te.jsxs)(Je,{popupOwner:g,open:S,onOpenChange:f,align:"end",contentRole:"menu",ariaLabel:"\u79FB\u52A8\u4F1A\u8BDD\u5230\u4EFB\u52A1",className:"workspace-session-move-menu",trigger:o?(0,te.jsx)(ba,{label:"\u79FB\u52A8\u5230\u4EFB\u52A1\u2026",icon:"folder",disabled:A}):(0,te.jsx)(ne,{className:l,title:"\u79FB\u52A8\u5230\u5176\u4ED6\u4EFB\u52A1","aria-label":"\u79FB\u52A8\u5230\u5176\u4ED6\u4EFB\u52A1",disabled:A,children:(0,te.jsx)(D,{name:"folder",size:13})}),children:[(0,te.jsx)("p",{className:"workspace-session-move-hint",children:"\u79FB\u52A8\u5F52\u5C5E \xB7 \u4FDD\u7559\u8FD0\u884C\u76EE\u5F55"}),c?(0,te.jsx)(ba,{disabled:A,label:"\u5F52\u7EB3\u4E3A\u65B0\u4EFB\u52A1",icon:"plus",onClick:()=>{u()}}):null,R?(0,te.jsxs)("p",{role:"alert",children:[R,(0,te.jsx)(ba,{label:"\u91CD\u65B0\u52A0\u8F7D\u4EFB\u52A1",disabled:A||P,onClick:G})]}):null,P?(0,te.jsx)("p",{role:"status",children:"\u6B63\u5728\u52A0\u8F7D\u4EFB\u52A1\u2026"}):b.length===0?(0,te.jsx)("p",{children:"\u8BF7\u5148\u521B\u5EFA\u53E6\u4E00\u4E2A\u4EFB\u52A1\u3002"}):b.map(v=>(0,te.jsx)(ba,{disabled:A,label:v.label,icon:"folder",onClick:()=>{k(v.id)}},v.id))]})}async function Ln(a,r={}){if(a.status==="archived"||!a.workspaceTaskId)throw new Error("\u8BF7\u5148\u6062\u590D\u4EFB\u52A1\uFF0C\u518D\u65B0\u5EFA\u4F1A\u8BDD\u3002");let l=r.getCreationState??ln.getSnapshot,c=l();if(c.open)return!1;let o=await(r.getTask??(S=>Sn.getTask(S)))(a.workspaceTaskId);if(o.id!==a.workspaceTaskId||o.archived||o.status==="done")throw new Error("\u4EFB\u52A1\u5BB9\u5668\u5DF2\u53D8\u5316\uFF0C\u8BF7\u6062\u590D\u4EFB\u52A1\u540E\u91CD\u8BD5\u3002");let p=l();if(p.open||p.revision!==c.revision||r.canContinue?.()===!1)return!1;if(!(r.open??on.open)({initialCwd:o.cwd,workspaceId:o.workspaceId,workspaceTaskId:o.id,taskName:o.name}))throw new Error("\u65B0\u5EFA\u4F1A\u8BDD\u73AF\u5883\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5\u3002");return!0}var oe=X(gt(),1);var w=X(ke(),1);function Me({size:a=16,color:r="currentColor",className:l,title:c}){return{width:a,height:a,viewBox:"0 0 16 16",fill:"none",className:l,"aria-hidden":c?void 0:!0,role:c?"img":void 0,color:r,style:{color:r,flex:"0 0 auto"}}}function qa({status:a,size:r=14,color:l="currentColor",className:c}){let o=Me({size:r,color:l,className:c});return a==="doing"?(0,w.jsxs)("svg",{...o,children:[(0,w.jsx)("path",{d:"M8 1.83C3.38 1.83 1.83 3.38 1.83 8s1.55 6.17 6.17 6.17S14.17 12.62 14.17 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,w.jsx)("path",{fillRule:"evenodd",d:"M13.02 2.87c-.66-.59-1.67-.53-2.26.14s-2.91 3.29-3.92 4.43c-1.01 1.14-.27 2.72-.27 2.72s1.67.53 2.67-.6 3.92-4.43 3.92-4.43c.59-.66.52-1.67-.14-2.26Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,w.jsx)("path",{d:"m10.01 3.87 2.4 2.12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):a==="done"?(0,w.jsxs)("svg",{...o,viewBox:"0 0 13.836 11.236",children:[(0,w.jsx)("path",{fillRule:"evenodd",d:"M9.026 5.618a2.108 2.108 0 1 1-4.216 0 2.108 2.108 0 0 1 4.216 0Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,w.jsx)("path",{fillRule:"evenodd",d:"M.75 5.618c0 2.187 2.761 4.868 6.168 4.868s6.168-2.679 6.168-4.868S10.324.75 6.918.75.75 3.431.75 5.618Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):a==="archived"?(0,w.jsxs)("svg",{...o,children:[(0,w.jsx)("path",{d:"M2.5 4.25h11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,w.jsx)("path",{d:"M3.25 4.25v7.25A1.5 1.5 0 0 0 4.75 13h6.5a1.5 1.5 0 0 0 1.5-1.5V4.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,w.jsx)("path",{d:"M2 3.25 3.2 1.75h9.6L14 3.25H2Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,w.jsx)("path",{d:"M6.5 7.25h3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}):(0,w.jsxs)("svg",{...o,children:[(0,w.jsx)("path",{d:"M13.16 11.5H8.84",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,w.jsx)("path",{fillRule:"evenodd",d:"M2.84 11.5c0 1.36.46 1.81 1.82 1.81s1.81-.45 1.81-1.81-.45-1.81-1.81-1.81-1.82.45-1.82 1.81Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,w.jsx)("path",{d:"M8.84 4.5h4.32",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,w.jsx)("path",{fillRule:"evenodd",d:"M6.47 4.5c0-1.36-.45-1.81-1.81-1.81S2.84 3.14 2.84 4.5s.46 1.81 1.82 1.81 1.81-.45 1.81-1.81Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mt({priority:a,size:r=14,color:l="currentColor",className:c}){let o=Me({size:r,color:l,className:c});if(a==="urgent")return(0,w.jsx)("svg",{...o,children:(0,w.jsx)("path",{fill:"currentColor",d:"M8 1a7 7 0 1 0 .00 14A7 7 0 0 0 8 1Zm-1 3h2l-.25 5H7.25L7 4Zm2 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"})});let p=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("path",{fill:"currentColor",d:"M3.5 8h-1A.5.5 0 0 0 2 8.5v4a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-4A.5.5 0 0 0 3.5 8Z"}),(0,w.jsx)("path",{fill:"currentColor",fillOpacity:a==="low"||a==="none"?.4:1,d:"M8.5 5h-1A.5.5 0 0 0 7 5.5v7.5a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5V5.5A.5.5 0 0 0 8.5 5Z"}),(0,w.jsx)("path",{fill:"currentColor",fillOpacity:a==="high"?1:.4,d:"M13.5 2h-1a.5.5 0 0 0-.5.5v11a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-11a.5.5 0 0 0-.5-.5Z"})]});return a==="none"?(0,w.jsxs)("svg",{...o,children:[(0,w.jsx)("path",{fill:"currentColor",opacity:"0.9",d:"M4 7.25H2a.25.25 0 0 0-.25.25v.5c0 .14.11.25.25.25h2a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25Z"}),(0,w.jsx)("path",{fill:"currentColor",opacity:"0.9",d:"M9 7.25H7a.25.25 0 0 0-.25.25v.5c0 .14.11.25.25.25h2a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25Z"}),(0,w.jsx)("path",{fill:"currentColor",opacity:"0.9",d:"M14 7.25h-2a.25.25 0 0 0-.25.25v.5c0 .14.11.25.25.25h2a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25Z"})]}):(0,w.jsx)("svg",{...o,children:p})}function Pn({size:a=14,color:r="currentColor",className:l}){return(0,w.jsx)("svg",{...Me({size:a,color:r,className:l}),viewBox:"0 0 14 14",children:(0,w.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.47 2.63a.66.66 0 0 1 .66.65.66.66 0 0 1-.66.66H1.53a.66.66 0 1 1 0-1.31h10.94ZM3.5 7c0-.17.07-.34.19-.46.12-.13.29-.2.47-.2h5.68c.17 0 .34.07.47.2.12.12.19.29.19.46s-.07.34-.19.46c-.13.13-.3.2-.47.2H4.16a.66.66 0 0 1-.66-.66Zm2.41 3.06a.66.66 0 0 0 0 1.31h2.18a.66.66 0 1 0 0-1.31H5.91Z"})})}function Fn({size:a=16,color:r="currentColor",className:l}){return(0,w.jsxs)("svg",{...Me({size:a,color:r,className:l}),children:[(0,w.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 2A3.25 3.25 0 0 0 1 5.25v5.5A3.25 3.25 0 0 0 4.25 14h7.5A3.25 3.25 0 0 0 15 10.75v-5.5A3.25 3.25 0 0 0 11.75 2H4.25ZM2.5 5.5A2 2 0 0 1 4.5 3.5h7a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2v-5Z"}),(0,w.jsx)("path",{fill:"currentColor",d:"M11.5 5.75a.75.75 0 0 0-1.5 0v4.5a.75.75 0 0 0 1.5 0v-4.5Z"})]})}function Ot({size:a=16,color:r="currentColor",className:l}){return(0,w.jsx)("svg",{...Me({size:a,color:r,className:l}),children:(0,w.jsx)("path",{d:"M8 12.5c2.76 0 5-2.02 5-4.5S10.76 3.5 8 3.5 3 5.51 3 8c0 .9.29 1.73.79 2.43-.08.71-.29 1.39-.56 2.07A11.4 11.4 0 0 0 5.76 12c.67.3 1.43.5 2.24.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}function _t({size:a=12,color:r="currentColor",className:l}){return(0,w.jsx)("svg",{...Me({size:a,color:r,className:l}),children:(0,w.jsx)("path",{d:"M2 8v3.5A1.5 1.5 0 0 0 3.5 13h8a1.5 1.5 0 0 0 1.5-1.5V8M2 8V4.5A1.5 1.5 0 0 1 3.5 3h2c.63 0 1.22.3 1.6.8l.3.4c.38.5.97.8 1.6.8h2.5A1.5 1.5 0 0 1 14 6.5V8M2 8h12",stroke:"currentColor",strokeWidth:"1"})})}function $n({size:a=12,color:r="currentColor",className:l}){return(0,w.jsx)("svg",{...Me({size:a,color:r,className:l}),children:(0,w.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15 5a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v6a4 4 0 0 0 4 4h1.25a.75.75 0 0 0 0-1.5H5A2.5 2.5 0 0 1 2.5 11V6h11v.25a.75.75 0 0 0 1.5 0V5Zm-3.5 3a.75.75 0 0 1 .75.75v2h2a.75.75 0 0 1 0 1.5h-2v2a.75.75 0 0 1-1.5 0v-2h-2a.75.75 0 0 1 0-1.5h2v-2A.75.75 0 0 1 11.5 8Z"})})}function Mn({className:a}){return(0,w.jsx)("span",{className:a?`task-board-processing-glyph ${a}`:"task-board-processing-glyph","aria-hidden":"true",children:Array.from({length:16},(r,l)=>(0,w.jsx)("i",{style:{animationDelay:`${-fs*(l%7)}ms`}},l))})}var t=X(ke(),1);function sa({status:a}){return(0,t.jsx)("span",{className:`task-board-status-glyph is-${a}`,"aria-hidden":"true",children:(0,t.jsx)(qa,{status:a,size:14})})}function jt({priority:a,interactive:r}){return a==="none"&&!r?null:(0,t.jsxs)(ue,{className:`task-board-priority is-${a}`,children:[(0,t.jsx)(Mt,{priority:a,size:14}),wt(a)]})}function Re({label:a}){let r=Ds(a);return(0,t.jsx)(ue,{className:K("task-board-label",r&&`is-${r}`),color:Ls(a),children:Ps(a)})}function Ja({sessions:a,onOpen:r}){let l=Dt();return a.length===0?null:a.length>1?(0,t.jsxs)(Je,{align:"end",side:"bottom",sideOffset:6,ariaLabel:"\u5173\u8054\u4F1A\u8BDD",className:"task-board-conversation-menu",trigger:(0,t.jsxs)(N,{kind:"ghost",type:"button",className:"task-board-conversation is-multiple","aria-label":`\u67E5\u770B ${a.length} \u4E2A\u4F1A\u8BDD`,onClick:o=>o.stopPropagation(),children:[(0,t.jsx)(Ot,{size:16}),(0,t.jsxs)("span",{children:["+",a.length]})]}),children:[(0,t.jsx)("div",{className:"task-board-conversation-menu-heading",children:"\u5173\u8054\u4F1A\u8BDD"}),a.map(o=>(0,t.jsxs)(N,{kind:"ghost",type:"button",role:"menuitem",onClick:()=>r?.(o.id),children:[(0,t.jsx)(Be,{provider:o.provider,className:"task-board-agent-logo"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("strong",{children:o.title||Q(o.provider,o.engine)}),(0,t.jsx)("small",{children:St(o,l)})]})]},o.id))]}):(0,t.jsx)(N,{kind:"ghost",type:"button",className:"task-board-conversation",title:a[0].title||a[0].id,onClick:o=>{o.preventDefault(),o.stopPropagation(),r?.(a[0].id)},children:(0,t.jsx)(Ot,{size:16})})}function _n({task:a,onOpenSession:r}){if(a.status!=="doing")return null;let l=a.sessions.some(c=>ya(c.status));return(0,t.jsxs)(T,{align:"center",gap:"small",className:K("task-board-processing",l&&"is-running"),children:[l?(0,t.jsx)(Mn,{}):null,(0,t.jsx)("span",{className:"task-board-processing-label",children:l?"\u6B63\u5728\u5904\u7406...":a.sessions.length>0?"\u6682\u505C\u5904\u7406":"\u7B49\u5F85\u6D3E\u53D1"}),(0,t.jsx)("span",{style:{flex:1},"aria-hidden":"true"}),(0,t.jsx)(Ja,{sessions:a.sessions,onOpen:r})]})}function jn({tasks:a,filters:r,onChange:l}){let c=Ta(a),o=Ga(r),p=(g,S)=>S.includes(g)?S.filter(f=>f!==g):[...S,g];return(0,t.jsxs)(Je,{align:"end",side:"bottom",ariaLabel:"\u7B5B\u9009\u4EFB\u52A1",className:"task-board-filter-menu",trigger:(0,t.jsxs)(ne,{className:K("task-board-icon-button",o>0&&"is-active"),"aria-label":o>0?`\u7B5B\u9009\uFF08${o}\uFF09`:"\u7B5B\u9009",title:"\u7B5B\u9009",children:[(0,t.jsx)(Pn,{}),o>0?(0,t.jsx)("span",{className:"task-board-filter-badge",children:o}):null]}),children:[(0,t.jsx)("strong",{children:"\u7B5B\u9009"}),(0,t.jsx)("p",{children:"\u72B6\u6001"}),Bs.map(g=>(0,t.jsxs)(ea,{checked:r.statuses.includes(g.status),onChange:()=>l({...r,statuses:p(g.status,r.statuses)}),children:[(0,t.jsx)(qa,{status:g.status,size:14}),g.label]},g.status)),(0,t.jsx)("p",{children:"\u4F18\u5148\u7EA7"}),Te.map(g=>(0,t.jsxs)(ea,{checked:r.priorities.includes(g.value),onChange:()=>l({...r,priorities:p(g.value,r.priorities)}),children:[(0,t.jsx)(Mt,{priority:g.value,size:14}),g.label]},g.value)),c.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:"\u6807\u7B7E"}),c.map(g=>(0,t.jsx)(ea,{checked:r.labels.includes(g),onChange:()=>l({...r,labels:p(g,r.labels)}),children:(0,t.jsx)(Re,{label:g})},g))]}),o>0&&(0,t.jsx)(N,{kind:"ghost",type:"button",className:"task-board-filter-clear",onClick:()=>l(Fe),children:"\u6E05\u9664\u7B5B\u9009"})]})}function zn({display:a,onChange:r}){return(0,t.jsxs)(Je,{align:"end",side:"bottom",ariaLabel:"\u663E\u793A\u8BBE\u7F6E",className:"task-board-display-menu",trigger:(0,t.jsx)(ne,{className:"task-board-icon-button","aria-label":"\u663E\u793A\u8BBE\u7F6E",title:"\u663E\u793A\u8BBE\u7F6E",children:(0,t.jsx)(Fn,{})}),children:[(0,t.jsx)("strong",{children:"\u663E\u793A\u8BBE\u7F6E"}),(0,t.jsx)(ka,{checked:a.body,onCheckedChange:l=>r({...a,body:l}),ariaLabel:"\u663E\u793A\u6B63\u6587",label:"\u6B63\u6587"}),(0,t.jsx)("p",{children:"\u4E3B\u5217"}),re.map(l=>{let c=a.mainStatuses.includes(l.status);return(0,t.jsxs)(ea,{className:"task-board-display-status",checked:c,onChange:()=>{let o=c?a.mainStatuses.filter(p=>p!==l.status):[...a.mainStatuses,l.status];r({...a,mainStatuses:o.length>0?o:[l.status]})},children:[(0,t.jsx)(qa,{status:l.status,size:14}),l.label]},l.status)})]})}function zt({count:a,open:r,onToggle:l,onPurge:c,purging:o=!1,children:p}){return a===0?null:(0,t.jsxs)("div",{className:"task-board-archive-folder",children:[(0,t.jsxs)("div",{className:"task-board-archive-heading",style:{display:"flex",alignItems:"center",gap:4},children:[(0,t.jsxs)(N,{kind:"ghost",type:"button",className:"task-board-archive-header",style:{flex:1,minWidth:0,justifyContent:"flex-start"},"aria-expanded":r,onClick:l,children:[(0,t.jsx)(D,{name:r?"chevron":"chevronLeft",size:12}),(0,t.jsx)(_t,{size:13}),(0,t.jsx)("strong",{children:ha.label}),(0,t.jsx)("span",{children:a})]}),c?(0,t.jsx)(N,{kind:"ghost",size:"small",type:"button",className:"task-board-archive-purge",disabled:o,title:"\u6C38\u4E45\u5220\u9664\u5F52\u6863\u76EE\u5F55\u91CC\u7684\u5168\u90E8\u4EFB\u52A1\uFF0C\u65E0\u6CD5\u6062\u590D",onClick:c,children:o?"\u6E05\u7406\u4E2D\u2026":"\u6E05\u7A7A\u5F52\u6863"}):null]}),r?p:null]})}function Vt(a){return a==="running"||a==="thinking"?"\u8FDB\u884C\u4E2D":a==="waiting-input"?"\u7B49\u5F85\u8F93\u5165":a==="idle"?"\u7A7A\u95F2":a==="exited"||a==="stopped"?"\u5DF2\u7ED3\u675F":a==="failed"?"\u5931\u8D25":a||"\u4F1A\u8BDD"}function Vn(a){return ya(a)?"running":a==="thinking"?"thinking":a==="waiting-input"||a==="waiting_input"?"waiting-input":a==="failed"?"failed":"none"}function Gt(a){let r=oe.useRef(new Map),l=oe.useRef(""),c=oe.useCallback(o=>p=>{p?r.current.set(o,p):r.current.delete(o)},[]);return oe.useEffect(()=>{let o=l.current;if(l.current=a,!o||a)return;let p=r.current.get(o);if(!p?.isConnected)return;let g=document.activeElement;g&&g!==document.body&&g!==document.documentElement||p.focus()},[a]),c}function On({task:a,parentLabel:r,expanded:l,onToggle:c,onOpen:o,onOpenSession:p,bindTrigger:g}){let S=a.description.trim(),f=oe.useMemo(()=>g(a.id),[g,a.id]);return(0,t.jsxs)(ae,{className:K("task-board-list-row",l&&"is-open",a.status==="archived"&&"is-archived"),onClick:b=>{b.target.closest("button, a")||c()},children:[(0,t.jsxs)(N,{kind:"ghost",type:"button",ref:f,className:"task-board-list-title","aria-expanded":l,"aria-controls":`task-list-detail-${a.id}`,"aria-label":`${l?"\u6536\u8D77":"\u5C55\u5F00"} ${a.identifier}: ${a.title}`,onClick:c,children:[(0,t.jsx)(D,{name:"chevron",size:12,className:"task-board-list-chevron"}),(0,t.jsxs)("small",{children:[a.identifier,r?` \u21B3 ${r}`:""]}),(0,t.jsx)("strong",{children:a.title})]}),(0,t.jsxs)(T,{wrap:!0,align:"center",gap:4,className:"task-board-list-meta",children:[(0,t.jsx)(jt,{priority:a.priority}),a.milestone?(0,t.jsx)(Zt,{name:a.milestone.name}):null,a.labels.slice(0,2).map(b=>(0,t.jsx)(Re,{label:b},b)),a.dueDate?(0,t.jsxs)("span",{className:"task-board-due",children:[(0,t.jsx)($n,{size:12}),Qe(a.dueDate)]}):null,(0,t.jsx)("span",{children:a.workspace?.name??"\u672A\u5F52\u5C5E\u5DE5\u4F5C\u533A"}),(0,t.jsx)(Ja,{sessions:a.sessions,onOpen:p}),(0,t.jsx)("time",{children:Ha(a.updatedAt)})]}),(0,t.jsx)(bt,{bordered:!1,ghost:!0,activeKey:l?["details"]:[],styles:{header:{display:"none"},body:{padding:0}},items:[{key:"details",label:"\u4EFB\u52A1\u8BE6\u60C5",forceRender:!0,showArrow:!1,children:(0,t.jsx)("div",{className:"task-board-list-detail",id:`task-list-detail-${a.id}`,inert:!l,children:(0,t.jsxs)("div",{className:"task-board-list-detail-inner",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{children:De(a.status)}),(0,t.jsxs)("span",{children:["\u66F4\u65B0\u4E8E ",Ha(a.updatedAt)]})]}),S?(0,t.jsx)(L.Paragraph,{className:"task-board-list-description",ellipsis:{rows:4,expandable:"collapsible",symbol:b=>b?"\u6536\u8D77\u5168\u6587":"\u5C55\u5F00\u5168\u6587"},style:{whiteSpace:"pre-wrap",margin:"8px 0"},children:S}):null,(0,t.jsx)("div",{"aria-label":"\u5168\u90E8\u4EFB\u52A1\u6807\u7B7E",children:a.labels.map(b=>(0,t.jsx)(Re,{label:b},b))}),a.workspace?.cwd&&(0,t.jsx)("p",{children:(0,t.jsx)("code",{children:a.workspace.cwd})}),a.sessions.length>0?(0,t.jsx)("ul",{children:a.sessions.map(b=>{let P=Vn(b.status);return(0,t.jsx)("li",{children:(0,t.jsxs)(N,{kind:"ghost",type:"button",onClick:()=>p?.(b.id),"data-session-glow":P,children:[(0,t.jsx)(Be,{provider:b.provider,className:K("task-board-agent-logo",P!=="none"&&`wand-logo-glow glow-${P}`)}),(0,t.jsx)("span",{children:b.title||Q(b.provider,b.engine)}),(0,t.jsx)("small",{children:Vt(b.status)}),(0,t.jsx)("code",{children:b.cwd})]})},b.id)})}):(0,t.jsx)("p",{className:"task-board-list-description",children:"\u8FD8\u6CA1\u6709\u5173\u8054\u4F1A\u8BDD"}),(0,t.jsx)(N,{kind:"ghost",type:"button",className:"task-board-list-open",onClick:()=>o(a.id),children:"\u67E5\u770B\u8BE6\u60C5"})]})})}]})]})}function Gn({task:a,open:r,parentLabel:l,childCount:c,onOpen:o,onCollapse:p,onOpenSession:g}){let S=a.description.trim(),f=Dt(),b=a.agent,P=b?`${Q(b.provider,b.engine)} \xB7 ${Ct(b.mode)}`:"\u672A\u6307\u6D3E",A=[{key:"status",label:"\u72B6\u6001",children:De(a.status)},{key:"assignee",label:"\u8D1F\u8D23\u4EBA",children:P},{key:"priority",label:"\u4F18\u5148\u7EA7",children:wt(a.priority)},{key:"workspace",label:"\u9879\u76EE",children:(0,t.jsxs)(T,{vertical:!0,children:[(0,t.jsx)("span",{children:a.workspace?.name??"\u672A\u5F52\u5C5E\u5DE5\u4F5C\u533A"}),a.workspace?.cwd&&(0,t.jsx)(L.Text,{code:!0,children:a.workspace.cwd})]})},...b?[{key:"model",label:"\u6A21\u578B",children:`${St(b,f)} \xB7 ${Rt(b.thinkingEffort)}`}]:[],{key:"milestone",label:"\u8FED\u4EE3",children:a.milestone?.name??"\u9ED8\u8BA4\u8FED\u4EE3"},{key:"due",label:"\u622A\u6B62",children:a.dueDate?Qe(a.dueDate):"\u672A\u8BBE\u7F6E"},{key:"updated",label:"\u66F4\u65B0",children:Ha(a.updatedAt)},...l?[{key:"parent",label:"\u7236\u4EFB\u52A1",children:l}]:[],...c>0?[{key:"children",label:"\u5B50\u4EFB\u52A1",children:`${c} \u4E2A`}]:[]];return(0,t.jsx)(bt,{bordered:!1,ghost:!0,activeKey:r?["details"]:[],styles:{header:{display:"none"},body:{padding:0}},items:[{key:"details",label:"\u4EFB\u52A1\u8BE6\u60C5",showArrow:!1,forceRender:!0,children:(0,t.jsx)("div",{className:"task-board-card-detail",id:`task-card-detail-${a.id}`,inert:!r,children:(0,t.jsxs)(T,{vertical:!0,gap:"middle",className:"task-board-card-detail-inner",children:[(0,t.jsx)(Ts,{size:"small",column:1,items:A}),a.labels.length>0&&(0,t.jsx)(T,{wrap:!0,gap:4,"aria-label":"\u5168\u90E8\u4EFB\u52A1\u6807\u7B7E",children:a.labels.map(R=>(0,t.jsx)(Re,{label:R},R))}),(0,t.jsx)(L.Paragraph,{ellipsis:{rows:4,expandable:"collapsible",symbol:R=>R?"\u6536\u8D77\u5168\u6587":"\u5C55\u5F00\u5168\u6587"},style:{whiteSpace:"pre-wrap",margin:0},children:S||"\u8FD8\u6CA1\u6709\u586B\u5199\u4EFB\u52A1\u8BF4\u660E\u3002"}),a.sessions.length>0?(0,t.jsx)(me,{size:"small",className:"task-board-card-detail-sessions",dataSource:a.sessions,renderItem:R=>{let k=Vn(R.status);return(0,t.jsx)(me.Item,{children:(0,t.jsxs)(N,{kind:"ghost",type:"button",onClick:()=>g?.(R.id),title:R.cwd,"data-session-glow":k,style:{height:"auto",width:"100%",justifyContent:"flex-start",textAlign:"left",whiteSpace:"normal"},children:[(0,t.jsx)(yt,{status:k==="failed"?"error":k==="none"?"default":"processing",children:(0,t.jsx)(Be,{provider:R.provider})}),(0,t.jsxs)(T,{vertical:!0,align:"flex-start",style:{minWidth:0},children:[(0,t.jsx)(L.Text,{children:R.title||Q(R.provider,R.engine)}),(0,t.jsx)(L.Text,{type:"secondary",children:Vt(R.status)}),(0,t.jsx)(L.Text,{code:!0,style:{overflowWrap:"anywhere"},children:R.cwd})]})]})})}}):(0,t.jsx)(L.Text,{type:"secondary",children:"\u8FD8\u6CA1\u6709\u5173\u8054\u4F1A\u8BDD\u3002"}),(0,t.jsxs)(T,{wrap:!0,gap:"small",className:"task-board-card-detail-actions",children:[(0,t.jsx)(N,{kind:"ghost",type:"button",className:"task-board-card-detail-open",onClick:()=>o(a.id),children:"\u67E5\u770B\u5B8C\u6574\u8BE6\u60C5"}),(0,t.jsx)(N,{kind:"ghost",type:"button",className:"task-board-card-detail-collapse",onClick:()=>p(),children:"\u6536\u8D77"})]})]})})}]})}function Zn({grouped:a,allTasks:r,collapsed:l,archiveOpen:c,archiveCount:o=a.archived.length,onToggle:p,onToggleArchive:g,onPurgeArchive:S,archivePurging:f=!1,onOpen:b,onOpenSession:P}){let[A,R]=oe.useState(null),k=Gt(A??""),u=v=>{R(Z=>Z===v?null:v)},G=a.archived;return(0,t.jsx)(T,{vertical:!0,gap:"middle",className:"task-board-list-view",children:re.map(v=>{let Z=a[v.status],ie=v.status==="done"&&c&&G.length>0?!1:l[v.status];return(0,t.jsxs)("section",{className:`task-board-list-group is-${v.status}`,children:[(0,t.jsxs)(N,{kind:"ghost",type:"button",className:"task-board-list-header","aria-expanded":!ie,onClick:()=>p(v.status),children:[(0,t.jsxs)("span",{className:"task-board-list-heading",children:[(0,t.jsx)(D,{name:ie?"chevronLeft":"chevron",size:12}),(0,t.jsx)(sa,{status:v.status}),(0,t.jsx)("strong",{children:v.label})]}),(0,t.jsx)("b",{children:Z.length})]}),!ie&&(0,t.jsxs)(T,{vertical:!0,gap:"small",className:"task-board-list-rows",children:[Z.length===0&&v.status!=="done"&&(0,t.jsx)("p",{className:"task-board-column-empty",children:v.empty}),Z.length===0&&v.status==="done"&&G.length===0&&(0,t.jsx)("p",{className:"task-board-column-empty",children:v.empty}),Z.map(F=>(0,t.jsx)(On,{task:F,expanded:A===F.id,parentLabel:r.find(ee=>ee.id===F.parentTaskId)?.identifier,onToggle:()=>u(F.id),onOpen:b,onOpenSession:P,bindTrigger:k},F.id)),v.status==="done"?(0,t.jsx)(zt,{count:o,open:c,onToggle:g,onPurge:S,purging:f,children:(0,t.jsx)(T,{vertical:!0,gap:"small",className:"task-board-archive-rows",children:G.map(F=>(0,t.jsx)(On,{task:F,expanded:A===F.id,parentLabel:r.find(ee=>ee.id===F.parentTaskId)?.identifier,onToggle:()=>u(F.id),onOpen:b,onOpenSession:P,bindTrigger:k},F.id))})}):null]})]},v.status)})})}function Hn({projectName:a,tasks:r,onOpen:l,onOpenSession:c}){let o=Ks(r),p=r.filter(k=>k.status!=="archived"),g=[...p].filter(k=>k.dueDate&&k.status!=="done").sort((k,u)=>(k.dueDate??"").localeCompare(u.dueDate??"")).slice(0,6),S=Te.map(k=>({...k,count:p.filter(u=>u.priority===k.value).length})).filter(k=>k.count>0),f=Ta(p).map(k=>({label:k,count:p.filter(u=>u.labels.includes(k)).length})),b=o.total===0?`${a} \u5F53\u524D\u6CA1\u6709\u4EFB\u52A1\u3002`:`\u5171 ${o.total} \u9879\u4EFB\u52A1\uFF0C${o.remaining} \u9879\u5F85\u5904\u7406\uFF0C${o.done} \u9879${De("done")}\u3002`,P=p.filter(k=>k.status!=="done"&&(k.priority==="high"||k.priority==="urgent")).length,A=(k,u,G,v=o.total)=>(0,t.jsxs)(ae,{size:"small",className:`task-board-metric tone-${G}`,style:{flex:"1 1 160px"},children:[(0,t.jsx)(L.Text,{type:"secondary",children:k}),(0,t.jsx)(L.Title,{level:3,style:{margin:"4px 0"},children:u}),(0,t.jsx)(Bt,{status:"normal",percent:Math.round(v?u/v*100:0),"aria-label":`${k}\u5360\u5F53\u524D\u4EFB\u52A1\u6BD4\u4F8B`})]}),R=(k,u)=>(0,t.jsx)(ae,{title:k,size:"small",className:"task-board-dashboard-panel",style:{flex:"1 1 260px",minWidth:0},children:u});return(0,t.jsxs)(T,{vertical:!0,gap:"middle",className:"task-board-dashboard",children:[(0,t.jsxs)(ae,{size:"small",children:[(0,t.jsx)(L.Title,{level:4,style:{margin:0},children:a}),(0,t.jsx)(L.Paragraph,{style:{margin:"8px 0 0"},children:b})]}),(0,t.jsxs)("section",{"aria-label":"\u4EFB\u52A1\u72B6\u6001",children:[(0,t.jsx)(L.Title,{level:5,style:{margin:"0 0 8px"},children:"\u4EFB\u52A1\u72B6\u6001"}),(0,t.jsxs)(T,{wrap:!0,gap:"small",className:"task-board-metrics",children:[A(De("todo"),o.todo,"todo"),A(De("doing"),o.doing,"doing"),A(De("done"),o.done,"done")]})]}),(0,t.jsxs)(ae,{size:"small",title:"\u9700\u8981\u5173\u6CE8",className:"task-board-risk-panel",children:[(0,t.jsxs)(T,{wrap:!0,gap:"small",children:[(0,t.jsxs)(ue,{color:o.overdue>0?"error":"default",children:["\u5DF2\u903E\u671F ",o.overdue]}),(0,t.jsxs)(ue,{color:P>0?"warning":"default",children:["\u9AD8\u4F18\u5148\u7EA7\u5F85\u5904\u7406 ",P]})]}),(0,t.jsx)(L.Paragraph,{type:"secondary",style:{margin:"8px 0 0"},children:o.overdue===0&&P===0?"\u5F53\u524D\u6CA1\u6709\u903E\u671F\u6216\u9AD8\u4F18\u5148\u7EA7\u5F85\u5904\u7406\u4EFB\u52A1\u3002":"\u540C\u4E00\u4EFB\u52A1\u53EF\u80FD\u540C\u65F6\u903E\u671F\u4E14\u5C5E\u4E8E\u9AD8\u4F18\u5148\u7EA7\u3002"})]}),(0,t.jsxs)(T,{wrap:!0,gap:"middle",className:"task-board-dashboard-grid",children:[R("\u5373\u5C06\u5230\u671F",g.length===0?(0,t.jsx)(pe,{image:pe.PRESENTED_IMAGE_SIMPLE,description:"\u6CA1\u6709\u8BBE\u7F6E\u622A\u6B62\u65E5\u671F\u7684\u4EFB\u52A1"}):(0,t.jsx)(me,{size:"small",dataSource:g,renderItem:k=>(0,t.jsx)(me.Item,{children:(0,t.jsxs)(N,{kind:"ghost",onClick:()=>l(k.id),style:{height:"auto",whiteSpace:"normal"},children:[(0,t.jsx)(sa,{status:k.status}),(0,t.jsx)("span",{children:k.title}),(0,t.jsx)(ue,{color:Za(k.dueDate,k.status)?"error":"default",children:Qe(k.dueDate)})]})})})),R("\u4F18\u5148\u7EA7",S.length===0?(0,t.jsx)(pe,{image:pe.PRESENTED_IMAGE_SIMPLE,description:"\u8FD8\u6CA1\u6709\u4F18\u5148\u7EA7\u5206\u5E03"}):(0,t.jsx)(me,{size:"small",dataSource:S,renderItem:k=>(0,t.jsx)(me.Item,{children:(0,t.jsxs)(T,{vertical:!0,style:{width:"100%"},children:[(0,t.jsxs)(T,{justify:"space-between",children:[(0,t.jsx)("span",{children:k.label}),(0,t.jsx)("span",{children:k.count})]}),(0,t.jsx)(Bt,{status:"normal",percent:Math.round(k.count/Math.max(1,o.total)*100),size:"small",showInfo:!1})]})})})),R("\u6807\u7B7E",f.length===0?(0,t.jsx)(pe,{image:pe.PRESENTED_IMAGE_SIMPLE,description:"\u8FD8\u6CA1\u6709\u6807\u7B7E"}):(0,t.jsx)(me,{size:"small",dataSource:f,renderItem:k=>(0,t.jsxs)(me.Item,{children:[(0,t.jsx)(Re,{label:k.label}),(0,t.jsx)(ue,{children:k.count})]})})),R("\u6700\u8FD1\u4F1A\u8BDD",r.every(k=>k.sessions.length===0)?(0,t.jsx)(pe,{image:pe.PRESENTED_IMAGE_SIMPLE,description:"\u8FD8\u6CA1\u6709\u6D3E\u53D1\u4F1A\u8BDD"}):(0,t.jsx)(me,{size:"small",dataSource:r.flatMap(k=>k.sessions.map(u=>({task:k,session:u}))).slice(0,6),renderItem:({task:k,session:u})=>(0,t.jsx)(me.Item,{children:(0,t.jsxs)(N,{kind:"ghost",onClick:()=>c?.(u.id),style:{height:"auto",whiteSpace:"normal"},children:[(0,t.jsx)(Be,{provider:u.provider}),(0,t.jsx)("span",{children:k.title}),(0,t.jsx)("span",{children:Q(u.provider,u.engine)})]})})}))]})]})}function Un({grouped:a,zoom:r,hideCompleted:l,onZoom:c,onHideCompleted:o,onOpen:p}){let g=u=>u==="done"||u==="archived",S=[...re.flatMap(u=>a[u.status]),...a.archived].filter(u=>!(l&&g(u.status))),f=Ys(S,r),b=Wt(new Date),P=f.columns.indexOf(b),A=[];f.columns.forEach((u,G)=>{let v=u.slice(0,7),Z=A.at(-1);Z?.key===v?Z.days+=1:A.push({key:v,start:G,days:1})});let R=`repeat(${f.days}, minmax(0, 1fr))`,k=P>=0?(0,t.jsx)("span",{className:"task-board-gantt-today-line","aria-hidden":"true",style:{position:"absolute",top:0,bottom:0,left:`${(P+.5)/f.days*100}%`,borderLeft:"1px dashed var(--accent)",pointerEvents:"none"}}):null;return(0,t.jsxs)(ae,{size:"small",className:"task-board-gantt",styles:{body:{minWidth:0}},children:[(0,t.jsxs)(T,{wrap:!0,align:"center",justify:"space-between",gap:"small",className:"task-board-gantt-toolbar",children:[(0,t.jsx)(ea,{className:"task-board-gantt-hide",checked:l,onChange:u=>o(u.target.checked),children:Es("done")}),(0,t.jsx)(ja,{className:"task-board-gantt-zooms",ariaLabel:"\u7518\u7279\u56FE\u7F29\u653E",value:r,tabs:Gs.map(u=>({value:u.value,label:u.label})),onValueChange:u=>c(u)})]}),(0,t.jsxs)(L.Paragraph,{type:"secondary",style:{margin:"8px 0 0"},children:["\u4ECA\u5929 ",b," \xB7 \u65F6\u95F4\u6761\u8868\u793A\u521B\u5EFA\u81F3\u622A\u6B62\u65E5\u671F\uFF0C\u672A\u8BBE\u622A\u6B62\u65E5\u671F\u65F6\u4EC5\u6807\u8BB0\u521B\u5EFA\u65E5\u3002"]}),S.length===0?(0,t.jsx)(pe,{image:pe.PRESENTED_IMAGE_SIMPLE,description:"\u5F53\u524D\u6CA1\u6709\u53EF\u663E\u793A\u7684\u4EFB\u52A1"}):(0,t.jsx)("div",{className:"task-board-gantt-scroll",tabIndex:0,role:"region","aria-label":"\u4EFB\u52A1\u65F6\u95F4\u7EBF\uFF0C\u53EF\u6A2A\u5411\u6EDA\u52A8",style:{overflowX:"auto",marginTop:12},children:(0,t.jsxs)("div",{className:"task-board-gantt-grid",style:{minWidth:Math.max(680,180+f.days*(r==="day"?32:24))},children:[(0,t.jsxs)("div",{className:"task-board-gantt-head",style:{display:"grid",gridTemplateColumns:"180px minmax(0, 1fr)",borderBottom:"1px solid var(--border-subtle)"},children:[(0,t.jsx)(L.Text,{strong:!0,style:{alignSelf:"center",paddingInline:8},children:"\u4EFB\u52A1"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"task-board-gantt-months",style:{display:"grid",gridTemplateColumns:R},children:A.map(u=>(0,t.jsx)(L.Text,{strong:!0,ellipsis:!0,title:`${u.key.slice(0,4)}\u5E74${Number(u.key.slice(5))}\u6708`,"aria-label":`${u.key.slice(0,4)}\u5E74${Number(u.key.slice(5))}\u6708`,style:{gridColumn:`${u.start+1} / span ${u.days}`,minWidth:0,borderLeft:"1px solid var(--border-subtle)",padding:"4px",whiteSpace:"nowrap"},children:u.days<4?`${Number(u.key.slice(5))}\u6708`:`${u.key.slice(0,4)}\u5E74${Number(u.key.slice(5))}\u6708`},u.key))}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:R,textAlign:"center"},children:f.columns.map(u=>(0,t.jsx)("time",{dateTime:u,title:u,"aria-current":u===b?"date":void 0,style:{paddingBlock:6,color:u===b?"var(--accent)":"var(--text-secondary)",fontWeight:u===b?700:400,borderLeft:u.endsWith("-01")?"1px solid var(--border-subtle)":void 0},children:u===b?"\u4ECA":Number(u.slice(8,10))},u))})]})]}),[...re,...l?[]:[ha]].map(u=>{let G=a[u.status].filter(v=>!(l&&g(v.status)));return G.length===0?null:(0,t.jsxs)("section",{className:`task-board-gantt-group is-${u.status}`,children:[(0,t.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"180px minmax(0, 1fr)",height:36},children:[(0,t.jsxs)(T,{component:"header",align:"center",gap:"small",style:{paddingInline:8},children:[(0,t.jsx)(sa,{status:u.status}),(0,t.jsx)(L.Text,{strong:!0,children:u.label}),(0,t.jsx)(ue,{children:G.length})]}),(0,t.jsx)("div",{style:{position:"relative"},children:k})]}),G.map(v=>{let Z=Wt(new Date(v.createdAt)),ie=v.dueDate||Z,F=Z<=f.columns.at(-1)&&ie>=f.start,ee=qs({...v,dueDate:ie},f.start,f.days);return(0,t.jsxs)(N,{kind:"ghost",type:"button",className:"task-board-gantt-row",title:`${v.title} \xB7 ${Z}${v.dueDate?` \u81F3 ${v.dueDate}`:" \xB7 \u672A\u8BBE\u7F6E\u622A\u6B62\u65E5\u671F"}`,style:{width:"100%",height:48,padding:0,display:"grid",gridTemplateColumns:"180px minmax(0, 1fr)",gap:0,textAlign:"left"},onClick:()=>p(v.id),children:[(0,t.jsxs)(T,{vertical:!0,style:{minWidth:0,paddingInline:8},children:[(0,t.jsx)(L.Text,{type:"secondary",children:v.identifier}),(0,t.jsx)(L.Text,{ellipsis:!0,children:v.title})]}),(0,t.jsxs)("div",{className:"task-board-gantt-track",style:{position:"relative",display:"grid",gridTemplateColumns:R,alignItems:"center",height:"100%",minWidth:0,backgroundImage:"linear-gradient(to right, var(--border-subtle) 1px, transparent 1px)",backgroundSize:`${100/f.days}% 100%`},children:[F?(0,t.jsx)("i",{className:`is-${v.status}`,"aria-hidden":"true",style:{gridColumn:`${ee.offset+1} / span ${ee.length}`,height:16,borderRadius:4,marginInline:2,background:v.status==="done"?"var(--success)":v.status==="archived"?"var(--text-tertiary)":"var(--accent)"}}):(0,t.jsx)(L.Text,{type:"secondary",style:{gridColumn:`1 / ${f.days+1}`,paddingInline:8},children:"\u65F6\u95F4\u4E0D\u5728\u5F53\u524D\u8303\u56F4"}),k]})]},v.id)})]},u.status)})]})})]})}function Kn({x:a,y:r,task:l,onOpen:c,onCopy:o,onDispatch:p,onNewSession:g,onArchive:S,onRestore:f,onClose:b}){_a(!0,b),oe.useEffect(()=>{let A=R=>{ks(R.target,"task-board-context")||b()};return window.addEventListener("pointerdown",A),()=>window.removeEventListener("pointerdown",A)},[b]);let P=[{key:"open",label:"\u6253\u5F00",icon:(0,t.jsx)(D,{name:"folder"}),onClick:c},{key:"copy",label:"\u590D\u5236 ID",icon:(0,t.jsx)(D,{name:"copy"}),onClick:o},...g?[{key:"new-session",label:"\u65B0\u5EFA\u4F1A\u8BDD",icon:(0,t.jsx)(D,{name:"plus"}),disabled:l.status==="archived"||!l.workspaceTaskId,onClick:g}]:[],...l.status==="archived"?[{key:"restore",label:"\u6062\u590D\u5230\u7B49\u5F85\u8BA4\u9886",icon:(0,t.jsx)(D,{name:"resume"}),onClick:f}]:[{key:"dispatch",label:"\u6D3E\u53D1 Agent",icon:(0,t.jsx)(D,{name:"zap"}),onClick:p},...$e(l)?[{key:"archive",label:"\u5F52\u6863",icon:(0,t.jsx)(D,{name:"archive"}),onClick:S}]:[]]];return(0,t.jsx)(ys,{open:!0,autoFocus:!0,placement:"bottomLeft",trigger:[],onOpenChange:A=>{A||b()},menu:{items:P.map(A=>({...A,onClick:()=>{A.onClick(),b()}}))},popupRender:A=>(0,t.jsx)("div",{"data-wand-popup-owner":"task-board-context",children:A}),children:(0,t.jsx)("span",{style:{position:"fixed",left:a,top:r,width:1,height:1},"aria-hidden":"true"})})}function Ar({agent:a,running:r=!1}){return a?(0,t.jsxs)(ue,{className:K("task-board-chip is-agent",r&&"is-running"),children:[(0,t.jsx)(Be,{provider:a.provider,className:"task-board-agent-logo"}),Q(a.provider,a.engine),r?(0,t.jsx)(yt,{status:"processing"}):null]}):null}function Yn({sessions:a,assigned:r}){let l=_s(a,r);return l.length===0?null:(0,t.jsx)(t.Fragment,{children:l.map(c=>(0,t.jsx)(Ar,{agent:c,running:a.some(o=>o.provider===c.provider&&ya(o.status))},c.provider))})}function qn({sessions:a,assigned:r,onOpenSession:l,catalog:c}){let o=Os(a,r);return o.length===0?(0,t.jsx)("div",{className:"task-board-agent-list","aria-label":"\u6307\u6D3E\u8BB0\u5F55",children:(0,t.jsx)("p",{className:"task-board-agent-empty",children:"\u8FD8\u6CA1\u6709\u6307\u6D3E Agent\u3002"})}):(0,t.jsx)("div",{className:"task-board-agent-list","aria-label":"\u5DF2\u6307\u6D3E\u7684 Agent",children:o.map(p=>(0,t.jsxs)("section",{className:"task-board-agent-group",children:[(0,t.jsxs)("header",{className:"task-board-agent-group-head",children:[(0,t.jsx)(Be,{provider:p.agent?.provider??p.provider,className:"task-board-agent-logo"}),(0,t.jsx)("strong",{children:Q(p.agent?.provider??p.provider,p.engine??p.agent?.engine)}),p.agent?(0,t.jsx)("span",{children:[Tt(c??null,p.agent.provider,p.agent.model),Rt(p.agent.thinkingEffort),Ct(p.agent.mode)].filter(Boolean).join(" \xB7 ")}):null,(0,t.jsx)("b",{children:p.sessions.length})]}),p.sessions.length===0?(0,t.jsx)("p",{className:"task-board-agent-empty",children:"\u5DF2\u6307\u6D3E\uFF0C\u7B49\u5F85\u6D3E\u53D1"}):p.sessions.map(g=>(0,t.jsxs)(N,{kind:"ghost",type:"button",className:"task-board-agent-session",onClick:()=>l?.(g.id),children:[(0,t.jsx)("span",{className:K("task-board-agent-session-status",ya(g.status)&&"is-running")}),(0,t.jsx)("strong",{children:g.title||Q(g.provider,g.engine)}),(0,t.jsx)("small",{children:[Tt(c??null,g.provider,g.model),Vt(g.status)].filter(Boolean).join(" \xB7 ")})]},g.id))]},`${p.provider}:${p.engine??"cli"}`))})}function Jn({name:a}){return(0,t.jsxs)(ue,{className:"task-board-chip",title:a,children:[(0,t.jsx)(_t,{size:12}),(0,t.jsx)("span",{children:a})]})}function Zt({name:a}){return(0,t.jsxs)(ue,{className:"task-board-chip is-milestone",title:`\u91CC\u7A0B\u7891\uFF1A${a}`,children:[(0,t.jsx)(D,{name:"milestone",size:12}),(0,t.jsx)("span",{children:a})]})}var Ht=[{value:"manual",label:"\u9ED8\u8BA4\u987A\u5E8F"},{value:"priority",label:"\u4F18\u5148\u7EA7\u4F18\u5148"},{value:"due",label:"\u622A\u6B62\u65E5\u671F\u4F18\u5148"},{value:"updated",label:"\u6700\u8FD1\u66F4\u65B0"}];function Xn(a,r){if(r==="manual")return a;let l={urgent:0,high:1,medium:2,low:3,none:4};return[...a].sort((c,o)=>r==="priority"?l[c.priority]-l[o.priority]:r==="due"?(c.dueDate||"9999").localeCompare(o.dueDate||"9999"):o.updatedAt.localeCompare(c.updatedAt))}var Qn="wand.task-board.view-state";function Wr(a){let r=a&&typeof a=="object"?a:{},l=r.filters&&typeof r.filters=="object"?r.filters:{},c=o=>Array.isArray(o)?o.filter(p=>typeof p=="string"):[];return{view:Va.some(o=>o.value===r.view)?r.view:"board",query:typeof r.query=="string"?r.query:"",workspaceId:typeof r.workspaceId=="string"?r.workspaceId:"",sort:Ht.some(o=>o.value===r.sort)?r.sort:"manual",filters:{statuses:c(l.statuses).filter(o=>["todo","doing","done","archived"].includes(o)),priorities:c(l.priorities).filter(o=>Te.some(p=>p.value===o)),labels:c(l.labels)}}}function er(){try{return Wr(JSON.parse(sessionStorage.getItem(Qn)??"null"))}catch{return{view:"board",query:"",workspaceId:"",filters:Fe,sort:"manual"}}}function ar(a){try{sessionStorage.setItem(Qn,JSON.stringify(a))}catch{}}var Br=[1200,2e3,3e3,5e3,8e3];function Dr(a){return new Promise(r=>{setTimeout(r,a)})}function tr(a){let r=a.sleep??Dr,l=a.delays??Br,c=0;return{cancel(){c+=1},async start(o,p){let g=c+=1;for(let S of l){if(g!==c||(await r(S),g!==c)||(await a.reload(),g!==c))return;let f=await a.getTask(o).catch(()=>null);if(f&&f.title&&f.title!==p)return}}}}var sr="wand.task-board.last-assignment";function Xa(a){if(!a||typeof a!="object"||Array.isArray(a))return null;let r=a;if(!Xe(r.agent)||!vt(r.subject))return null;let l=Pe(null,r.agent),c={type:r.subject.type,id:r.subject.id.trim()};return!c.id||c.type==="cli"&&c.id!==l.provider?null:{agent:l,subject:c}}function nr(){try{return Xa(JSON.parse(window.localStorage.getItem(sr)??"null"))}catch{return null}}function rr(a){let r=Xa(a);if(r)try{window.localStorage.setItem(sr,JSON.stringify(r))}catch{}}function Ut(a,r,l,c){let o=Xe(a.agent)?a.agent:null,p=vt(a.executionSubject)&&(a.executionSubject.type!=="cli"||xt(a.executionSubject.id))?a.executionSubject:null,g=o?Pe(o):p?.type==="cli"&&xt(p.id)?va(p.id):Pe(null,r?.agent??l),S=p??(o?{type:"cli",id:g.provider}:r?.subject??{type:"cli",id:g.provider});if(S.type==="employee"?c.employees!==null&&!c.employees.some(b=>b.id===S.id&&!b.archivedAt):S.type==="team"&&c.teams!==null&&!c.teams.some(b=>b.id===S.id)){let b=Pe(o,l);return{agent:b,subject:{type:"cli",id:b.provider}}}return{agent:g,subject:S}}var s=X(ke(),1);function Qa(a,r="todo",l=va(),c=""){return{workspaceId:a,title:"",description:"",status:r,priority:ws,dueDate:"",labels:"",milestoneId:"",parentTaskId:c,agent:l}}function et(a,r){return Pe(a.agent,r)}function Kt(a){return re.find(r=>r.status===a)??re[0]}var V=nn;function di({onOpenSession:a,onBack:r,onOpenSidebar:l,sidebarOpen:c=!1}={}){let o=d.useSyncExternalStore(aa.subscribe,aa.getSnapshot,aa.getSnapshot),p=pn(o.open),g=p===null?null:mn(Rs,p,e=>e.provider).map(e=>({value:e.value,label:e.label})),[S]=d.useState(er),[f,b]=d.useState([]),[P,A]=d.useState([]),[R,k]=d.useState(null),[u,G]=d.useState(!1),[v,Z]=d.useState(""),[ie,F]=d.useState(""),[ee,le]=d.useState(""),[Oe,j]=d.useState(""),[H,_e]=d.useState(S.query),[U,Ra]=d.useState(S.view),[Ce,at]=d.useState(S.sort),[he,je]=d.useState(Zs),[$,Ie]=d.useState(S.filters),[tt,st]=d.useState("week"),[Ca,I]=d.useState(!1),[W,na]=d.useState(S.workspaceId),we=d.useRef(!1),[xe,xa]=d.useState(!1),[ra,Yt]=d.useState(!1),[nt,or]=d.useState(!1),[rt,qt]=d.useState(!1),[m,_]=d.useState(()=>Qa("")),Jt=d.useRef(m);Jt.current=m;let[ze,de]=d.useState(""),[Na,Ve]=d.useState(""),ir=Gt(Na),[lr,oa]=d.useState(null),[q,Xt]=d.useState(null),{employees:J,loading:ia,error:la}=Is(),[Ea,dr]=d.useState(nr),da=d.useRef(Ea);da.current=Ea;let ca=d.useRef(""),[ye,ua]=d.useState(""),[ge,pa]=d.useState(""),[cr,ur]=d.useState(0),[Ge,Qt]=d.useState(()=>va()),Ne=d.useRef(Ge);Ne.current=Ge;let[es,ma]=d.useState({todo:!1,doing:!1,done:!1,archived:!0}),[Ee,Aa]=d.useState(""),[as,Ze]=d.useState(""),[Wa,Ba]=d.useState(!1),[ga,ce]=d.useState(null),ot=d.useRef(!1),[pr,mr]=d.useState(null),Da=d.useRef(0),ts=d.useRef(0),La=d.useRef(null),Pa=d.useRef(null),ss=d.useRef({}),He=d.useRef(null);d.useLayoutEffect(()=>{for(let e of Object.values(ss.current))e&&(e.scrollTop=0)},[Ce]),d.useEffect(()=>{Oe&&(Ia.toast(Oe,{tone:"success"}),j(""))},[Oe]);let B=d.useCallback(async(e=!1)=>{let n=++Da.current;e||(G(!0),le(""));try{let i=await O.list();if(n!==Da.current)return;b(i)}catch(i){if(n!==Da.current)return;le(i instanceof Error?i.message:"\u65E0\u6CD5\u52A0\u8F7D\u4EFB\u52A1\u3002")}finally{n===Da.current&&G(!1)}},[]),fa=d.useCallback(async()=>{let e=++ts.current;try{let n=await O.workspaces();e===ts.current&&(A(n),na(i=>n.some(y=>y.id===i)?i:""))}catch{}},[]);d.useEffect(()=>{o.open||He.current?.cancel()},[o.open]),d.useEffect(()=>()=>{He.current?.cancel()},[]),d.useEffect(()=>{if(!o.open)return;je(Hs()),B(),fa(),O.models().then(i=>k($s(i))).catch(()=>k(null)),un.list().then(Xt).catch(()=>Xt([]));let e=!0;O.agentDefaults().then(i=>{e&&(Ne.current=i,Qt(i))}).catch(()=>{});let n=Ss(k);return()=>{e=!1,n()}},[o.open,o.revision,fa,B]),d.useEffect(()=>{if(!o.open)return;let e=window.setInterval(()=>{fa(),B(!0)},xe?2e3:6e3),n=Xs(()=>{B(!0),fa()});return()=>{window.clearInterval(e),n()}},[o.open,xe,fa,B]),d.useEffect(()=>{le(""),j(""),de(""),oa(null),ca.current="",xa(!1),ce(null)},[o.revision,o.open]),d.useEffect(()=>{o.workspaceId&&(na(e=>e||o.workspaceId),_(e=>e.workspaceId?e:{...e,workspaceId:o.workspaceId}))},[o.workspaceId,o.open]);let z=d.useCallback(async(e,n)=>{if(!we.current){we.current=!0,Z(e),le("");try{await n()}catch(i){le(i instanceof Error?i.message:"\u64CD\u4F5C\u5931\u8D25\u3002")}finally{we.current=!1,Z("")}}},[]),gr=d.useCallback(e=>{je(e),Us(e)},[]),ns=d.useCallback(e=>{Xe(e)&&(Ne.current=e,Qt(e))},[]),fe=d.useCallback((e,n)=>{let i=Xa({agent:e,subject:n});i&&(da.current=i,dr(i),rr(i))},[]),fr=xn(m.workspaceId||W||null,xe);Nn(xe,fr,e=>{_(n=>n.milestoneId?n:{...n,milestoneId:e})});let Ue=d.useCallback((e="todo",n)=>{let i=Ut({},Le(e)?da.current:null,Ne.current,{employees:ia||la?null:J,teams:q});ua(i.subject.type==="team"?i.subject.id:""),pa(i.subject.type==="employee"?i.subject.id:""),_({...Qa(n?n.workspaceId??"":W||o.workspaceId,e,i.agent,n?.id),milestoneId:n?.milestoneId??""}),qt(!1),Yt(!1),xa(!0),requestAnimationFrame(()=>La.current?.focus())},[o.workspaceId,J,la,ia,W,q]),br=d.useCallback(async()=>{let e=m.title.trim(),n=m.description.trim();!e&&!n||u||await z("__create__",async()=>{let i=ye&&Le(m.status)?{type:"team",id:ye}:ge&&Le(m.status)?{type:"employee",id:ge}:{type:"cli",id:m.agent.provider},y=await O.create({workspaceId:m.workspaceId||null,title:e,description:n,status:m.status,priority:m.priority,labels:m.labels.split(/[,,]/).map(x=>x.trim()).filter(Boolean),dueDate:m.dueDate||null,milestoneId:m.milestoneId||null,parentTaskId:m.parentTaskId||null,...i.type==="cli"?{agent:m.agent}:{},executionSubject:i,rememberAgentDefaults:i.type==="cli"&&ra});i.type==="cli"&&ra&&ns(m.agent);let E="",M=i.type==="team"?q?.find(x=>x.id===i.id):void 0,h=i.type==="employee"?J.find(x=>x.id===i.id):void 0;if(M&&n)try{await O.dispatch(y.id,null,{subject:i,prompt:n,workspaceId:m.workspaceId||null}),fe(m.agent,i),j(`\u56E2\u961F\u300C${M.name}\u300D\u5DF2\u5F00\u59CB\u5904\u7406\u300C${y.title}\u300D`)}catch(x){E=x instanceof Error?x.message:"\u4EFB\u52A1\u5DF2\u521B\u5EFA\uFF0C\u4F46\u4EA4\u7ED9\u56E2\u961F\u5931\u8D25\u3002"}else if(Le(m.status)&&n&&(h||Xe(m.agent)))try{let x=await O.dispatch(y.id,i.type==="cli"?m.agent:null,{prompt:n,workspaceId:m.workspaceId||null,subject:i});fe(m.agent,i),j(`${h?.name||Q(x.session?.provider||m.agent.provider,m.agent.engine)} \u5DF2\u5F00\u59CB\u5904\u7406\u300C${y.title}\u300D`)}catch(x){E=x instanceof Error?x.message:"\u4EFB\u52A1\u5DF2\u521B\u5EFA\uFF0C\u4F46\u7B2C\u4E00\u6B21\u6307\u6D3E\u5931\u8D25\u3002"}Jt.current!==m?requestAnimationFrame(()=>La.current?.focus()):nt?(_({...Qa(m.workspaceId,m.status,m.agent,m.parentTaskId),milestoneId:m.milestoneId}),requestAnimationFrame(()=>La.current?.focus())):(xa(!1),_(Qa(m.workspaceId,"todo",m.agent))),await B(),E?le(E):j(`\u5DF2\u521B\u5EFA\u4EFB\u52A1\u300C${y.title}\u300D${Le(m.status)&&n?"\uFF0C\u5DE5\u5177\u5DF2\u542F\u52A8":"\uFF0C\u672A\u542F\u52A8\u6267\u884C"}${i.type==="cli"&&ra?"\uFF1B\u4EE5\u540E\u65B0\u5EFA\u4EFB\u52A1\u5C06\u4F7F\u7528\u8FD9\u7EC4\u6267\u884C\u9ED8\u8BA4":""}\u3002`),!e&&y.titleSource==="auto"&&(He.current??(He.current=tr({getTask:x=>O.get(x),reload:B})),He.current.start(y.id,y.title))})},[nt,m,ge,J,u,ns,fe,ra,B,z,ye,q]),kr=d.useCallback(async(e,n)=>{await z(e,async()=>{await O.update(e,n),await B()})},[B,z]),rs=d.useCallback(async e=>{if(!$e(e))return;let n=await Ia.dialog({title:`\u5F52\u6863\u300C${e.title}\u300D\uFF1F`,description:"\u4EFB\u52A1\u4F1A\u79FB\u5165\u5F52\u6863\uFF0C\u5E76\u5C06\u5173\u8054\u7684\u5DE5\u4F5C\u4EFB\u52A1\u6807\u4E3A\u5B8C\u6210\u3002\u4F1A\u8BDD\u8BB0\u5F55\u4F1A\u4FDD\u7559\u3002",actions:[{label:"\u53D6\u6D88",value:!1,autoFocus:!0},{label:"\u5F52\u6863\u4EFB\u52A1",value:!0,kind:"primary"}]});n.dismissed===!0||!n.action||await z(e.id,async()=>{await O.remove(e.id),j(`\u5DF2\u5F52\u6863\u300C${e.title}\u300D\uFF0C\u4F1A\u8BDD\u8BB0\u5F55\u5DF2\u4FDD\u7559\u3002`),ze===e.id&&(de(""),oa(null)),await B()})},[B,z,ze]),hr=d.useCallback(async(e,n,i)=>{await z(e.id,async()=>{await O.update(e.id,{agent:n,workspaceId:e.workspaceId});let y=await O.dispatch(e.id,n,{prompt:i.trim(),workspaceId:e.workspaceId,subject:{type:"cli",id:n.provider}});fe(n,{type:"cli",id:n.provider}),j(`${Q(y.session?.provider||n.provider,n.engine)} \u5DF2\u5F00\u59CB\u5904\u7406\u300C${e.title}\u300D`),await B()})},[fe,B,z]),yr=d.useCallback(async(e,n,i)=>{await z(e.id,async()=>{let y=i.trim(),E=await O.dispatch(e.id,null,{prompt:y,workspaceId:e.workspaceId,subject:{type:"team",id:n.id}});fe(et(e,da.current?.agent??Ne.current),{type:"team",id:n.id}),j(`\u56E2\u961F\u300C${n.name}\u300D\u5DF2\u5F00\u59CB\u5904\u7406\u300C${e.title}\u300D`),ur(M=>M+1),await B(),E.teamRun?.run.id?Ua.open("","","teamchat",E.teamRun.run.id):E.session?.id&&a?.(E.session.id)})},[a,fe,B,z]),vr=d.useCallback(async(e,n,i)=>{let y=J.find(E=>E.id===n);y&&await z(e.id,async()=>{let E=await O.dispatch(e.id,null,{prompt:i.trim(),workspaceId:e.workspaceId,subject:{type:"employee",id:n}});fe(et(e,da.current?.agent??Ne.current),{type:"employee",id:n}),j(`${y.name} \u5DF2\u5F00\u59CB\u5904\u7406\u300C${e.title}\u300D`),await B(),E.session?.id&&a?.(E.session.id)})},[J,a,fe,B,z]),Tr=d.useCallback(async(e,n)=>{let i=f.find(h=>h.id===n);if(!i||i.status===e)return;let y=As(e,i.sessions.length),E=y?et(i,Ne.current):null;if(we.current)return;let M="";if(y&&E){M=Ws(i);let h=M.length>240?`${M.slice(0,240)}\u2026`:M,x=await Ia.dialog({title:`\u7528\u4EFB\u52A1\u8BF4\u660E\u542F\u52A8\u300C${i.title}\u300D\uFF1F`,description:`\u62D6\u8FDB\u300C\u5904\u7406\u4E2D\u300D\u4F1A\u6309\u4EFB\u52A1\u5361\u4E0A\u5DF2\u6709\u7684\u8FD9\u6BB5\u8BF4\u660E\u6D3E\u53D1\uFF0C\u4E0D\u662F\u6307\u6D3E\u6846\u91CC\u65B0\u5199\u7684\u63D0\u793A\u8BCD\uFF1A\u300C${h}\u300D`,actions:[{label:"\u53D6\u6D88",value:"cancel",autoFocus:!0},{label:"\u53EA\u79FB\u5165\u5904\u7406\u4E2D",value:"move"},{label:"\u6309\u8FD9\u6BB5\u8BF4\u660E\u6D3E\u53D1",value:"dispatch",kind:"primary"}]});if(x.dismissed===!0||x.action==="cancel")return;x.action==="move"&&(M="")}await z(n,async()=>{await O.update(n,{status:e});let h="";if(M&&E)try{let x=await O.dispatch(n,i.executionSubject&&i.executionSubject.type!=="cli"?null:E,{prompt:M,workspaceId:i.workspaceId,subject:i.executionSubject??{type:"cli",id:E.provider}}),pt=i.executionSubject?.type==="employee"?J.find(mt=>mt.id===i.executionSubject?.id)?.name:i.executionSubject?.type==="team"?q?.find(mt=>mt.id===i.executionSubject?.id)?.name:Q(x.session?.provider||E.provider,E.engine);j(`${pt||Q(x.session?.provider||E.provider,E.engine)} \u5DF2\u5F00\u59CB\u5904\u7406\u300C${i.title}\u300D`)}catch(x){h=x instanceof Error?x.message:"\u4EFB\u52A1\u5DF2\u79FB\u5165\u300C\u5904\u7406\u4E2D\u300D\uFF0C\u4F46\u6D3E\u53D1 Agent \u5931\u8D25\u3002"}await B(),h&&le(h)})},[J,B,z,f,q]),Ir=d.useCallback(async e=>{let n=f.find(i=>i.id===e);!n||n.status==="archived"||!$e(n)||await z(e,async()=>{await O.update(e,{status:"archived"}),ma(i=>({...i,archived:!0})),j(`\u5DF2\u5F52\u6863\u300C${n.title}\u300D\uFF0C\u62D6\u56DE\u4EFB\u610F\u5217\u6216\u53F3\u952E\u300C\u6062\u590D\u5230\u7B49\u5F85\u8BA4\u9886\u300D\u5373\u53EF\u6062\u590D\u3002`),await B()})},[B,z,f]),wr=d.useCallback(async e=>{let n=f.find(i=>i.id===e);!n||n.status!=="archived"||await z(e,async()=>{await O.update(e,{status:"todo"}),j(`\u5DF2\u6062\u590D\u300C${n.title}\u300D\u5230\u300C\u7B49\u5F85\u8BA4\u9886\u300D\u3002`),await B()})},[B,z,f]),C=f.find(e=>e.id===ze)??null,Sr=C?f.filter(e=>e.parentTaskId===C.id):[],Fa=zs(es.archived,H,$),os=Xn(At(f,H,W,$,Fa),Ce),$a=js(os),it=At(f,H,W,$,!0),Ma=it.filter(e=>e.status!=="archived").length,Ae=it.length-Ma,is=f.filter(e=>e.status==="archived"&&(!W||e.workspaceId===W)).length,[ls,ds]=d.useState(!1),cs=d.useCallback(async()=>{let e=await Ia.dialog({title:`\u6C38\u4E45\u5220\u9664 ${is} \u4E2A\u5F52\u6863\u4EFB\u52A1\uFF1F`,description:"\u5F52\u6863\u5361\u7247\u4F1A\u88AB\u5F7B\u5E95\u5220\u9664\uFF0C\u65E0\u6CD5\u6062\u590D\uFF1B\u4ECD\u5728\u8FD0\u884C\u7684\u4F1A\u8BDD\u540D\u4E0B\u7684\u4EFB\u52A1\u4F1A\u88AB\u8DF3\u8FC7\u3002",actions:[{label:"\u53D6\u6D88",value:!1,autoFocus:!0},{label:"\u6C38\u4E45\u5220\u9664",value:!0,kind:"danger"}]});if(!(e.dismissed===!0||e.action!==!0)&&!we.current){we.current=!0,ds(!0),le("");try{let n=await O.purgeArchived(W||null);j(n.skipped>0?`\u5DF2\u5220\u9664 ${n.deleted} \u4E2A\u5F52\u6863\u4EFB\u52A1\uFF0C${n.skipped} \u4E2A\u4ECD\u5728\u5904\u7406\u5DF2\u8DF3\u8FC7\u3002`:`\u5DF2\u5220\u9664 ${n.deleted} \u4E2A\u5F52\u6863\u4EFB\u52A1\u3002`),await B()}catch(n){le(n instanceof Error?n.message:"\u65E0\u6CD5\u6E05\u7A7A\u5F52\u6863\u4EFB\u52A1\u3002")}finally{we.current=!1,ds(!1)}}},[is,W,B]),us=Vs(P),Rr=It(f,m.workspaceId||void 0,null,m.parentTaskId),Cr=W?P.find(e=>e.id===W)?.name??"\u9879\u76EE":"\u6240\u6709\u9879\u76EE",lt=re.filter(e=>he.mainStatuses.includes(e.status)),dt=re.filter(e=>!he.mainStatuses.includes(e.status)),xr=C?v===C.id:!1,ps=lr??(C?et(C,Ge):Ge),ve=ga?f.find(e=>e.id===ga.taskId)??null:null,ct=Ga($)>0,Ke=Js(f.length,Ma,Ae,!!(H.trim()||ct)),[Se,ut]=d.useState(!1),se=fn(),be=Le(m.status),Ye=be?q?.find(e=>e.id===ye)??null:null,qe=be?J.find(e=>e.id===ge)??null:null,Nr=JSON.stringify(C?.agent??null);d.useEffect(()=>{if(!C){ca.current="",oa(null);return}if(ca.current===C.id&&(!ge||ia||la||J.some(n=>n.id===ge&&!n.archivedAt))&&(!ye||q===null||q.some(n=>n.id===ye)))return;ca.current="";let e=Ut(C,Ea,Ge,{employees:ia||la?null:J,teams:q});oa(e.agent),ua(e.subject.type==="team"?e.subject.id:""),pa(e.subject.type==="employee"?e.subject.id:"")},[C?.id,Nr,C?.executionSubject?.type,C?.executionSubject?.id,Ge,Ea,ge,J,la,ia,ye,q]),d.useEffect(()=>{ar({view:U,query:H,workspaceId:W,filters:$,sort:Ce})},[U,H,W,$,Ce]),d.useEffect(()=>{Ve("")},[U,H,W,$,ze,o.open,o.revision]),d.useEffect(()=>{let e=document.title;return document.title=C?`${C.title} \xB7 Wand`:"\u4EFB\u52A1\u770B\u677F \xB7 Wand",()=>{document.title=e}},[C?.title]);let Oa=d.useCallback(async()=>{we.current||(m.title.trim()||m.description.trim())&&!await En()||xa(!1)},[m.title,m.description]);if(d.useEffect(()=>{if(!o.open)return;let e=n=>{if(n.defaultPrevented||n.isComposing)return;let i=n.target;if(i instanceof Element&&i.closest('[role="dialog"], [role="alertdialog"], [role="listbox"], [role="menu"]'))return;let y=i instanceof HTMLElement&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.isContentEditable);if(n.key==="/"&&!y){n.preventDefault(),Pa.current?.focus();return}if(n.key==="c"&&!y&&!n.metaKey&&!n.ctrlKey){n.preventDefault(),Ue("todo");return}if(!(n.key!=="Escape"||y)){if(xe){Oa();return}if(ze){de("");return}if(Na){Ve("");return}r?r():Ua.close()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o.open,xe,Oa,Na,r,Ue,ze]),!o.open)return null;let ms=e=>{let n=e.agent,i=v===e.id,y=f.find(h=>h.id===e.parentTaskId),E=f.filter(h=>h.parentTaskId===e.id).length,M=Na===e.id;return(0,s.jsx)("article",{className:K("task-board-card",`is-${e.status}`,M&&"is-open",Ee===e.id&&"is-dragging",as===e.status&&Ee&&Ee!==e.id&&"is-shift",i&&"is-busy",ie===e.id&&"is-session-drop-target"),onDragOver:h=>{i||!Ka(h.dataTransfer)||(h.preventDefault(),h.stopPropagation(),h.dataTransfer.dropEffect="move",F(e.id))},onDragLeave:h=>{h.currentTarget.contains(h.relatedTarget)||F("")},onDrop:h=>{if(!Ka(h.dataTransfer))return;h.preventDefault(),h.stopPropagation(),F("");let x=Tn(h.dataTransfer);!x||i||e.sessions.some(pt=>pt.id===x)||z(e.id,async()=>{await O.moveSession(e.id,x),j(`\u5DF2\u79FB\u5165\u300C${e.title}\u300D\uFF0C\u8FD0\u884C\u76EE\u5F55\u4E0D\u53D8`),await B(),await dn.getRuntime()?.refreshSessions()})},"data-task-id":e.id,draggable:!i,onKeyDown:h=>{if(h.key!=="ContextMenu"&&!(h.shiftKey&&h.key==="F10"))return;h.preventDefault();let x=h.currentTarget.getBoundingClientRect();ce({taskId:e.id,x:x.left+16,y:x.top+32})},onDragStart:h=>{h.target===h.currentTarget&&(Ve(""),Wn(h.dataTransfer,e.id),Aa(e.id))},onDragEnd:()=>{Aa(""),Ze(""),Ba(!1)},onContextMenu:h=>{h.preventDefault(),ce({taskId:e.id,x:h.clientX,y:h.clientY})},children:(0,s.jsx)(ae,{size:"small",styles:{body:{padding:12}},loading:i,children:(0,s.jsxs)(T,{vertical:!0,gap:"small",children:[(0,s.jsxs)(T,{align:"flex-start",gap:4,className:"task-board-card-heading",children:[(0,s.jsx)(N,{kind:"ghost",type:"button",ref:ir(e.id),className:"task-board-card-open",style:{height:"auto",width:"100%",justifyContent:"flex-start",whiteSpace:"normal",textAlign:"left"},"aria-expanded":M,"aria-controls":`task-card-detail-${e.id}`,"aria-label":`${M?"\u6536\u8D77":"\u5C55\u5F00"} ${e.identifier}: ${e.title}`,title:e.title||"\u672A\u547D\u540D\u4EFB\u52A1",onClick:()=>Ve(h=>h===e.id?"":e.id),children:(0,s.jsx)(L.Text,{strong:!0,className:"task-board-card-title",id:`task-${e.id}-title`,children:e.title||"\u672A\u547D\u540D\u4EFB\u52A1"})}),(0,s.jsx)(ne,{className:"task-board-card-menu","aria-label":`\u4EFB\u52A1\u83DC\u5355 ${e.identifier}`,disabled:i,onClick:h=>{let x=h.currentTarget.getBoundingClientRect();ce({taskId:e.id,x:x.left,y:x.bottom})},children:(0,s.jsx)(D,{name:"more",size:16})})]}),he.body&&e.description&&!M?(0,s.jsx)("p",{className:"task-board-card-body",children:e.description}):null,(0,s.jsxs)(T,{wrap:!0,gap:4,align:"center",className:"task-board-card-meta","aria-label":"\u4EFB\u52A1\u5C5E\u6027",children:[(0,s.jsx)("span",{className:"task-board-card-id",children:e.identifier}),y&&(0,s.jsxs)("span",{className:"task-board-chip is-parent",title:`\u5F52\u5C5E ${y.identifier} \xB7 ${y.title}`,children:["\u21B3 ",y.identifier]}),E>0&&(0,s.jsxs)("span",{className:"task-board-chip is-parent",title:`${E} \u4E2A\u5B50\u4EFB\u52A1`,children:[E," \u4E2A\u5B50\u4EFB\u52A1"]}),(0,s.jsx)(Jn,{name:e.workspace?e.workspace.name:"\u672A\u5F52\u5C5E\u5DE5\u4F5C\u533A"}),e.milestone?(0,s.jsx)(Zt,{name:e.milestone.name}):null,(0,s.jsx)(jt,{priority:e.priority}),e.labels.slice(0,2).map(h=>(0,s.jsx)(Re,{label:h},h)),e.labels.length>2?(0,s.jsxs)("span",{className:"task-board-label-more",children:["+",e.labels.length-2]}):null,e.dueDate?(0,s.jsx)("span",{className:K("task-board-due",Za(e.dueDate,e.status)&&"is-overdue"),children:Qe(e.dueDate)}):null,(0,s.jsx)(Yn,{sessions:e.sessions,assigned:n}),e.status!=="doing"?(0,s.jsx)(Ja,{sessions:e.sessions,onOpen:a}):null]}),ie===e.id&&(0,s.jsx)(We,{type:"info",showIcon:!0,title:"\u79FB\u5165\u6B64\u4EFB\u52A1 \xB7 \u8FD0\u884C\u76EE\u5F55\u4E0D\u53D8"}),e.sessions.length>0&&(0,s.jsxs)(T,{vertical:!0,gap:4,className:"task-board-session-list",style:{display:M?"none":void 0},"aria-label":`${e.title} \u7684\u4F1A\u8BDD`,children:[e.sessions.slice(0,2).map(h=>(0,s.jsxs)(T,{align:"center",justify:"space-between",gap:4,className:"task-board-session-row",style:{minWidth:0},"data-session-id":h.id,draggable:!i,onDragStart:x=>{x.stopPropagation(),vn(x.dataTransfer,h.id)},children:[(0,s.jsxs)(N,{kind:"ghost",type:"button",className:"task-board-session-open",style:{flex:1,minWidth:0,justifyContent:"flex-start"},title:`${h.title}
2
+ ${h.cwd}`,onClick:()=>a?.(h.id),children:[(0,s.jsx)(D,{name:"terminal",size:13}),(0,s.jsx)(L.Text,{ellipsis:!0,style:{flex:1,minWidth:0,textAlign:"left"},children:h.title||h.provider||"CLI \u4F1A\u8BDD"})]}),(0,s.jsx)(Dn,{sessionId:h.id,taskId:e.workspaceTaskId??void 0})]},h.id)),e.sessions.length>2&&(0,s.jsxs)(N,{kind:"ghost",size:"small",className:"task-board-session-more",onClick:()=>Ve(e.id),children:["\u67E5\u770B\u5168\u90E8 ",e.sessions.length," \u4E2A\u4F1A\u8BDD"]})]}),e.status==="doing"?(0,s.jsx)(_n,{task:e,onOpenSession:a}):null,(0,s.jsx)(Gn,{task:e,open:M,parentLabel:y?.title,childCount:E,onOpen:de,onCollapse:()=>Ve(""),onOpenSession:a})]})})},e.id)},gs=e=>{let n=Kt(e),i=$a[e];return(0,s.jsxs)("section",{className:K("task-board-column",`is-${e}`,as===e&&"is-drop-target"),style:{flex:"1 0 280px",minWidth:0},"aria-labelledby":`column-${e}`,onDragEnter:y=>{Sa(y.dataTransfer)&&Ze(e)},onDragOver:y=>{Sa(y.dataTransfer)&&(y.preventDefault(),y.dataTransfer.dropEffect="move",Ze(e))},onDragLeave:y=>{y.currentTarget.contains(y.relatedTarget)||Ze(E=>E===e?"":E)},onDrop:y=>{if(Ka(y.dataTransfer))return;y.preventDefault();let E=Bn(y.dataTransfer);Ze(""),Aa(""),E&&f.some(M=>M.id===E)&&Tr(e,E)},children:[(0,s.jsxs)(T,{component:"header",align:"center",justify:"space-between",gap:"small",className:"task-board-column-head",children:[(0,s.jsxs)(T,{align:"center",gap:"small",className:"task-board-column-heading",children:[(0,s.jsx)(sa,{status:e}),(0,s.jsx)(L.Title,{level:5,id:`column-${e}`,style:{margin:0},children:n.label}),(0,s.jsx)("span",{className:"task-board-column-count",children:i.length})]}),(0,s.jsx)("div",{className:"task-board-column-actions",children:(0,s.jsx)(ne,{className:"task-board-icon-button","aria-label":`\u5728${n.label}\u4E2D\u65B0\u5EFA\u4EFB\u52A1`,title:`\u6DFB\u52A0\u5230${n.label}`,onClick:()=>Ue(e),children:(0,s.jsx)(D,{name:"plus"})})})]}),(0,s.jsxs)(T,{vertical:!0,gap:"small",className:"task-board-column-list",ref:y=>{ss.current[e]=y??void 0},children:[u&&f.length===0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ht,{className:"task-board-skeleton"}),(0,s.jsx)(ht,{className:"task-board-skeleton"})]}):null,!u&&i.length===0&&(0,s.jsx)("p",{className:"task-board-column-empty",children:n.empty}),i.map(ms)]})]},e)};return(0,s.jsxs)(T,{component:"section",vertical:!0,gap:"middle",className:"task-board-native-page","aria-label":"\u4EFB\u52A1\u7BA1\u7406","data-view":U,"data-detail":!!C,children:[(0,s.jsxs)(T,{component:"header",wrap:!0,align:"center",justify:"space-between",gap:"small",className:"task-board-workspace-header",children:[(0,s.jsxs)(T,{align:"center",gap:"small",className:"task-board-kicker",children:[l?(0,s.jsx)(ne,{className:"task-board-icon-button","aria-label":c?"\u5173\u95ED\u4EFB\u52A1\u5217\u8868":"\u6253\u5F00\u4EFB\u52A1",onClick:l,children:(0,s.jsx)(gn,{open:c,size:16})}):null,C?null:(0,s.jsx)(ne,{className:"task-board-icon-button","aria-label":"\u8FD4\u56DE\u5DE5\u4F5C\u533A",title:"\u8FD4\u56DE\u5DE5\u4F5C\u533A",onClick:()=>r?r():Ua.close(),children:(0,s.jsx)(D,{name:"chevronLeft"})}),(0,s.jsx)("div",{className:"task-board-heading-copy",children:C?(0,s.jsx)(bs,{variant:"title",ariaLabel:"\u4EFB\u52A1\u770B\u677F\u5BFC\u822A",items:[{label:"\u4EFB\u52A1\u770B\u677F",onNavigate:()=>de("")},{label:C.identifier}]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("h1",{children:"\u4EFB\u52A1\u770B\u677F"})})})]}),(0,s.jsx)(T,{wrap:!0,gap:"small",className:"task-board-header-actions",children:!C&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Cn,{target:W?{kind:"workspace",workspaceId:W}:{kind:"all"},onChanged:()=>B(!0)}),(0,s.jsx)(ne,{disabled:u,onClick:()=>{B()},"aria-label":"\u5237\u65B0\u4EFB\u52A1",title:"\u5237\u65B0\u4EFB\u52A1",children:(0,s.jsx)(D,{name:"refresh"})}),(0,s.jsxs)(N,{className:"task-board-create-button",kind:"primary",size:"medium","aria-label":"\u65B0\u5EFA\u4EFB\u52A1",title:"\u65B0\u5EFA\u4EFB\u52A1 (C)",onClick:()=>Ue("todo"),children:[(0,s.jsx)(D,{name:"plus",slot:"start"}),(0,s.jsx)("span",{children:"\u65B0\u5EFA\u4EFB\u52A1"})]})]})})]}),!C&&(0,s.jsxs)(T,{wrap:!0,align:"center",justify:"space-between",gap:"small",className:"task-board-toolbar",children:[!C&&(0,s.jsx)(ja,{className:"task-board-view-tabs",ariaLabel:"\u770B\u677F\u89C6\u56FE",value:U,onValueChange:e=>Ra(e),tabs:Va.map(e=>({value:e.value,label:e.label}))}),(0,s.jsxs)(T,{wrap:!0,align:"center",gap:"small",className:"task-board-toolbar-controls",children:[(0,s.jsx)(vs,{inputRef:Pa,className:"task-board-search",label:"\u641C\u7D22\u4EFB\u52A1",placeholder:"\u641C\u7D22\u6807\u9898\u3001\u7F16\u53F7\u6216\u6B63\u6587",value:H,onValueChange:_e}),(0,s.jsx)(Y,{className:"task-board-workspace-filter",value:W||"__all__",options:[{value:"__all__",label:"\u6240\u6709\u76EE\u5F55"},...P.map(e=>({value:e.id,label:e.name}))],ariaLabel:"\u7B5B\u9009\u5DE5\u4F5C\u76EE\u5F55",searchable:!0,searchPlaceholder:"\u641C\u7D22\u76EE\u5F55",onValueChange:e=>na(e==="__all__"?"":e)}),(0,s.jsx)(Y,{className:"task-board-sort",ariaLabel:"\u4EFB\u52A1\u6392\u5E8F",value:Ce,options:Ht,onValueChange:e=>at(e)}),(U==="board"||U==="list"||U==="gantt")&&(0,s.jsx)(jn,{tasks:f,filters:$,onChange:Ie}),U==="board"&&(0,s.jsx)(zn,{display:he,onChange:gr})]})]}),!C&&(0,s.jsxs)(T,{wrap:!0,align:"center",justify:"space-between",gap:"small",className:"task-board-result-summary",role:"status",children:[(0,s.jsxs)("span",{children:[u?"\u6B63\u5728\u540C\u6B65\u4EFB\u52A1\u2026":`\u6D3B\u52A8 ${Ma} \xB7 \u5F52\u6863 ${Ae}`,H||ct||W?" \xB7 \u5DF2\u7B5B\u9009":""]}),(0,s.jsxs)(T,{wrap:!0,gap:4,className:"task-board-active-filters",children:[$.statuses.map(e=>(0,s.jsxs)(N,{kind:"ghost",size:"small","aria-label":`\u79FB\u9664\u72B6\u6001\u7B5B\u9009 ${Kt(e).label}`,onClick:()=>Ie({...$,statuses:$.statuses.filter(n=>n!==e)}),children:[e==="archived"?"\u5F52\u6863\u4EFB\u52A1":Kt(e).label,(0,s.jsx)(D,{name:"close",size:12})]},e)),$.priorities.map(e=>(0,s.jsxs)(N,{kind:"ghost",size:"small","aria-label":`\u79FB\u9664\u4F18\u5148\u7EA7\u7B5B\u9009 ${e}`,onClick:()=>Ie({...$,priorities:$.priorities.filter(n=>n!==e)}),children:[Te.find(n=>n.value===e)?.label,(0,s.jsx)(D,{name:"close",size:12})]},e)),$.labels.map(e=>(0,s.jsxs)(N,{kind:"ghost",size:"small","aria-label":`\u79FB\u9664\u6807\u7B7E\u7B5B\u9009 ${e}`,onClick:()=>Ie({...$,labels:$.labels.filter(n=>n!==e)}),children:[e,(0,s.jsx)(D,{name:"close",size:12})]},e))]}),(H||ct||W)&&(0,s.jsx)(N,{kind:"ghost",size:"small",onClick:()=>{_e(""),Ie(Fe),na(""),Pa.current?.focus()},children:"\u6E05\u9664\u7B5B\u9009"})]}),!C&&!u&&Ma===0&&Ae>0&&!Fa&&(0,s.jsx)(We,{type:"info",showIcon:!0,title:"\u5F53\u524D\u6CA1\u6709\u6D3B\u52A8\u4EFB\u52A1",description:`\u6709 ${Ae} \u4E2A\u5F52\u6863\u4EFB\u52A1\u3002\u5C55\u5F00\u5F52\u6863\u53EF\u67E5\u770B\u5386\u53F2\uFF0C\u5F52\u6863\u4E0D\u4F1A\u542F\u52A8\u6216\u505C\u6B62\u6267\u884C\u3002`,action:(0,s.jsx)(N,{kind:"ghost",size:"small",onClick:()=>ma(e=>({...e,archived:!1})),children:"\u5C55\u5F00\u5F52\u6863"})}),ee&&(0,s.jsx)(We,{type:"error",role:"alert",showIcon:!0,title:ee,action:(0,s.jsx)(N,{kind:"ghost",size:"small",disabled:u,onClick:()=>{B()},children:"\u91CD\u65B0\u52A0\u8F7D"})}),C?(0,s.jsx)(Lr,{task:C,busy:xr,catalog:R,agent:ps,providerOptions:g,teams:q,teamId:ye,employees:J,employeeId:ge,teamRunRefresh:cr,onTeamChange:ua,onEmployeeChange:pa,workspaceOptions:us,parent:f.find(e=>e.id===C.parentTaskId)??null,children:Sr,parentOptions:It(f,C.workspaceId,C.id,C.parentTaskId),onOpenTask:de,onCreateChild:()=>Ue("doing",C),onAgentChange:(e,n)=>{ca.current=C.id,oa(e),fe(e,n??{type:"cli",id:e.provider})},onPatch:e=>{kr(C.id,e)},composeRequest:pr,onDispatch:e=>{let n=q?.find(i=>i.id===ye);n?yr(C,n,e):ge?vr(C,ge,e):hr(C,ps,e)},onRemove:()=>{rs(C)},onOpenSession:a}):!u&&it.length===0?(0,s.jsxs)("div",{className:"task-board-no-results",role:"status",children:[(0,s.jsx)(D,{name:Ke.kind==="filtered"?"search":"board",size:24}),(0,s.jsx)("h2",{children:Ke.title}),(0,s.jsx)("p",{children:Ke.description}),(0,s.jsx)(N,{kind:Ke.kind==="filtered"?"secondary":"primary",onClick:()=>{Ke.kind==="filtered"?(_e(""),Ie(Fe),na(""),Pa.current?.focus()):Ue("todo")},children:Ke.kind==="filtered"?"\u6E05\u9664\u7B5B\u9009":"\u65B0\u5EFA\u4EFB\u52A1"})]}):U==="dashboard"?(0,s.jsx)(Hn,{projectName:Cr,tasks:os,onOpen:de,onOpenSession:a}):U==="list"?(0,s.jsx)(Zn,{grouped:$a,allTasks:f,collapsed:es,archiveOpen:Fa,archiveCount:Ae,onToggle:e=>ma(n=>({...n,[e]:!n[e]})),onToggleArchive:()=>ma(e=>({...e,archived:!e.archived})),onPurgeArchive:()=>{cs()},archivePurging:ls,onOpen:de,onOpenSession:a}):U==="gantt"?(0,s.jsx)(Un,{grouped:$a,zoom:tt,hideCompleted:Ca,onZoom:st,onHideCompleted:I,onOpen:de}):(0,s.jsxs)(T,{vertical:!0,gap:"middle",className:K("task-board-layout",dt.length>0&&"has-other-tasks"),children:[(0,s.jsx)("div",{className:"task-board-scroll",tabIndex:0,"aria-label":"\u4EFB\u52A1\u72B6\u6001\u5217",children:(0,s.jsx)(T,{gap:"middle",align:"stretch",className:"task-board-board",style:{minWidth:Math.max(lt.length,1)*280,"--task-board-columns":Math.max(lt.length,1)},children:lt.map(e=>gs(e.status))})}),dt.length>0&&(0,s.jsx)(T,{component:"aside",wrap:!0,gap:"middle",className:"task-board-other","aria-label":"\u5176\u4ED6\u4EFB\u52A1",children:dt.map(e=>gs(e.status))}),Ae>0||Ee?(0,s.jsxs)(ae,{size:"small",styles:{body:{padding:12}},style:{borderColor:Wa?"var(--accent)":void 0},className:K("task-board-archive-zone",Ee&&"is-dragging-task",Wa&&"is-over"),"aria-label":"\u5F52\u6863\u533A",onDragOver:e=>{if(!Sa(e.dataTransfer))return;let n=f.find(i=>i.id===e.dataTransfer.getData(ta))??f.find(i=>i.id===Ee);!n||!$e(n)||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",Ba(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Ba(!1)},onDrop:e=>{if(!Sa(e.dataTransfer))return;e.preventDefault(),e.stopPropagation(),Ba(!1),Aa(""),Ze("");let n=e.dataTransfer.getData(ta);n&&Ir(n)},children:[(0,s.jsx)(zt,{count:Ae,open:Fa,onPurge:()=>{cs()},purging:ls,onToggle:()=>ma(e=>({...e,archived:!e.archived})),children:(0,s.jsx)("div",{className:"task-board-archive-cards",children:$a.archived.map(ms)})}),Ee?(0,s.jsx)(We,{className:"task-board-archive-hint",type:Wa?"info":"warning",showIcon:!0,title:Wa?"\u677E\u5F00\u9F20\u6807\uFF0C\u5F52\u6863\u6B64\u4EFB\u52A1":"\u62D6\u5230\u8FD9\u91CC\u5F52\u6863\uFF1A\u4FA7\u680F\u9690\u85CF\uFF0C\u7EC8\u7AEF\u4E0E\u8BB0\u5F55\u4FDD\u7559"}):null]}):null]}),ve&&ga&&(0,s.jsx)(Kn,{x:ga.x,y:ga.y,task:ve,onOpen:()=>{de(ve.id),ce(null)},onCopy:()=>{navigator.clipboard?.writeText(ve.identifier),ce(null)},onNewSession:()=>{ce(null),!ot.current&&(ot.current=!0,Ln(ve,{canContinue:()=>aa.getSnapshot().open}).catch(e=>{aa.getSnapshot().open&&j(e instanceof Error?e.message:"\u65E0\u6CD5\u6253\u5F00\u65B0\u5EFA\u4F1A\u8BDD\u3002")}).finally(()=>{ot.current=!1}))},onDispatch:()=>{de(ve.id),mr({id:ve.id,nonce:Date.now()}),ce(null)},onArchive:()=>{rs(ve),ce(null)},onRestore:()=>{wr(ve.id),ce(null)},onClose:()=>ce(null)}),(0,s.jsx)(hs,{open:xe,title:"\u65B0\u5EFA\u4EFB\u52A1",className:K("wand-ui-dialog-content","wand-task-library-dialog task-board-create-library-dialog",rt&&"is-expanded"),description:be?"\u63CF\u8FF0\u8981\u5B8C\u6210\u7684\u5DE5\u4F5C\uFF0C\u521B\u5EFA\u540E\u4EA4\u7ED9\u6240\u9009\u5DE5\u5177\u6267\u884C\u3002":"\u5148\u8BB0\u5F55\u8981\u505A\u7684\u4E8B\uFF0C\u51C6\u5907\u597D\u540E\u518D\u4ECE\u4EFB\u52A1\u8BE6\u60C5\u542F\u52A8\u6267\u884C\u3002",closeLabel:"\u5173\u95ED\u65B0\u5EFA\u4EFB\u52A1",dismissable:v!=="__create__",closeContent:(0,s.jsx)(D,{name:"close",size:14,strokeWidth:1.8}),onOpenChange:e=>{e||Oa()},children:(0,s.jsxs)(yn,{noValidate:!0,"aria-busy":v==="__create__",className:"task-board-create-form task-board-native-composer",onSubmit:e=>{if(e.preventDefault(),Se){se.hasPlan?se.startNow(m.workspaceId,m.description).then(n=>{if(n){ut(!1),se.resetResults(),Oa();let i=n.run?.chatSessionId;i?a?.(i):j(`\u5DF2\u5F00\u5DE5\uFF08\u4EFB\u52A1 ${n.taskId}\uFF09\uFF0C\u53EF\u5728\u4EFB\u52A1\u8BE6\u60C5\u91CC\u67E5\u770B\u56E2\u961F\u8FD0\u884C\u3002`)}}):se.planNow(m.description);return}br()},children:[(0,s.jsxs)(T,{vertical:!0,gap:"small",className:"task-board-create-writing task-board-form-section",children:[(0,s.jsx)("h3",{className:"task-board-form-section-title",children:"\u4EFB\u52A1\u5185\u5BB9"}),(0,s.jsx)(ft.Item,{label:(0,s.jsxs)("span",{id:"task-board-create-title-label",children:["\u4EFB\u52A1\u6807\u9898 ",(0,s.jsx)(L.Text,{type:"secondary",children:"\u53EF\u9009"})]}),className:"task-board-create-title-field",children:(0,s.jsx)(wa,{ref:La,className:"resize-none task-board-create-title-input",rows:1,value:m.title,placeholder:"\u4E0D\u586B\u5199\u5219\u6309\u63CF\u8FF0\u81EA\u52A8\u751F\u6210","aria-labelledby":"task-board-create-title-label",maxLength:240,"data-wand-autofocus":"",onChange:e=>{let n=e.currentTarget.value.replace(/\n/g,"");_(i=>({...i,title:n}))}})}),(0,s.jsx)(V,{label:"\u4EFB\u52A1\u63CF\u8FF0",children:(0,s.jsx)(wa,{className:"resize-none task-board-create-body-input",rows:4,value:m.description,placeholder:be?"\u6DFB\u52A0\u63CF\u8FF0\u2026\uFF08\u5C06\u4F5C\u4E3A\u7B2C\u4E00\u4E2A Agent \u7684\u6307\u6D3E\u5185\u5BB9\uFF09":"\u6DFB\u52A0\u63CF\u8FF0\u2026\uFF08\u53EA\u521B\u5EFA\u4EFB\u52A1\uFF0C\u4E0D\u6307\u6D3E Agent\uFF09","aria-label":be?"\u4EFB\u52A1\u63CF\u8FF0\uFF08\u4F5C\u4E3A\u7B2C\u4E00\u6B21\u6307\u6D3E\uFF09":"\u4EFB\u52A1\u63CF\u8FF0",onChange:e=>{let n=e.currentTarget.value;_(i=>({...i,description:n}))}})})]}),(0,s.jsxs)(T,{vertical:!0,gap:"middle",className:"task-board-create-meta",children:[(0,s.jsxs)("section",{className:"task-board-form-section",children:[(0,s.jsx)("h3",{className:"task-board-form-section-title",children:"\u5F52\u5C5E\u4E0E\u6392\u671F"}),(0,s.jsxs)(T,{wrap:!0,gap:"small",className:"task-board-create-properties","aria-label":"\u4EFB\u52A1\u5C5E\u6027",children:[(0,s.jsx)(V,{label:"\u9879\u76EE\u76EE\u5F55",children:(0,s.jsx)(Y,{value:Nt(m.workspaceId),options:us,ariaLabel:"\u6307\u5B9A\u9879\u76EE\u76EE\u5F55",placeholder:"\u9009\u62E9\u9879\u76EE\u76EE\u5F55",searchable:!0,searchPlaceholder:"\u641C\u7D22\u9879\u76EE",className:"task-board-native-select",onValueChange:e=>{let n=Et(e)??"";_(i=>({...i,workspaceId:n,parentTaskId:f.some(y=>y.id===i.parentTaskId&&y.workspaceId===(n||null))?i.parentTaskId:""}))}})}),(0,s.jsx)(V,{label:"\u7236\u4EFB\u52A1",children:(0,s.jsx)(Y,{value:m.parentTaskId||za,options:Rr,ariaLabel:"\u5F52\u5C5E\u7236\u4EFB\u52A1",placeholder:"\u5F52\u5C5E\u7236\u4EFB\u52A1",searchable:!0,searchPlaceholder:"\u641C\u7D22\u6B63\u5728\u5904\u7406\u7684\u4EFB\u52A1",className:"task-board-native-select task-board-parent-select",onValueChange:e=>{let n=f.find(i=>i.id===e);_(i=>({...i,parentTaskId:n?.id??"",workspaceId:n?n.workspaceId??"":i.workspaceId,milestoneId:n?.milestoneId??i.milestoneId}))}})}),(0,s.jsx)(V,{label:"\u4EFB\u52A1\u72B6\u6001",children:(0,s.jsx)(Y,{value:m.status,options:re.map(e=>({value:e.status,label:e.label})),ariaLabel:"\u72B6\u6001",className:"task-board-native-select",onValueChange:e=>_(n=>({...n,status:e}))})}),(0,s.jsx)(V,{label:"\u4F18\u5148\u7EA7",children:(0,s.jsx)(Y,{value:m.priority,options:Te.map(e=>({value:e.value,label:e.label})),ariaLabel:"\u4F18\u5148\u7EA7",className:"task-board-native-select",onValueChange:e=>_(n=>({...n,priority:e}))})}),(0,s.jsx)(V,{label:"\u622A\u6B62\u65E5\u671F",children:(0,s.jsx)($t,{ariaLabel:"\u622A\u6B62\u65E5\u671F",value:m.dueDate,popupOwner:"task-board-create",onValueChange:e=>_(n=>({...n,dueDate:e}))})}),(0,s.jsx)(V,{label:"\u8FED\u4EE3",children:(0,s.jsx)(Pt,{value:m.milestoneId||null,workspaceId:m.workspaceId||null,onChange:e=>_(n=>({...n,milestoneId:e??""}))})}),(0,s.jsx)(V,{label:"\u6807\u7B7E",children:(0,s.jsx)(kt,{type:"text",value:m.labels,placeholder:"\u7528\u9017\u53F7\u5206\u9694",onChange:e=>{let n=e.currentTarget.value;_(i=>({...i,labels:n}))}})})]})]}),(0,s.jsxs)(ae,{size:"small",className:"task-board-create-assign task-board-form-section","aria-label":be?"\u7B2C\u4E00\u6B21\u6307\u6D3E":"Agent \u4E0E\u8FD0\u884C\u6A21\u5F0F",children:[(0,s.jsxs)(T,{vertical:!0,gap:4,className:"task-board-create-assign-copy",style:{marginBottom:12},children:[(0,s.jsx)("strong",{children:be?"\u7B2C\u4E00\u6B21\u6307\u6D3E":"Agent \u4E0E\u8FD0\u884C\u6A21\u5F0F"}),(0,s.jsx)("span",{children:Se?"\u4E0D\u6307\u6D3E\u5458\u5DE5\uFF1A\u672C\u673A\u51B3\u7B56\u6A21\u578B\u7ED9\u5EFA\u8BAE\u540D\u5355\uFF0C\u786E\u8BA4\u540E\u624D\u5F00\u5DE5":Ye?"\u6709\u63CF\u8FF0\u65F6\u4F1A\u7ACB\u523B\u4EA4\u7ED9\u56E2\u961F\uFF0C\u7531\u8D1F\u8D23\u4EBA\u62C6\u89E3\u5206\u6D3E":qe?"\u6709\u63CF\u8FF0\u65F6\u4F1A\u7ACB\u523B\u4EA4\u7ED9\u5458\u5DE5":be?"\u6709\u63CF\u8FF0\u65F6\u4F1A\u7ACB\u5373\u4EA4\u7ED9\u6240\u9009\u5DE5\u5177\uFF1B\u914D\u7F6E\u4EC5\u7528\u4E8E\u672C\u4EFB\u52A1":"\u53EA\u521B\u5EFA\u4EFB\u52A1\uFF0C\u4E0D\u6307\u6D3E Agent\uFF1B\u6267\u884C\u914D\u7F6E\u4FDD\u5B58\u5728\u672C\u4EFB\u52A1\u4E2D"})]}),(0,s.jsxs)(T,{wrap:!0,gap:"small",className:"task-board-create-assign-controls",children:[g?(0,s.jsx)(V,{label:"\u6267\u884C\u5BF9\u8C61",children:(0,s.jsx)(Y,{value:Se?Qs:qe?`employee:${qe.id}`:Ye?`team:${Ye.id}`:Cs(m.agent),options:be?en(g,q,J,{includeDispatch:!0}):g,ariaLabel:"\u4EFB\u52A1\u6267\u884C\u5BF9\u8C61",className:"task-board-native-select",onValueChange:e=>{if(an(e)){ua(""),pa(""),se.resetResults(),ut(!0),_(y=>({...y,agent:{...y.agent,kind:"structured"}}));return}ut(!1),se.resetResults();let n=tn(e),i=sn(e);if(ua(n),pa(i),n||i){_(y=>({...y,agent:{...y.agent,kind:"structured"}}));return}_(y=>({...y,agent:xs(y.agent,e,R)}))}})}):(0,s.jsx)("span",{role:"status",children:"\u6B63\u5728\u52A0\u8F7D\u5DE5\u5177\u5217\u8868\u2026"}),Ye||qe||Se?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V,{label:"\u6A21\u578B",children:(0,s.jsx)(Y,{value:m.agent.model,options:Ms(R,m.agent.provider),ariaLabel:"\u4EFB\u52A1\u6267\u884C\u6A21\u578B",searchable:!0,searchPlaceholder:"\u641C\u7D22\u6A21\u578B",className:"task-board-native-select",onValueChange:e=>_(n=>({...n,agent:{...n.agent,model:e}}))})}),(0,s.jsx)(V,{label:"\u601D\u8003\u6DF1\u5EA6",children:(0,s.jsx)(Y,{value:m.agent.thinkingEffort,options:Fs(m.agent.provider,R,m.agent.model,m.agent.thinkingEffort),ariaLabel:"\u4EFB\u52A1\u601D\u8003\u6DF1\u5EA6",className:"task-board-native-select",onValueChange:e=>_(n=>({...n,agent:{...n.agent,thinkingEffort:e}}))})}),(0,s.jsx)(V,{label:"\u8FD0\u884C\u6A21\u5F0F",children:(0,s.jsx)(Y,{value:m.agent.mode,options:Ns(m.agent.provider),ariaLabel:"\u8FD0\u884C\u6A21\u5F0F",className:"task-board-native-select",onValueChange:e=>{_(n=>({...n,agent:{...n.agent,mode:e}}))}})})]})]}),!Ye&&!qe&&!Se&&m.agent.mode==="full-access"&&(0,s.jsx)(We,{type:"warning",showIcon:!0,className:"task-board-create-permission-note",title:"\u5B8C\u5168\u8BBF\u95EE\uFF08Full access\uFF09",description:"\u5DE5\u5177\u4F1A\u81EA\u52A8\u786E\u8BA4\u6743\u9650\u8BF7\u6C42\u3002\u521B\u5EFA\u524D\u8BF7\u786E\u8BA4\u6267\u884C\u5BF9\u8C61\u548C\u9879\u76EE\u76EE\u5F55\u3002"}),!Ye&&!qe&&!Se&&(0,s.jsxs)("div",{className:"task-board-defaults-choice",children:[(0,s.jsx)(ka,{checked:ra,onCheckedChange:Yt,ariaLabel:"\u540C\u65F6\u8BBE\u4E3A\u4EE5\u540E\u9ED8\u8BA4",label:"\u540C\u65F6\u8BBE\u4E3A\u4EE5\u540E\u9ED8\u8BA4",disabled:v==="__create__"}),(0,s.jsx)(L.Text,{type:"secondary",children:"\u521B\u5EFA\u6210\u529F\u540E\u751F\u6548\uFF1B\u4E0D\u6539\u53D8\u5DF2\u6709\u4EFB\u52A1\u6216\u4F1A\u8BDD\u3002"})]}),Se?(0,s.jsx)("div",{className:"task-board-create-dispatch",children:(0,s.jsx)(bn,{flow:se,blockedReason:Lt({selection:se.selection,workspaceId:m.workspaceId,note:m.description,busy:se.busy})})}):null]})]}),ee&&(0,s.jsx)(We,{type:"error",role:"alert",showIcon:!0,title:ee}),(0,s.jsxs)(T,{wrap:!0,gap:"small",align:"center",justify:"space-between",className:"task-board-create-footer",style:{marginTop:16},children:[(0,s.jsx)(ka,{checked:nt,onCheckedChange:or,ariaLabel:"\u521B\u5EFA\u66F4\u591A",label:"\u521B\u5EFA\u66F4\u591A"}),(0,s.jsx)(ne,{className:"task-board-icon-button","aria-label":rt?"\u6536\u8D77\u7F16\u8F91\u5668":"\u5C55\u5F00\u7F16\u8F91\u5668",onClick:()=>qt(e=>!e),children:(0,s.jsx)(D,{name:rt?"chevron":"up"})}),Se?(0,s.jsx)("div",{className:"task-board-create-submit-slot",children:(0,s.jsx)(kn,{flow:se,canPlan:m.description.trim().length>0,blockedReason:Lt({selection:se.selection,workspaceId:m.workspaceId,note:m.description,busy:se.busy})})}):(0,s.jsx)(N,{kind:"primary",type:"submit",className:"task-board-create-submit",disabled:!m.title.trim()&&!m.description.trim()||v==="__create__",children:v==="__create__"?"\u6B63\u5728\u4FDD\u5B58\u2026":be&&m.description.trim()?"\u521B\u5EFA\u5E76\u6307\u6D3E":"\u521B\u5EFA\u4EFB\u52A1"})]})]})})]})}function Lr({task:a,busy:r,catalog:l,agent:c,providerOptions:o,teams:p,teamId:g,employees:S,employeeId:f,teamRunRefresh:b,onTeamChange:P,onEmployeeChange:A,workspaceOptions:R,parent:k,children:u,parentOptions:G,onOpenTask:v,onCreateChild:Z,onAgentChange:ie,onPatch:F,onDispatch:ee,onRemove:le,onOpenSession:Oe,composeRequest:j}){let[H,_e]=d.useState(a.title),[U,Ra]=d.useState(a.labels.join(", ")),Ce=a.sessions.length>0,[at,he]=d.useState(!Ce),[je,$]=d.useState(""),Ie=Ta([a]),tt=a.labels.join("\0"),st=d.useMemo(()=>{let I=[...R];return a.workspaceId&&a.workspace&&!I.some(W=>W.value===a.workspaceId)&&I.splice(1,0,{value:a.workspace.id,label:`${a.workspace.name} \xB7 ${a.workspace.cwd}`}),I},[a.workspace,a.workspaceId,R]);d.useEffect(()=>{_e(a.title),Ra(a.labels.join(", "))},[a.id,a.title,tt]);let Ca=a.sessions.length;return d.useEffect(()=>{let I=Ca>0;he(!I),$("")},[a.id,Ca]),d.useEffect(()=>{j?.id===a.id&&(he(!0),$(""))},[j,a.id]),(0,s.jsx)(T,{vertical:!0,gap:"middle",className:"task-board-detail","aria-label":"\u4EFB\u52A1\u8BE6\u60C5",children:(0,s.jsx)("div",{className:"task-board-detail-scroll",children:(0,s.jsxs)(T,{wrap:!0,gap:"middle",className:"task-board-detail-layout",children:[(0,s.jsxs)(T,{vertical:!0,gap:"middle",className:"task-board-detail-main",style:{flex:"2 1 380px",minWidth:0},children:[k&&(0,s.jsxs)(N,{kind:"ghost",className:"task-board-parent-link",type:"button",onClick:()=>v(k.id),children:["\u21B3 \u5F52\u5C5E ",k.identifier," \xB7 ",k.title]}),(0,s.jsx)(wa,{className:"resize-none task-board-detail-title",rows:1,value:H,"aria-label":"\u4EFB\u52A1\u6807\u9898",disabled:r,onChange:I=>{let W=I.currentTarget.value.replace(/\n/g,"");_e(W)},onBlur:()=>{!H.trim()||H.trim()===a.title||F({title:H.trim()})}}),(0,s.jsx)(qn,{sessions:a.sessions,assigned:a.agent,catalog:l,onOpenSession:Oe}),(u.length>0||a.status==="doing")&&(0,s.jsxs)("section",{className:"task-board-children","aria-label":"\u5B50\u4EFB\u52A1",children:[(0,s.jsxs)("div",{className:"task-board-children-head",children:[(0,s.jsxs)("strong",{children:["\u5B50\u4EFB\u52A1 ",(0,s.jsx)("span",{children:u.length})]}),a.status==="doing"&&(0,s.jsxs)(N,{kind:"ghost",size:"small",onClick:Z,children:[(0,s.jsx)(D,{name:"plus",size:14,slot:"start"}),"\u6D3E\u53D1\u5B50\u4EFB\u52A1"]})]}),u.map(I=>(0,s.jsxs)(N,{kind:"ghost",type:"button",className:"task-board-child-row",onClick:()=>v(I.id),children:[(0,s.jsx)(sa,{status:I.status}),(0,s.jsx)("span",{children:I.title}),(0,s.jsx)("small",{children:I.identifier})]},I.id))]}),at?(0,s.jsxs)(ae,{size:"small",className:"task-board-native-assign","aria-label":"\u6307\u6D3E Agent",children:[(0,s.jsxs)(T,{vertical:!0,gap:4,className:"task-board-native-assign-head",style:{marginBottom:12},children:[(0,s.jsx)("strong",{children:a.sessions.length>0?"\u518D\u6307\u6D3E\u4E00\u4E2A Agent":"\u6307\u6D3E Agent"}),(0,s.jsx)("small",{children:"\u5148\u8F93\u5165\u63D0\u793A\u8BCD\uFF0C\u518D\u9009\u5458\u5DE5\u3001\u56E2\u961F\u6216 CLI"})]}),(0,s.jsx)(wa,{className:"resize-none task-board-detail-body",rows:5,value:je,placeholder:p?.some(I=>I.id===g)?"\u8F93\u5165\u8FD9\u6B21\u4EA4\u7ED9\u56E2\u961F\u7684\u63D0\u793A\u8BCD\u3002\u4EFB\u52A1\u5361\u91CC\u7684\u65E7\u63CF\u8FF0\u4E0D\u4F1A\u81EA\u52A8\u5E26\u4E0A\u3002":S.some(I=>I.id===f)?"\u8F93\u5165\u8FD9\u6B21\u4EA4\u7ED9\u5458\u5DE5\u7684\u4EFB\u52A1\u3002\u4EFB\u52A1\u5361\u91CC\u7684\u65E7\u63CF\u8FF0\u4E0D\u4F1A\u81EA\u52A8\u5E26\u4E0A\u3002":"\u8F93\u5165\u8FD9\u6B21\u6D3E\u7ED9 Agent \u7684\u63D0\u793A\u8BCD\u2026","aria-label":"\u6D3E\u53D1\u63D0\u793A\u8BCD",disabled:r,onChange:I=>{let W=I.currentTarget.value;$(W)}}),(0,s.jsx)(T,{wrap:!0,gap:"middle",className:"task-board-native-editor-grid is-assign",style:{marginTop:12},children:(0,s.jsx)(rn,{agent:c,catalog:l,providerOptions:o,disabled:r,ariaPrefix:"\u4EFB\u52A1",teams:p,teamId:g,employees:S,employeeId:f,onTeamChange:P,onEmployeeChange:A,onChange:ie})}),(0,s.jsxs)("div",{className:"task-board-native-editor-actions",children:[a.sessions.length>0?(0,s.jsx)(N,{kind:"ghost",size:"small",disabled:r,onClick:()=>he(!1),children:"\u53D6\u6D88"}):null,(0,s.jsxs)(N,{kind:"primary",size:"small",className:"task-board-native-dispatch",disabled:r||!je.trim(),onClick:()=>ee(je),children:[(0,s.jsx)(D,{name:"spark",size:14}),r?"\u6B63\u5728\u6D3E\u53D1\u2026":p?.some(I=>I.id===g)?"\u4EA4\u7ED9\u56E2\u961F":f?"\u4EA4\u7ED9\u5458\u5DE5":"\u6D3E\u53D1 CLI"]})]})]}):(0,s.jsx)(N,{kind:"ghost",type:"button",className:"task-board-agent-add","aria-label":"\u518D\u6307\u6D3E\u4E00\u4E2A Agent",disabled:r,onClick:()=>{$(""),he(!0)},children:(0,s.jsx)(D,{name:"plus",size:16})}),(0,s.jsx)(hn,{taskId:a.id,refreshKey:b,onOpenSession:Oe})]}),(0,s.jsx)(ae,{size:"small",title:"\u5C5E\u6027",className:"task-board-detail-properties","aria-label":"\u5C5E\u6027",style:{flex:"1 1 260px",minWidth:0},children:(0,s.jsxs)(ft,{component:!1,layout:"vertical",children:[(0,s.jsx)(V,{label:"\u72B6\u6001",children:(0,s.jsx)(Y,{value:a.status,options:[...re,ha].map(I=>({value:I.status,label:I.label})),ariaLabel:"\u4EFB\u52A1\u72B6\u6001",className:"task-board-native-select",disabled:r,onValueChange:I=>F({status:I})})}),(0,s.jsx)(V,{label:"\u4F18\u5148\u7EA7",children:(0,s.jsx)(Y,{value:a.priority,options:Te.map(I=>({value:I.value,label:I.label})),ariaLabel:"\u4EFB\u52A1\u4F18\u5148\u7EA7",className:"task-board-native-select",disabled:r,onValueChange:I=>F({priority:I})})}),(0,s.jsx)(V,{label:"\u9879\u76EE\u76EE\u5F55",children:(0,s.jsx)(Y,{value:Nt(a.workspaceId),options:st,ariaLabel:"\u4EFB\u52A1\u9879\u76EE",placeholder:"\u9009\u62E9\u9879\u76EE\u76EE\u5F55",searchable:!0,searchPlaceholder:"\u641C\u7D22\u9879\u76EE",className:"task-board-native-select",disabled:r,onValueChange:I=>{let W=Et(I);F({workspaceId:W,...a.parentTaskId&&a.workspaceId!==W?{parentTaskId:null}:{}})}})}),(0,s.jsx)(V,{label:"\u5F52\u5C5E\u7236\u4EFB\u52A1",children:(0,s.jsx)(Y,{value:a.parentTaskId||za,options:G,ariaLabel:"\u5F52\u5C5E\u7236\u4EFB\u52A1",placeholder:"\u5F52\u5C5E\u7236\u4EFB\u52A1",searchable:!0,searchPlaceholder:"\u641C\u7D22\u6B63\u5728\u5904\u7406\u7684\u4EFB\u52A1",className:"task-board-native-select task-board-parent-select",disabled:r,onValueChange:I=>F({parentTaskId:I===za?null:I})})}),(0,s.jsx)(V,{label:"\u91CC\u7A0B\u7891",children:(0,s.jsx)(Pt,{value:a.milestoneId,workspaceId:a.workspaceId,disabled:r,onChange:I=>F({milestoneId:I})})}),(0,s.jsx)(V,{label:"\u622A\u6B62\u65E5\u671F",children:(0,s.jsx)($t,{ariaLabel:"\u4EFB\u52A1\u622A\u6B62\u65E5\u671F",className:"task-board-detail-date",value:a.dueDate??"",disabled:r,onValueChange:I=>F({dueDate:I||null})})}),(0,s.jsxs)(V,{label:"\u6807\u7B7E",children:[(0,s.jsx)(kt,{type:"text",className:"task-board-detail-date",value:U,placeholder:"\u7528\u9017\u53F7\u5206\u9694",disabled:r,onChange:I=>{let W=I.currentTarget.value;Ra(W)},onBlur:()=>{let I=U.split(/[,,]/).map(W=>W.trim()).filter(Boolean);I.join("\0")!==a.labels.join("\0")&&F({labels:I})}}),Ie.length>0&&(0,s.jsx)("div",{className:"task-board-card-meta",children:a.labels.map(I=>(0,s.jsx)(Re,{label:I},I))})]}),(0,s.jsx)("div",{className:"task-board-native-editor-actions",children:$e(a)&&(0,s.jsx)(N,{size:"small",className:"task-board-native-remove",disabled:r,onClick:le,children:"\u5F52\u6863"})})]})})]})})})}export{di as TaskBoardHost};
@@ -0,0 +1,15 @@
1
+ import{shared7_Ea as k,shared7_V as x,shared7_ja as C}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared8_Mc as K,shared8_Rc as b}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared9_a as P}from"/assets/modules/1f93b5bd70381bb6/runtime.js";import{shared10_c as y}from"/assets/modules/1f93b5bd70381bb6/runtime.js";var i=y(P(),1);var A=!1;function S(){if(A||typeof document>"u")return;A=!0;let t=document.createElement("style");t.dataset.turnNavigation="",t.textContent=`
2
+ .chat-turn-navigation-host { position:absolute; inset:8px 12px auto auto; z-index:1; pointer-events:none; }
3
+ .conversation-stream > .turn-nav-dock { position:sticky; top:8px; height:0; z-index:1; align-self:flex-end; }
4
+ .turn-nav-dock { display:flex; justify-content:flex-end; align-items:center; gap:8px; pointer-events:none; }
5
+ .turn-nav-dock .turn-nav-trigger { pointer-events:auto; }
6
+ .turn-nav-reading { font-size:12px; color:var(--text-secondary); white-space:nowrap; }
7
+ .turn-nav-trigger { font-size:12px; color:var(--text-secondary); }
8
+ .turn-nav-directory { width:min(320px,calc(100vw - 48px)); display:flex; flex-direction:column; gap:8px; }
9
+ .turn-nav-range { font-size:12px; }
10
+ .turn-nav-list { list-style:none; margin:0; padding:0; max-height:min(55vh,420px); overflow:auto; }
11
+ .turn-nav-list .turn-nav-entry { width:100%; height:auto; min-height:44px; padding:8px; display:flex; align-items:baseline; text-align:start; }
12
+ .turn-nav-label { flex:none; color:var(--text-secondary); font-size:12px; }
13
+ .turn-nav-preview { min-width:0; white-space:normal; overflow-wrap:anywhere; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
14
+ @media (pointer:coarse) { .turn-nav-trigger { min-height:44px; } }
15
+ `,document.head.appendChild(t)}var o=y(K(),1);function D({scope:t,entries:r,range:e,active:n=!0,readingRoot:s,ownerAttribute:u="data-chat-owner",onJump:B}){let[d,p]=i.useState(!1),[v,h]=i.useState(null);i.useLayoutEffect(()=>{let a=s?.();if(!a||!n){h(null);return}let g=0,N=()=>{let m=a.getBoundingClientRect(),L=new Set(r.map(l=>l.ownerKey)),E=Array.from(a.querySelectorAll(`[${u}]`)).filter(l=>L.has(l.getAttribute(u)||"")&&l.getClientRects().length).sort((l,M)=>l.getBoundingClientRect().top-M.getBoundingClientRect().top),z=m.top+Math.min(80,m.height/3),I=E.filter(l=>l.getBoundingClientRect().top<=z).at(-1)??E.find(l=>l.getBoundingClientRect().top<m.bottom);h(I?.getAttribute(u)??null)},f=()=>{cancelAnimationFrame(g),g=requestAnimationFrame(N)};a.addEventListener("scroll",f,{passive:!0});let R=new ResizeObserver(f);return R.observe(a),N(),()=>{cancelAnimationFrame(g),a.removeEventListener("scroll",f),R.disconnect()}},[t,n,r,s,u]);let[w,c]=i.useState(""),T=i.useId();return i.useLayoutEffect(S,[]),i.useEffect(()=>{p(!1),c("")},[t,n]),!n||!r.length?null:(0,o.jsxs)("div",{className:"turn-nav-dock","data-turn-nav-scope":t,children:[(0,o.jsx)("span",{className:"turn-nav-reading",children:r.find(a=>a.ownerKey===v)?.label?`\u6B63\u5728\u9605\u8BFB\uFF1A${r.find(a=>a.ownerKey===v).label}`:"\u5C1A\u672A\u5B9A\u4F4D\u63D0\u95EE"}),(0,o.jsx)(k,{open:d,onOpenChange:a=>{p(a),c("")},align:"end",side:"bottom",ariaLabel:"\u63D0\u95EE\u76EE\u5F55",contentId:T,contentRole:"navigation",className:"turn-nav-popover",trigger:(0,o.jsxs)(x,{className:"turn-nav-trigger","aria-label":`\u63D0\u95EE\u76EE\u5F55\uFF0C\u5F53\u524D\u5DF2\u8F7D\u5165 ${r.length} \u4E2A\u63D0\u95EE`,"aria-expanded":d,"aria-controls":d?T:void 0,title:e,children:[(0,o.jsx)(C,{name:"history",size:14}),(0,o.jsxs)("span",{children:["\u63D0\u95EE \xB7 ",r.length]})]}),children:(0,o.jsxs)("div",{className:"turn-nav-directory",children:[(0,o.jsx)(b.Text,{type:"secondary",className:"turn-nav-range",children:e}),(0,o.jsx)("ol",{className:"turn-nav-list",children:r.map(a=>(0,o.jsx)("li",{children:(0,o.jsxs)(x,{kind:"ghost",className:"turn-nav-entry","data-turn-nav-owner":a.ownerKey,"aria-current":a.ownerKey===v?"location":void 0,title:a.preview,onClick:()=>{B(a.ownerKey)?(c(""),p(!1)):c("\u8FD9\u6761\u63D0\u95EE\u5DF2\u4E0D\u5728\u5F53\u524D\u8F7D\u5165\u8303\u56F4\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u76EE\u5F55\u3002")},children:[(0,o.jsx)("span",{className:"turn-nav-label",children:a.label}),(0,o.jsx)("span",{className:"turn-nav-preview",children:a.preview})]})},a.ownerKey))}),w?(0,o.jsx)(b.Text,{type:"danger",role:"status",children:w}):null]})})]})}function W(t,r=120){let e=t.replace(/\s+/g," ").trim();return e.length>r?e.slice(0,r-1)+"\u2026":e}function Q(t){let r=new Map;for(let e of t)e.ownerKey&&r.set(e.ownerKey,(r.get(e.ownerKey)??0)+1);return t.flatMap(e=>{if(e.role!=="user"||e.notice||e.placeholder||!e.ownerKey||r.get(e.ownerKey)!==1)return[];let n=W(e.visibleText);return n?[{ownerKey:e.ownerKey,label:"",preview:n,visibleIndex:e.visibleIndex}]:[]}).map((e,n)=>({...e,label:`\u63D0\u95EE ${n+1}`}))}function U(t,r,e=!1){return`\u5F53\u524D\u5DF2\u8F7D\u5165 ${t} \u4E2A\u63D0\u95EE`+(r==="available"?"\uFF1B\u66F4\u65E9\u5185\u5BB9\u8BF7\u7528\u6D88\u606F\u9876\u90E8\u7684\u539F\u6709\u52A0\u8F7D\u5165\u53E3":r==="unknown"?"\uFF1B\u4EC5\u7D22\u5F15\u5F53\u524D\u63D0\u4F9B\u7684\u5386\u53F2\u8303\u56F4":"")+(e?"\uFF1B\u90E8\u5206\u65E7\u63D0\u95EE\u6682\u65E0\u53EF\u9760\u5B9A\u4F4D\u6807\u8BC6":"")}function X(t,r,e){if(!t.isConnected)return!1;let n=Array.from(t.querySelectorAll(`[${e}]`)).find(u=>u.getAttribute(e)===r);if(!n||(n.classList.contains("chat-history-hidden")&&t.querySelector('.chat-history-summary button[aria-expanded="false"]')?.click(),!n.getClientRects().length))return!1;let s=n.getAttribute("tabindex");return n.setAttribute("tabindex","-1"),t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-8,n.focus({preventScroll:!0}),n.addEventListener("blur",()=>{s===null?n.removeAttribute("tabindex"):n.setAttribute("tabindex",s)},{once:!0}),!0}export{D as a,Q as b,U as c,X as d};