@agent-spaces/server 0.3.64 → 0.3.67

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 (332) hide show
  1. package/dist/adapters/agent-runtime.js +4 -0
  2. package/dist/adapters/claude-code-runtime/index.js +68 -2
  3. package/dist/adapters/claude-code-runtime/message-format.js +26 -0
  4. package/dist/adapters/claude-code-runtime/sdk-config.js +12 -0
  5. package/dist/adapters/codex-function-tool-bridge.js +144 -0
  6. package/dist/adapters/codex-runtime.js +23 -4
  7. package/dist/adapters/git.js +25 -7
  8. package/dist/adapters/hermes-runtime.js +210 -0
  9. package/dist/agents/agent-message-parts.js +1 -1
  10. package/dist/agents/commit-agent.js +4 -2
  11. package/dist/agents/issue-task-controller.js +75 -4
  12. package/dist/agents/pull-request-agent.js +115 -0
  13. package/dist/agents/scheduler-agent.js +1 -1
  14. package/dist/app.js +12 -70
  15. package/dist/middleware/auth.js +1 -1
  16. package/dist/package.json +2 -1
  17. package/dist/routes/agent-sse.js +2 -0
  18. package/dist/routes/agent.js +3 -0
  19. package/dist/routes/database.js +1 -0
  20. package/dist/routes/git.js +197 -317
  21. package/dist/routes/issue.js +1 -1
  22. package/dist/routes/notification.js +10 -0
  23. package/dist/routes/robot-account.js +68 -0
  24. package/dist/routes/version.js +94 -0
  25. package/dist/routes/worktree.js +93 -0
  26. package/dist/services/agent.js +37 -3
  27. package/dist/services/builtin-tools/kanban-tools.js +4 -0
  28. package/dist/services/git-operation-log.js +40 -0
  29. package/dist/services/global-wechat-qr.js +72 -0
  30. package/dist/services/hook-engine.js +175 -17
  31. package/dist/services/notification-center.js +9 -0
  32. package/dist/services/notification-hub/bot-agent.js +3 -1
  33. package/dist/services/notification-hub/service.js +12 -2
  34. package/dist/services/robot-account.js +34 -0
  35. package/dist/services/version.js +59 -0
  36. package/dist/services/workflow-command-runner.js +23 -0
  37. package/dist/services/workflow.js +25 -8
  38. package/dist/services/workspace.js +25 -1
  39. package/dist/services/worktree.js +207 -0
  40. package/dist/storage/robot-account-store.js +39 -0
  41. package/dist/storage/worktree-store.js +33 -0
  42. package/dist/web/404.html +1 -1
  43. package/dist/web/__next.__PAGE__.txt +4 -4
  44. package/dist/web/__next._full.txt +23 -25
  45. package/dist/web/__next._head.txt +4 -4
  46. package/dist/web/__next._index.txt +13 -13
  47. package/dist/web/__next._tree.txt +2 -2
  48. package/dist/web/_next/static/chunks/{0n6_4so_afuwk.js → 0-92u-tiuy40a.js} +4 -4
  49. package/dist/web/_next/static/chunks/{0vbqaynjq8ga..js → 0-yizd8osmas2.js} +1 -1
  50. package/dist/web/_next/static/chunks/0.ln~3mnv8.69.js +1 -0
  51. package/dist/web/_next/static/chunks/{0iuf30t0rjsjv.js → 01y3e9pemva7b.js} +10 -10
  52. package/dist/web/_next/static/chunks/02802taez976w.js +67 -0
  53. package/dist/web/_next/static/chunks/02l~tmzrgny.~.js +1 -0
  54. package/dist/web/_next/static/chunks/033.awk90g6eh.js +1 -0
  55. package/dist/web/_next/static/chunks/03f1bwuynjdmk.js +1 -0
  56. package/dist/web/_next/static/chunks/04cb4kc9r2pd1.js +1 -0
  57. package/dist/web/_next/static/chunks/04de6ha5_e3pp.js +1 -0
  58. package/dist/web/_next/static/chunks/06.kdsa9rr2h1.js +1 -0
  59. package/dist/web/_next/static/chunks/09he0p79ov1rn.js +1 -0
  60. package/dist/web/_next/static/chunks/09vpocs4zuc8h.js +1 -0
  61. package/dist/web/_next/static/chunks/0_o2exgr0e_nh.js +1 -0
  62. package/dist/web/_next/static/chunks/{0xbaakj0dfc0..js → 0_y9nskc-xt2k.js} +1 -1
  63. package/dist/web/_next/static/chunks/0clnj-1fi6u8j.js +3 -0
  64. package/dist/web/_next/static/chunks/0gv40by0zzxs_.js +1 -0
  65. package/dist/web/_next/static/chunks/0iusr8y88.kjg.js +1 -0
  66. package/dist/web/_next/static/chunks/{04a4vsq2wknm4.js → 0j-8418fxvkd1.js} +1 -1
  67. package/dist/web/_next/static/chunks/0j-l7l_k9jt45.js +1 -0
  68. package/dist/web/_next/static/chunks/0j.wxxyoclma5.js +1 -0
  69. package/dist/web/_next/static/chunks/0jq.16sozqik..js +3 -0
  70. package/dist/web/_next/static/chunks/0jw8xdk_fpnp0.css +1 -0
  71. package/dist/web/_next/static/chunks/0l1lkd-wcotma.js +1 -0
  72. package/dist/web/_next/static/chunks/0ncxf_zr4n839.js +1 -0
  73. package/dist/web/_next/static/chunks/0ndo7um~v7vco.js +1 -0
  74. package/dist/web/_next/static/chunks/0ngk.~kan8wq_.js +1 -0
  75. package/dist/web/_next/static/chunks/0p3h-h3zj5ujg.js +30 -0
  76. package/dist/web/_next/static/chunks/0pm-un~-sy3rl.js +1 -0
  77. package/dist/web/_next/static/chunks/0rt9bofnn6qvn.js +1 -0
  78. package/dist/web/_next/static/chunks/0t64.9jd00hio.js +3 -0
  79. package/dist/web/_next/static/chunks/0taui9--5n6-5.js +1 -0
  80. package/dist/web/_next/static/chunks/0ty39169lh~z3.js +1 -0
  81. package/dist/web/_next/static/chunks/0uxzi~9b~k4mn.js +31 -0
  82. package/dist/web/_next/static/chunks/0v8nof~waedlu.js +1 -0
  83. package/dist/web/_next/static/chunks/{0ctg5qmw7uu.1.js → 0vcfoagnpf.aw.js} +3 -3
  84. package/dist/web/_next/static/chunks/{08ckpwmmwlors.js → 0wwwq.gyyz0vg.js} +3 -3
  85. package/dist/web/_next/static/chunks/0x5lak8yz7pm7.js +1 -0
  86. package/dist/web/_next/static/chunks/0xon_.4-o0_zq.js +7 -0
  87. package/dist/web/_next/static/chunks/0zjnrbt7inime.js +1 -0
  88. package/dist/web/_next/static/chunks/0zncg76rgtbm-.js +1 -0
  89. package/dist/web/_next/static/chunks/0zwebpitvpuv1.js +1 -0
  90. package/dist/web/_next/static/chunks/0~02o4g-o6n~m.js +1 -0
  91. package/dist/web/_next/static/chunks/{10l-9myrdo3x9.js → 0~fjezp.k4qk3.js} +1 -1
  92. package/dist/web/_next/static/chunks/0~sh93re1-_rp.js +1 -0
  93. package/dist/web/_next/static/chunks/10_niiq0k6o-p.js +5 -0
  94. package/dist/web/_next/static/chunks/12tjr0_2ccrtq.js +2 -0
  95. package/dist/web/_next/static/chunks/12x5.go_x9mfk.js +1 -0
  96. package/dist/web/_next/static/chunks/{1442stwa0gbxe.js → 12~5dk9i9d16t.js} +2 -2
  97. package/dist/web/_next/static/chunks/13iye4rv5p31b.js +1 -0
  98. package/dist/web/_next/static/chunks/{01~quun6sefgl.js → 13~y-b.b9rrw4.js} +1 -1
  99. package/dist/web/_next/static/chunks/151wzhb5q0lo5.js +1 -0
  100. package/dist/web/_next/static/chunks/18c7g84y01mj0.js +1 -0
  101. package/dist/web/_next/static/chunks/{turbopack-0ndm2zc_pdptk.js → turbopack-11qjwlynmfc-n.js} +1 -1
  102. package/dist/web/_not-found/__next._full.txt +30 -29
  103. package/dist/web/_not-found/__next._head.txt +4 -4
  104. package/dist/web/_not-found/__next._index.txt +13 -13
  105. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  106. package/dist/web/_not-found/__next._not-found.txt +3 -3
  107. package/dist/web/_not-found/__next._tree.txt +2 -2
  108. package/dist/web/_not-found.html +1 -1
  109. package/dist/web/_not-found.txt +30 -29
  110. package/dist/web/index.html +1 -1
  111. package/dist/web/index.txt +23 -25
  112. package/dist/web/login/__next._full.txt +28 -28
  113. package/dist/web/login/__next._head.txt +4 -4
  114. package/dist/web/login/__next._index.txt +13 -13
  115. package/dist/web/login/__next._tree.txt +2 -2
  116. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  117. package/dist/web/login/__next.login.txt +3 -3
  118. package/dist/web/login.html +1 -1
  119. package/dist/web/login.txt +28 -28
  120. package/dist/web/settings/__next._full.txt +33 -32
  121. package/dist/web/settings/__next._head.txt +4 -4
  122. package/dist/web/settings/__next._index.txt +13 -13
  123. package/dist/web/settings/__next._tree.txt +2 -2
  124. package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
  125. package/dist/web/settings/__next.settings.txt +5 -5
  126. package/dist/web/settings/agents/__next._full.txt +24 -24
  127. package/dist/web/settings/agents/__next._head.txt +4 -4
  128. package/dist/web/settings/agents/__next._index.txt +13 -13
  129. package/dist/web/settings/agents/__next._tree.txt +2 -2
  130. package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
  131. package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
  132. package/dist/web/settings/agents/__next.settings.txt +5 -5
  133. package/dist/web/settings/agents.html +1 -1
  134. package/dist/web/settings/agents.txt +24 -24
  135. package/dist/web/settings/mcps/__next._full.txt +24 -24
  136. package/dist/web/settings/mcps/__next._head.txt +4 -4
  137. package/dist/web/settings/mcps/__next._index.txt +13 -13
  138. package/dist/web/settings/mcps/__next._tree.txt +2 -2
  139. package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
  140. package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
  141. package/dist/web/settings/mcps/__next.settings.txt +5 -5
  142. package/dist/web/settings/mcps.html +1 -1
  143. package/dist/web/settings/mcps.txt +24 -24
  144. package/dist/web/settings/models/__next._full.txt +24 -24
  145. package/dist/web/settings/models/__next._head.txt +4 -4
  146. package/dist/web/settings/models/__next._index.txt +13 -13
  147. package/dist/web/settings/models/__next._tree.txt +2 -2
  148. package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
  149. package/dist/web/settings/models/__next.settings.models.txt +3 -3
  150. package/dist/web/settings/models/__next.settings.txt +5 -5
  151. package/dist/web/settings/models.html +1 -1
  152. package/dist/web/settings/models.txt +24 -24
  153. package/dist/web/settings/output-styles/__next._full.txt +24 -24
  154. package/dist/web/settings/output-styles/__next._head.txt +4 -4
  155. package/dist/web/settings/output-styles/__next._index.txt +13 -13
  156. package/dist/web/settings/output-styles/__next._tree.txt +2 -2
  157. package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
  158. package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
  159. package/dist/web/settings/output-styles/__next.settings.txt +5 -5
  160. package/dist/web/settings/output-styles.html +1 -1
  161. package/dist/web/settings/output-styles.txt +24 -24
  162. package/dist/web/settings/prompts/__next._full.txt +24 -24
  163. package/dist/web/settings/prompts/__next._head.txt +4 -4
  164. package/dist/web/settings/prompts/__next._index.txt +13 -13
  165. package/dist/web/settings/prompts/__next._tree.txt +2 -2
  166. package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
  167. package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
  168. package/dist/web/settings/prompts/__next.settings.txt +5 -5
  169. package/dist/web/settings/prompts.html +1 -1
  170. package/dist/web/settings/prompts.txt +24 -24
  171. package/dist/web/settings/providers/__next._full.txt +24 -24
  172. package/dist/web/settings/providers/__next._head.txt +4 -4
  173. package/dist/web/settings/providers/__next._index.txt +13 -13
  174. package/dist/web/settings/providers/__next._tree.txt +2 -2
  175. package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
  176. package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
  177. package/dist/web/settings/providers/__next.settings.txt +5 -5
  178. package/dist/web/settings/providers.html +1 -1
  179. package/dist/web/settings/providers.txt +24 -24
  180. package/dist/web/settings/skills/__next._full.txt +24 -24
  181. package/dist/web/settings/skills/__next._head.txt +4 -4
  182. package/dist/web/settings/skills/__next._index.txt +13 -13
  183. package/dist/web/settings/skills/__next._tree.txt +2 -2
  184. package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
  185. package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
  186. package/dist/web/settings/skills/__next.settings.txt +5 -5
  187. package/dist/web/settings/skills.html +1 -1
  188. package/dist/web/settings/skills.txt +24 -24
  189. package/dist/web/settings/tools/__next._full.txt +24 -24
  190. package/dist/web/settings/tools/__next._head.txt +4 -4
  191. package/dist/web/settings/tools/__next._index.txt +13 -13
  192. package/dist/web/settings/tools/__next._tree.txt +2 -2
  193. package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
  194. package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
  195. package/dist/web/settings/tools/__next.settings.txt +5 -5
  196. package/dist/web/settings/tools.html +1 -1
  197. package/dist/web/settings/tools.txt +24 -24
  198. package/dist/web/settings.html +1 -1
  199. package/dist/web/settings.txt +33 -32
  200. package/dist/web/workflows/__next._full.txt +31 -33
  201. package/dist/web/workflows/__next._head.txt +4 -4
  202. package/dist/web/workflows/__next._index.txt +13 -13
  203. package/dist/web/workflows/__next._tree.txt +2 -2
  204. package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
  205. package/dist/web/workflows/__next.workflows.txt +3 -3
  206. package/dist/web/workflows.html +1 -1
  207. package/dist/web/workflows.txt +31 -33
  208. package/dist/web/workspace/_/__next._full.txt +28 -29
  209. package/dist/web/workspace/_/__next._head.txt +4 -4
  210. package/dist/web/workspace/_/__next._index.txt +13 -13
  211. package/dist/web/workspace/_/__next._tree.txt +2 -2
  212. package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
  213. package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
  214. package/dist/web/workspace/_/__next.workspace.txt +3 -3
  215. package/dist/web/workspace/_.html +1 -1
  216. package/dist/web/workspace/_.txt +28 -29
  217. package/dist/web/workspaces/__next._full.txt +29 -31
  218. package/dist/web/workspaces/__next._head.txt +4 -4
  219. package/dist/web/workspaces/__next._index.txt +13 -13
  220. package/dist/web/workspaces/__next._tree.txt +2 -2
  221. package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
  222. package/dist/web/workspaces/__next.workspaces.txt +3 -3
  223. package/dist/web/workspaces.html +1 -1
  224. package/dist/web/workspaces.txt +29 -31
  225. package/dist/ws/agent-prompt.js +32 -3
  226. package/dist/ws/agent-runner.js +83 -6
  227. package/package.json +11 -11
  228. package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +0 -1
  229. package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +0 -1
  230. package/dist/web/_next/static/chunks/02mf61htij8g0.js +0 -31
  231. package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +0 -3
  232. package/dist/web/_next/static/chunks/04fxddw-y20~-.js +0 -7
  233. package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +0 -1
  234. package/dist/web/_next/static/chunks/05oc21sj24wtq.js +0 -1
  235. package/dist/web/_next/static/chunks/08kfx8on9oty~.js +0 -1
  236. package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +0 -1
  237. package/dist/web/_next/static/chunks/099h96wjsdb25.js +0 -2
  238. package/dist/web/_next/static/chunks/09h23logvq65m.js +0 -1
  239. package/dist/web/_next/static/chunks/0a5y-vhf4i5id.js +0 -3
  240. package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +0 -24
  241. package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +0 -1
  242. package/dist/web/_next/static/chunks/0ewceguykiut5.js +0 -1
  243. package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +0 -67
  244. package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +0 -1
  245. package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +0 -1
  246. package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +0 -1
  247. package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +0 -1
  248. package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +0 -1
  249. package/dist/web/_next/static/chunks/0os58q93stt7j.js +0 -3
  250. package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +0 -1
  251. package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +0 -1
  252. package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +0 -1
  253. package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +0 -1
  254. package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +0 -1
  255. package/dist/web/_next/static/chunks/0v3a_x4vt42kx.js +0 -5
  256. package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +0 -1
  257. package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +0 -1
  258. package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +0 -1
  259. package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +0 -1
  260. package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +0 -16
  261. package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +0 -1
  262. package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +0 -1
  263. package/public/output-styles/carmack-mode.md +0 -381
  264. package/public/output-styles/codex-rigor-mode.md +0 -114
  265. package/public/output-styles/dhh-mode.md +0 -265
  266. package/public/output-styles/evan-you-mode.md +0 -539
  267. package/public/output-styles/index.json +0 -37
  268. package/public/output-styles/jobs-mode.md +0 -369
  269. package/public/output-styles/linus-mode.md +0 -135
  270. package/public/output-styles/uncle-bob-mode.md +0 -221
  271. package/public/prompt/andrej-karpathy-skills.md +0 -65
  272. package/public/prompt/claude-token-efficient-coding.md +0 -35
  273. package/public/prompt/index.json +0 -12
  274. package/public/skills/index.json +0 -92
  275. package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +0 -243
  276. package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +0 -44
  277. package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +0 -46
  278. package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +0 -124
  279. package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +0 -124
  280. package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +0 -438
  281. package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +0 -29
  282. package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +0 -40
  283. package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +0 -58
  284. package/public/skills/superpowers/brainstorming/SKILL.md +0 -164
  285. package/public/skills/superpowers/brainstorming/scripts/frame-template.html +0 -214
  286. package/public/skills/superpowers/brainstorming/scripts/helper.js +0 -88
  287. package/public/skills/superpowers/brainstorming/scripts/server.cjs +0 -354
  288. package/public/skills/superpowers/brainstorming/scripts/start-server.sh +0 -148
  289. package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +0 -56
  290. package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +0 -49
  291. package/public/skills/superpowers/brainstorming/visual-companion.md +0 -287
  292. package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +0 -182
  293. package/public/skills/superpowers/executing-plans/SKILL.md +0 -70
  294. package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +0 -251
  295. package/public/skills/superpowers/receiving-code-review/SKILL.md +0 -213
  296. package/public/skills/superpowers/requesting-code-review/SKILL.md +0 -103
  297. package/public/skills/superpowers/requesting-code-review/code-reviewer.md +0 -168
  298. package/public/skills/superpowers/subagent-driven-development/SKILL.md +0 -279
  299. package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
  300. package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +0 -113
  301. package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +0 -61
  302. package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +0 -119
  303. package/public/skills/superpowers/systematic-debugging/SKILL.md +0 -296
  304. package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +0 -158
  305. package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +0 -115
  306. package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +0 -122
  307. package/public/skills/superpowers/systematic-debugging/find-polluter.sh +0 -63
  308. package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +0 -169
  309. package/public/skills/superpowers/systematic-debugging/test-academic.md +0 -14
  310. package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +0 -58
  311. package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +0 -68
  312. package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +0 -69
  313. package/public/skills/superpowers/test-driven-development/SKILL.md +0 -371
  314. package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +0 -299
  315. package/public/skills/superpowers/using-git-worktrees/SKILL.md +0 -215
  316. package/public/skills/superpowers/using-superpowers/SKILL.md +0 -117
  317. package/public/skills/superpowers/using-superpowers/references/codex-tools.md +0 -59
  318. package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +0 -42
  319. package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +0 -51
  320. package/public/skills/superpowers/verification-before-completion/SKILL.md +0 -139
  321. package/public/skills/superpowers/writing-plans/SKILL.md +0 -152
  322. package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +0 -49
  323. package/public/skills/superpowers/writing-skills/SKILL.md +0 -655
  324. package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +0 -1150
  325. package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
  326. package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +0 -172
  327. package/public/skills/superpowers/writing-skills/persuasion-principles.md +0 -187
  328. package/public/skills/superpowers/writing-skills/render-graphs.js +0 -168
  329. package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +0 -384
  330. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_buildManifest.js +0 -0
  331. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_clientMiddlewareManifest.js +0 -0
  332. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,259295,e=>{"use strict";var s=e.i(344180),t=e.i(764556),a=e.i(799543),r=e.i(451534),o=e.i(315775),i=e.i(962562),n=e.i(953700),c=e.i(137340),l=e.i(244644),d=e.i(244073),p=e.i(260218),u=e.i(917955),m=e.i(524),x=e.i(361031),h=e.i(233297);function f({initialWorkspaces:e}){let j=(0,d.useTranslations)("workspaces");(0,d.useTranslations)("common");let g=(0,a.useRouter)(),k=(0,x.useWorkspaceStore)(e=>e.workspaces),w=(0,x.useWorkspaceStore)(e=>e.setWorkspaces),b=(0,x.useWorkspaceStore)(e=>e.upsertWorkspace),N=(0,x.useWorkspaceStore)(e=>e.removeWorkspace),[v,y]=(0,t.useState)(!1),[S,T]=(0,t.useState)(null);(0,t.useEffect)(()=>{w(e)},[e,w]);let C=async e=>{if(S){let s=await fetch(`/api/workspaces/${S.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});b(await s.json())}else{let s=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});b(await s.json())}},P=async e=>{confirm(j("deleteConfirm",{name:e.name}))&&(await fetch(`/api/workspaces/${e.id}`,{method:"DELETE"}),N(e.id))},z=async e=>{await fetch(`/api/workspaces/${e.id}/reveal`,{method:"POST"})};return(0,s.jsxs)("div",{className:"flex min-h-dvh w-full flex-col",children:[(0,s.jsxs)("main",{className:"mx-auto size-full max-w-7xl flex-1 px-4 py-6 sm:px-6",children:[(0,s.jsxs)("div",{className:"mb-6 flex items-center justify-between",children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold",children:j("title")}),(0,s.jsxs)(p.Button,{onClick:()=>{T(null),y(!0)},size:"sm",className:"rounded-full px-4",children:[(0,s.jsx)(n.Plus,{className:"size-3.5"}),j("newWorkspace")]})]}),0===k.length?(0,s.jsxs)("div",{className:"rounded-2xl border border-dashed border-border p-16 text-center",children:[(0,s.jsx)(r.FolderOpen,{className:"size-10 mx-auto text-muted-foreground/40 mb-4"}),(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:j("emptyMessage")})]}):(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:k.map(e=>(0,s.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>(0,h.tauriNavigate)(g,`/workspace/${e.id}`),onKeyDown:s=>{"Enter"===s.key&&(0,h.tauriNavigate)(g,`/workspace/${e.id}`)},className:"group relative cursor-pointer rounded-2xl border border-border bg-card p-5 hover:shadow-card-hover transition-all duration-200 block",children:[(0,s.jsxs)(u.DropdownMenu,{children:[(0,s.jsx)(u.DropdownMenuTrigger,{className:"absolute right-3 top-3 flex items-center justify-center rounded-md p-1 opacity-0 group-hover:opacity-100 hover:bg-accent transition-opacity cursor-pointer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(o.MoreHorizontal,{className:"size-4 text-muted-foreground"})}),(0,s.jsxs)(u.DropdownMenuContent,{align:"end",children:[(0,s.jsxs)(u.DropdownMenuItem,{onClick:s=>{s.stopPropagation(),T(e),y(!0)},children:[(0,s.jsx)(i.Pencil,{className:"size-3.5"}),j("edit")]}),(0,s.jsxs)(u.DropdownMenuItem,{onClick:s=>{s.stopPropagation(),z(e)},children:[(0,s.jsx)(l.FolderSearch,{className:"size-3.5"}),j("reveal")]}),(0,s.jsxs)(u.DropdownMenuItem,{variant:"destructive",onClick:s=>{s.stopPropagation(),P(e)},children:[(0,s.jsx)(c.Trash2,{className:"size-3.5"}),j("delete")]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 shrink-0 rounded-xl bg-primary/10 flex items-center justify-center",children:(0,s.jsx)(r.FolderOpen,{className:"size-5 text-primary"})}),(0,s.jsx)("h3",{className:"font-heading text-lg font-semibold truncate",children:e.name})]}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:e.boundDirs.join(", ")})]},e.id))})]}),(0,s.jsx)(m.WorkspaceDialog,{open:v,onOpenChange:y,workspace:S,onSubmit:C})]})}var j=e.i(437122);e.s(["default",0,function(){let[e,a]=(0,t.useState)([]);return(0,t.useEffect)(()=>{fetch("/api/workspaces",{headers:(0,j.authHeaders)()}).then(e=>e.ok?e.json():[]).then(a)},[]),(0,s.jsx)(f,{initialWorkspaces:e})}],259295)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,837121,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"warnOnce",{enumerable:!0,get:function(){return s}});let s=e=>{}},361031,e=>{"use strict";let t=(0,e.i(816709).create)(e=>({workspaces:[],setWorkspaces:t=>e({workspaces:t}),upsertWorkspace:t=>{e(e=>{let a=e.workspaces.findIndex(e=>e.id===t.id);if(-1===a)return{workspaces:[...e.workspaces,t]};let s=[...e.workspaces];return s[a]=t,{workspaces:s}})},removeWorkspace:t=>{e(e=>({workspaces:e.workspaces.filter(e=>e.id!==t)}))}}));e.s(["useWorkspaceStore",0,t])},613087,e=>{"use strict";var t=e.i(344180),a=e.i(465458);e.s(["Skeleton",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"skeleton",className:(0,a.cn)("animate-pulse rounded-md bg-muted",e),...s})},"SkeletonGroup",0,function({count:e=3,children:a}){return(0,t.jsx)(t.Fragment,{children:Array.from({length:e},(e,s)=>(0,t.jsx)("div",{children:a(s)},s))})}])},817854,e=>{"use strict";var t=e.i(344180),a=e.i(465458);e.s(["Label",0,function({className:e,...s}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,a.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}])},210,e=>{"use strict";let t=(0,e.i(433721).default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);e.s(["Settings2",0,t],210)},226651,e=>{"use strict";let t=(0,e.i(433721).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);e.s(["default",0,t])},315775,e=>{"use strict";var t=e.i(226651);e.s(["MoreHorizontal",()=>t.default])},381253,e=>{"use strict";let t=(0,e.i(433721).default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]);e.s(["FileCode",0,t],381253)},905724,e=>{"use strict";let t=(0,e.i(433721).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",0,t])},989484,e=>{"use strict";var t=e.i(905724);e.s(["FileText",()=>t.default])},974267,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"BailoutToCSR",{enumerable:!0,get:function(){return n}});let s=e.r(981225);function n({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new s.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},404590,(e,t,a)=>{"use strict";function s(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"encodeURIPath",{enumerable:!0,get:function(){return s}})},172441,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"PreloadChunks",{enumerable:!0,get:function(){return o}});let s=e.r(344180),n=e.r(106206),i=e.r(94932),r=e.r(404590),l=e.r(745137);function o({moduleIds:e}){if("u">typeof window)return null;let t=i.workAsyncStorage.getStore();if(void 0===t)return null;let a=[];if(t.reactLoadableManifest&&e){let s=t.reactLoadableManifest;for(let t of e){if(!s[t])continue;let e=s[t].files;a.push(...e)}}if(0===a.length)return null;let c=(0,l.getAssetTokenQuery)();return(0,s.jsx)(s.Fragment,{children:a.map(e=>{let a=`${t.assetPrefix}/_next/${(0,r.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,s.jsx)("link",{precedence:"dynamic",href:a,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,n.preload)(a,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},672479,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"default",{enumerable:!0,get:function(){return c}});let s=e.r(344180),n=e.r(764556),i=e.r(974267),r=e.r(172441);function l(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},c=function(e){let t={...o,...e},a=(0,n.lazy)(()=>t.loader().then(l)),c=t.loading;function d(e){let l=c?(0,s.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?n.Suspense:n.Fragment,u=t.ssr?(0,s.jsxs)(s.Fragment,{children:["u"<typeof window?(0,s.jsx)(r.PreloadChunks,{moduleIds:t.modules}):null,(0,s.jsx)(a,{...e})]}):(0,s.jsx)(i.BailoutToCSR,{reason:"next/dynamic",children:(0,s.jsx)(a,{...e})});return(0,s.jsx)(d,{...o?{fallback:l}:{},children:u})}return d.displayName="LoadableComponent",d}},887836,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"default",{enumerable:!0,get:function(){return n}});let s=e.r(481258)._(e.r(672479));function n(e,t){let a={};"function"==typeof e&&(a.loader=e);let n={...a,...t};return(0,s.default)({...n,modules:n.loadableGenerated?.modules})}("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),t.exports=a.default)},977694,e=>{"use strict";let t=(0,e.i(433721).default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);e.s(["Rocket",0,t],977694)},401058,e=>{"use strict";let t=(0,e.i(433721).default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);e.s(["MoreVertical",0,t],401058)},239340,e=>{"use strict";var t=e.i(344180),a=e.i(209988),s=e.i(260218),n=e.i(611176),i=e.i(972846),r=e.i(465458);e.s(["AgentPickerDialog",0,function({open:e,onClose:l,onConfirm:o,title:c,description:d,agents:u,selected:m,onToggle:p,cancelText:h,confirmText:f,loading:x}){return(0,t.jsx)(a.Dialog,{open:e,onOpenChange:e=>{e||l()},children:(0,t.jsxs)(a.DialogContent,{className:"sm:max-w-sm flex flex-col gap-0 overflow-hidden p-0",children:[(0,t.jsxs)(a.DialogHeader,{className:"shrink-0 px-6 py-4",children:[(0,t.jsx)(a.DialogTitle,{children:c}),d&&(0,t.jsx)(a.DialogDescription,{children:d})]}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 pb-2 overflow-y-auto px-6 space-y-3",children:[(0,t.jsx)("div",{className:"space-y-0.5",children:u.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>p(e.id),className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,t.jsx)(n.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:(0,r.cn)("flex items-center justify-center size-4 rounded border shrink-0",m.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),m.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m.map(e=>{let a=u.find(t=>t.id===e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs max-w-[160px] min-w-0",children:[(0,t.jsx)(n.AgentIcon,{agentId:e,name:a?.name,avatarUrl:a?.avatarUrl,className:"size-3.5 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:a?.name||e}),(0,t.jsx)("button",{type:"button",onClick:()=>p(e),className:"hover:text-destructive shrink-0 cursor-pointer",children:(0,t.jsx)(i.X,{className:"size-3"})})]},e)})})]}),(0,t.jsxs)("div",{className:"shrink-0 flex justify-end gap-2 border-t px-6 py-4",children:[(0,t.jsx)(s.Button,{variant:"outline",onClick:l,children:h||"Cancel"}),(0,t.jsx)(s.Button,{onClick:o,disabled:x||0===m.length,children:f||"Confirm"})]})]})})}])},513501,e=>{"use strict";let t=(0,e.i(433721).default)("store",[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]);e.s(["Store",0,t],513501)},327962,e=>{"use strict";let t=(0,e.i(433721).default)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);e.s(["GitBranch",0,t],327962)},964970,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(244073),n=e.i(260218),i=e.i(681622),r=e.i(817854),l=e.i(360112),o=e.i(437122);e.s(["GitSettingsForm",0,function({scope:e,workspaceId:c}){let d=(0,s.useTranslations)("git.settings"),u=(0,s.useTranslations)("common"),[m,p]=(0,a.useState)(""),[h,f]=(0,a.useState)(""),[x,g]=(0,a.useState)(""),[y,v]=(0,a.useState)(""),[j,w]=(0,a.useState)(!0),[b,k]=(0,a.useState)(!1),S=(0,a.useCallback)(async()=>{w(!0);try{let t="global"===e?"/api/git-config":`/api/workspaces/${c}/git/config`,a=await fetch(t,{headers:(0,o.authHeaders)()});if(a.ok){let e=await a.json();p(e.name??""),f(e.email??""),g(e.proxy??"")}if("local"===e&&c){let e=await fetch(`/api/workspaces/${c}/git/remote-url`,{headers:(0,o.authHeaders)()});if(e.ok){let t=await e.json();v(t.url??"")}}}catch{}w(!1)},[e,c]);(0,a.useEffect)(()=>{S()},[e,c,S]);let N=async()=>{k(!0);try{let t="global"===e?"/api/git-config":`/api/workspaces/${c}/git/config`;if(!(await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",...(0,o.authHeaders)()},body:JSON.stringify({name:m,email:h,proxy:x})})).ok){l.toast.error(d("saveFailed")),k(!1);return}"local"===e&&c&&y&&await fetch(`/api/workspaces/${c}/git/remotes`,{method:"POST",headers:{"Content-Type":"application/json",...(0,o.authHeaders)()},body:JSON.stringify({name:"origin",url:y})}),l.toast.success(d("saved"))}catch{l.toast.error(d("saveFailed"))}k(!1)};return j?(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:d("loading")}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"global"===e?d("globalScopeDescription"):d("localScopeDescription")}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(r.Label,{className:"text-xs text-muted-foreground",children:d("name")}),(0,t.jsx)(i.Input,{className:"h-7 text-xs",value:m,onChange:e=>p(e.target.value),placeholder:d("namePlaceholder")})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(r.Label,{className:"text-xs text-muted-foreground",children:d("email")}),(0,t.jsx)(i.Input,{className:"h-7 text-xs",value:h,onChange:e=>f(e.target.value),placeholder:d("emailPlaceholder")})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(r.Label,{className:"text-xs text-muted-foreground",children:d("proxy")}),(0,t.jsx)(i.Input,{className:"h-7 text-xs",value:x,onChange:e=>g(e.target.value),placeholder:d("proxyPlaceholder")})]}),"local"===e&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(r.Label,{className:"text-xs text-muted-foreground",children:d("remoteUrl")}),(0,t.jsx)(i.Input,{className:"h-7 text-xs",value:y,onChange:e=>v(e.target.value),placeholder:d("remoteUrlPlaceholder")})]}),(0,t.jsx)(n.Button,{size:"sm",className:"text-xs",onClick:N,disabled:b,children:u(b?"loading":"save")})]})}])},951841,e=>{"use strict";let t;var a=e.i(764556);let s=new Set;e.s(["setCachedUserAvatarUrl",0,function(e){t=e,s.forEach(t=>t(e))},"useUserAvatar",0,function(){let[e,n]=(0,a.useState)(()=>void 0!==t?t:null);return(0,a.useEffect)(()=>(void 0===t&&fetch("/api/user/settings").then(e=>e.json()).then(e=>{e.avatarUrl&&(t=e.avatarUrl,n(e.avatarUrl))}).catch(()=>{}),s.add(n),()=>{s.delete(n)}),[]),e}])},249673,380797,e=>{"use strict";let t=(0,e.i(433721).default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["default",0,t],380797),e.s(["ChevronUp",0,t],249673)},14452,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(724966),n=e.i(465458),i=e.i(260218),r=e.i(422373),l=e.i(250226);function o({...e}){return(0,t.jsx)(s.Dialog.Portal,{"data-slot":"sheet-portal",...e})}function c({className:e,...a}){return(0,t.jsx)(s.Dialog.Backdrop,{"data-slot":"sheet-overlay",className:(0,n.cn)("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...a})}e.s(["Sheet",0,function({ignoreBack:e=!1,...n}){let i=a.useId(),r=(0,l.useMobilePanelStore)(e=>e.registerOverlay),o=(0,l.useMobilePanelStore)(e=>e.unregisterOverlay),c="open"in n?n.open:"defaultOpen"in n?n.defaultOpen:void 0,d=n.onOpenChange,u=a.useRef(d);return a.useEffect(()=>{u.current=d},[d]),a.useEffect(()=>c&&!e&&u.current?(r(i,()=>u.current?.(!1,{reason:void 0})),()=>o(i)):void o(i),[e,c,i,r,o]),(0,t.jsx)(s.Dialog.Root,{"data-slot":"sheet",...n})},"SheetContent",0,function({className:e,children:a,side:l="right",showCloseButton:d=!0,...u}){return(0,t.jsxs)(o,{children:[(0,t.jsx)(c,{}),(0,t.jsxs)(s.Dialog.Popup,{"data-slot":"sheet-content","data-side":l,className:(0,n.cn)("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:top-[var(--app-top-inset)] data-[side=left]:bottom-0 data-[side=left]:left-0 data-[side=left]:h-[calc(100dvh-var(--app-top-inset))] data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:top-[var(--app-top-inset)] data-[side=right]:right-0 data-[side=right]:bottom-0 data-[side=right]:h-[calc(100dvh-var(--app-top-inset))] data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-[var(--app-top-inset)] data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...u,children:[a,d&&(0,t.jsxs)(s.Dialog.Close,{"data-slot":"sheet-close",render:(0,t.jsx)(i.Button,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[(0,t.jsx)(r.XIcon,{}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})},"SheetDescription",0,function({className:e,...a}){return(0,t.jsx)(s.Dialog.Description,{"data-slot":"sheet-description",className:(0,n.cn)("text-sm text-muted-foreground",e),...a})},"SheetHeader",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"sheet-header",className:(0,n.cn)("flex flex-col gap-0.5 p-4",e),...a})},"SheetTitle",0,function({className:e,...a}){return(0,t.jsx)(s.Dialog.Title,{"data-slot":"sheet-title",className:(0,n.cn)("font-heading text-base font-medium text-foreground",e),...a})}])},157408,e=>{"use strict";var t=e.i(523592),a=e.i(437122);class s{workspaceId;ws;handlers;reconnectTimer;url;disposed;constructor(e){this.workspaceId=e,this.ws=null,this.handlers=new Map,this.reconnectTimer=null,this.disposed=!1,this.onVisibilityChange=()=>{"visible"!==document.visibilityState||this.disposed||this.ws&&this.ws.readyState!==WebSocket.CLOSED&&this.ws.readyState!==WebSocket.CLOSING||(console.log("[WS] page visible, reconnecting..."),this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.connect())};const s=(0,t.getActiveServerUrl)(),n=(0,a.getToken)(),i=new URL("/ws",s??window.location.origin);i.protocol="https:"===i.protocol?"wss:":"ws:",i.searchParams.set("workspaceId",e),n&&i.searchParams.set("token",n),this.url=i.toString(),document.addEventListener("visibilitychange",this.onVisibilityChange)}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("[WS] connected");let e=this.handlers.get("connected");if(e)for(let t of e)t(void 0)},this.ws.onmessage=e=>{try{let t=JSON.parse(e.data),a=this.handlers.get(t.event);if(a)for(let e of a)e(t.data)}catch{console.error("[WS] parse error")}},this.ws.onclose=e=>{console.log(`[WS] disconnected (${e.code}${e.reason?`: ${e.reason}`:""}), reconnecting...`),this.reconnectTimer=setTimeout(()=>this.connect(),3e3)},this.ws.onerror=()=>{this.ws?.close()}}onVisibilityChange;disconnect(){this.disposed=!0,document.removeEventListener("visibilitychange",this.onVisibilityChange),this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.ws?.close(),this.ws=null}send(e,t){this.ws?.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({event:e,data:t}))}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>this.handlers.get(e)?.delete(t)}off(e,t){this.handlers.get(e)?.delete(t)}}let n=null;e.s(["getWS",0,function(e){return n&&n.workspaceId!==e&&(n.disconnect(),n=null),n||(n=new s(e)).connect(),n}])},31807,e=>{"use strict";var t=e.i(816709),a=e.i(157408);let s="agent-spaces:channel:",n=(0,t.create)((e,t)=>({workspaceId:null,channels:[],activeChannelId:null,channelSelectSeq:0,messages:{},loadChannels:async t=>{let a=await fetch(`/api/workspaces/${t}/channels`),n=await a.json(),i=function(e,t){try{let a=localStorage.getItem(s+e);if(a&&t.some(e=>e.id===a))return a}catch{}return t[0]?.id??null}(t,n);e({workspaceId:t,channels:n,activeChannelId:i})},createChannel:async(t,a,s="general",n)=>{let i=await fetch(`/api/workspaces/${t}/channels`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,type:s,members:n})}),r=await i.json();e(e=>({channels:e.channels.some(e=>e.id===r.id)?e.channels.map(e=>e.id===r.id?r:e):[...e.channels,r],activeChannelId:r.id}))},updateChannel:async(t,a,s)=>{let n=await fetch(`/api/workspaces/${t}/channels/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw Error("Failed to update channel");let i=await n.json();return e(e=>({channels:e.channels.map(e=>e.id===a?i:e)})),i},setActiveChannel:t=>{let{workspaceId:a}=n.getState();if(a)try{localStorage.setItem(s+a,t)}catch{}e(e=>({activeChannelId:t,channelSelectSeq:e.channelSelectSeq+1}))},loadMessages:async(t,a)=>{let s=await fetch(`/api/workspaces/${t}/channels/${a}/messages`),n=await s.json();e(e=>({messages:{...e.messages,[a]:n}}))},loadChannelState:async(e,t)=>{let a=await fetch(`/api/workspaces/${e}/channels/${t}/state`);return a.ok?await a.json():null},sendMessage:(e,t,s,n=[],i=[],r)=>{(0,a.getWS)(e).send("channel.message",{channelId:t,content:s,mentions:n,attachments:i,replyToMessageId:r})},addMessage:(t,a)=>{e(e=>({messages:{...e.messages,[t]:[...e.messages[t]||[],a]}}))},updateMessage:(t,a)=>{e(e=>({messages:{...e.messages,[t]:(e.messages[t]||[]).map(e=>e.id===a.id?a:e)}}))},stopProcessingMessages:t=>{e(e=>({messages:{...e.messages,[t]:(e.messages[t]||[]).map(e=>"pending"===e.status||"streaming"===e.status||"waiting_for_user"===e.status?{...e,status:"error",content:e.content||"Stopped by user"}:e)}}))},deleteMessage:(t,a)=>{e(e=>({messages:{...e.messages,[t]:(e.messages[t]||[]).filter(e=>e.id!==a)}}))},clearMessages:async(t,a)=>{await fetch(`/api/workspaces/${t}/channels/${a}/messages`,{method:"DELETE"}),e(e=>({messages:{...e.messages,[a]:[]}}))},deleteChannel:async(e,a)=>{await fetch(`/api/workspaces/${e}/channels/${a}`,{method:"DELETE"}),t().removeChannelLocal(a)},removeChannelLocal:t=>{e(e=>{let a=e.channels.filter(e=>e.id!==t),s={...e.messages};return delete s[t],{channels:a,activeChannelId:e.activeChannelId===t?a[0]?.id??null:e.activeChannelId,messages:s}})},upsertChannel:t=>{e(e=>{let a=e.channels.findIndex(e=>e.id===t.id);if(a<0)return"string"==typeof t.workspaceId&&"string"==typeof t.name&&("general"===t.type||"issue"===t.type||"agent"===t.type)&&Array.isArray(t.members)&&"string"==typeof t.createdAt?{channels:[...e.channels,t]}:{channels:e.channels};let s=[...e.channels],n=s[a];return s[a]={...n,...t,members:Array.isArray(t.members)?t.members:n.members},{channels:s}})},saveDraft:async(t,a,s)=>{let i=n.getState().channels.find(e=>e.id===a);if(i?.draft?.content===s)return;let r={content:s,updatedAt:new Date().toISOString()};e(e=>({channels:e.channels.map(e=>e.id===a?{...e,draft:r}:e)})),await fetch(`/api/workspaces/${t}/channels/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:r})})},clearDraft:async(t,a)=>{e(e=>({channels:e.channels.map(e=>e.id===a?{...e,draft:void 0}:e)})),await fetch(`/api/workspaces/${t}/channels/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:null})})},ensureAndActivateChannel:async(a,s)=>{let{channels:n}=t();if(!n.some(e=>e.id===s)){let t=await fetch(`/api/workspaces/${a}/channels`);t.ok&&e({channels:await t.json()})}t().setActiveChannel(s)}}));e.s(["useChannelStore",0,n])},873111,e=>{"use strict";let t=(0,e.i(816709).create)((e,t)=>({tasks:[],loading:!1,loadTasks:async(t,a)=>{e({loading:!0});try{let s=a?`?issueId=${a}`:"",n=await fetch(`/api/workspaces/${t}/tasks${s}`),i=await n.json();e({tasks:i,loading:!1})}catch{e({loading:!1})}},createTask:async(e,a,s,n,i)=>{let r=await fetch(`/api/workspaces/${e}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:a,title:s,description:n,agentConfigId:i})}),l=await r.json();return t().upsertTask(l),l},updateTask:async(e,a,s)=>{let n=await fetch(`/api/workspaces/${e}/tasks/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),i=await n.json();t().upsertTask(i)},deleteTask:async(t,a)=>{await fetch(`/api/workspaces/${t}/tasks/${a}`,{method:"DELETE"}),e(e=>({tasks:e.tasks.filter(e=>e.id!==a)}))},retryTask:async(e,a)=>{let s=await fetch(`/api/workspaces/${e}/tasks/${a}/retry`,{method:"POST"}),n=await s.json();t().upsertTask(n)},cancelTask:async(e,a)=>{let s=await fetch(`/api/workspaces/${e}/tasks/${a}/cancel`,{method:"POST"}),n=await s.json();t().upsertTask(n)},reorderTasks:async(e,t,a)=>{await fetch(`/api/workspaces/${e}/tasks/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,taskIds:a})})},upsertTask:t=>{e(e=>{let a=e.tasks.findIndex(e=>e.id===t.id);if(a>=0){let s=[...e.tasks];return s[a]=t,{tasks:s}}return{tasks:[...e.tasks,t]}})}}));e.s(["useTaskStore",0,t])},327964,e=>{"use strict";var t=e.i(816709),a=e.i(31807),s=e.i(873111);let n="agent-spaces:issue:",i=(0,t.create)((t,r)=>({workspaceId:null,issues:[],activeIssueId:null,issueSelectSeq:0,loading:!1,loadIssues:async e=>{t({loading:!0});try{let a=await fetch(`/api/workspaces/${e}/issues`),s=await a.json(),i=function(e,t){try{let a=localStorage.getItem(n+e);if(a&&t.some(e=>e.id===a))return a}catch{}return null}(e,s);t({workspaceId:e,issues:s,activeIssueId:i,loading:!1})}catch{t({loading:!1})}},createIssue:async(e,t,a,s,n)=>{let i=await fetch(`/api/workspaces/${e}/issues`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,description:a,members:s,workflowId:n})}),l=await i.json();r().upsertIssue(l),r().setActiveIssue(l.id)},setActiveIssue:e=>{let{workspaceId:a}=i.getState();if(a&&e)try{localStorage.setItem(n+a,e)}catch{}t(t=>({activeIssueId:e,issueSelectSeq:t.issueSelectSeq+1}))},updateIssue:async(e,t,a)=>{let s=await fetch(`/api/workspaces/${e}/issues/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),n=await s.json();r().upsertIssue(n)},updateIssueStatus:async(e,t,a)=>{await fetch(`/api/workspaces/${e}/issues/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:a})})},startIssue:async(t,a)=>{let s=await fetch(`/api/workspaces/${t}/issues/${a}/start`,{method:"POST"});if(!s.ok){let t=await s.json(),{toast:a}=await e.A(930010);a.error(t.error||t.message||"Failed to start issue");return}let n=await s.json();r().upsertIssue(n)},resumeIssue:async(e,t)=>{let a=await fetch(`/api/workspaces/${e}/issues/${t}/resume`,{method:"POST"}),s=await a.json();r().upsertIssue(s)},continueIssue:async(e,t)=>{let a=await fetch(`/api/workspaces/${e}/issues/${t}/continue`,{method:"POST"});if(!a.ok)return;let s=await a.json();r().upsertIssue(s)},interruptIssue:async(e,t)=>{let a=await fetch(`/api/workspaces/${e}/issues/${t}/interrupt`,{method:"POST"});if(!a.ok)return;let s=await a.json();r().upsertIssue(s)},deleteIssue:async(e,t)=>{let n=r().issues.find(e=>e.id===t);if(await fetch(`/api/workspaces/${e}/issues/${t}`,{method:"DELETE"}),r().removeIssue(t),n?.channelId){let{removeChannelLocal:e}=a.useChannelStore.getState();e(n.channelId)}let{tasks:i}=s.useTaskStore.getState(),l=i.filter(e=>e.issueId===t);if(l.length>0){let e=new Set(l.map(e=>e.id));s.useTaskStore.setState(t=>({tasks:t.tasks.filter(t=>!e.has(t.id))}))}},upsertIssue:e=>{t(t=>{let a=t.issues.findIndex(t=>t.id===e.id);if(a>=0){let s=[...t.issues];return s[a]=e,{issues:s}}return{issues:[...t.issues,e]}})},removeIssue:e=>{t(t=>({issues:t.issues.filter(t=>t.id!==e),activeIssueId:t.activeIssueId===e?null:t.activeIssueId}))}}));e.s(["useIssueStore",0,i])},592039,e=>{"use strict";let t=(0,e.i(433721).default)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);e.s(["CircleDot",0,t],592039)},938306,e=>{"use strict";let t=(0,e.i(433721).default)("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]);e.s(["MessageCircle",0,t],938306)},506037,e=>{"use strict";var t=e.i(816709),a=e.i(437122);let s=(0,t.create)((e,t)=>({notifications:[],loaded:!1,load:async t=>{try{let s=await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications`),n=await s.json();e({notifications:n,loaded:!0})}catch{e({loaded:!0})}},addNotification:t=>{e(e=>({notifications:[t,...e.notifications]}))},clearAll:async t=>{await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications`,{method:"DELETE"}),e({notifications:[]})},markRead:async(t,s)=>{await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications/${s}/read`,{method:"PUT"}),e(e=>({notifications:e.notifications.map(e=>e.id===s?{...e,read:!0}:e)}))},markAllRead:async t=>{await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications/read-all`,{method:"PUT"}),e(e=>({notifications:e.notifications.map(e=>({...e,read:!0}))}))},reset:()=>e({notifications:[],loaded:!1})}));e.s(["useNotificationStore",0,s])},307858,e=>{"use strict";let t=(0,e.i(433721).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,t],307858)},100559,e=>{"use strict";let t=(0,e.i(433721).default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);e.s(["Server",0,t],100559)},757106,e=>{"use strict";let t=(0,e.i(433721).default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);e.s(["default",0,t])},990336,e=>{"use strict";var t=e.i(757106);e.s(["Brain",()=>t.default])},651850,939760,e=>{"use strict";var t=e.i(433721);let a=(0,t.default)("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);e.s(["default",0,a],651850);let s=(0,t.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Settings",0,s],939760)},417092,e=>{"use strict";var t=e.i(344180),a=e.i(764556);function s(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}let n=(0,a.forwardRef)(function({size:e=44,lsKey:n,onClick:i,children:r,className:l,style:o,visible:c=!0,snapThreshold:d=60,minimizeDelay:u=2e3,unhoverDelay:m=2e3,defaultPosition:p},h){let f=(0,a.useRef)({x:0,y:0}),[x,g]=(0,a.useState)({x:0,y:0}),[y,v]=(0,a.useState)(!1),[j,w]=(0,a.useState)(!1),b=(0,a.useRef)(!1),k=(0,a.useRef)({x:0,y:0}),S=(0,a.useRef)(!1),N=(0,a.useRef)(void 0),C=(0,a.useRef)(void 0),T=(0,a.useRef)("right"),P=(0,a.useRef)(null),D=e/2;(0,a.useEffect)(()=>{let t=function(e){try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}(n),a={x:p?.x??window.innerWidth-e-20,y:p?.y??window.innerHeight-e-28},s=t?{x:Math.min(t.x,window.innerWidth-e),y:Math.min(t.y,window.innerHeight-e)}:a;f.current=s,g(s),v(!0)},[n,e,p]);let M=(0,a.useCallback)(e=>{w(!0),f.current={x:"left"===e?-D:window.innerWidth-D,y:f.current.y},g(f.current)},[D]),O=(0,a.useCallback)(()=>{clearTimeout(N.current),N.current=void 0,clearTimeout(C.current),C.current=void 0},[]),I=(0,a.useCallback)(()=>{O(),w(!1);let t=window.innerWidth,a={x:f.current.x<t/2?12:t-e-12,y:f.current.y};f.current=a,g(a),s(n,a)},[O,e,n]),z=(0,a.useCallback)(()=>{j&&I(),clearTimeout(C.current),C.current=void 0},[j,I]),E=(0,a.useCallback)(()=>{P.current&&(C.current=setTimeout(()=>M(T.current),m))},[M,m]),A=(0,a.useCallback)(e=>{b.current=!0,S.current=!1,P.current=null,O(),j&&I(),k.current={x:e.clientX-f.current.x,y:e.clientY-f.current.y},e.target.setPointerCapture(e.pointerId)},[O,j,I]),R=(0,a.useCallback)(t=>{if(!b.current)return;S.current=!0;let a=Math.max(0,Math.min(window.innerWidth-e,t.clientX-k.current.x)),s=Math.max(0,Math.min(window.innerHeight-e,t.clientY-k.current.y));f.current={x:a,y:s},g({x:a,y:s})},[e]),$=(0,a.useCallback)(()=>{b.current=!1;let{x:t,y:a}=f.current,r=window.innerWidth,l=t<d,o=t>r-e-d,c=Math.max(12,Math.min(window.innerHeight-e-12,a));if(l||o){let t=l?"left":"right";T.current=t,P.current=t;let a={x:l?12:r-e-12,y:c};f.current=a,g(a),s(n,a),N.current=setTimeout(()=>M(t),u)}else P.current=null,f.current={x:t,y:c},g(f.current),s(n,{x:t,y:c});if(!S.current&&i){let e=t=>{t.stopPropagation(),t.preventDefault(),document.removeEventListener("click",e,!0)};document.addEventListener("click",e,!0),i()}},[i,M,e,d,u,n]);return((0,a.useEffect)(()=>{let t=()=>{O();let t=window.innerWidth;if(j){let a=f.current.x<t/2;f.current={x:a?-D:t-D,y:Math.min(f.current.y,window.innerHeight-e-12)}}else f.current={x:Math.min(f.current.x,t-e-12),y:Math.min(f.current.y,window.innerHeight-e-12)};g(f.current)};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[O,j,D,e]),(0,a.useEffect)(()=>O,[O]),c&&y)?(0,t.jsx)("div",{ref:h,onPointerDown:A,onPointerMove:R,onPointerUp:$,onMouseEnter:z,onMouseLeave:E,className:l,style:{position:"fixed",left:x.x,top:x.y,width:e,height:e,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:99999,touchAction:"none",userSelect:"none",transition:b.current?"none":"left 0.3s ease-out, top 0.3s ease-out",...o},children:r}):null});e.s(["FloatingBall",0,n])},549705,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(244073),n=e.i(209988),i=e.i(260218),r=e.i(681622),l=e.i(562918),o=e.i(767467),c=e.i(100559),d=e.i(953700),u=e.i(137340),m=e.i(990336),p=e.i(307858),h=e.i(368942);let f={vision:"bg-blue-500/10 text-blue-600 border-blue-200",reasoning:"bg-purple-500/10 text-purple-600 border-purple-200",embedding:"bg-green-500/10 text-green-600 border-green-200"};function x({providers:e,providerModels:a,onEdit:n,onDelete:r,onAddModel:o}){let d=(0,s.useTranslations)("providers");return(0,t.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let s=a.find(t=>t.id===e.id),h=s?.models??[];return(0,t.jsxs)("div",{className:"group rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>n(e),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex size-8 items-center justify-center rounded-lg bg-primary/10",children:(0,t.jsx)(c.Server,{className:"size-4 text-primary"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.apiBase||d("list.noApiBase")})]}),(0,t.jsxs)(l.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:[h.length," ",d("list.modelsCount")]}),(0,t.jsx)(i.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,t.jsx)(u.Trash2,{className:"size-3 text-destructive"})})]}),h.length>0&&(0,t.jsx)("div",{className:"mt-2 ml-11 flex flex-wrap gap-1",children:h.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[11px] text-muted-foreground",children:[(0,t.jsx)(m.Brain,{className:"size-3"}),e.name,["vision","reasoning","embedding"].map(a=>e[a]?(0,t.jsx)("span",{className:`inline-block rounded px-1 text-[9px] font-medium border ${f[a]}`,children:a[0].toUpperCase()},a):null)]},e.id))}),(0,t.jsxs)(i.Button,{variant:"ghost",size:"xs",className:"mt-1 ml-11 h-6 text-[11px] text-muted-foreground",onClick:t=>{t.stopPropagation(),o(e.name)},children:[(0,t.jsx)(p.ExternalLink,{className:"size-3"}),d("list.addModel")]})]},e.id)}),0===e.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(c.Server,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:d("list.empty")})]})]})}function g({draft:e,onChange:a}){let n=(0,s.useTranslations)("providers");return(0,t.jsx)("div",{className:"flex flex-col gap-5 p-5",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:n("form.connection")}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:n("form.name")}),(0,t.jsx)(r.Input,{value:e.name||"",onChange:e=>a("name",e.target.value),placeholder:n("form.namePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:n("form.apiBase")}),(0,t.jsx)(r.Input,{value:e.apiBase||"",onChange:e=>a("apiBase",e.target.value),placeholder:n("form.apiBasePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:n("form.apiKey")}),(0,t.jsx)(r.Input,{type:"password",value:e.apiKey||"",onChange:e=>a("apiKey",e.target.value),placeholder:n("form.apiKeyPlaceholder")})]})]})})}e.s(["ProvidersDialog",0,function({open:e,onOpenChange:r,onAddModel:l,standalone:c}){let u=(0,s.useTranslations)("providers"),m=(0,s.useTranslations)("common"),{models:p,providers:f,ensure:y,addProvider:v,updateProvider:j,removeProvider:w}=(0,h.useLLMStore)(),[b,k]=(0,a.useState)(null),[S,N]=(0,a.useState)(null),[C,T]=(0,a.useState)(!1),[P,D]=(0,a.useState)(!1),[M,O]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(T(!0),O(null),y().finally(()=>T(!1)))},[e,y]);let I=()=>{k(null),N(null)},z=()=>{k(null),N({name:"",apiBase:"",apiKey:""})},E=async()=>{if(S&&S.name){D(!0),O(null);try{let e=!b,t=await fetch(e?"/api/providers":`/api/providers/${b.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)});if(!t.ok)throw Error();let a=await t.json();e?v(a):j(a),I()}catch{O(u("error.saveFailed"))}finally{D(!1)}}},A=async e=>{if(confirm(u("confirm.delete"))){D(!0);try{if(!(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok)throw Error();w(e),b?.id===e&&I()}catch{O(u("error.deleteFailed"))}finally{D(!1)}}},R=(0,t.jsxs)(t.Fragment,{children:[!c&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 py-4",children:[S&&(0,t.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:I,children:(0,t.jsx)(o.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)(n.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(n.DialogTitle,{className:"text-base",children:S?b?u("dialog.editTitle"):u("dialog.addTitle"):u("dialog.title")}),(0,t.jsx)(n.DialogDescription,{className:"text-xs",children:S?u("dialog.editDescription"):u("dialog.listDescription")})]}),!S&&(0,t.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:z,className:"mr-6",children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),u("dialog.add")]})]}),c&&!S&&(0,t.jsx)("div",{className:"flex items-center justify-end px-5 py-3 border-b",children:(0,t.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:z,children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),u("dialog.add")]})}),c&&S&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,t.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:I,children:(0,t.jsx)(o.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-medium truncate",children:b?u("dialog.editTitle"):u("dialog.addTitle")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:u("dialog.editDescription")})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[M&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:M}),C?(0,t.jsx)("div",{className:"py-12 text-center text-sm text-muted-foreground",children:u("dialog.loading")}):S?(0,t.jsx)(g,{draft:S,onChange:(e,t)=>{N(a=>a?{...a,[e]:t}:a)}}):(0,t.jsx)(x,{providers:f,providerModels:f.map(e=>{let t;return{id:e.id,models:(t=e.name,p.filter(e=>e.provider===t))}}),onEdit:e=>{k(e),N({...e})},onDelete:A,onAddModel:e=>{c||r(!1),l(e)}})]}),S&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(i.Button,{variant:"outline",size:"sm",onClick:I,disabled:P,children:m("cancel")}),(0,t.jsx)(i.Button,{size:"sm",onClick:E,disabled:P||!S.name,children:m(P?"saving":"save")})]})]});return c?(0,t.jsx)("div",{className:"h-full flex flex-col",children:R}):(0,t.jsx)(n.Dialog,{open:e,onOpenChange:e=>{e||I(),r(e)},children:(0,t.jsx)(n.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:R})})}])},894920,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(209988),n=e.i(260218),i=e.i(681622),r=e.i(788010),l=e.i(344118),o=e.i(962562),c=e.i(953700),d=e.i(100559),u=e.i(137340);let m=(0,e.i(433721).default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);var p=e.i(244073);e.s(["ServerManagerDialog",0,function({open:e,onOpenChange:h,servers:f,activeId:x,onUpdate:g,onRemove:y,onSwitch:v}){let j=(0,p.useTranslations)("sidebar"),w=(0,p.useTranslations)("common"),[b,k]=a.useState(null),[S,N]=a.useState(""),[C,T]=a.useState(""),[P,D]=a.useState(""),[M,O]=a.useState(""),[I,z]=a.useState(""),[E,A]=a.useState(""),[R,$]=a.useState(""),[L,F]=a.useState(null),B=()=>{k(null),N(""),T(""),D("")},W=()=>{if(!S.trim()||!C.trim())return;let e=C.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),g(f.map(t=>t.id===b?{...t,name:S.trim(),url:e,secret:P.trim()||void 0}:t)),B()},U=a.useCallback(e=>{console.log(`[server-diagnostic] ${e}`),$(t=>`${t}${t?"\n":""}${e}`)},[]),H=async e=>{F(e.id),$("");let t=e.url.replace(/\/$/,""),a=`${t}/api/health`,s=new URL("/ws",t);s.protocol="https:"===s.protocol?"wss:":"ws:",s.searchParams.set("workspaceId","__diagnostic__"),s.searchParams.set("token",e.secret||"__diagnostic__"),U(`time: ${new Date().toISOString()}`),U(`window.origin: ${window.location.origin}`),U(`window.href: ${window.location.href}`),U(`navigator.onLine: ${navigator.onLine}`),U(`target: ${t}`),U(`health: ${a}`);let n=performance.now();try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),1e4),s=await fetch(a,{method:"GET",cache:"no-store",mode:"cors",signal:e.signal});window.clearTimeout(t);let i=await s.text();U(`fetch /api/health: OK ${s.status} ${s.statusText} (${Math.round(performance.now()-n)}ms)`),U(`fetch response: ${i.slice(0,500)||"<empty>"}`)}catch(t){let e=t instanceof Error?t:Error(String(t));U(`fetch /api/health: FAILED ${e.name}: ${e.message} (${Math.round(performance.now()-n)}ms)`)}U(`websocket: ${s.toString()}`),await new Promise(e=>{let t=performance.now(),a=!1,n=(s,n)=>{if(!a){a=!0,U(`${s} (${Math.round(performance.now()-t)}ms)`);try{n?.close()}catch{}e()}};try{let e=new WebSocket(s.toString()),t=window.setTimeout(()=>n("websocket: TIMEOUT",e),1e4);e.onopen=()=>{window.clearTimeout(t),n("websocket: OPEN",e)},e.onerror=()=>{window.clearTimeout(t),n("websocket: ERROR",e)},e.onclose=a=>{window.clearTimeout(t),n(`websocket: CLOSE code=${a.code} reason=${a.reason||"<empty>"}`,e)}}catch(t){let e=t instanceof Error?t:Error(String(t));n(`websocket: FAILED ${e.name}: ${e.message}`)}}),F(null)};return(0,t.jsx)(s.Dialog,{open:e,onOpenChange:e=>{h(e),e||B()},children:(0,t.jsxs)(s.DialogContent,{className:"max-w-md",children:[(0,t.jsxs)(s.DialogHeader,{children:[(0,t.jsx)(s.DialogTitle,{children:j("server.manageServers")}),(0,t.jsx)(s.DialogDescription,{children:j("server.manageDescription")})]}),(0,t.jsx)("div",{className:"space-y-1",children:f.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-md border px-3 py-2",children:[(0,t.jsx)(d.Server,{className:"size-4 shrink-0 text-muted-foreground"}),b===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.Input,{className:"h-7 text-sm flex-1",value:S,onChange:e=>N(e.target.value),placeholder:"Name",autoFocus:!0}),(0,t.jsx)(i.Input,{className:"h-7 text-sm flex-[1.5]",value:C,onChange:e=>T(e.target.value),placeholder:"http://...",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)(n.Button,{size:"sm",variant:"ghost",onClick:W,className:"h-7 px-2",children:w("save")}),(0,t.jsx)(n.Button,{size:"sm",variant:"ghost",onClick:B,className:"h-7 px-2",children:w("cancel")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>{e.id!==x&&v(e)},children:[(0,t.jsx)("div",{className:"text-sm font-medium truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.url})]}),e.id===x?(0,t.jsx)(l.Check,{className:"size-4 shrink-0 text-primary"}):(0,t.jsx)(n.Button,{size:"sm",variant:"ghost",onClick:()=>v(e),className:"h-7 px-2 text-xs shrink-0",children:j("server.switch")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>H(e)}),(0,t.jsx)(o.Pencil,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>{k(e.id),N(e.name),T(e.url),D(e.secret||"")}}),"default"!==e.id&&(0,t.jsx)(u.Trash2,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-destructive",onClick:()=>y(e.id)})]})]})]},e.id))}),null===b&&(0,t.jsxs)("div",{className:"border-t pt-3 mt-2 space-y-2",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:j("server.newServer")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Input,{className:"h-8 text-sm",value:M,onChange:e=>O(e.target.value),placeholder:"Name"}),(0,t.jsx)(n.Button,{size:"sm",onClick:()=>{if(!M.trim()||!I.trim())return;let e=I.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),g([...f,{id:Date.now().toString(),name:M.trim(),url:e,secret:E.trim()||void 0}]),O(""),z(""),A("")},disabled:!M.trim()||!I.trim(),children:(0,t.jsx)(c.Plus,{className:"size-4"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(i.Input,{className:"h-8 text-sm flex-1",value:I,onChange:e=>z(e.target.value),placeholder:"http://..."})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(i.Input,{className:"h-8 text-sm flex-1",type:"password",value:E,onChange:e=>A(e.target.value),placeholder:j("server.secretOptionalPlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})})]}),(0,t.jsxs)("div",{className:"border-t pt-3 mt-2 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:"Network diagnostics"}),(0,t.jsx)(n.Button,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",disabled:!f.find(e=>e.id===x)||null!==L,onClick:()=>{let e=f.find(e=>e.id===x);e&&H(e)},children:L?"Testing...":"Test active"})]}),(0,t.jsx)(r.Textarea,{readOnly:!0,value:R||"Tap the Wi-Fi icon next to a server, or use Test active.",className:"h-36 resize-none font-mono text-[11px]"})]})]})})}],894920)},164202,511518,487122,e=>{"use strict";let t=(0,e.i(433721).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);e.s(["Zap",0,t],164202);let a=Symbol.for("constructDateFrom");e.s(["constructFromSymbol",0,a,"millisecondsInDay",0,864e5,"millisecondsInWeek",0,6048e5,"minutesInDay",0,1440,"minutesInMonth",0,43200],511518),e.s(["constructFrom",0,function(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&a in e?e[a](t):e instanceof Date?new e.constructor(t):new Date(t)}],487122)},238153,244874,e=>{"use strict";var t;let a={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function s(e){return (t={})=>{let a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}let n={date:s({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:s({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:s({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},i={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function r(e){return(t,a)=>{let s;if("formatting"===(a?.context?String(a.context):"standalone")&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,n=a?.width?String(a.width):t;s=e.formattingValues[n]||e.formattingValues[t]}else{let t=e.defaultWidth,n=a?.width?String(a.width):e.defaultWidth;s=e.values[n]||e.values[t]}return s[e.argumentCallback?e.argumentCallback(t):t]}}function l(e){return(t,a={})=>{let s,n=a.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;let l=r[0],o=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(o)?function(e,t){for(let a=0;a<e.length;a++)if(t(e[a]))return a}(o,e=>e.test(l)):function(e,t){for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a}(o,e=>e.test(l));return s=e.valueCallback?e.valueCallback(c):c,{value:s=a.valueCallback?a.valueCallback(s):s,rest:t.slice(l.length)}}}let o={code:"en-US",formatDistance:(e,t,s)=>{let n,i=a[e];if(n="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),s?.addSuffix)if(s.comparison&&s.comparison>0)return"in "+n;else return n+" ago";return n},formatLong:n,formatRelative:(e,t,a,s)=>i[e],localize:{ordinalNumber:(e,t)=>{let a=Number(e),s=a%100;if(s>20||s<10)switch(s%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},era:r({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:r({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:r({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:r({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:r({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(t={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,a={})=>{let s=e.match(t.matchPattern);if(!s)return null;let n=s[0],i=e.match(t.parsePattern);if(!i)return null;let r=t.valueCallback?t.valueCallback(i[0]):i[0];return{value:r=a.valueCallback?a.valueCallback(r):r,rest:e.slice(n.length)}}),era:l({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:l({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:l({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:l({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:l({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};e.s(["enUS",0,o],244874),e.s(["defaultLocale",0,o],238153)},492421,e=>{"use strict";let t={};e.s(["getDefaultOptions",0,function(){return t}])},632713,516467,e=>{"use strict";var t=e.i(487122);function a(e,a){return(0,t.constructFrom)(a||e,e)}e.s(["toDate",0,a],516467),e.s(["getTimezoneOffsetInMilliseconds",0,function(e){let t=a(e),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),e-s}],632713)},539392,e=>{"use strict";var t=e.i(487122);e.s(["normalizeDates",0,function(e,...a){let s=t.constructFrom.bind(null,e||a.find(e=>"object"==typeof e));return a.map(s)}])},731285,e=>{"use strict";var t=e.i(539392);e.s(["differenceInCalendarMonths",0,function(e,a,s){let[n,i]=(0,t.normalizeDates)(s?.in,e,a);return 12*(n.getFullYear()-i.getFullYear())+(n.getMonth()-i.getMonth())}])},936765,e=>{"use strict";var t=e.i(516467);e.s(["endOfMonth",0,function(e,a){let s=(0,t.toDate)(e,a?.in),n=s.getMonth();return s.setFullYear(s.getFullYear(),n+1,0),s.setHours(23,59,59,999),s}])},524,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(209988),n=e.i(260218),i=e.i(355819),r=e.i(193251),l=e.i(62669),o=e.i(511800),c=e.i(681622),d=e.i(434805),u=e.i(660748),m=e.i(244073);function p({open:e,onOpenChange:h,workspace:f,onSubmit:x}){let g=(0,m.useTranslations)("workspace"),y=(0,m.useTranslations)("common"),v=(0,i.useAgentStore)(e=>e.agents),[j,w]=(0,a.useState)(f?.name??""),[b,k]=(0,a.useState)(f?.boundDirs[0]??""),[S,N]=(0,a.useState)(!1),[C,T]=(0,a.useState)(!1),[P,D]=(0,a.useState)(""),[M,O]=(0,a.useState)(!1),[I,z]=(0,a.useState)(null),E=!!f,A=async()=>{if(j&&b){N(!0);try{await x({name:j,boundDirs:[b]}),h(!1)}finally{N(!1)}}},R=(0,a.useCallback)(async()=>{if(P&&b){O(!0),z(null);try{let e=await fetch("/api/workspaces/clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:P,targetDir:b})});if(!e.ok){let t=await e.json();z({phase:"error",progress:0,error:t.error||g("clone.cloneFailed")}),O(!1);return}let t=e.body?.getReader();if(!t){z({phase:"error",progress:0,error:g("clone.noResponseBody")}),O(!1);return}let a=new TextDecoder,s="";for(;;){let{done:e,value:n}=await t.read();if(e)break;let i=(s+=a.decode(n,{stream:!0})).split("\n");for(let e of(s=i.pop()||"",i))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));z(t),("done"===t.phase||"error"===t.phase)&&(O(!1),"done"===t.phase&&t.cloneDir&&(k(t.cloneDir),j||w(P.split("/").pop()?.replace(".git","")||""),T(!1),D(""),z(null)))}catch{}}}catch(e){z({phase:"error",progress:0,error:e instanceof Error?e.message:String(e)}),O(!1)}}},[P,b,j,g]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.Dialog,{open:e,onOpenChange:h,children:(0,t.jsxs)(s.DialogContent,{children:[(0,t.jsxs)(s.DialogHeader,{children:[(0,t.jsx)(s.DialogTitle,{children:E?g("dialog.editTitle"):g("dialog.newTitle")}),(0,t.jsx)(s.DialogDescription,{children:E?g("dialog.editDescription"):g("dialog.newDescription")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,t.jsx)(c.Input,{className:"rounded-xl py-2.5",placeholder:g("dialog.namePlaceholder"),value:j,onChange:e=>w(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)("div",{children:(0,t.jsx)(d.FolderPicker,{value:b,onChange:k,placeholder:"/path/to/project"})}),!E&&(0,t.jsxs)(n.Button,{type:"button",variant:"outline",size:"sm",className:"w-full gap-1.5",onClick:()=>T(!0),disabled:!b,title:b?g("clone.fromGitTooltip"):g("clone.selectFolderFirst"),children:[(0,t.jsx)(r.Download,{className:"size-4"}),g("clone.createFromGit")]}),E&&v.length>0&&(0,t.jsxs)("div",{className:"rounded-xl border border-border p-3",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:v.length}),(0,t.jsx)("span",{children:g("agents")})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:v.map(e=>(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:e.name||e.role},e.id))})]})]}),(0,t.jsxs)(s.DialogFooter,{children:[(0,t.jsx)(n.Button,{variant:"outline",onClick:()=>h(!1),disabled:S,children:y("cancel")}),(0,t.jsx)(n.Button,{onClick:A,disabled:!j||!b||S,children:y(E?"save":"create")})]})]})}),(0,t.jsx)(s.Dialog,{open:C,onOpenChange:e=>{M||T(e)},children:(0,t.jsxs)(s.DialogContent,{children:[(0,t.jsxs)(s.DialogHeader,{children:[(0,t.jsx)(s.DialogTitle,{children:g("clone.title")}),(0,t.jsx)(s.DialogDescription,{children:g("clone.description")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,t.jsx)(c.Input,{className:"rounded-xl py-2.5",placeholder:"https://github.com/user/repo.git",value:P,onChange:e=>D(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),disabled:M}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[g("clone.cloneTo"),b,"/",P?P.split("/").pop()?.replace(".git","")||"repo":"..."]}),I&&"done"!==I.phase&&"error"!==I.phase&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)(u.Progress,{value:I.progress,children:[(0,t.jsx)(u.ProgressLabel,{children:g(`clone.phase.${I.phase}`)}),(0,t.jsxs)("span",{className:"ml-auto text-sm text-muted-foreground tabular-nums",children:[I.progress,"%"]}),(0,t.jsx)(u.ProgressTrack,{children:(0,t.jsx)(u.ProgressIndicator,{})})]}),null!=I.received&&null!=I.total&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[I.received," / ",I.total," ",g("clone.objects")]})]}),I?.phase==="error"&&(0,t.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/5 p-3",children:[(0,t.jsx)(o.AlertCircle,{className:"size-4 mt-0.5 shrink-0 text-destructive"}),(0,t.jsx)("p",{className:"text-sm text-destructive",children:I.error})]})]}),(0,t.jsxs)(s.DialogFooter,{children:[(0,t.jsx)(n.Button,{variant:"outline",onClick:()=>{M||T(!1)},disabled:M,children:y("cancel")}),(0,t.jsx)(n.Button,{onClick:R,disabled:!P||M,children:M?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.Loader2,{className:"size-4 animate-spin"}),g("clone.cloning")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Download,{className:"size-4"}),g("clone.clone")]})})]})]})})]})}e.s(["WorkspaceDialog",0,function({open:e,onOpenChange:a,workspace:s,onSubmit:n}){return(0,t.jsx)(p,{open:e,onOpenChange:a,workspace:s,onSubmit:n},e?s?.id??"new":"closed")}])},842809,203922,e=>{"use strict";let t=new Map;function a(e,a,s){return null==e?"":(function(e,a){let s=JSON.stringify({locale:e,options:a}),n=t.get(s);if(n)return n;let i=new Intl.NumberFormat(e,a);return t.set(s,i),i})(a,s).format(e)}e.s(["formatNumber",0,a,"formatNumberValue",0,function(e,t,s){return null==e?"":s?a(e,t,s):a(e/100,t,{style:"percent"})}],842809),e.s(["valueToPercent",0,function(e,t,a){return(e-t)*100/(a-t)}],203922)},612505,e=>{"use strict";let t=(0,e.i(433721).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",0,t])},511800,e=>{"use strict";var t=e.i(612505);e.s(["AlertCircle",()=>t.default])},660748,e=>{"use strict";var t,a=e.i(344180);e.s([],606106),e.i(606106),e.i(8890);var s=e.i(764556),n=e.i(106045),i=e.i(236706),r=e.i(842809),l=e.i(969490),o=e.i(267805);let c=s.createContext(void 0);function d(){let e=s.useContext(c);if(void 0===e)throw Error((0,o.default)(51));return e}let u=((t={}).complete="data-complete",t.indeterminate="data-indeterminate",t.progressing="data-progressing",t),m={status:e=>"progressing"===e?{[u.progressing]:""}:"complete"===e?{[u.complete]:""}:"indeterminate"===e?{[u.indeterminate]:""}:null};function p(e,t){return null==t?"indeterminate progress":e||`${t}%`}let h=s.forwardRef(function(e,t){let{format:o,getAriaValueText:d=p,locale:u,max:h=100,min:f=0,value:x,render:g,className:y,children:v,style:j,...w}=e,[b,k]=s.useState(),S=(0,n.useValueAsRef)(o),N="indeterminate";Number.isFinite(x)&&(N=x===h?"complete":"progressing");let C=(0,r.formatNumberValue)(x,u,S.current),T=s.useMemo(()=>({status:N}),[N]),P={"aria-labelledby":b,"aria-valuemax":h,"aria-valuemin":f,"aria-valuenow":x??void 0,"aria-valuetext":d(C,x),role:"progressbar",children:(0,a.jsxs)(s.Fragment,{children:[v,(0,a.jsx)("span",{role:"presentation",style:i.visuallyHidden,children:"x"})]})},D=s.useMemo(()=>({formattedValue:C,max:h,min:f,setLabelId:k,state:T,status:N,value:x}),[C,h,f,k,T,N,x]),M=(0,l.useRenderElement)("div",e,{state:T,ref:t,props:[P,w],stateAttributesMapping:m});return(0,a.jsx)(c.Provider,{value:D,children:M})}),f=s.forwardRef(function(e,t){let{render:a,className:s,style:n,...i}=e,{state:r}=d();return(0,l.useRenderElement)("div",e,{state:r,ref:t,props:i,stateAttributesMapping:m})});var x=e.i(203922);let g=s.forwardRef(function(e,t){let{render:a,className:n,style:i,...r}=e,{max:o,min:c,value:u,state:p}=d(),h=Number.isFinite(u)&&null!==u?(0,x.valueToPercent)(u,c,o):null,f=s.useCallback(()=>null==h?{}:{insetInlineStart:0,height:"inherit",width:`${h}%`},[h]);return(0,l.useRenderElement)("div",e,{state:p,ref:t,props:[{style:f()},r],stateAttributesMapping:m})}),y=s.forwardRef(function(e,t){let{className:a,render:s,children:n,style:i,...r}=e,{value:o,formattedValue:c,state:u}=d(),p=null==o?"indeterminate":c,h=null==o?null:c;return(0,l.useRenderElement)("span",e,{state:u,ref:t,props:[{"aria-hidden":!0,children:"function"==typeof n?n(p,o):h},r],stateAttributesMapping:m})});var v=e.i(559713);let j=s.forwardRef(function(e,t){let{render:a,className:s,style:n,id:i,...r}=e,{setLabelId:o,state:c}=d(),u=(0,v.useRegisteredLabelId)(i,o);return(0,l.useRenderElement)("span",e,{state:c,ref:t,props:[{id:u,role:"presentation"},r],stateAttributesMapping:m})});e.s(["Indicator",0,g,"Label",0,j,"Root",0,h,"Track",0,f,"Value",0,y],729535);var w=e.i(729535),w=w,b=e.i(465458);function k({className:e,...t}){return(0,a.jsx)(w.Track,{className:(0,b.cn)("relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",e),"data-slot":"progress-track",...t})}function S({className:e,...t}){return(0,a.jsx)(w.Indicator,{"data-slot":"progress-indicator",className:(0,b.cn)("h-full bg-primary transition-all",e),...t})}e.s(["Progress",0,function({className:e,children:t,value:s,...n}){return(0,a.jsxs)(w.Root,{value:s,"data-slot":"progress",className:(0,b.cn)("flex flex-wrap gap-3",e),...n,children:[t,(0,a.jsx)(k,{children:(0,a.jsx)(S,{})})]})},"ProgressIndicator",0,S,"ProgressLabel",0,function({className:e,...t}){return(0,a.jsx)(w.Label,{className:(0,b.cn)("text-sm font-medium",e),"data-slot":"progress-label",...t})},"ProgressTrack",0,k],660748)},361421,e=>{"use strict";let t=(0,e.i(433721).default)("folder-search",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);e.s(["default",0,t])},244644,e=>{"use strict";var t=e.i(361421);e.s(["FolderSearch",()=>t.default])},756638,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(244073),n=e.i(887836),i=e.i(209988),r=e.i(260218),l=e.i(681622),o=e.i(191118),c=e.i(239340),d=e.i(460578),u=e.i(996652),m=e.i(917955),p=e.i(887354),h=e.i(401058),f=e.i(137340),x=e.i(977694),g=e.i(111343),y=e.i(953700),v=e.i(426022),j=e.i(129981),w=e.i(193251),b=e.i(513501),k=e.i(989484);let S=(0,n.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["PromptsDialog",0,function({open:e,onOpenChange:n,standalone:N}){let C=(0,s.useTranslations)("prompts"),T=(0,s.useTranslations)("common"),[P,D]=(0,a.useState)("local"),[M,O]=(0,a.useState)([]),[I,z]=(0,a.useState)([]),[E,A]=(0,a.useState)(!1),[R,$]=(0,a.useState)(""),[L,F]=(0,a.useState)([]),[B,W]=(0,a.useState)(!1),[U,H]=(0,a.useState)(new Set),[J,V]=(0,a.useState)(!1),[_,q]=(0,a.useState)([]),[X,Y]=(0,a.useState)(null),[K,G]=(0,a.useState)([]),[Q,Z]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(null),[ea,es]=(0,a.useState)(!1),[en,ei]=(0,a.useState)(""),[er,el]=(0,a.useState)(""),[eo,ec]=(0,a.useState)(!1),ed=(0,a.useCallback)(async()=>{A(!0);try{let e=await fetch("/api/prompt-templates");e.ok&&O(await e.json())}catch{}A(!1)},[]),eu=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/prompt-templates/agents");e.ok&&z(await e.json())}catch{}},[]),em=(0,a.useCallback)(async()=>{W(!0);try{let e=await fetch("/public/prompt/index.json");e.ok&&F(await e.json())}catch{}W(!1)},[]);(0,a.useEffect)(()=>{(e||N)&&(ed(),eu(),em())},[e,N,ed,eu,em]);let ep=new Set(M.filter(e=>e.storeId).map(e=>e.storeId)),eh=async()=>{if(0!==_.length){if(1===_.length){let e=await _[0].file.text(),t=_[0].file.name.replace(/\.(md|txt|markdown)$/i,"");q([]),V(!1),et(null),es(!0),ei(t),el(e);return}for(let e of _){let t=await e.file.text(),a=e.file.name.replace(/\.(md|txt|markdown)$/i,"");await fetch("/api/prompt-templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,content:t})})}q([]),V(!1),ed()}},ef=async e=>{if(!(ep.has(e.id)||U.has(e.id))){H(t=>new Set(t).add(e.id));try{let t=await fetch(`/public/prompt/${e.filename}`);if(!t.ok)return;let a=await t.text(),s=await fetch("/api/prompt-templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,content:a,storeId:e.id})});if(s.ok){let e=await s.json();O(t=>[...t,e])}}catch{}H(t=>{let a=new Set(t);return a.delete(e.id),a})}},ex=()=>{et(null),es(!1),ei(""),el("")},eg=async()=>{if(en.trim()&&er.trim()){ec(!0);try{if(ee){let e=await fetch(`/api/prompt-templates/${ee.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:en,content:er})});if(e.ok){let t=await e.json();O(e=>e.map(e=>e.id===t.id?t:e)),ex()}}else{let e=await fetch("/api/prompt-templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:en,content:er})});if(e.ok){let t=await e.json();O(e=>[...e,t]),ex()}}}catch{}ec(!1)}},ey=async e=>{try{(await fetch(`/api/prompt-templates/${e.id}`,{method:"DELETE"})).ok&&O(t=>t.filter(t=>t.id!==e.id))}catch{}},ev=async()=>{if(X&&0!==K.length){Z(!0);try{await fetch(`/api/prompt-templates/${X.id}/apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentIds:K})}),Y(null)}catch{}Z(!1)}},ej=M.filter(e=>{if(!R)return!0;let t=R.toLowerCase();return e.name.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),ew=L.filter(e=>{if(!R)return!0;let t=R.toLowerCase();return e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)}),eb=(N||e)&&!X&&!ee&&!ea,ek=I.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})),eS=(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-1",children:[["local",k.FileText,C("tabLocal")],["store",b.Store,C("tabStore")]].map(([e,a,s])=>(0,t.jsxs)("button",{onClick:()=>D(e),className:`flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors ${P===e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(a,{className:"size-3.5"}),s]},e))}),eN=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0 pt-2",children:[(0,t.jsxs)(u.Popover,{open:J,onOpenChange:V,children:[(0,t.jsx)(u.PopoverTrigger,{render:(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(j.Upload,{className:"size-3.5 mr-1"}),C("import")]})}),(0,t.jsx)(u.PopoverContent,{className:"w-80",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:C("importTitle")}),(0,t.jsx)(d.FileUpload,{value:_,onChange:q,accept:{"text/markdown":[".md",".txt"],"":[".md",".txt"]},placeholder:C("importPlaceholder"),maxFiles:10}),(0,t.jsx)(r.Button,{size:"sm",onClick:eh,disabled:0===_.length,className:"w-full",children:C("importConfirm")})]})})]}),(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:()=>{et(null),es(!0),ei(""),el("")},children:[(0,t.jsx)(y.Plus,{className:"size-3.5 mr-1"}),C("create")]})]}),(0,t.jsx)(o.ScrollArea,{className:"flex-1",children:E?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("loading")}):0===ej.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:C("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pr-2",children:ej.map(e=>(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{et(e),es(!1),ei(e.name),el(e.content)},children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)(v.MessageSquare,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",className:"h-6 px-1.5 text-xs",onClick:()=>{Y(e),G([])},children:[(0,t.jsx)(x.Rocket,{className:"size-3 mr-0.5"}),C("apply")]}),(0,t.jsxs)(m.DropdownMenu,{children:[(0,t.jsx)(m.DropdownMenuTrigger,{render:(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"size-6"}),children:(0,t.jsx)(h.MoreVertical,{className:"size-3"})}),(0,t.jsx)(m.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(m.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>ey(e),children:[(0,t.jsx)(f.Trash2,{className:"size-3 mr-1.5"}),C("delete")]})})]})]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-3",children:e.content.slice(0,200).replace(/^#\s+/,"")})]})},e.id))})})]}),eC=(0,t.jsx)(o.ScrollArea,{className:"flex-1",children:B?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("loading")}):0===ew.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:C("storeEmpty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pr-2",children:ew.map(e=>{let a=ep.has(e.id),s=U.has(e.id);return(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)(b.Store,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name})]}),(0,t.jsx)(r.Button,{variant:a?"ghost":"outline",size:"sm",className:"h-6 px-1.5 text-xs shrink-0",disabled:a||s,onClick:()=>ef(e),children:a?(0,t.jsx)(t.Fragment,{children:C("imported")}):s?(0,t.jsx)(t.Fragment,{children:C("importing")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.Download,{className:"size-3 mr-0.5"}),C("importTo")]})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.id})]})},e.id)})})}),eT=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.DialogHeader,{children:(0,t.jsx)("div",{className:"flex items-center justify-between pr-8",children:(0,t.jsxs)("div",{className:"hidden md:block",children:[N?(0,t.jsx)("h2",{className:"text-base font-semibold",children:C("title")}):(0,t.jsx)(i.DialogTitle,{children:C("title")}),N?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:C("description")}):(0,t.jsx)(i.DialogDescription,{children:C("description")})]})})}),eS,(0,t.jsx)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(p.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(l.Input,{value:R,onChange:e=>$(e.target.value),placeholder:C("search"),className:"pl-8"})]}),"local"===P?eN:eC]})})]});return(0,t.jsxs)(t.Fragment,{children:[N&&eb&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:eT}),!N&&(0,t.jsx)(i.Dialog,{open:eb,onOpenChange:n,children:(0,t.jsx)(i.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:eT})}),(0,t.jsx)(i.Dialog,{open:!!ee||ea,onOpenChange:e=>{e||ex()},children:(0,t.jsxs)(i.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(i.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(i.DialogTitle,{children:ee?C("editTitle",{name:ee.name}):C("createTitle")}),(0,t.jsx)(i.DialogDescription,{children:C("editDescription")})]}),(0,t.jsxs)(r.Button,{size:"sm",onClick:eg,disabled:eo||!en.trim()||!er.trim(),children:[(0,t.jsx)(g.Save,{className:"size-3.5 mr-1"}),T("save")]})]})}),(0,t.jsx)("div",{className:"space-y-3 pb-2",children:(0,t.jsx)(l.Input,{value:en,onChange:e=>ei(e.target.value),placeholder:C("namePlaceholder")})}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(S,{height:"100%",language:"markdown",value:er,onChange:e=>el(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})})]})}),(0,t.jsx)(c.AgentPickerDialog,{open:!!X,onClose:()=>Y(null),onConfirm:ev,title:C("applyTitle",{name:X?.name||""}),description:C("applyDescription"),agents:ek,selected:K,onToggle:e=>G(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),cancelText:T("cancel"),confirmText:C("applyConfirm",{count:K.length}),loading:Q})]})}])},841734,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(244073),n=e.i(887836),i=e.i(209988),r=e.i(260218),l=e.i(681622),o=e.i(191118),c=e.i(239340),d=e.i(460578),u=e.i(996652),m=e.i(917955),p=e.i(887354),h=e.i(401058),f=e.i(137340),x=e.i(953700),g=e.i(962562),y=e.i(129981),v=e.i(193251),j=e.i(977694),w=e.i(513501),b=e.i(989484);let k=(0,n.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["OutputStylesDialog",0,function({open:e,onOpenChange:n,standalone:S}){let N=(0,s.useTranslations)("outputStyles"),C=(0,s.useTranslations)("common"),[T,P]=(0,a.useState)("local"),[D,M]=(0,a.useState)([]),[O,I]=(0,a.useState)([]),[z,E]=(0,a.useState)(!1),[A,R]=(0,a.useState)(""),[$,L]=(0,a.useState)([]),[F,B]=(0,a.useState)(!1),[W,U]=(0,a.useState)(new Set),[H,J]=(0,a.useState)(!1),[V,_]=(0,a.useState)([]),[q,X]=(0,a.useState)(null),[Y,K]=(0,a.useState)(!1),[G,Q]=(0,a.useState)(""),[Z,ee]=(0,a.useState)(""),[et,ea]=(0,a.useState)(""),[es,en]=(0,a.useState)(!1),[ei,er]=(0,a.useState)(null),[el,eo]=(0,a.useState)([]),[ec,ed]=(0,a.useState)(!1),eu=(0,a.useCallback)(async()=>{E(!0);try{let e=await fetch("/api/output-styles");e.ok&&M(await e.json())}catch{}E(!1)},[]),em=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/output-styles/agents");e.ok&&I(await e.json())}catch{}},[]),ep=(0,a.useCallback)(async()=>{B(!0);try{let e=await fetch("/public/output-styles/index.json");e.ok&&L(await e.json())}catch{}B(!1)},[]);(0,a.useEffect)(()=>{(e||S)&&(eu(),em(),ep())},[e,S,eu,em,ep]);let eh=new Set(D.filter(e=>e.storeId).map(e=>e.storeId));function ef(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!t)return{content:e};let a=t[1],s=e.slice(t[0].length),n=a.match(/^name:\s*(.+)$/m),i=a.match(/^description:\s*(.+)$/m);return{name:n?.[1]?.trim(),description:i?.[1]?.trim(),content:s}}let ex=async()=>{if(0!==V.length){if(1===V.length){let e=await V[0].file.text(),t=ef(e),a=t.name||V[0].file.name.replace(/\.(md|txt|markdown)$/i,"");_([]),J(!1),X(null),K(!0),Q(a),ee(t.description||""),ea(t.content||e);return}for(let e of V){let t=await e.file.text(),a=ef(t),s=a.name||e.file.name.replace(/\.(md|txt|markdown)$/i,"");await fetch("/api/output-styles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,content:a.content||t,description:a.description})})}_([]),J(!1),eu()}},eg=async e=>{if(!(eh.has(e.id)||W.has(e.id))){U(t=>new Set(t).add(e.id));try{let t=await fetch(`/public/output-styles/${e.filename}`);if(!t.ok)return;let a=await t.text(),s=ef(a),n=await fetch("/api/output-styles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,content:s.content||a,storeId:e.id,description:s.description})});if(n.ok){let e=await n.json();M(t=>[...t,e])}}catch{}U(t=>{let a=new Set(t);return a.delete(e.id),a})}},ey=()=>{X(null),K(!1),Q(""),ee(""),ea("")},ev=async()=>{if(G.trim()&&et.trim()){en(!0);try{let e=q?`/api/output-styles/${q.id}`:"/api/output-styles",t=q?"PUT":"POST",a=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify({name:G,content:et,description:Z||void 0})});if(a.ok){let e=await a.json();M(t=>q?t.map(t=>t.id===e.id?e:t):[...t,e]),ey()}}catch{}en(!1)}},ej=async e=>{try{(await fetch(`/api/output-styles/${e.id}`,{method:"DELETE"})).ok&&M(t=>t.filter(t=>t.id!==e.id))}catch{}},ew=async()=>{if(ei&&0!==el.length){ed(!0);try{await fetch(`/api/output-styles/${ei.id}/apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentIds:el})}),er(null)}catch{}ed(!1)}},eb=D.filter(e=>{if(!A)return!0;let t=A.toLowerCase();return e.name.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),ek=$.filter(e=>{if(!A)return!0;let t=A.toLowerCase();return e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)}),eS=(S||e)&&!ei&&!q&&!Y,eN=(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-1",children:[["local",b.FileText,N("tabLocal")],["store",w.Store,N("tabStore")]].map(([e,a,s])=>(0,t.jsxs)("button",{onClick:()=>P(e),className:`flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors ${T===e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(a,{className:"size-3.5"}),s]},e))}),eC=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0 pt-2",children:[(0,t.jsxs)(u.Popover,{open:H,onOpenChange:J,children:[(0,t.jsx)(u.PopoverTrigger,{render:(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(y.Upload,{className:"size-3.5 mr-1"}),N("import")]})}),(0,t.jsx)(u.PopoverContent,{className:"w-80",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:N("importTitle")}),(0,t.jsx)(d.FileUpload,{value:V,onChange:_,accept:{"text/markdown":[".md",".txt"],"":[".md",".txt"]},placeholder:N("importPlaceholder"),maxFiles:10}),(0,t.jsx)(r.Button,{size:"sm",onClick:ex,disabled:0===V.length,className:"w-full",children:N("importConfirm")})]})})]}),(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:()=>{X(null),K(!0),Q(""),ee(""),ea("")},children:[(0,t.jsx)(x.Plus,{className:"size-3.5 mr-1"}),N("create")]})]}),(0,t.jsx)(o.ScrollArea,{className:"flex-1",children:z?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:C("loading")}):0===eb.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:N("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pr-2",children:eb.map(e=>(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{X(e),K(!1),Q(e.name),ee(e.description||""),ea(e.content)},children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)(g.Pencil,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",className:"h-6 px-1.5 text-xs",onClick:()=>{er(e),eo([])},children:[(0,t.jsx)(j.Rocket,{className:"size-3 mr-0.5"}),N("apply")]}),(0,t.jsxs)(m.DropdownMenu,{children:[(0,t.jsx)(m.DropdownMenuTrigger,{render:(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"size-6"}),children:(0,t.jsx)(h.MoreVertical,{className:"size-3"})}),(0,t.jsx)(m.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(m.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>ej(e),children:[(0,t.jsx)(f.Trash2,{className:"size-3 mr-1.5"}),N("delete")]})})]})]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-3",children:e.description||e.content.slice(0,200)})]})},e.id))})})]}),eT=(0,t.jsx)(o.ScrollArea,{className:"flex-1",children:F?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:C("loading")}):0===ek.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:N("storeEmpty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pr-2",children:ek.map(e=>{let a=eh.has(e.id),s=W.has(e.id);return(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)(w.Store,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name})]}),(0,t.jsx)(r.Button,{variant:a?"ghost":"outline",size:"sm",className:"h-6 px-1.5 text-xs shrink-0",disabled:a||s,onClick:()=>eg(e),children:a?(0,t.jsx)(t.Fragment,{children:N("imported")}):s?(0,t.jsx)(t.Fragment,{children:N("importing")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.Download,{className:"size-3 mr-0.5"}),N("importTo")]})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.id})]})},e.id)})})}),eP=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.DialogHeader,{children:(0,t.jsx)("div",{className:"flex items-center justify-between pr-8",children:(0,t.jsxs)("div",{className:"hidden md:block",children:[S?(0,t.jsx)("h2",{className:"text-base font-semibold",children:N("title")}):(0,t.jsx)(i.DialogTitle,{children:N("title")}),S?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:N("description")}):(0,t.jsx)(i.DialogDescription,{children:N("description")})]})})}),eN,(0,t.jsx)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(p.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(l.Input,{value:A,onChange:e=>R(e.target.value),placeholder:N("search"),className:"pl-8"})]}),"local"===T?eC:eT]})})]});return(0,t.jsxs)(t.Fragment,{children:[S&&eS&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:eP}),!S&&(0,t.jsx)(i.Dialog,{open:eS,onOpenChange:n,children:(0,t.jsx)(i.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:eP})}),(0,t.jsx)(i.Dialog,{open:!!q||Y,onOpenChange:e=>{e||ey()},children:(0,t.jsxs)(i.DialogContent,{className:"sm:max-w-2xl h-[80vh] flex flex-col",children:[(0,t.jsxs)(i.DialogHeader,{children:[(0,t.jsx)(i.DialogTitle,{children:q?N("editTitle",{name:q.name}):N("createTitle")}),(0,t.jsx)(i.DialogDescription,{children:N("editDescription")})]}),(0,t.jsx)(l.Input,{value:G,onChange:e=>Q(e.target.value),placeholder:N("namePlaceholder")}),(0,t.jsx)(l.Input,{value:Z,onChange:e=>ee(e.target.value),placeholder:N("descriptionPlaceholder")}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden rounded-md border border-border",children:(0,t.jsx)(k,{height:"100%",language:"markdown",value:et,onChange:e=>ea(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.Button,{variant:"outline",onClick:ey,disabled:es,children:C("cancel")}),(0,t.jsx)(r.Button,{onClick:ev,disabled:es||!G.trim()||!et.trim(),children:C(es?"saving":"save")})]})]})}),(0,t.jsx)(c.AgentPickerDialog,{open:!!ei,onClose:()=>er(null),onConfirm:ew,title:N("applyTitle",{name:ei?.name||""}),description:N("applyDescription"),agents:O.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})),selected:el,onToggle:e=>eo(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),cancelText:C("cancel"),confirmText:N("applyConfirm",{count:el.length}),loading:ec})]})}])},255742,e=>{"use strict";let t=(0,e.i(433721).default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);e.s(["Star",0,t],255742)},111343,e=>{"use strict";let t=(0,e.i(433721).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],111343)},973767,e=>{"use strict";let t=(0,e.i(433721).default)("star-off",[["path",{d:"m10.344 4.688 1.181-2.393a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.237 3.152",key:"19ctli"}],["path",{d:"m17.945 17.945.43 2.505a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a8 8 0 0 0 .4-.099",key:"ptqqvy"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["StarOff",0,t],973767)},22906,191202,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(244073),n=e.i(887836),i=e.i(209988),r=e.i(260218),l=e.i(681622),o=e.i(788010),c=e.i(191118),d=e.i(917955),u=e.i(996652),m=e.i(188815),p=e.i(611176),h=e.i(239340),f=e.i(255742),x=e.i(973767),g=e.i(129981),y=e.i(887354);let v=(0,e.i(433721).default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]);e.s(["Plug",0,v],191202);var j=e.i(401058),w=e.i(137340),b=e.i(977694),k=e.i(111343),S=e.i(465458);e.i(462506);let N=(0,n.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["McpsDialog",0,function({open:e,onOpenChange:n,standalone:C}){let T=(0,s.useTranslations)("mcps"),P=(0,s.useTranslations)("common"),[D,M]=(0,a.useState)([]),[O,I]=(0,a.useState)([]),[z,E]=(0,a.useState)(!1),[A,R]=(0,a.useState)(""),[$,L]=(0,a.useState)("all"),[F,B]=(0,a.useState)(""),[W,U]=(0,a.useState)(!1),[H,J]=(0,a.useState)(""),[V,_]=(0,a.useState)(""),[q,X]=(0,a.useState)(null),[Y,K]=(0,a.useState)([]),[G,Q]=(0,a.useState)(null),[Z,ee]=(0,a.useState)(""),et=(0,a.useCallback)(async()=>{E(!0);try{let e=await fetch("/api/mcps");e.ok&&M(await e.json())}catch{}E(!1)},[]),ea=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();I(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,a.useEffect)(()=>{(e||C)&&(et(),ea())},[e,C,et,ea]);let es=async e=>{try{let t=await fetch(`/api/mcps/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:a}=await t.json();M(t=>t.map(t=>t.name===e.name?{...t,favorited:a}:t))}}catch{}},en=async()=>{_("");try{JSON.parse(H)}catch{_(T("importInvalidJson"));return}try{let e=await fetch("/api/mcps/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonText:H})});if(e.ok)J(""),U(!1),et();else{let t=await e.json();_(t.error||T("importFailed"))}}catch{_(T("importFailed"))}},ei=async()=>{let e;if(G){try{e=JSON.parse(Z)}catch{return}try{(await fetch(`/api/mcps/${encodeURIComponent(G.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:e})})).ok&&(M(t=>t.map(t=>t.name===G.name?{...t,config:e}:t)),Q(null))}catch{}}},er=async e=>{try{(await fetch(`/api/mcps/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&M(t=>t.filter(t=>t.name!==e.name))}catch{}},el=async()=>{if(q){for(let e of O){let t=q.boundAgents.some(t=>t.id===e.id),a=Y.includes(e.id);if(t&&!a){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let a=await t.json(),s=a.mcps||{},n={...s.mcpServers||{}};delete n[q.name],await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,mcps:{...s,mcpServers:n}})})}else if(!t&&a){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let a=await t.json(),s=a.mcps||{},n={...s.mcpServers||{}};q.name in n||(n[q.name]=q.config,await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,mcps:{...s,mcpServers:n}})}))}}X(null),et()}},eo=D.filter(e=>{if(A){let t=A.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.description.toLowerCase().includes(t))return!1}return("favorites"!==$||!!e.favorited)&&("agent"!==$||!F||!!e.boundAgents.some(e=>e.id===F))}),ec=(C||e)&&!q&&!G,ed=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-end pr-8 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:block",children:[C?(0,t.jsx)("h2",{className:"text-base font-semibold",children:T("title")}):(0,t.jsx)(i.DialogTitle,{children:T("title")}),C?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("description")}):(0,t.jsx)(i.DialogDescription,{children:T("description")})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)(u.Popover,{open:W,onOpenChange:U,children:[(0,t.jsx)(u.PopoverTrigger,{render:(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(g.Upload,{className:"size-3.5 mr-1"}),T("import")]})}),(0,t.jsx)(u.PopoverContent,{className:"w-96",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:T("importTitle")}),(0,t.jsx)(o.Textarea,{value:H,onChange:e=>{J(e.target.value),_("")},placeholder:'{\n "mcpServers": {\n "server-name": {\n "command": "npx",\n "args": ["-y", "package"],\n "env": {}\n }\n }\n}',className:"font-mono text-xs min-h-[180px] resize-none"}),V&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:V}),(0,t.jsx)(r.Button,{size:"sm",onClick:en,disabled:!H.trim(),className:"w-full",children:T("importConfirm")})]})})]})})]})}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(r.Button,{variant:"all"===$?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("all"),B("")},children:[(0,t.jsx)(v,{className:"size-3.5 mr-1.5"}),T("filterAll")]}),(0,t.jsxs)(r.Button,{variant:"favorites"===$?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("favorites"),B("")},children:[(0,t.jsx)(f.Star,{className:"size-3.5 mr-1.5"}),T("filterFavorites")]})]}),O.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:T("filterByAgent")}),(0,t.jsx)(c.ScrollArea,{className:"max-h-48",children:O.map(e=>(0,t.jsxs)(r.Button,{variant:"agent"===$&&F===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("agent"),B(e.id)},children:[(0,t.jsx)(p.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(y.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(l.Input,{value:A,onChange:e=>R(e.target.value),placeholder:T("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,S.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===$?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{L("all"),B("")},children:T("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,S.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===$?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{L("favorites"),B("")},children:[(0,t.jsx)(f.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),T("filterFavorites")]})]}),O.length>0&&(0,t.jsx)(m.SearchSelect,{value:"agent"===$?F:"",onChange:e=>{e?(L("agent"),B(e)):(L("all"),B(""))},options:O.map(e=>({value:e.id,label:e.name})),placeholder:T("filterByAgent"),allowCustom:!1,className:"flex-1 min-w-0"})]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(y.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(l.Input,{value:A,onChange:e=>R(e.target.value),placeholder:T("search"),className:"pl-8"})]}),(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:z?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:P("loading")}):0===eo.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:eo.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{Q(e),ee(JSON.stringify(e.config,null,2))},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(v,{className:"size-3.5 text-muted-foreground"}),(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent cursor-pointer",onClick:t=>{t.stopPropagation(),es(e)},children:e.favorited?(0,t.jsx)(f.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(x.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.config.command||e.config.url||JSON.stringify(e.config).slice(0,100)})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:()=>{X(e),K(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(b.Rocket,{className:"size-3.5 mr-1"}),T("apply")]}),(0,t.jsxs)(d.DropdownMenu,{children:[(0,t.jsx)(d.DropdownMenuTrigger,{render:(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(j.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(d.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(d.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>er(e),children:[(0,t.jsx)(w.Trash2,{className:"size-3.5 mr-1.5"}),T("delete")]})})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(p.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[C&&ec&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:ed}),!C&&(0,t.jsx)(i.Dialog,{open:ec,onOpenChange:n,children:(0,t.jsx)(i.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:ed})}),(0,t.jsx)(i.Dialog,{open:!!G,onOpenChange:e=>{e||Q(null)},children:(0,t.jsxs)(i.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(i.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(i.DialogTitle,{children:T("editTitle",{name:G?.name||""})}),(0,t.jsx)(i.DialogDescription,{children:T("editDescription")})]}),(0,t.jsxs)(r.Button,{size:"sm",onClick:ei,children:[(0,t.jsx)(k.Save,{className:"size-3.5 mr-1"}),P("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(N,{height:"100%",language:"json",value:Z,onChange:e=>ee(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on",formatOnPaste:!0}})})]})}),(0,t.jsx)(h.AgentPickerDialog,{open:!!q,onClose:()=>X(null),onConfirm:el,title:T("bindTitle",{name:q?.name||""}),description:T("bindDescription"),agents:O,selected:Y,onToggle:e=>{K(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},cancelText:P("cancel"),confirmText:P("confirm")})]})}],22906)},601039,e=>{"use strict";let t=(0,e.i(433721).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],601039)},384389,e=>{"use strict";var t=e.i(764556),a=e.i(106206),s=e.i(128108),n=e.i(344180);let i=t.forwardRef(function(e,i){let{children:r,container:l,className:o,render:c,style:d,...u}=e,{portalNode:m,portalSubtree:p}=(0,s.useFloatingPortalNode)({container:l,ref:i,componentProps:e,elementProps:u});return p||m?(0,n.jsxs)(t.Fragment,{children:[p,m&&a.createPortal(r,m)]}):null});e.s(["FloatingPortalLite",0,i])},638322,e=>{"use strict";var t,a,s=e.i(344180);e.s([],935002),e.i(935002),e.i(8890);var n=e.i(764556),i=e.i(155461),r=e.i(166392),l=e.i(277642),o=e.i(267805);let c=n.createContext(void 0);function d(e){let t=n.useContext(c);if(void 0===t&&!e)throw Error((0,o.default)(72));return t}var u=e.i(92615),m=e.i(422561),p=e.i(29905),h=e.i(410421),f=e.i(150129);function x(e){return null!=e&&null!=e.clientX}var g=e.i(538501),y=e.i(427396),v=e.i(602453),j=e.i(279501),w=e.i(106206),b=e.i(332976),k=e.i(493696),S=e.i(549154),N=e.i(107164),C=e.i(742665),T=e.i(695011),P=e.i(561213);let D={...T.popupStoreSelectors,disabled:(0,b.createSelector)(e=>e.disabled),instantType:(0,b.createSelector)(e=>e.instantType),isInstantPhase:(0,b.createSelector)(e=>e.isInstantPhase),trackCursorAxis:(0,b.createSelector)(e=>e.trackCursorAxis),disableHoverablePopup:(0,b.createSelector)(e=>e.disableHoverablePopup),lastOpenChangeReason:(0,b.createSelector)(e=>e.openChangeReason),closeOnClick:(0,b.createSelector)(e=>e.closeOnClick),closeDelay:(0,b.createSelector)(e=>e.closeDelay),hasViewport:(0,b.createSelector)(e=>e.hasViewport)};class M extends k.ReactStore{constructor(e){super({...(0,T.createInitialPopupStoreState)(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1,...e},{popupRef:n.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new P.PopupTriggerMap},D)}setOpen=(e,t)=>{let a=t.reason,s=a===C.REASONS.triggerHover,n=e&&a===C.REASONS.triggerFocus,i=!e&&(a===C.REASONS.triggerPress||a===C.REASONS.escapeKey);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let r=()=>{let s={open:e,openChangeReason:a};n?s.instantType="focus":i?s.instantType="dismiss":a===C.REASONS.triggerHover&&(s.instantType=void 0);let r=t.trigger?.id??null;(r||e)&&(s.activeTriggerId=r,s.activeTriggerElement=t.trigger??null),this.update(s)};s?w.flushSync(r):r()};static useStore(e,t){let a=(0,S.useRefWithInit)(()=>new M(t)).current,s=e??a,n=(0,N.useSyncedFloatingRootContext)({popupStore:s,onOpenChange:s.setOpen});return s.state.floatingRootContext=n,s}}let O=(0,i.fastComponent)(function(e){let{disabled:t=!1,defaultOpen:a=!1,open:i,disableHoverablePopup:o=!1,trackCursorAxis:d="none",actionsRef:w,onOpenChange:b,onOpenChangeComplete:k,handle:S,triggerId:N,defaultTriggerId:T=null,children:P}=e,D=M.useStore(S?.store,{open:a,openProp:i,activeTriggerId:T,triggerIdProp:N});(0,r.useOnFirstRender)(()=>{void 0===i&&!1===D.state.open&&!0===a&&D.update({open:!0,activeTriggerId:T})}),D.useControlledProp("openProp",i),D.useControlledProp("triggerIdProp",N),D.useContextCallback("onOpenChange",b),D.useContextCallback("onOpenChangeComplete",k);let O=D.useState("open"),I=!t&&O,z=D.useState("activeTriggerId"),E=D.useState("payload");D.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:o}),(0,l.useIsoLayoutEffect)(()=>{O&&t&&D.setOpen(!1,(0,v.createChangeEventDetails)(C.REASONS.disabled))},[O,t,D]),D.useSyncedValue("disabled",t),(0,j.useImplicitActiveTrigger)(D);let{forceUnmount:A,transitionStatus:R}=(0,j.useOpenStateTransitions)(I,D),$=D.select("floatingRootContext"),L=D.useState("isInstantPhase"),F=D.useState("instantType"),B=D.useState("lastOpenChangeReason"),W=n.useRef(null);(0,l.useIsoLayoutEffect)(()=>{"ending"===R&&B===C.REASONS.none||"ending"!==R&&L?("delay"!==F&&(W.current=F),D.set("instantType","delay")):null!==W.current&&(D.set("instantType",W.current),W.current=null)},[R,L,B,F,D]),(0,l.useIsoLayoutEffect)(()=>{I&&null==z&&D.set("payload",void 0)},[D,z,I]);let U=n.useCallback(()=>{D.setOpen(!1,(0,v.createChangeEventDetails)(C.REASONS.imperativeAction))},[D]);n.useImperativeHandle(w,()=>({unmount:A,close:U}),[A,U]);let H=(0,g.useDismiss)($,{enabled:!t,referencePress:()=>D.select("closeOnClick")}),J=function(e,t={}){let a="rootStore"in e?e.rootStore:e,s=a.useState("open"),i=a.useState("floatingElement"),r=a.useState("domReferenceElement"),l=a.context.dataRef,{enabled:o=!0,axis:c="both"}=t,d=n.useRef(!1),g=n.useRef(null),[y,v]=n.useState(),[j,w]=n.useState([]),b=(0,p.useStableCallback)((e,t,s)=>{if(!d.current&&(!l.current.openEvent||x(l.current.openEvent))){var n,i;let o,d,u;a.set("positionReference",(n=s??r,i={x:e,y:t,axis:c,dataRef:l,pointerType:y},o=null,d=null,u=!1,{contextElement:n||void 0,getBoundingClientRect(){let e=n?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},t="x"===i.axis||"both"===i.axis,a="y"===i.axis||"both"===i.axis,s=["mouseenter","mousemove"].includes(i.dataRef.current.openEvent?.type||"")&&"touch"!==i.pointerType,r=e.width,l=e.height,c=e.x,m=e.y;return null==o&&i.x&&t&&(o=e.x-i.x),null==d&&i.y&&a&&(d=e.y-i.y),c-=o||0,m-=d||0,r=0,l=0,!u||s?(r="y"===i.axis?e.width:0,l="x"===i.axis?e.height:0,c=t&&null!=i.x?i.x:c,m=a&&null!=i.y?i.y:m):u&&!s&&(l="x"===i.axis?e.height:l,r="y"===i.axis?e.width:r),u=!0,{width:r,height:l,x:c,y:m,top:m,right:c+r,bottom:m+l,left:c}}}))}}),k=(0,p.useStableCallback)(e=>{s?g.current||w([]):b(e.clientX,e.clientY,e.currentTarget)}),S=(0,f.isMouseLikePointerType)(y)?i:s,N=n.useCallback(()=>{if(!S||!o)return;let e=(0,u.getWindow)(i);if(!l.current.openEvent||x(l.current.openEvent))return g.current=(0,m.addEventListener)(e,"mousemove",function(e){let t=(0,h.getTarget)(e);(0,h.contains)(i,t)?(g.current?.(),g.current=null):b(e.clientX,e.clientY)}),()=>{g.current?.(),g.current=null};a.set("positionReference",r)},[S,o,i,l,r,a,b]);n.useEffect(()=>N(),[N,j]),n.useEffect(()=>{o&&!i&&(d.current=!1)},[o,i]),n.useEffect(()=>{!o&&s&&(d.current=!0)},[o,s]);let C=n.useMemo(()=>{function e(e){v(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:k,onMouseEnter:k}},[k]);return n.useMemo(()=>o?{reference:C,trigger:C}:{},[o,C])}($,{enabled:!t&&"none"!==d,axis:"none"===d?void 0:d}),{getReferenceProps:V,getFloatingProps:_,getTriggerProps:q}=(0,y.useInteractions)([H,J]),X=n.useMemo(()=>V(),[V]),Y=n.useMemo(()=>q(),[q]),K=n.useMemo(()=>_(),[_]);return D.useSyncedValues({activeTriggerProps:X,inactiveTriggerProps:Y,popupProps:K}),(0,s.jsx)(c.Provider,{value:D,children:"function"==typeof P?P({payload:E}):P})});var I=e.i(817955),z=e.i(969490),E=e.i(139236);let A=n.createContext(void 0);var R=e.i(499198),$=e.i(232449),L=e.i(49863);let F=n.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new $.Timeout,currentIdRef:{current:null},currentContextRef:{current:null}});function B(e){let{children:t,delay:a,timeoutMs:i=0}=e,r=n.useRef(a),l=n.useRef(a),o=n.useRef(null),c=n.useRef(null),d=(0,$.useTimeout)();return(0,s.jsx)(F.Provider,{value:n.useMemo(()=>({hasProvider:!0,delayRef:r,initialDelayRef:l,currentIdRef:o,timeoutMs:i,currentContextRef:c,timeout:d}),[i,d]),children:t})}var W=e.i(604921),U=e.i(480283);let H=((t={})[t.popupOpen=I.CommonTriggerDataAttributes.popupOpen]="popupOpen",t.triggerDisabled="data-trigger-disabled",t),J=(0,i.fastComponentRef)(function(e,t){let{className:a,render:s,handle:i,payload:r,disabled:c,delay:u,closeOnClick:m=!0,closeDelay:p,id:h,style:f,...x}=e,g=d(!0),y=i?.store??g;if(!y)throw Error((0,o.default)(82));let w=(0,E.useBaseUiId)(h),b=y.useState("isTriggerActive",w),k=y.useState("isOpenedByTrigger",w),S=y.useState("floatingRootContext"),N=n.useRef(null),T=u??600,P=p??0,{registerTrigger:D,isMountedByThisTrigger:M}=(0,j.useTriggerDataForwarding)(w,N,y,{payload:r,closeOnClick:m,closeDelay:P}),O=n.useContext(A),{delayRef:$,isInstantPhase:B,hasProvider:J}=function(e,t={open:!1}){let a="rootStore"in e?e.rootStore:e,s=a.useState("floatingId"),{open:i}=t,{currentIdRef:r,delayRef:o,timeoutMs:c,initialDelayRef:d,currentContextRef:u,hasProvider:m,timeout:p}=n.useContext(F),[h,f]=n.useState(!1);return(0,l.useIsoLayoutEffect)(()=>{function e(){f(!1),u.current?.setIsInstantPhase(!1),r.current=null,u.current=null,o.current=d.current}if(r.current&&!i&&r.current===s){if(f(!1),c)return p.start(c,()=>{a.select("open")||r.current&&r.current!==s||e()}),()=>{p.clear()};e()}},[i,s,r,o,c,d,u,p,a]),(0,l.useIsoLayoutEffect)(()=>{if(!i)return;let e=u.current,t=r.current;p.clear(),u.current={onOpenChange:a.setOpen,setIsInstantPhase:f},r.current=s,o.current={open:0,close:(0,L.getDelay)(d.current,"close")},null!==t&&t!==s?(f(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,(0,v.createChangeEventDetails)(C.REASONS.none))):(f(!1),e?.setIsInstantPhase(!1))},[i,s,a,r,o,c,d,u,p]),(0,l.useIsoLayoutEffect)(()=>()=>{u.current=null},[u]),n.useMemo(()=>({hasProvider:m,delayRef:o,isInstantPhase:h}),[m,o,h])}(S,{open:k});y.useSyncedValue("isInstantPhase",B);let V=y.useState("disabled"),_=c??V,q=y.useState("trackCursorAxis"),X=y.useState("disableHoverablePopup"),Y=(0,U.useHoverReferenceInteraction)(S,{enabled:!_,mouseOnly:!0,move:!1,handleClose:X||"both"===q?null:(0,R.safePolygon)(),restMs(){let e=O?.delay,t="object"==typeof $.current?$.current.open:void 0,a=T;return J&&(a=0!==t?u??e??T:0),a},delay(){let e="object"==typeof $.current?$.current.close:void 0,t=P;return null==p&&J&&(t=e),{close:t}},triggerElementRef:N,isActiveTrigger:b,isClosing:()=>"ending"===y.select("transitionStatus")}),K=(0,W.useFocus)(S,{enabled:!_}).reference,G=y.useState("triggerProps",M);return(0,z.useRenderElement)("button",e,{state:{open:k},ref:[t,D,N],props:[Y,K,G,{onPointerDown(){y.set("closeOnClick",m)},id:w,[H.triggerDisabled]:_?"":void 0},x],stateAttributesMapping:I.triggerOpenStateMapping})}),V=n.createContext(void 0);var _=e.i(384389);let q=n.forwardRef(function(e,t){let{keepMounted:a=!1,...n}=e;return d().useState("mounted")||a?(0,s.jsx)(V.Provider,{value:a,children:(0,s.jsx)(_.FloatingPortalLite,{ref:t,...n})}):null}),X=n.createContext(void 0);function Y(){let e=n.useContext(X);if(void 0===e)throw Error((0,o.default)(71));return e}var K=e.i(576557),G=e.i(576487),Q=e.i(909852),Z=e.i(263635);let ee=n.forwardRef(function(e,t){let{render:a,className:i,anchor:r,positionMethod:l="absolute",side:c="top",align:u="center",sideOffset:m=0,alignOffset:p=0,collisionBoundary:h="clipping-ancestors",collisionPadding:f=5,arrowPadding:x=5,sticky:g=!1,disableAnchorTracking:y=!1,collisionAvoidance:v=G.POPUP_COLLISION_AVOIDANCE,style:j,...w}=e,b=d(),k=function(){let e=n.useContext(V);if(void 0===e)throw Error((0,o.default)(70));return e}(),S=b.useState("open"),N=b.useState("mounted"),C=b.useState("trackCursorAxis"),T=b.useState("disableHoverablePopup"),P=b.useState("floatingRootContext"),D=b.useState("instantType"),M=b.useState("transitionStatus"),O=b.useState("hasViewport"),I=(0,K.useAnchorPositioning)({anchor:r,positionMethod:l,floatingRootContext:P,mounted:N,side:c,sideOffset:m,align:u,alignOffset:p,collisionBoundary:h,collisionPadding:f,sticky:g,arrowPadding:x,disableAnchorTracking:y,keepMounted:k,collisionAvoidance:v,adaptiveOrigin:O?Q.adaptiveOrigin:void 0}),z=n.useMemo(()=>({open:S,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:"none"!==C?"tracking-cursor":D}),[S,I.side,I.align,I.anchorHidden,C,D]),E=(0,Z.usePositioner)(e,z,{styles:I.positionerStyles,transitionStatus:M,props:w,refs:[t,b.useStateSetter("positionerElement")],hidden:!N,inert:!S||"both"===C||T});return(0,s.jsx)(X.Provider,{value:I,children:E})});var et=e.i(282458),ea=e.i(273598),es=e.i(328657),en=e.i(795914);let ei={...I.popupStateMapping,...et.transitionStatusMapping},er=n.forwardRef(function(e,t){let{className:a,render:s,style:n,...i}=e,r=d(),{side:l,align:o}=Y(),c=r.useState("open"),u=r.useState("instantType"),m=r.useState("transitionStatus"),p=r.useState("popupProps"),h=r.useState("floatingRootContext");(0,ea.useOpenChangeComplete)({open:c,ref:r.context.popupRef,onComplete(){c&&r.context.onOpenChangeComplete?.(!0)}});let f=r.useState("disabled"),x=r.useState("closeDelay");return(0,en.useHoverFloatingInteraction)(h,{enabled:!f,closeDelay:x}),(0,z.useRenderElement)("div",e,{state:{open:c,side:l,align:o,instant:u,transitionStatus:m},ref:[t,r.context.popupRef,r.useStateSetter("popupElement")],props:[p,(0,es.getDisabledMountTransitionStyles)(m),i],stateAttributesMapping:ei})}),el=n.forwardRef(function(e,t){let{className:a,render:s,style:n,...i}=e,r=d(),l=r.useState("open"),o=r.useState("instantType"),{arrowRef:c,side:u,align:m,arrowUncentered:p,arrowStyles:h}=Y();return(0,z.useRenderElement)("div",e,{state:{open:l,side:u,align:m,uncentered:p,instant:o},ref:[t,c],props:[{style:h,"aria-hidden":!0},i],stateAttributesMapping:I.popupStateMapping})}),eo=((a={}).popupWidth="--popup-width",a.popupHeight="--popup-height",a);var ec=e.i(3310);let ed={activationDirection:e=>e?{"data-activation-direction":e}:null},eu=n.forwardRef(function(e,t){let{render:a,className:s,style:n,children:i,...r}=e,l=d(),o=Y(),c=l.useState("instantType"),{children:u,state:m}=(0,ec.usePopupViewport)({store:l,side:o.side,cssVars:eo,children:i}),p={activationDirection:m.activationDirection,transitioning:m.transitioning,instant:c};return(0,z.useRenderElement)("div",e,{state:p,ref:t,props:[r,{children:u}],stateAttributesMapping:ed})});class em{constructor(){this.store=new M}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw Error((0,o.default)(81,e));this.store.setOpen(!0,(0,v.createChangeEventDetails)(C.REASONS.imperativeAction,void 0,t))}close(){this.store.setOpen(!1,(0,v.createChangeEventDetails)(C.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,el,"Handle",0,em,"Popup",0,er,"Portal",0,q,"Positioner",0,ee,"Provider",0,function(e){let{delay:t,closeDelay:a,timeout:i=400}=e,r=n.useMemo(()=>({delay:t,closeDelay:a}),[t,a]),l=n.useMemo(()=>({open:t,close:a}),[t,a]);return(0,s.jsx)(A.Provider,{value:r,children:(0,s.jsx)(B,{delay:l,timeoutMs:i,children:e.children})})},"Root",0,O,"Trigger",0,J,"Viewport",0,eu,"createHandle",0,function(){return new em}],638295);var ep=e.i(638295),ep=ep,eh=e.i(465458);e.s(["Tooltip",0,function({...e}){return(0,s.jsx)(ep.Root,{"data-slot":"tooltip",...e})},"TooltipContent",0,function({className:e,side:t="top",sideOffset:a=4,align:n="center",alignOffset:i=0,children:r,...l}){return(0,s.jsx)(ep.Portal,{children:(0,s.jsx)(ep.Positioner,{align:n,alignOffset:i,side:t,sideOffset:a,className:"isolate z-50",children:(0,s.jsxs)(ep.Popup,{"data-slot":"tooltip-content",className:(0,eh.cn)("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...l,children:[r,(0,s.jsx)(ep.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})},"TooltipProvider",0,function({delay:e=0,...t}){return(0,s.jsx)(ep.Provider,{"data-slot":"tooltip-provider",delay:e,...t})},"TooltipTrigger",0,function({...e}){return(0,s.jsx)(ep.Trigger,{"data-slot":"tooltip-trigger",...e})}],638322)},92457,e=>{"use strict";let t=(0,e.i(433721).default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);e.s(["Monitor",0,t],92457)},36539,e=>{"use strict";let t=(0,e.i(433721).default)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);e.s(["default",0,t])},980476,e=>{e.v(t=>Promise.all(["static/chunks/05f8cnmzqd5wb.js","static/chunks/128ugqd34tr_-.js"].map(t=>e.l(t))).then(()=>t(65666)))},863812,e=>{e.v(t=>Promise.all(["static/chunks/168ojsxhm7ypc.js"].map(t=>e.l(t))).then(()=>t(158480)))},930010,e=>{e.v(e=>Promise.resolve().then(()=>e(360112)))}]);
@@ -1,2 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,588591,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(244073),l=e.i(355819),i=e.i(209988),r=e.i(260218),n=e.i(917955),o=e.i(465458),d=e.i(767467),c=e.i(325443),m=e.i(650654),p=e.i(953700),u=e.i(357301),x=e.i(433721);let h=(0,x.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);var g=e.i(444433);let v={agent:"bg-gray-500/10 text-gray-600 border-gray-200",scheduler:"bg-blue-500/10 text-blue-600 border-blue-200",task_creator:"bg-green-500/10 text-green-600 border-green-200",bot:"bg-cyan-500/10 text-cyan-600 border-cyan-200"},j=[{value:"anthropic-messages",labelKey:"anthropicMessages"},{value:"openai-chat-completions",labelKey:"openaiChatCompletions"},{value:"openai-responses",labelKey:"openaiResponses"},{value:"openai-responses-to-anthropic-messages",labelKey:"openaiResponsesToAnthropic"},{value:"openai-chat-completions-to-anthropic-messages",labelKey:"openaiChatToAnthropic"},{value:"gemini-generate-content",labelKey:"geminiGenerateContent"}],f=[{value:"claude-code",labelKey:"claudeCode"},{value:"open-agent-sdk",labelKey:"openAgentSdk"},{value:"codex",labelKey:"codex"},{value:"langchain",labelKey:"langchain"}],y=["agent","scheduler","task_creator","bot"],b=(g.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name),N=new Set(["openai-responses-to-anthropic-messages","openai-chat-completions-to-anthropic-messages"]);function k(e){return{mcpServers:Object.fromEntries(e.map(e=>[e,{}]))}}function w(e){return e.map(e=>({name:`${e}.md`,content:`# ${e}
2
- `}))}let S={agent:{name:"Agent",role:"agent",description:"通用 Agent,可在 workflow 中承担任意执行节点",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:k([]),skills:w(["coding","debugging","testing"]),tools:b,systemPrompt:"你是通用 Agent。根据 issue 和当前任务上下文完成被分配的工作,遵循项目规范,必要时修改代码、运行验证,并清晰汇报结果。",outputStyle:"",temperature:.3,maxTokens:8192,enabled:!0},scheduler:{name:"Scheduler",role:"scheduler",description:"任务调度者,负责任务分发和协调",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:k([]),skills:w(["planning","task-split"]),tools:b,systemPrompt:"你是调度者 Agent。负责接收用户任务,分析任务类型,分发给合适的执行者。你需要跟踪任务状态,确保所有子任务按时完成。",outputStyle:"",temperature:.3,maxTokens:4096,enabled:!0},task_creator:{name:"Task Creator",role:"task_creator",description:"任务创建者,负责把 issue 拆成可执行任务",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:k([]),skills:w(["planning","task-split"]),tools:b,systemPrompt:"你是任务创建者 Agent。负责读取 issue 上下文,把需求拆分为少量可执行任务,并用系统工具写入任务列表。只创建真正需要独立执行的任务,避免把细碎步骤拆成任务。",outputStyle:"",temperature:.3,maxTokens:4096,enabled:!0},bot:{name:"Bot Agent",role:"bot",description:"消息机器人,负责处理外部聊天平台中的用户消息",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:{},skills:[],tools:b,systemPrompt:"你是 Agent Spaces 的消息机器人。你会简洁回答来自外部聊天平台的用户消息。不要执行危险操作;需要用户提供更多信息时直接询问。",outputStyle:"",temperature:.3,maxTokens:4096,enabled:!0}};function C(e){var t,a;return{...e,name:e.name||"New Agent",description:e.description||"",avatarUrl:e.avatarUrl||"",runtimeKind:e.runtimeKind||"open-agent-sdk",modelProvider:e.modelProvider||"",modelId:e.modelId||"claude-sonnet-4-6",apiBase:e.apiBase||"",apiKey:e.apiKey||"",workingDir:e.workingDir||"",mcps:(t=e.mcps)||{},skills:Array.isArray(a=e.skills)?a.map(e=>"string"==typeof e?{name:e.endsWith(".md")?e:`${e}.md`}:e):[],tools:function(e){if(!Array.isArray(e))return b;let t=new Set((g.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name));return e.filter(e=>t.has(e))}(e.tools),systemPrompt:e.systemPrompt||"",outputStyle:e.outputStyle||"",temperature:e.temperature??.3,maxTokens:e.maxTokens??4096,enabled:e.enabled??!0}}function P(e){return{id:`draft-${e}-${Date.now()}`,...S[e],mcps:structuredClone(S[e].mcps),skills:S[e].skills.map(e=>({...e})),tools:[...S[e].tools]}}function T(){return{id:`draft-empty-${Date.now()}`,name:"",role:"agent",description:"",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"",modelId:"",apiBase:"",apiKey:"",workingDir:"",mcps:{},skills:[],tools:b,systemPrompt:"",outputStyle:"",temperature:.3,maxTokens:4096,enabled:!0}}function z({icon:e,title:a,children:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[e,a]}),s]})}function D({label:e,children:a}){return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:e}),a]})}function B({icon:e,title:a,action:s}){return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[e,(0,t.jsx)("span",{className:"truncate",children:a})]}),s?(0,t.jsx)("div",{className:"shrink-0",children:s}):null]})}var A=e.i(611176),K=e.i(562918),I=e.i(226624),M=e.i(159619),O=e.i(137340);function U({agents:e,onSelect:a,onDelete:l,onToggleEnabled:i}){let n=(0,s.useTranslations)("agent");return(0,t.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let s="agent-generator"===e.id;return(0,t.jsxs)("div",{className:(0,o.cn)("group flex items-center gap-3 rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",!e.enabled&&!s&&"opacity-50"),onClick:()=>a(e),children:[(0,t.jsx)(A.AgentIcon,{name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-8"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)(K.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:s?"system":e.role}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono",children:e.modelId.split("-").slice(0,2).join("-")})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.description||n("list.noDescription")})]}),(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e.id)},children:(0,t.jsx)(M.Copy,{className:"size-3"})}),!s&&(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),l(e.id)},children:(0,t.jsx)(O.Trash2,{className:"size-3 text-destructive"})}),(0,t.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,t.jsx)(I.Switch,{size:"sm",checked:s||e.enabled,disabled:s,onCheckedChange:()=>i?.(e.id)})})]},e.id)}),0===e.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(c.Bot,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:n("list.empty")})]})]})}var E=e.i(788010),F=e.i(368942),$=e.i(681622),L=e.i(188815),R=e.i(972846),_=e.i(673478);let q=(0,x.default)("plug-zap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);var J=e.i(451534),G=e.i(119211),H=e.i(415360),W=e.i(426022);let V=(0,x.default)("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]]);var X=e.i(129981),Z=e.i(344118),Q=e.i(613812),Y=e.i(113519);function ee({agent:e,roleOptions:l,testing:n,testResult:d,onChange:c,onMcpChange:m,onAddSkillFiles:p,onRemoveSkill:u,onTestConnection:x}){let v=(0,s.useTranslations)("agent"),[y,b]=(0,a.useState)(()=>JSON.stringify(e.mcps,null,2)),[N,k]=(0,a.useState)(null),[w,S]=(0,a.useState)([]),[C,P]=(0,a.useState)(!1),[T,K]=(0,a.useState)(""),[I,M]=(0,a.useState)(!1),[O,U]=(0,a.useState)(""),[et,ea]=(0,a.useState)(null),[es,el]=(0,a.useState)(!1),[ei,er]=(0,a.useState)(!1),[en,eo]=(0,a.useState)(""),{models:ed,providers:ec,ensure:em}=(0,F.useLLMStore)(),ep=ed.filter(e=>!e.embedding);(0,a.useEffect)(()=>{em()},[em]),(0,a.useEffect)(()=>{b(JSON.stringify(e.mcps,null,2))},[e.mcps]);let eu=(0,a.useCallback)(e=>{c("apiBase",e.apiBase),c("apiKey",e.apiKey);let t=ep.filter(t=>t.provider===e.name).map(e=>({value:e.modelId,label:e.name}));S(t),t.length>0&&c("modelId",t[0].value)},[ep,c]),ex=async e=>{if(!e?.length)return;let t=Array.from(e).filter(e=>e.name.toLowerCase().endsWith(".md"));p(await Promise.all(t.map(async e=>({name:e.name,content:await e.text()}))))},eh=async()=>{let t=T.trim();if(t){M(!0),ea(null);try{let a=await fetch("/api/agents/presets/optimize-prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t,currentPrompt:e.systemPrompt})}),s=await a.json();if(!a.ok)throw Error(s.error||"Failed to optimize prompt");U(s.systemPrompt?.trim()||""),eo(e.systemPrompt),P(!1),el(!0)}catch(e){ea(e instanceof Error?e.message:"优化提示词失败")}finally{M(!1)}}},eg=e=>{P(e),e||I||(K(""),ea(null))};return(0,t.jsxs)("div",{className:"flex flex-col gap-5 p-5",children:[(0,t.jsxs)(z,{icon:(0,t.jsx)(W.MessageSquare,{className:"size-3.5"}),title:v("detail.basic"),children:[(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,t.jsx)(A.AgentIcon,{name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-16 rounded-xl border border-input"}),(0,t.jsxs)("label",{className:"text-[10px] text-primary cursor-pointer hover:underline",children:[v("detail.uploadAvatar"),(0,t.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:async e=>{let t=e.target.files?.[0];if(!t)return;let a=new FileReader;a.onload=async()=>{try{let e=await fetch("/api/upload/avatar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:a.result,filename:t.name})}),s=await e.json();s.url&&c("avatarUrl",s.url)}catch{}},a.readAsDataURL(t),e.target.value=""}})]}),e.avatarUrl&&(0,t.jsx)("button",{type:"button",className:"text-[10px] text-destructive hover:underline cursor-pointer",onClick:()=>c("avatarUrl",""),children:v("detail.removeAvatar")})]}),(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-2.5",children:[(0,t.jsx)(D,{label:v("detail.name"),children:(0,t.jsx)($.Input,{value:e.name,onChange:e=>c("name",e.target.value)})}),(0,t.jsx)(D,{label:v("detail.role"),children:(0,t.jsx)("select",{value:e.role,onChange:e=>c("role",e.target.value),className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:l.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})})]})]}),(0,t.jsx)(D,{label:v("detail.description"),children:(0,t.jsx)($.Input,{value:e.description,onChange:e=>c("description",e.target.value)})}),(0,t.jsx)(D,{label:v("detail.agentRuntime"),children:(0,t.jsx)(L.SearchSelect,{value:e.runtimeKind??"",onChange:e=>c("runtimeKind",e),options:f.map(e=>({value:e.value,label:v(`runtime.${e.labelKey}`)})),placeholder:v("detail.runtimePlaceholder"),searchPlaceholder:v("detail.runtimeSearchPlaceholder"),allowCustom:!1})})]}),(0,t.jsx)(z,{icon:(0,t.jsx)(J.FolderOpen,{className:"size-3.5"}),title:v("detail.workingDirectory"),children:(0,t.jsx)($.Input,{value:e.workingDir,onChange:e=>c("workingDir",e.target.value),placeholder:v("detail.workingDirPlaceholder")})}),(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)(B,{icon:(0,t.jsx)(H.Sparkles,{className:"size-3.5"}),title:v("detail.systemPrompt"),action:(0,t.jsxs)(r.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>P(!0),children:[(0,t.jsx)(h,{className:"size-3.5"}),v("detail.optimizePrompt")]})}),(0,t.jsx)(E.Textarea,{value:e.systemPrompt,onChange:e=>c("systemPrompt",e.target.value),placeholder:v("detail.systemPromptPlaceholder"),className:"min-h-24 text-xs"})]}),(0,t.jsx)(z,{icon:(0,t.jsx)(H.Sparkles,{className:"size-3.5"}),title:v("detail.outputStyle"),children:(0,t.jsx)(E.Textarea,{value:e.outputStyle,onChange:e=>c("outputStyle",e.target.value),placeholder:v("detail.outputStylePlaceholder"),className:"min-h-24 text-xs"})}),(0,t.jsxs)(z,{icon:(0,t.jsx)(G.Wrench,{className:"size-3.5"}),title:v("detail.mcpServers"),children:[(0,t.jsx)(E.Textarea,{value:y,onChange:e=>(e=>{b(e);try{let t=JSON.parse(e);if(!t||"object"!=typeof t||Array.isArray(t))throw Error("MCP config must be a JSON object");k(null),m(t)}catch(e){k(e instanceof Error?e.message:"Invalid JSON")}})(e.target.value),placeholder:'{\n "mcpServers": {}\n}',className:"min-h-28 font-mono text-xs"}),N&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:N})]}),(0,t.jsxs)(z,{icon:(0,t.jsx)(G.Wrench,{className:"size-3.5"}),title:v("detail.tools"),children:[(0,t.jsx)(r.Button,{variant:"outline",size:"sm",className:"w-full",onClick:()=>er(!0),children:v("detail.enabledToolsCount",{count:e.tools.length,total:(g.BUILT_IN_AGENT_TOOLS??[]).length})}),(0,t.jsx)(Y.ToolsDialog,{open:ei,onOpenChange:er,selectable:!0,selectedTools:e.tools,onSelectedToolsChange:e=>c("tools",e)})]}),(0,t.jsxs)(z,{icon:(0,t.jsx)(_.Cpu,{className:"size-3.5"}),title:v("detail.skills"),children:[(0,t.jsx)("div",{className:"mb-2 flex flex-wrap gap-1.5",children:e.skills.map((e,a)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium text-foreground",children:[e.name,(0,t.jsx)("button",{type:"button",onClick:()=>u(a),className:"hover:text-destructive cursor-pointer",children:(0,t.jsx)(R.X,{className:"size-2.5"})})]},a))}),(0,t.jsxs)("label",{className:"flex h-8 cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-input text-xs text-muted-foreground hover:bg-muted/50",children:[(0,t.jsx)(X.Upload,{className:"size-3.5"}),v("detail.uploadSkills"),(0,t.jsx)("input",{type:"file",accept:".md,text/markdown",multiple:!0,className:"hidden",onChange:e=>{ex(e.target.files),e.target.value=""}})]})]}),(0,t.jsxs)(z,{icon:(0,t.jsx)(V,{className:"size-3.5"}),title:v("detail.model"),children:[(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsx)(D,{label:v("detail.provider"),children:(0,t.jsx)(L.SearchSelect,{value:ec.find(t=>t.apiBase===e.apiBase&&t.apiKey===e.apiKey)?.name||"",onChange:e=>{let t=ec.find(t=>t.name===e);t&&eu(t)},options:ec.map(e=>({value:e.name,label:e.name})),placeholder:v("detail.providerPlaceholder"),searchPlaceholder:v("detail.providerSearchPlaceholder"),allowCustom:!1})}),(0,t.jsx)(D,{label:v("detail.modelField"),children:(0,t.jsx)(L.SearchSelect,{value:e.modelId,onChange:e=>c("modelId",e),options:w.length>0?w:[{value:e.modelId||"",label:e.modelId||v("detail.selectProviderFirst")}],placeholder:v("detail.modelPlaceholder"),searchPlaceholder:v("detail.modelSearchPlaceholder")})}),(0,t.jsx)(D,{label:v("detail.apiMessageType"),children:(0,t.jsx)(L.SearchSelect,{value:e.modelProvider||"",onChange:e=>c("modelProvider",e),options:j.map(e=>({value:e.value,label:v(`provider.${e.labelKey}`)})),placeholder:v("detail.apiMessageTypePlaceholder"),searchPlaceholder:v("detail.apiMessageTypeSearchPlaceholder"),allowCustom:!1})}),(0,t.jsx)(D,{label:v("detail.apiBase"),children:(0,t.jsx)($.Input,{value:e.apiBase,onChange:e=>c("apiBase",e.target.value),placeholder:v("detail.apiBasePlaceholder"),className:"h-7 text-xs"})}),(0,t.jsx)(D,{label:v("detail.apiKey"),children:(0,t.jsx)($.Input,{type:"password",value:e.apiKey,onChange:e=>c("apiKey",e.target.value),placeholder:v("detail.apiKeyPlaceholder"),className:"h-7 text-xs"})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:v("detail.validateHelper")}),(0,t.jsxs)(r.Button,{type:"button",variant:"outline",size:"sm",onClick:x,disabled:n||!e.apiBase||!e.apiKey||!e.modelId,children:[(0,t.jsx)(q,{className:"size-3.5"}),n?v("detail.testing"):v("detail.test")]})]}),d&&(0,t.jsxs)("div",{className:(0,o.cn)("rounded-md border px-3 py-2 text-xs",d.success?"border-green-500/30 bg-green-500/10 text-green-700":"border-destructive/30 bg-destructive/10 text-destructive"),children:[d.message,d.debug&&(0,t.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[10px] opacity-80",children:[d.debug.status&&(0,t.jsxs)("div",{children:[v("debug.status")," ",d.debug.status]}),d.debug.provider&&(0,t.jsxs)("div",{children:[v("debug.provider")," ",d.debug.provider]}),d.debug.requestUrl&&(0,t.jsxs)("div",{children:[v("debug.url")," ",d.debug.requestUrl]}),d.debug.model&&(0,t.jsxs)("div",{children:[v("debug.model")," ",d.debug.model]}),d.debug.responseBody&&(0,t.jsxs)("div",{className:"max-h-20 overflow-auto whitespace-pre-wrap",children:[v("debug.body")," ",d.debug.responseBody]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(D,{label:v("detail.temperature"),children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"range",min:0,max:2,step:.1,value:e.temperature,onChange:e=>c("temperature",parseFloat(e.target.value)),className:"flex-1"}),(0,t.jsx)("span",{className:"w-8 text-right font-mono text-xs",children:e.temperature})]})}),(0,t.jsx)(D,{label:v("detail.maxTokens"),children:(0,t.jsx)($.Input,{type:"number",value:e.maxTokens,onChange:e=>c("maxTokens",parseInt(e.target.value)||0),className:"h-7 text-xs"})})]})]}),(0,t.jsx)(i.Dialog,{open:C,onOpenChange:eg,children:(0,t.jsxs)(i.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(i.DialogHeader,{children:[(0,t.jsx)(i.DialogTitle,{children:v("detail.optimizePrompt")}),(0,t.jsx)(i.DialogDescription,{children:v("detail.optimizePromptDescription")})]}),(0,t.jsx)(E.Textarea,{value:T,onChange:e=>K(e.target.value),placeholder:v("detail.optimizePromptPlaceholder"),className:"min-h-32 text-sm"}),et&&(0,t.jsx)("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:et}),(0,t.jsxs)(i.DialogFooter,{children:[(0,t.jsx)(r.Button,{variant:"outline",onClick:()=>eg(!1),disabled:I,children:v("detail.cancel")}),(0,t.jsx)(r.Button,{onClick:eh,disabled:I||!T.trim(),children:I?v("detail.optimizing"):v("detail.optimizeConfirm")})]})]})}),(0,t.jsx)(i.Dialog,{open:es,onOpenChange:el,children:(0,t.jsxs)(i.DialogContent,{className:"!w-[min(92vw,1200px)] !max-w-[min(92vw,1200px)] !h-[85vh] flex flex-col gap-0 overflow-hidden p-0",children:[(0,t.jsxs)(i.DialogHeader,{className:"border-b px-4 py-3",children:[(0,t.jsx)(i.DialogTitle,{children:v("detail.optimizePreviewTitle")}),(0,t.jsx)(i.DialogDescription,{children:v("detail.optimizePreviewDescription")})]}),(0,t.jsxs)("div",{className:"grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-2",children:[(0,t.jsx)("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r",children:(0,t.jsx)(Q.DiffViewer,{oldContent:en,newContent:O,path:"system-prompt.md"})}),(0,t.jsxs)("div",{className:"flex min-h-0 flex-col border-t lg:border-t-0",children:[(0,t.jsxs)("div",{className:"border-b px-4 py-3",children:[(0,t.jsx)("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:v("detail.optimizeRequest")}),(0,t.jsx)("div",{className:"mt-2 whitespace-pre-wrap text-sm text-foreground",children:T})]}),(0,t.jsxs)("div",{className:"flex-1 min-h-0 overflow-auto px-4 py-3",children:[(0,t.jsx)("div",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:v("detail.optimizedPrompt")}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap text-sm leading-6 text-foreground",children:O})]})]})]}),(0,t.jsxs)(i.DialogFooter,{className:"border-t m-1",children:[(0,t.jsxs)(r.Button,{variant:"outline",onClick:()=>el(!1),children:[(0,t.jsx)(R.X,{className:"size-3.5"}),v("detail.cancel")]}),(0,t.jsxs)(r.Button,{onClick:()=>{O.trim()&&(c("systemPrompt",O),el(!1),U(""),eo(""),K(""))},children:[(0,t.jsx)(Z.Check,{className:"size-3.5"}),v("detail.applyOptimizedPrompt")]})]})]})})]})}let et=(0,a.forwardRef)(function({agent:e,roleOptions:n=y,onSaved:o,onBack:d,showFooter:c=!0,autoOpenGenerate:m=!1,presetBasePath:p="/api/agents/presets"},u){let x=(0,s.useTranslations)("agent"),h=(0,s.useTranslations)("common"),[g,v]=(0,a.useState)({...e}),[j,f]=(0,a.useState)(!1),[b,k]=(0,a.useState)(!1),[w,S]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[D,B]=(0,a.useState)(0),[A,K]=(0,a.useState)(m),[I,M]=(0,a.useState)(""),[O,U]=(0,a.useState)(!1);(0,a.useImperativeHandle)(u,()=>({reset(){v(t=>{if(!t)return{...e};let{modelProvider:a,modelId:s,apiBase:l,apiKey:i,runtimeKind:r}=t;return{...e,modelProvider:a,modelId:s,apiBase:l,apiKey:i,runtimeKind:r}}),S(null),B(e=>e+1)},openGenerate(){K(!0)}}));let F=async()=>{if(g){f(!0),z(null);try{let e=g.id.startsWith("draft-"),t=function(e){let{id:t,...a}=e;return{...a,modelProvider:a.modelProvider||void 0}}(g),a=await fetch(e?p:`${p}/${g.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e?t:g)});if(!a.ok)throw Error(await a.text());let s=await a.json(),i=C(s);"/api/agents/presets"===p&&l.useAgentStore.setState(t=>({agents:e?[...t.agents,s]:t.agents.map(e=>e.id===s.id?s:e)})),o(i)}catch{z(x("error.saveFailed"))}finally{f(!1)}}},$=async()=>{if(g){k(!0),S(null),z(null);try{let e=await fetch(`${p}/test-connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),t=await e.json();S({success:!!t.success,message:t.message||t.error||x("error.connectionTestFailed"),debug:t.debug?{...t.debug,status:e.status}:{status:e.status}})}catch(e){S({success:!1,message:e instanceof Error?e.message:x("error.connectionTestFailed")})}finally{k(!1)}}},L=async()=>{let e=I.trim();if(e){U(!0),z(null);try{let t=await fetch(`${p}/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e})}),a=await t.json();if(!t.ok)throw Error(a.error||"Failed to generate agent");let s=g??P(n[0]??"agent"),l={...s,name:a.name?.trim()||s.name,description:a.description?.trim()||s.description,systemPrompt:a.systemPrompt?.trim()||s.systemPrompt};v(l),K(!1),M(""),S(null)}catch(e){z(e instanceof Error?e.message:"智能创建 Agent 失败")}finally{U(!1)}}};return(0,t.jsxs)(t.Fragment,{children:[T&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:T}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(ee,{agent:g,roleOptions:n,testing:b,testResult:w,onChange:(e,t)=>{v(a=>{if(!a)return a;if("modelProvider"===e)return{...a,modelProvider:t,runtimeKind:t&&N.has(t)?"claude-code":a.runtimeKind};return"runtimeKind"===e?{...a,runtimeKind:t}:{...a,[e]:t}})},onMcpChange:e=>{v(t=>t?{...t,mcps:e}:t)},onAddSkillFiles:e=>{if(!g)return;let t=new Set(g.skills.map(e=>e.name));v(a=>a?{...a,skills:[...a.skills.filter(t=>!e.some(e=>e.name===t.name)),...e.filter(e=>e.name&&!t.has(e.name)),...e.filter(e=>t.has(e.name))]}:a)},onRemoveSkill:e=>{g&&v(t=>t?{...t,skills:t.skills.filter((t,a)=>a!==e)}:t)},onTestConnection:$},`${g.id}-${D}`)}),c&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(r.Button,{variant:"outline",size:"sm",onClick:d,disabled:j,children:h("cancel")}),(0,t.jsx)(r.Button,{size:"sm",onClick:F,disabled:j,children:h(j?"saving":"save")})]}),(0,t.jsx)(i.Dialog,{open:A,onOpenChange:K,children:(0,t.jsxs)(i.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(i.DialogHeader,{children:[(0,t.jsx)(i.DialogTitle,{children:"智能创建 Agent"}),(0,t.jsx)(i.DialogDescription,{children:"输入 Agent 的职责、使用场景和约束,系统会生成名称、描述和 Markdown 系统提示。"})]}),(0,t.jsx)(E.Textarea,{value:I,onChange:e=>M(e.target.value),placeholder:"例如:创建一个代码评审 Agent,专注发现 TypeScript/React 项目中的缺陷、回归风险和缺失测试。",className:"min-h-32 text-sm"}),(0,t.jsxs)(i.DialogFooter,{children:[(0,t.jsx)(r.Button,{variant:"outline",onClick:()=>K(!1),disabled:O,children:h("cancel")}),(0,t.jsx)(r.Button,{onClick:L,disabled:O||!I.trim(),children:O?"生成中...":"生成"})]})]})})]})}),ea=new Set(["agent-generator","commit-agent"]);e.s(["AgentDialog",0,function({open:e,onOpenChange:x,roleFilter:g,initialAgentId:j,standalone:f,presetBasePath:b="/api/agents/presets",singleAgent:N=!1}){let k=(0,s.useTranslations)("agent"),w=(0,s.useTranslations)("common"),S=(0,a.useRef)(null),[z,D]=(0,a.useState)([]),[B,A]=(0,a.useState)(null),[K,I]=(0,a.useState)(!1),[M,O]=(0,a.useState)(!1),[E,F]=(0,a.useState)(!1),[$,L]=(0,a.useState)(null),R=g?new Set(Array.isArray(g)?g:[g]):null,_=R?z.filter(e=>ea.has(e.id)||R.has(e.role)):z,q=R?y.filter(e=>R.has(e)):y;(0,a.useEffect)(()=>{if(!e)return;let t=new AbortController;return queueMicrotask(()=>{O(!0),L(null)}),fetch(b,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(await e.text());return e.json()}).then(e=>{let t=e.map(C);if(D(t),j){let e=t.find(e=>e.id===j);e&&A(e)}else N&&t[0]&&A(t[0])}).catch(e=>{"AbortError"!==e.name&&L(k("error.loadFailed"))}).finally(()=>O(!1)),()=>t.abort()},[e,j,b,N,k]);let J=()=>{A(null),I(!1)},G=e=>{let t="empty"===e?T():P(e);L(null),A(t)},H=async e=>{ea.has(e)||(D(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t)),await l.useAgentStore.getState().toggleEnabled(e))},W=async e=>{if(!ea.has(e)){if(e.startsWith("draft-"))return void A(null);F(!0),L(null);try{let t=await fetch(`${b}/${e}`,{method:"DELETE"});if(!t.ok)throw Error(await t.text());D(t=>t.filter(t=>t.id!==e)),l.useAgentStore.setState(t=>({agents:t.agents.filter(t=>t.id!==e)})),B?.id===e&&A(null)}catch{L(k("error.deleteFailed"))}finally{F(!1)}}},V=e=>(0,t.jsxs)(n.DropdownMenu,{children:[(0,t.jsx)(n.DropdownMenuTrigger,{render:(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",disabled:E,children:[(0,t.jsx)(p.Plus,{className:"size-3.5"}),!e&&k("dialog.add"),(0,t.jsx)(m.ChevronDown,{className:"size-3.5"})]})}),(0,t.jsx)(n.DropdownMenuContent,{side:"bottom",align:"end",className:"w-44",children:(0,t.jsxs)(n.DropdownMenuGroup,{children:[!R&&(0,t.jsxs)(n.DropdownMenuItem,{className:"gap-2",onClick:()=>G("empty"),children:[(0,t.jsx)("span",{className:"size-2 rounded-full bg-muted"}),(0,t.jsx)("span",{children:k("dialog.addEmpty")})]}),y.map(e=>(0,t.jsxs)(n.DropdownMenuItem,{className:"gap-2",onClick:()=>G(e),children:[(0,t.jsx)("span",{className:(0,o.cn)("size-2 rounded-full",v[e].split(" ")[0])}),(0,t.jsx)("span",{className:"capitalize",children:k(`role.${e}.name`)})]},e))]})})]}),X=(0,t.jsxs)(t.Fragment,{children:[!f&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 pr-12 py-4",children:[B?(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:N?()=>x(!1):J,children:(0,t.jsx)(d.ArrowLeft,{className:"size-4"})}):(0,t.jsx)("div",{className:"flex size-7 items-center justify-center rounded-lg bg-primary/10",children:(0,t.jsx)(c.Bot,{className:"size-4 text-primary"})}),(0,t.jsxs)(i.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(i.DialogTitle,{className:"text-base",children:B?B.name:k("dialog.title")}),(0,t.jsx)(i.DialogDescription,{className:"text-xs",children:B?k("dialog.editDescription"):k("dialog.listDescription")})]}),B&&ea.has(B.id)&&(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",disabled:E,onClick:()=>S.current?.reset(),children:[(0,t.jsx)(u.RotateCcw,{className:"size-3.5"}),w("reset")]}),B&&(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:()=>S.current?.openGenerate(),children:[(0,t.jsx)(h,{className:"size-3.5"}),"智能创建"]}),!B&&!N&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:()=>{let e=q[0]?P(q[0]):T();L(null),A(e),I(!0)},children:[(0,t.jsx)(h,{className:"size-3.5"}),"智能创建"]}),V()]})]}),f&&!B&&!N&&(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-b",children:[(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:()=>{let e=q[0]?P(q[0]):T();L(null),A(e),I(!0)},children:[(0,t.jsx)(h,{className:"size-3.5"}),"智能创建"]}),V()]}),f&&B&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:N?()=>x(!1):J,children:(0,t.jsx)(d.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-medium truncate",children:B.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:k("dialog.editDescription")})]}),ea.has(B.id)&&(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",disabled:E,onClick:()=>S.current?.reset(),children:[(0,t.jsx)(u.RotateCcw,{className:"size-3.5"}),w("reset")]}),(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:()=>S.current?.openGenerate(),children:[(0,t.jsx)(h,{className:"size-3.5"}),"智能创建"]})]}),$&&!B&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:$}),M?(0,t.jsx)("div",{className:"flex-1 flex flex-col p-2 space-y-1",children:Array.from({length:5},(e,a)=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-lg px-3 py-2.5",children:[(0,t.jsx)("div",{className:"size-8 rounded-full bg-muted animate-pulse"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-4 w-20 rounded bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-4 w-10 rounded-full bg-muted animate-pulse"})]}),(0,t.jsx)("div",{className:"h-3 w-32 rounded bg-muted animate-pulse"})]}),(0,t.jsx)("div",{className:"h-3 w-12 rounded bg-muted animate-pulse"})]},a))}):B?(0,t.jsx)(et,{ref:S,agent:B,roleOptions:q,onSaved:e=>{(D(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),N)?x(!1):(A(null),I(!1))},onBack:N?()=>x(!1):J,showFooter:!0,autoOpenGenerate:K,presetBasePath:b}):(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(U,{agents:_,onSelect:e=>{A(e)},onDelete:W,onToggleEnabled:H})})]});return f?(0,t.jsx)("div",{className:"h-full flex flex-col",children:X}):(0,t.jsx)(i.Dialog,{open:e,onOpenChange:e=>{e||N||J(),x(e)},children:(0,t.jsx)(i.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:X})})}],588591)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,386041,t=>{"use strict";let e=(0,t.i(433721).default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);t.s(["Code2",0,e],386041)},835829,t=>{"use strict";function e(t){return`agent-spaces:inspector-history:${t}`}function s(t){try{var s;return s=JSON.parse(localStorage.getItem(e(t))||"[]"),Array.isArray(s)?s.filter(t=>t&&"object"==typeof t&&"string"==typeof t.path&&"number"==typeof t.line).map(t=>({...t,column:"number"==typeof t.column?t.column:1,timestamp:"number"==typeof t.timestamp?t.timestamp:Date.now()})).slice(0,50):[]}catch{return[]}}function i(t,s){localStorage.setItem(e(t),JSON.stringify(s.slice(0,50)))}let a=(0,t.i(816709).create)(t=>({histories:{},loadHistory:e=>{let i=s(e);t(t=>({histories:{...t.histories,[e]:i}}))},addEntry:(e,a)=>{let r={...a,id:a.id??`${a.timestamp}-${Math.random().toString(36).slice(2,8)}`,column:a.column??1,timestamp:a.timestamp??Date.now()},o=s(e).filter(t=>t.path!==r.path||t.line!==r.line||t.column!==r.column),n=[r,...o].slice(0,50);i(e,n),t(t=>({histories:{...t.histories,[e]:n}}))},setHistory:(e,s)=>{i(e,s),t(t=>({histories:{...t.histories,[e]:s}}))},clearHistory:e=>{i(e,[]),t(t=>({histories:{...t.histories,[e]:[]}}))}}));t.s(["useInspectorHistoryStore",0,a])},194228,t=>{"use strict";let e=(0,t.i(433721).default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);t.s(["GitCommitHorizontal",0,e],194228)},253307,t=>{"use strict";let e=(0,t.i(433721).default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);t.s(["FileDiff",0,e],253307)},363156,t=>{"use strict";var e=t.i(816709);let s=/not a git repository/i;function i(t){return t instanceof Error&&s.test(t.message)}let a=(0,e.create)(t=>({status:null,diffs:[],selectedFile:null,log:[],branches:[],loading:!1,error:null,notGitRepo:!1,commitMsg:"",loadStatus:async e=>{try{let s=await fetch(`/api/workspaces/${e}/git/status`);if(!s.ok)throw Error(await s.text());let i=await s.json();t({status:i,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:i(e)})}},loadDiffs:async(e,s)=>{t({loading:!0});try{let i=s?`/api/workspaces/${e}/git/diff?path=${encodeURIComponent(s)}`:`/api/workspaces/${e}/git/diff`,a=await fetch(i);if(!a.ok)throw Error(await a.text());let r=await a.json();t({diffs:r,loading:!1,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),loading:!1,notGitRepo:i(e)})}},loadLog:async e=>{try{let s=await fetch(`/api/workspaces/${e}/git/log`);if(!s.ok)throw Error(await s.text());let i=await s.json();t({log:i,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:i(e)})}},loadBranches:async e=>{try{let s=await fetch(`/api/workspaces/${e}/git/branches`);if(!s.ok)throw Error(await s.text());let i=await s.json();t({branches:i,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:i(e)})}},initRepo:async e=>{try{let s=await fetch(`/api/workspaces/${e}/git/init`,{method:"POST"});if(!s.ok)throw Error(await s.text());t({error:null,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e)})}},commit:async(e,s)=>{try{let t=await fetch(`/api/workspaces/${e}/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},discard:async(e,s)=>{try{let t=await fetch(`/api/workspaces/${e}/git/discard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},discardAll:async e=>{try{let t=await fetch(`/api/workspaces/${e}/git/discard-all`,{method:"POST"});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},stage:async(e,s)=>{try{let t=await fetch(`/api/workspaces/${e}/git/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},unstage:async(e,s)=>{try{let t=await fetch(`/api/workspaces/${e}/git/unstage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},resolveFile:async(t,e,s,i=!0)=>{let a=await fetch(`/api/workspaces/${t}/git/resolve-file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:s,stage:i})});if(!a.ok)throw Error(await a.text())},checkout:async(e,s)=>{try{let t=await fetch(`/api/workspaces/${e}/git/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:s})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},push:async t=>{let e=await fetch(`/api/workspaces/${t}/git/push`,{method:"POST"});if(!e.ok)throw Error((await e.json().catch(()=>({error:"Push failed"}))).error)},pull:async t=>{let e=await fetch(`/api/workspaces/${t}/git/pull`,{method:"POST"});if(!e.ok)throw Error((await e.json().catch(()=>({error:"Pull failed"}))).error)},fetchRemote:async t=>{let e=await fetch(`/api/workspaces/${t}/git/fetch`,{method:"POST"});if(!e.ok)throw Error((await e.json().catch(()=>({error:"Fetch failed"}))).error)},getRemotes:async t=>{let e=await fetch(`/api/workspaces/${t}/git/remotes`);if(!e.ok)throw Error(await e.text());return e.json()},addRemote:async(t,e,s)=>{let i=await fetch(`/api/workspaces/${t}/git/remotes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,url:s})});if(!i.ok)throw Error((await i.json().catch(()=>({error:"Failed to add remote"}))).error)},selectFile:e=>t({selectedFile:e}),setCommitMsg:e=>t({commitMsg:e}),checkoutDetached:async(t,e)=>{let s=await fetch(`/api/workspaces/${t}/git/checkout-detached`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:e})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error)},cherryPick:async(t,e)=>{let s=await fetch(`/api/workspaces/${t}/git/cherry-pick`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:e})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error)},createBranch:async(t,e,s)=>{let i=await fetch(`/api/workspaces/${t}/git/create-branch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,startPoint:s})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},deleteBranch:async(t,e,s)=>{let i=await fetch(`/api/workspaces/${t}/git/delete-branch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,force:s})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},createTag:async(t,e,s)=>{let i=await fetch(`/api/workspaces/${t}/git/create-tag`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,commitHash:s})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},getCommitDiff:async(t,e)=>{let s=await fetch(`/api/workspaces/${t}/git/commit-diff?hash=${encodeURIComponent(e)}`);if(!s.ok)throw Error((await s.json().catch(()=>({}))).error);return s.json()},getRemoteUrl:async t=>{let e=await fetch(`/api/workspaces/${t}/git/remote-url`);if(!e.ok)throw Error((await e.json().catch(()=>({}))).error);return(await e.json()).url},getMergeBase:async t=>{let e=await fetch(`/api/workspaces/${t}/git/merge-base`);if(!e.ok)throw Error((await e.json().catch(()=>({}))).error);return(await e.json()).hash}}));t.s(["useGitStore",0,a])},524360,t=>{"use strict";var e=t.i(816709),s=t.i(360112);let i=new Map,a=(0,e.create)((t,e)=>({sessions:[],activeId:null,ws:null,workspaceId:null,_initialized:!1,_restored:!1,init:(a,r)=>{let o=e();if(o._initialized&&o.ws===a)return;let n=o.workspaceId!==a.workspaceId;n&&i.clear(),t({ws:a,workspaceId:a.workspaceId,sessions:n?[]:o.sessions,activeId:n?null:o.activeId,_initialized:!0,_restored:!1}),a.on("terminal.created",e=>{let{sessionId:s,cwd:i,shell:a}=e;t(t=>t.sessions.some(t=>t.id===s)?t:{sessions:[...t.sessions,{id:s,cwd:i,shell:a}],activeId:s})}),a.on("terminal.error",t=>{let{error:e}=t;s.toast.error(e)}),a.on("terminal.closed",e=>{let{sessionId:s}=e;t(t=>{let e=t.sessions.filter(t=>t.id!==s),i=t.activeId===s?e[0]?.id??null:t.activeId;return{sessions:e,activeId:i}})}),a.on("terminal.sessions",e=>{let{sessions:s}=e;t(t=>{let e=new Map(t.sessions.map(t=>[t.id,t])),a=s.map(t=>{let s=e.get(t.sessionId);return t.buffer&&i.set(t.sessionId,t.buffer),{...s,id:t.sessionId,cwd:t.cwd,shell:t.shell??s?.shell}}),r=!!t.activeId&&a.some(e=>e.id===t.activeId);for(let t of s)t.buffer||i.delete(t.sessionId);return{sessions:a,activeId:r?t.activeId:a[0]?.id??null,_restored:!0}}),r?.()})},createSession:(t,s)=>{let{ws:i}=e();i?.send("terminal.create",{sessionId:crypto.randomUUID?.()??crypto.getRandomValues(new Uint8Array(16)).reduce((t,e)=>t+e.toString(16).padStart(2,"0"),""),shell:t,cwd:s})},setActive:e=>t({activeId:e}),setSessionName:(e,s)=>t(t=>({sessions:t.sessions.map(t=>t.id===e?{...t,name:s}:t)})),removeSession:s=>{let{ws:i,sessions:a,activeId:r}=e();i?.send("terminal.close",{sessionId:s});let o=a.filter(t=>t.id!==s),n=r===s?o[0]?.id??null:r;t({sessions:o,activeId:n})},sendInput:(t,s)=>{e().ws?.send("terminal.input",{sessionId:t,data:s})},resize:(t,s,i)=>{e().ws?.send("terminal.resize",{sessionId:t,cols:s,rows:i})}}));t.s(["consumeSessionBuffer",0,function(t){let e=i.get(t);return i.delete(t),e},"useTerminalStore",0,a])},191441,t=>{"use strict";let e=(0,t.i(433721).default)("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]);t.s(["ListChecks",0,e],191441)},404175,t=>{"use strict";var e=t.i(344180),s=t.i(227634),i=t.i(191441),a=t.i(451534),r=t.i(386041),o=t.i(426022),n=t.i(989484),c=t.i(433721);let l=(0,c.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var h=t.i(253307),d=t.i(194228),p=t.i(210),u=t.i(255742),m=t.i(943997);let f=(0,c.default)("kanban",[["path",{d:"M5 3v14",key:"9nsxs2"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"M19 3v18",key:"1sk56x"}]]),g=[{id:"channel-list",icon:s.Hash,group:"channel"},{id:"chat",icon:o.MessageSquare,group:"channel"},{id:"issue-list",icon:i.ListChecks,group:"issue"},{id:"issue-detail",icon:h.FileDiff,group:"issue"},{id:"workfolder",icon:a.FolderOpen,group:"workfolder"},{id:"code-editor",icon:r.Code2,group:"workfolder"},{id:"terminal",icon:l,group:"tools"},{id:"git-commits",icon:d.GitCommitHorizontal,group:"git"},{id:"project-settings",icon:p.Settings2,group:"settings"},{id:"code-favorites",icon:u.Star,group:"workfolder"},{id:"database",icon:m.Database,group:"workfolder"},{id:"kanban",icon:f,group:"workfolder"}],k={"channel-list":(0,e.jsx)(s.Hash,{size:16}),"issue-list":(0,e.jsx)(i.ListChecks,{size:16}),workfolder:(0,e.jsx)(a.FolderOpen,{size:16}),"code-editor":(0,e.jsx)(r.Code2,{size:16}),chat:(0,e.jsx)(o.MessageSquare,{size:16}),"issue-detail":(0,e.jsx)(n.FileText,{size:16}),terminal:(0,e.jsx)(l,{size:16}),"git-commits":(0,e.jsx)(d.GitCommitHorizontal,{size:16}),"project-settings":(0,e.jsx)(p.Settings2,{size:16}),"code-favorites":(0,e.jsx)(u.Star,{size:16}),database:(0,e.jsx)(m.Database,{size:16}),kanban:(0,e.jsx)(f,{size:16}),...{}};function w(t,s,i,a,r){if("git-commits"===t&&s&&!s.clean){let t=s.insertions>0||s.deletions>0,i=(0,e.jsx)("span",{className:"ml-1 text-[10px] font-medium leading-none flex items-center gap-0.5",children:t?(0,e.jsxs)(e.Fragment,{children:[s.insertions>0&&(0,e.jsxs)("span",{className:"text-green-600",children:["+",s.insertions]}),s.deletions>0&&(0,e.jsxs)("span",{className:"text-red-500",children:["-",s.deletions]})]}):(0,e.jsx)("span",{className:"text-orange-500",children:s.files.length})}),a=s.files.length;return{trailing:i,badge:a>0?(0,e.jsx)("span",{className:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] rounded-full bg-blue-500 text-white text-[9px] font-medium leading-none flex items-center justify-center px-0.5",children:a}):null}}if("terminal"===t&&i.length>0)return{trailing:null,badge:(0,e.jsx)("span",{className:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] rounded-full bg-green-500 text-white text-[9px] font-medium leading-none flex items-center justify-center px-0.5",children:i.length})};let o=(0,e.jsxs)("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[(0,e.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,e.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]});return"channel-list"===t&&Object.values(a).some(t=>t.some(t=>"streaming"===t.status||"pending"===t.status))||"issue-detail"===t&&r.some(t=>"pending"===t.status||"running"===t.status||"retrying"===t.status||"waiting_review"===t.status)?{trailing:null,badge:o}:{trailing:null,badge:null}}t.s(["RIGHT_TO_LEFT_TAB_MAP",0,{"code-editor":"workfolder",chat:"channel-list","issue-detail":"issue-list",database:"workfolder"},"TAB_ITEMS",0,g,"getTabBadge",0,w,"renderTabIcon",0,function(t,s,i,a,r,o){let n=k[t];if(!n)return null;let{trailing:c,badge:l}=w(t,i,a,r,o);return(0,e.jsxs)("span",{title:s,className:"flex items-center justify-center",children:[(0,e.jsxs)("span",{className:"relative",children:[n,l]}),c]})}],404175)},202411,t=>{t.v(e=>Promise.all(["static/chunks/0k4zdm72k_bfy.js","static/chunks/0a5y-vhf4i5id.js"].map(e=>t.l(e))).then(()=>e(388576)))},136450,t=>{t.v(e=>Promise.all(["static/chunks/0xoo17yef_b8g.js","static/chunks/15hca2.5le07..js","static/chunks/0ghx3j_.-gdyd.js","static/chunks/016xz2o-hv3am.js","static/chunks/0bbmx45w_h5np.js","static/chunks/0xbaakj0dfc0..js","static/chunks/0lcc9r.o.p.sc.js","static/chunks/0ow~co9wcleka.js","static/chunks/0.006.ycpe92w.js","static/chunks/0_8dm7bxp18xo.js","static/chunks/0n6_4so_afuwk.js","static/chunks/0-utii~i2fncd.js","static/chunks/05psi2gtx~bev.js","static/chunks/0-~4vw4_9z_0_.js","static/chunks/08ckpwmmwlors.js","static/chunks/0tl6o7zu1j1r-.css","static/chunks/0ay4fv-nniykh.css","static/chunks/0pldvk5_h__t7.css","static/chunks/08.u~dmq20cak.css","static/chunks/15rf3~h7sugz4.css","static/chunks/0-wkj-hzh444r.css","static/chunks/14_y_s_5rhsd1.css","static/chunks/0z8ipjj2z-3al.css","static/chunks/06vadtvw631k5.css","static/chunks/16~udgv7eel6a.css","static/chunks/0qad.lgvtlt0b.css","static/chunks/0mt-7av8yrg0o.css","static/chunks/0brrgp3ki5w4_.css","static/chunks/16i87txo0qh0h.css","static/chunks/0ojcao3hdm36s.css"].map(e=>t.l(e))).then(()=>e(538691)))},58872,t=>{t.v(e=>Promise.all(["static/chunks/04a4vsq2wknm4.js","static/chunks/0iuf30t0rjsjv.js","static/chunks/17oc2l.ekcs8b.css"].map(e=>t.l(e))).then(()=>e(608745)))},329052,t=>{t.v(e=>Promise.all(["static/chunks/0nb8.iteznuvx.js"].map(e=>t.l(e))).then(()=>e(878166)))},126861,t=>{t.v(e=>Promise.all(["static/chunks/0h9cu-k6z5o08.js","static/chunks/05oc21sj24wtq.js","static/chunks/12jm4gwmvq-0q.js","static/chunks/0xbaakj0dfc0..js","static/chunks/04dg4l4hv11q2.js"].map(e=>t.l(e))).then(()=>e(773354)))},124383,t=>{t.v(e=>Promise.all(["static/chunks/0tel~zsv4z8l_.js"].map(e=>t.l(e))).then(()=>e(783481)))},318599,t=>{t.v(e=>Promise.all(["static/chunks/04w7~5ooz_pwm.js","static/chunks/0-9194nbxy_6d.js","static/chunks/12jm4gwmvq-0q.js","static/chunks/0f7cb9li~3jra.js"].map(e=>t.l(e))).then(()=>e(706304)))},222445,t=>{t.v(e=>Promise.all(["static/chunks/0uhol5wafdbl~.js","static/chunks/04fxddw-y20~-.js"].map(e=>t.l(e))).then(()=>e(514669)))},78906,t=>{t.v(e=>Promise.all(["static/chunks/14s37n6h0_q3x.js"].map(e=>t.l(e))).then(()=>e(985646)))},857328,t=>{t.v(e=>Promise.all(["static/chunks/0xt-8wk21gs7g.js"].map(e=>t.l(e))).then(()=>e(306649)))},3725,t=>{t.v(e=>Promise.all(["static/chunks/0-f~0xmwl__u5.js"].map(e=>t.l(e))).then(()=>e(722705)))},823528,t=>{t.v(e=>Promise.all(["static/chunks/0os58q93stt7j.js","static/chunks/0ake2f3x2uan4.js","static/chunks/12jm4gwmvq-0q.js","static/chunks/0xbaakj0dfc0..js"].map(e=>t.l(e))).then(()=>e(394896)))},903135,t=>{t.v(e=>Promise.all(["static/chunks/0ck8dw_9-1cdx.js","static/chunks/0ghx3j_.-gdyd.js"].map(e=>t.l(e))).then(()=>e(683223)))}]);