@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
@@ -0,0 +1,7 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,448303,e=>{"use strict";var t=e.i(344180),n=e.i(764556),a=e.i(129981),s=e.i(62669),i=e.i(601039),r=e.i(378371),l=e.i(212965),o=e.i(381253),c=e.i(357301),d=e.i(137340),u=e.i(650654),x=e.i(327962),h=e.i(415360),m=e.i(210),p=e.i(253307),f=e.i(953700),g=e.i(450158),j=e.i(486657),b=e.i(433721);let y=(0,b.default)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);var v=e.i(363156),C=e.i(691223),w=e.i(244073);function k({workspaceId:e,onInitialized:a}){let s=(0,w.useTranslations)("git.notInitialized"),i=(0,v.useGitStore)(e=>e.initRepo),[r,l]=(0,n.useState)(!1),o=(0,n.useCallback)(async()=>{l(!0),await i(e),l(!1),a()},[e,i,a]);return(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,t.jsx)(x.GitBranch,{size:32,className:"text-muted-foreground/40"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:s("message")}),(0,t.jsx)("button",{onClick:o,disabled:r,className:"text-xs px-3 py-1.5 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",children:s(r?"initializing":"initialize")})]})}var N=e.i(209988),M=e.i(260218),S=e.i(681622);function D({open:e,onOpenChange:a,onSubmit:s}){let i=(0,w.useTranslations)("git.remote"),r=(0,w.useTranslations)("common"),[l,o]=(0,n.useState)("origin"),[c,d]=(0,n.useState)(""),[u,x]=(0,n.useState)(!1),h=async()=>{if(l.trim()&&c.trim()){x(!0);try{await s(l.trim(),c.trim()),d(""),a(!1)}finally{x(!1)}}};return(0,t.jsx)(N.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:i("bindTitle")})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:i("nameLabel")}),(0,t.jsx)(S.Input,{value:l,onChange:e=>o(e.target.value),placeholder:i("namePlaceholder"),className:"h-8 text-xs"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:i("urlLabel")}),(0,t.jsx)(S.Input,{value:c,onChange:e=>d(e.target.value),placeholder:i("urlPlaceholder"),className:"h-8 text-xs",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]})]}),(0,t.jsxs)(N.DialogFooter,{children:[(0,t.jsx)(N.DialogClose,{render:(0,t.jsx)(M.Button,{variant:"outline",size:"sm"}),children:r("cancel")}),(0,t.jsx)(M.Button,{size:"sm",onClick:h,disabled:!l.trim()||!c.trim()||u,children:i(u?"adding":"addRemote")})]})]})})}var z=e.i(613812),T=e.i(964970),I=e.i(564822),B=e.i(613087),O=e.i(360112),F=e.i(441781);let P={modified:"text-yellow-600",added:"text-green-600",deleted:"text-red-600",renamed:"text-blue-600",untracked:"text-gray-500",conflicted:"text-red-500"},$={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflicted:"!"};function A(e){return e instanceof Error?e.message:String(e)}function L({open:e,onOpenChange:a,title:s,label:i,placeholder:r,onSubmit:l}){let o=(0,w.useTranslations)("common"),[c,d]=(0,n.useState)(""),u=()=>{c.trim()&&(l(c.trim()),a(!1))};return(0,t.jsx)(N.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:s})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:i}),(0,t.jsx)(S.Input,{value:c,onChange:e=>d(e.target.value),placeholder:r,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&c.trim()&&u()}})]}),(0,t.jsxs)(N.DialogFooter,{children:[(0,t.jsx)(M.Button,{variant:"outline",onClick:()=>a(!1),children:o("cancel")}),(0,t.jsx)(M.Button,{disabled:!c.trim(),onClick:u,children:o("confirm")})]})]})})}function R({confirm:e,open:n,onOpenChange:a,onConfirm:s}){let i=(0,w.useTranslations)("common"),r=(0,w.useTranslations)("git.changes");return(0,t.jsx)(N.Dialog,{open:n,onOpenChange:a,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:r(e?.type==="all"?"discardAll":"discard")})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e?.type==="all"?r("confirmDiscardAll"):r("confirmDiscardFile",{file:e?.type==="single"?e.path:""})}),(0,t.jsxs)(N.DialogFooter,{children:[(0,t.jsx)(M.Button,{variant:"outline",onClick:()=>a(!1),children:i("cancel")}),(0,t.jsx)(M.Button,{variant:"destructive",onClick:s,children:r("discard")})]})]})})}var E=e.i(887836);e.i(462506);var G=e.i(950396);let H=(0,E.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-32 text-muted-foreground text-xs",children:"Loading editor..."})});function U({open:e,onOpenChange:n,content:a,onContentChange:s,saving:i,onSave:r}){let l=(0,w.useTranslations)("common"),{resolvedTheme:o}=(0,G.useTheme)();return(0,t.jsx)(N.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-2xl",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:".gitignore"})}),(0,t.jsx)("div",{className:"h-80 border rounded overflow-hidden",children:(0,t.jsx)(H,{height:"100%",language:"plaintext",value:a,onChange:e=>s(e??""),options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},lineNumbers:"on"},theme:"dark"===o?"vs-dark":"vs"})}),(0,t.jsxs)(N.DialogFooter,{children:[(0,t.jsx)(N.DialogClose,{render:(0,t.jsx)(M.Button,{variant:"outline",size:"sm"}),children:l("cancel")}),(0,t.jsx)(M.Button,{size:"sm",onClick:r,disabled:i,children:l(i?"saving":"save")})]})]})})}let W=(0,b.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function K({x:e,y:a,path:s,onAddToGitignore:i,onOpenFile:r,onDiscard:l,onClose:d}){let u=(0,n.useRef)(null),x=(0,w.useTranslations)("git.changes"),h=(0,w.useTranslations)("common");(0,n.useEffect)(()=>(document.addEventListener("click",d),()=>document.removeEventListener("click",d)),[d]);let m=s.split("/").pop(),p=s.lastIndexOf("/"),f=p>=0?s.substring(0,p+1):s;return(0,t.jsxs)("div",{ref:u,className:"fixed z-[100] bg-popover border rounded-lg shadow-md py-1 text-xs min-w-40 ring-1 ring-foreground/10",style:{left:e,top:a},children:[(0,t.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left cursor-pointer",onClick:()=>{r(s),d()},children:[(0,t.jsx)(o.FileCode,{size:13}),(0,t.jsx)("span",{children:h("open")})]}),(0,t.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left cursor-pointer",onClick:()=>{l(s),d()},children:[(0,t.jsx)(c.RotateCcw,{size:13}),(0,t.jsx)("span",{children:x("discardAll")})]}),(0,t.jsx)("div",{className:"my-1 border-t"}),(0,t.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left cursor-pointer",onClick:()=>i(m),children:[(0,t.jsx)(W,{size:13}),(0,t.jsx)("span",{children:x("ignoreThisFile")}),(0,t.jsx)("span",{className:"ml-auto text-muted-foreground truncate max-w-24",children:m})]}),(0,t.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left cursor-pointer",onClick:()=>{f&&i(f)},children:[(0,t.jsx)(W,{size:13}),(0,t.jsx)("span",{children:x("ignoreFilePath",{path:f})})]})]})}function J({workspaceId:e,entry:a,onClose:i}){let r=(0,w.useTranslations)("git.commits"),l=(0,I.useIsMobile)(),o=(0,v.useGitStore)(e=>e.getCommitDiff),[c,d]=(0,n.useState)([]),[u,x]=(0,n.useState)(!1),[h,m]=(0,n.useState)(null),p=!!a;(0,n.useEffect)(()=>{if(!a){d([]),m(null);return}x(!0),m(null),o(e,a.hash).then(e=>{d(e),e.length>0&&m(e[0].path)}).catch(()=>d([])).finally(()=>x(!1))},[a,e,o]);let f=c.find(e=>e.path===h),g=(0,n.useCallback)(()=>{i(),d([]),m(null)},[i]);return(0,t.jsx)(N.Dialog,{open:p,onOpenChange:e=>!e&&g(),children:(0,t.jsxs)(N.DialogContent,{className:`${l?"w-[95vw] max-w-[95vw] h-[90vh]":"!max-w-none w-[80vw] h-[80vh]"} flex flex-col p-0 gap-0`,children:[(0,t.jsxs)(N.DialogHeader,{className:"px-4 py-3 border-b shrink-0",children:[(0,t.jsxs)(N.DialogTitle,{className:"text-sm font-medium flex items-center gap-2 flex-wrap",children:[(0,t.jsx)("code",{className:"font-mono text-blue-600",children:a?.hash.slice(0,7)}),(0,t.jsx)("span",{className:"truncate",children:a?.message.split("\n")[0]})]}),a&&(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:a.author}),(0,t.jsx)("span",{children:new Date(a.date).toLocaleString()}),c.length>0&&(0,t.jsx)("span",{children:r("detailFileCount",{count:c.length})})]})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 flex flex-col",children:u?(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,t.jsx)(s.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):l?(0,t.jsx)(X,{diffs:c,selectedFile:h,onSelect:m,selectedDiff:f}):(0,t.jsx)(V,{diffs:c,selectedFile:h,onSelect:m,selectedDiff:f})})]})})}function V({diffs:e,selectedFile:n,onSelect:a,selectedDiff:s}){return(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,t.jsx)("div",{className:"w-48 border-r overflow-auto shrink-0",children:e.map(e=>(0,t.jsxs)("button",{onClick:()=>a(e.path),className:`w-full text-left px-2 py-1.5 text-xs font-mono flex items-center gap-1.5 border-b hover:bg-accent cursor-pointer ${n===e.path?"bg-accent":""}`,children:[(0,t.jsx)(o.FileCode,{size:13,className:"shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:e.path})]},e.path))}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:s?(0,t.jsx)(z.DiffViewer,{oldContent:s.oldContent,newContent:s.newContent,path:s.path,isBinary:s.isBinary}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:"Select a file"})})]})}function X({diffs:e,selectedFile:n,onSelect:a,selectedDiff:s}){return(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col",children:[(0,t.jsx)("div",{className:"flex overflow-x-auto border-b shrink-0 gap-0.5 px-1 py-1",children:e.map(e=>(0,t.jsx)("button",{onClick:()=>a(e.path),className:`shrink-0 text-xs font-mono px-2 py-1 rounded border ${n===e.path?"bg-accent border-accent":"border-transparent hover:bg-accent/50"} truncate max-w-[140px]`,children:e.path},e.path))}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:s?(0,t.jsx)(z.DiffViewer,{oldContent:s.oldContent,newContent:s.newContent,path:s.path,isBinary:s.isBinary}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:"Select a file"})})]})}var Y=e.i(230902),_=e.i(562918),q=e.i(940361),Q=e.i(465458),Z=e.i(31807),ee=e.i(355819);function et({workspaceId:e,entry:n,onRefreshAll:a,onOpenPrompt:s}){let i=(0,w.useTranslations)("git.commits"),{getCommitDiff:r,getRemoteUrl:l,checkout:o,checkoutDetached:c,createBranch:d,deleteBranch:u,createTag:x,cherryPick:h,getMergeBase:m}=(0,v.useGitStore)(),p=(0,C.useEditorStore)(e=>e.openCommitDiff),{activeChannelId:f,sendMessage:g}=(0,Z.useChannelStore)(),j=(0,ee.useAgentStore)(e=>e.agents),b=async()=>{try{let t=await r(e,n.hash);t.length>0&&p(e,n.hash,n.message,t)}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}},y=async()=>{try{let t=await l(e);if(!t)return void O.toast.error(i("contextMenu.failed"),{description:"No remote URL"});window.open(t.replace(/\.git$/,"")+"/commit/"+n.hash,"_blank")}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}},k=async()=>{try{await o(e,n.hash),O.toast.success(i("contextMenu.checkedOut")),a()}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}},N=async()=>{try{await c(e,n.hash),O.toast.success(i("contextMenu.checkedOut")),a()}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}},M=async()=>{try{await h(e,n.hash),O.toast.success(i("contextMenu.cherryPicked")),a()}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}},S=async()=>{try{let t=await r(e,n.hash);v.useGitStore.setState({diffs:t}),O.toast.info(i("contextMenu.comparingWith",{hash:n.hash.slice(0,7)}))}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}},D=async()=>{try{let t=await m(e);if(!t)return void O.toast.error(i("contextMenu.failed"),{description:"No merge base"});let a=await r(e,n.hash);v.useGitStore.setState({diffs:a}),O.toast.info(i("contextMenu.comparingWith",{hash:t.slice(0,7)}))}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}},z=async()=>{if(!f)return void O.toast.error(i("contextMenu.failed"),{description:"No active channel"});let t=j.find(e=>e.enabled&&"bot"!==e.role&&"scheduler"!==e.role),a=await r(e,n.hash).then(e=>e.map(e=>e.path).join("\n")).catch(()=>"");g(e,f,t?`@${t.name} Explain the changes in commit \`${n.hash.slice(0,7)}\`: ${n.message.split("\n")[0]}
2
+
3
+ Changed files:
4
+ ${a}`:`Explain the changes in commit \`${n.hash.slice(0,7)}\`: ${n.message.split("\n")[0]}
5
+
6
+ Changed files:
7
+ ${a}`,t?[t.id]:[])};return(0,t.jsxs)(q.ContextMenuContent,{className:"min-w-48",children:[(0,t.jsx)(q.ContextMenuItem,{onClick:b,children:i("contextMenu.openChanges")}),(0,t.jsx)(q.ContextMenuItem,{onClick:y,children:i("contextMenu.openOnGitHub")}),(0,t.jsx)(q.ContextMenuSeparator,{}),(0,t.jsx)(q.ContextMenuItem,{onClick:k,children:i("contextMenu.checkout")}),(0,t.jsx)(q.ContextMenuItem,{onClick:N,children:i("contextMenu.checkoutDetached")}),(0,t.jsx)(q.ContextMenuItem,{onClick:()=>{s(i("contextMenu.createBranch"),i("contextMenu.branchName"),"feature/...",async t=>{try{await d(e,t,n.hash),O.toast.success(i("contextMenu.branchCreated")),a()}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}})},children:i("contextMenu.createBranch")}),(0,t.jsx)(q.ContextMenuItem,{onClick:()=>{let t=v.useGitStore.getState().branches.filter(e=>!e.current);t.length?s(i("contextMenu.deleteBranch"),i("contextMenu.branchToDelete"),t.map(e=>e.name).join(", "),async t=>{try{await u(e,t),O.toast.success(i("contextMenu.branchDeleted")),a()}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}}):O.toast.error(i("contextMenu.failed"),{description:"No other branches"})},children:i("contextMenu.deleteBranch")}),(0,t.jsx)(q.ContextMenuItem,{onClick:()=>{s(i("contextMenu.createTag"),i("contextMenu.tagName"),"v1.0.0",async t=>{try{await x(e,t,n.hash),O.toast.success(i("contextMenu.tagCreated"))}catch(e){O.toast.error(i("contextMenu.failed"),{description:A(e)})}})},children:i("contextMenu.createTag")}),(0,t.jsx)(q.ContextMenuSeparator,{}),(0,t.jsx)(q.ContextMenuItem,{onClick:M,children:i("contextMenu.cherryPick")}),(0,t.jsx)(q.ContextMenuSeparator,{}),(0,t.jsxs)(q.ContextMenuSub,{children:[(0,t.jsx)(q.ContextMenuSubTrigger,{children:i("contextMenu.compareWith")}),(0,t.jsxs)(q.ContextMenuSubContent,{children:[(0,t.jsx)(q.ContextMenuItem,{onClick:S,children:i("contextMenu.compareWithRemote")}),(0,t.jsx)(q.ContextMenuItem,{onClick:D,children:i("contextMenu.compareWithMergeBase")})]})]}),(0,t.jsx)(q.ContextMenuSeparator,{}),(0,t.jsx)(q.ContextMenuItem,{onClick:()=>{navigator.clipboard.writeText(n.hash),O.toast.success(i("contextMenu.commitIdCopied"))},children:i("contextMenu.copyCommitId")}),(0,t.jsx)(q.ContextMenuItem,{onClick:()=>{navigator.clipboard.writeText(n.message),O.toast.success(i("contextMenu.commitMessageCopied"))},children:i("contextMenu.copyCommitMessage")}),(0,t.jsx)(q.ContextMenuSeparator,{}),(0,t.jsx)(q.ContextMenuItem,{onClick:z,children:i("contextMenu.explainChanges")})]})}function en({workspaceId:e,log:n,currentHeadHash:a,currentBranch:s,onSelectEntry:i,onRefreshAll:r,onOpenPrompt:l}){return(0,t.jsx)("div",{children:n.map(n=>{let o,{label:c,variant:d}=function(e){let t=e.split("\n")[0].match(/^(\w+)(?:\([\w-]+\))?(!)?:/);if(!t)return{label:"Other",variant:"outline"};let n=t[1].toLowerCase();if(t[2])return{label:"Breaking",variant:"destructive"};let a={feat:{label:"Feature",variant:"default"},fix:{label:"Fix",variant:"secondary"},refactor:{label:"Refactor",variant:"outline"},perf:{label:"Perf",variant:"outline"},docs:{label:"Docs",variant:"outline"},test:{label:"Test",variant:"outline"},chore:{label:"Chore",variant:"outline"},ci:{label:"CI",variant:"outline"},build:{label:"Build",variant:"outline"}}[n];return a||{label:n.charAt(0).toUpperCase()+n.slice(1),variant:"outline"}}(n.message),u=(o=n.message.split("\n")[0]).replace(/^\w+(?:\([\w-]+\))?!?:\s*/,"")||o,h=n.hash.slice(0,7),m=!!a&&(n.hash.startsWith(a)||a.startsWith(n.hash));return(0,t.jsxs)(q.ContextMenu,{children:[(0,t.jsx)(q.ContextMenuTrigger,{children:(0,t.jsxs)("div",{onClick:()=>i(n),className:(0,Q.cn)("flex items-center gap-3 border-b px-4 py-2.5 transition-colors hover:bg-muted/50 cursor-pointer",m&&"border-l-2 border-l-primary bg-primary/5"),children:[(0,t.jsx)(_.Badge,{variant:d,className:"shrink-0 px-1.5 py-0 text-[10px]",children:c}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm",children:u}),m&&(0,t.jsxs)(_.Badge,{variant:"secondary",className:"shrink-0 gap-1 px-1.5 py-0 text-[10px]",children:[(0,t.jsx)(x.GitBranch,{size:10}),(0,t.jsx)("span",{className:"max-w-24 truncate",children:s||"HEAD"})]}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:h}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:(0,Y.format)(new Date(n.date),"MMM d")})]})}),(0,t.jsx)(et,{workspaceId:e,entry:n,onRefreshAll:r,onOpenPrompt:l})]},n.hash)})})}let ea="agent-spaces:git-layout",es="changes",ei="commits",er={changesMin:15,changesMax:60,commitsMin:30},el={changesMin:15,changesMax:60,commitsMin:30};e.s(["GitCommitsPanel",0,function({workspaceId:e}){let b=(0,w.useTranslations)("common"),M=(0,w.useTranslations)("git.commits"),S=(0,w.useTranslations)("git.changes"),E=(0,I.useIsMobile)(),G=(0,n.useMemo)(()=>(function(e){try{let t=localStorage.getItem(ea);if(!t)return;let n=JSON.parse(t),a=e?el:er,s=n[es],i=n[ei];return"number"==typeof s&&"number"==typeof i&&s>=a.changesMin&&s<=a.changesMax&&i>=a.commitsMin?{[es]:s,[ei]:i}:void 0}catch{return}})(E),[E]),H=(0,n.useCallback)(e=>{let t,n,a;if(t=E?el:er,n=e[es],a=e[ei],"number"==typeof n&&"number"==typeof a&&n>=t.changesMin&&n<=t.changesMax&&a>=t.commitsMin)try{localStorage.setItem(ea,JSON.stringify(e))}catch{}},[E]),{log:W,loading:V,notGitRepo:X,status:Y,branches:_,diffs:q,selectedFile:Q,loadStatus:Z,loadDiffs:ee,loadLog:et,loadBranches:eo,commit:ec,discard:ed,discardAll:eu,stage:ex,unstage:eh,resolveFile:em,checkout:ep,selectFile:ef,commitMsg:eg,setCommitMsg:ej,fetchRemote:eb}=(0,v.useGitStore)(),ey=(0,C.useEditorStore)(e=>e.openFile),ev=(0,C.useEditorStore)(e=>e.openCommitDiff),[eC,ew]=(0,n.useState)(!1),[ek,eN]=(0,n.useState)(!1),[eM,eS]=(0,n.useState)(!1),[eD,ez]=(0,n.useState)({open:!1,title:"",label:"",placeholder:"",onSubmit:()=>{}}),[eT,eI]=(0,n.useState)(null),[eB,eO]=(0,n.useState)(!1),[eF,eP]=(0,n.useState)(""),[e$,eA]=(0,n.useState)(!1),[eL,eR]=(0,n.useState)(!1),[eE,eG]=(0,n.useState)(null),[eH,eU]=(0,n.useState)(null),[eW,eK]=(0,n.useState)(!1),[eJ,eV]=(0,n.useState)([]),[eX,eY]=(0,n.useState)(!1),e_=(0,n.useCallback)(async()=>{eK(!0),eY(!0);try{let t=await fetch(`/api/workspaces/${e}/git/operations`);if(!t.ok)throw Error(await t.text());eV(await t.json())}catch{eV([])}finally{eY(!1)}},[e]),eq=Y?.ahead??0,eQ=Y?.behind??0,eZ=(Y?.files.length??0)>0,e0=q.find(e=>e.path===Q),e1=(0,n.useCallback)(async()=>{await eb(e).catch(()=>{}),await Promise.all([Z(e),ee(e),et(e)])},[e,eb,Z,ee,et]),e2=(0,n.useCallback)(async()=>{await e1();let e=v.useGitStore.getState().status;(e?.files.length??0)===0&&O.toast.info(S("noChanges"))},[e1,S]),e3=(0,n.useCallback)(()=>{e1(),eo(e)},[e,e1,eo]),{syncing:e5,remoteDialogOpen:e4,setRemoteDialogOpen:e6,handleSync:e8,handleRemoteSubmit:e9,handleSyncChanges:e7}=function(e,t){let a=(0,w.useTranslations)("git.commits"),s=(0,w.useTranslations)("git.changes"),{push:i,pull:r,getRemotes:l,addRemote:o}=(0,v.useGitStore)(),[c,d]=(0,n.useState)(null),[u,x]=(0,n.useState)(!1),[h,m]=(0,n.useState)(null),p=async n=>{"push"===n?(await i(e),O.toast.success(a("pushedSuccessfully"))):(await r(e),O.toast.success(a("pulledSuccessfully"))),t()},f=async n=>{d(n);try{if(!(await l(e)).length){m(n),x(!0);return}await p(n)}catch(e){A(e)?.includes("No remote")?(m(n),x(!0)):O.toast.error("push"===n?a("pushFailed"):a("pullFailed"),{description:A(e)}),"pull"===n&&await t()}finally{d(null)}},g=async(t,n)=>{await o(e,t,n),O.toast.success(a("remoteAdded")),h&&(await p(h),m(null))},j=(0,n.useCallback)(async()=>{d("push");try{if(!(await l(e)).length)return void x(!0);await i(e),await r(e),O.toast.success(s("syncedSuccessfully")),t()}catch(e){A(e)?.includes("No remote")?x(!0):O.toast.error(s("syncFailed"),{description:A(e)}),await t()}finally{d(null)}},[e,i,r,l,t,s]);return{syncing:c,remoteDialogOpen:u,setRemoteDialogOpen:x,handleSync:f,handleRemoteSubmit:g,handleSyncChanges:j}}(e,e1);(0,n.useEffect)(()=>{e1(),eo(e)},[e,e1,eo]),(0,n.useEffect)(()=>{let t=setInterval(()=>{Z(e),ee(e)},5e3);return()=>clearInterval(t)},[e,Z,ee]);let te=(0,n.useCallback)(async t=>{ew(!1),await ep(e,t),e1(),eo(e)},[e,ep,e1,eo]),tt=(0,n.useCallback)(async()=>{eg.trim()&&(eN(!0),ef(null),await ec(e,eg.trim()),ej(""),eN(!1),e1())},[e,eg,ec,e1,ef,ej]),tn=(0,n.useCallback)(async()=>{if(!eM&&!ek){eS(!0);try{let t=await fetch(`/api/workspaces/${e}/git/generate-commit-message`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>({error:"Failed"}));throw Error(e.error)}let n=await t.json();n.message&&ej(n.message)}catch(e){O.toast.error(A(e)||S("failedCommitMessage"))}finally{eS(!1)}}},[e,eM,ek,ej,S]),ta=(0,n.useCallback)(e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&tt()},[tt]),ts=(0,n.useCallback)(e=>{ef(e===Q?null:e)},[Q,ef]),ti=(0,n.useCallback)((t,n)=>{t.stopPropagation(),ey(e,n)},[e,ey]),tr=(0,n.useCallback)((e,t)=>{e.stopPropagation(),eG({type:"single",path:t})},[]),tl=(0,n.useCallback)(async(t,n,a)=>{t.stopPropagation(),a?await eh(e,n):await ex(e,n),e1()},[e,e1,ex,eh]),to=(0,n.useCallback)(async(t,n)=>{await em(e,t,n,!0),ef(null),e1(),O.toast.success("冲突已解决并暂存")},[e,e1,em,ef]),tc=(0,n.useCallback)(()=>{eG({type:"all"})},[]),td=(0,n.useCallback)(async()=>{eE&&("single"===eE.type?await ed(e,eE.path):await eu(e),eG(null),e1())},[e,eE,ed,eu,e1]);(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/workspaces/${e}/files/content?path=.gitignore`),n=await t.json();eP(n.content??"")}catch{eP("")}eO(!0)},[e]);let tu=(0,n.useCallback)(async()=>{eR(!0);try{await fetch(`/api/workspaces/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:".gitignore",content:eF})}),eO(!1),e1()}finally{eR(!1)}},[e,eF,e1]),tx=(0,n.useCallback)(async t=>{eI(null);try{let n=await fetch(`/api/workspaces/${e}/files/content?path=.gitignore`),a=(await n.json()).content??"";if(a.split("\n").filter(Boolean).includes(t))return;let s=a&&!a.endsWith("\n")?a+"\n"+t+"\n":a+t+"\n";await fetch(`/api/workspaces/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:".gitignore",content:s})}),e1()}catch{}},[e,e1]);return X?(0,t.jsxs)("div",{className:"flex flex-col h-full overflow-hidden rounded-t-xl bg-background",children:[(0,t.jsx)("div",{className:"flex items-center px-2 py-1.5 border-b",children:(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:M("title")})}),(0,t.jsx)(k,{workspaceId:e,onInitialized:e1})]}):(0,t.jsxs)(F.ResizablePanelGroup,{orientation:E?"vertical":"horizontal",defaultLayout:G,onLayoutChange:H,className:"h-full overflow-hidden rounded-t-xl bg-background",children:[(0,t.jsxs)(F.ResizablePanel,{id:es,defaultSize:E?"40%":"25%",minSize:"15%",maxSize:"60%",className:"flex flex-col bg-muted/20 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b",children:[(0,t.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,t.jsxs)("button",{onClick:()=>ew(!eC),className:"flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground active:opacity-70 transition-all duration-100 cursor-pointer w-full",children:[(0,t.jsx)(x.GitBranch,{size:13,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:Y?.branch??"..."}),Y&&eZ&&(0,t.jsxs)("span",{className:"text-muted-foreground",children:["(",Y.files.length,")"]}),(0,t.jsx)(u.ChevronDown,{size:12,className:"shrink-0"})]}),eC&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-48 bg-popover border rounded shadow-md py-0.5 max-h-60 overflow-auto",children:[_.map(e=>(0,t.jsx)("button",{onClick:()=>te(e.name),className:`w-full text-left px-2 py-1 text-xs hover:bg-accent active:scale-[0.98] active:bg-accent transition-all duration-100 cursor-pointer truncate ${e.current?"font-semibold text-foreground":"text-muted-foreground"}`,children:e.name},e.name)),0===_.length&&(0,t.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:S("noBranches")})]}),(0,t.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>ew(!1)})]})]}),eZ&&(0,t.jsx)("button",{onClick:tc,className:"p-1 text-muted-foreground hover:text-destructive active:scale-90 transition-all duration-100 cursor-pointer",title:S("discardAll"),children:(0,t.jsx)(d.Trash2,{size:13})}),(0,t.jsx)("button",{onClick:()=>{q.length>0&&ev(e,"unstaged",S("unstagedChanges"),q)},disabled:!eZ,className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer disabled:opacity-30",title:S("viewDiff"),children:(0,t.jsx)(p.FileDiff,{size:13})}),(0,t.jsx)("button",{onClick:e2,className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer",title:b("refresh"),children:(0,t.jsx)(i.RefreshCw,{size:13})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-auto",children:[Y?.files.map(e=>(0,t.jsxs)("div",{onClick:()=>ts(e.path),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),eI({x:t.clientX,y:t.clientY,path:e.path})},className:`group w-full text-left px-2 py-1 text-xs font-mono flex items-center gap-1.5 hover:bg-accent cursor-pointer ${Q===e.path?"bg-accent":""}`,children:[(0,t.jsx)("span",{className:`w-4 text-center font-bold shrink-0 ${P[e.status]}`,children:$[e.status]}),e.conflicted&&(0,t.jsx)(j.AlertTriangle,{size:12,className:"shrink-0 text-red-500"}),(0,t.jsx)("span",{className:"truncate flex-1",children:e.path}),(0,t.jsxs)("span",{className:"hidden group-hover:flex md:flex items-center gap-0.5 shrink-0",children:[(0,t.jsx)("button",{onClick:t=>tl(t,e.path,e.staged),disabled:e.conflicted,className:"p-0.5 rounded hover:bg-accent/80 active:scale-90 transition-all duration-100 cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",title:e.staged?"Unstage":"Stage",children:e.staged?(0,t.jsx)(g.Minus,{size:13}):(0,t.jsx)(f.Plus,{size:13})}),(0,t.jsx)("button",{onClick:t=>ti(t,e.path),className:"p-0.5 rounded hover:bg-accent/80 active:scale-90 transition-all duration-100 cursor-pointer",title:b("open"),children:(0,t.jsx)(o.FileCode,{size:13})}),(0,t.jsx)("button",{onClick:t=>tr(t,e.path),className:"p-0.5 rounded hover:bg-accent/80 active:scale-90 transition-all duration-100 cursor-pointer",title:S("discardAll"),children:(0,t.jsx)(c.RotateCcw,{size:13})})]})]},e.path)),Y?.clean&&(0,t.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:S("noChanges")})]}),eZ?(0,t.jsxs)("div",{className:"border-t p-2 space-y-1.5",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("textarea",{value:eg,onChange:e=>ej(e.target.value),onKeyDown:ta,placeholder:S("commitMessagePlaceholder"),rows:3,className:"w-full resize-none text-xs px-2 pt-1 pr-8 pb-7 border rounded bg-background disabled:opacity-50",disabled:ek||eM}),(0,t.jsx)("button",{type:"button",onClick:tn,disabled:eM||ek||!eZ,className:"absolute bottom-1.5 right-1.5 p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent active:scale-90 cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-100",title:"AI generate commit message",children:eM?(0,t.jsx)(s.Loader2,{size:14,className:"animate-spin"}):(0,t.jsx)(h.Sparkles,{size:14})})]}),(0,t.jsx)("button",{onClick:tt,disabled:!eg.trim()||ek,className:"w-full text-xs px-2 py-1 rounded bg-primary text-primary-foreground active:scale-[0.98] transition-all duration-100 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:ek?S("committing"):S("commit")})]}):eq>0?(0,t.jsx)("div",{className:"border-t p-2",children:(0,t.jsxs)("button",{onClick:e7,disabled:null!==e5,className:"w-full text-xs px-2 py-1 rounded bg-primary text-primary-foreground active:scale-[0.98] transition-all duration-100 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-1.5",children:[e5?(0,t.jsx)(s.Loader2,{size:13,className:"animate-spin"}):(0,t.jsx)(a.Upload,{size:13}),e5?S("syncing"):S("syncChanges")]})}):null]}),(0,t.jsx)(F.ResizableHandle,{withHandle:!0}),(0,t.jsxs)(F.ResizablePanel,{id:ei,defaultSize:E?"60%":"75%",minSize:"30%",className:"flex flex-col min-w-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b shrink-0",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:W.length>0?M("titleWithCount",{count:W.length}):M("title")}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)("button",{onClick:()=>e8("push"),disabled:null!==e5,className:"relative p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer disabled:opacity-50",title:eq>0?M("pushNCommits",{count:eq}):"Push",children:["push"===e5?(0,t.jsx)(s.Loader2,{size:13,className:"animate-spin"}):(0,t.jsx)(r.ArrowUp,{size:13}),eq>0&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-foreground px-1 text-[9px] font-medium leading-none text-background",children:eq})]}),(0,t.jsxs)("button",{onClick:()=>e8("pull"),disabled:null!==e5,className:"relative p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer disabled:opacity-50",title:eQ>0?M("pullNCommits",{count:eQ}):"Pull",children:["pull"===e5?(0,t.jsx)(s.Loader2,{size:13,className:"animate-spin"}):(0,t.jsx)(l.ArrowDown,{size:13}),eQ>0&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-foreground px-1 text-[9px] font-medium leading-none text-background",children:eQ})]}),(0,t.jsx)("button",{onClick:e2,className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer",children:(0,t.jsx)(i.RefreshCw,{size:13})}),(0,t.jsx)("button",{onClick:()=>eA(!0),className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer",title:M("settingsTitle"),children:(0,t.jsx)(m.Settings2,{size:13})}),(0,t.jsx)("button",{onClick:e_,className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer",title:M("operationLog"),children:(0,t.jsx)(y,{size:13})})]})]}),e0?(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(z.DiffViewer,{oldContent:e0.oldContent,newContent:e0.newContent,path:e0.path,isBinary:e0.isBinary,mergeMode:!!e0.isConflict,onResolve:e0.isConflict?e=>to(e0.path,e):void 0})}):(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[V&&!W.length&&(0,t.jsx)("div",{className:"p-2 space-y-1",children:(0,t.jsx)(B.SkeletonGroup,{count:6,children:e=>(0,t.jsxs)("div",{className:"px-2 py-1.5 border-b space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(B.Skeleton,{className:"h-3 w-10 rounded"}),(0,t.jsx)(B.Skeleton,{className:"h-3 flex-1"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pl-7",children:[(0,t.jsx)(B.Skeleton,{className:"h-3 w-20"}),(0,t.jsx)(B.Skeleton,{className:"h-3 w-16"})]})]},e)})}),(0,t.jsx)(en,{workspaceId:e,log:W,currentHeadHash:Y?.headHash,currentBranch:Y?.branch,onSelectEntry:eU,onRefreshAll:e3,onOpenPrompt:(e,t,n,a)=>{ez({open:!0,title:e,label:t,placeholder:n,onSubmit:a})}}),!V&&!W.length&&(0,t.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:M("noCommits")})]})]}),eT&&(0,t.jsx)(K,{x:eT.x,y:eT.y,path:eT.path,onAddToGitignore:tx,onOpenFile:t=>ey(e,t),onDiscard:e=>eG({type:"single",path:e}),onClose:()=>eI(null)}),(0,t.jsx)(D,{open:e4,onOpenChange:e6,onSubmit:e9}),(0,t.jsx)(L,{open:eD.open,onOpenChange:e=>ez(t=>({...t,open:e})),title:eD.title,label:eD.label,placeholder:eD.placeholder,onSubmit:e=>{eD.onSubmit(e),ez(e=>({...e,open:!1}))}}),(0,t.jsx)(U,{open:eB,onOpenChange:eO,content:eF,onContentChange:eP,saving:eL,onSave:tu}),(0,t.jsx)(N.Dialog,{open:e$,onOpenChange:eA,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:M("settingsTitle")})}),(0,t.jsx)(T.GitSettingsForm,{scope:"local",workspaceId:e})]})}),(0,t.jsx)(R,{confirm:eE,open:!!eE,onOpenChange:e=>!e&&eG(null),onConfirm:td}),(0,t.jsx)(J,{workspaceId:e,entry:eH,onClose:()=>eU(null)}),(0,t.jsx)(N.Dialog,{open:eW,onOpenChange:eK,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-3xl max-h-[85vh] flex flex-col",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:M("operationLogTitle",{count:eJ.length})})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:eX?(0,t.jsx)("div",{className:"p-4 text-center text-xs text-muted-foreground",children:b("loading")}):0===eJ.length?(0,t.jsx)("div",{className:"p-4 text-center text-xs text-muted-foreground",children:M("noOperations")}):eJ.map(e=>(0,t.jsxs)("details",{className:"group border-b",children:[(0,t.jsxs)("summary",{className:"flex items-center gap-2 px-3 py-2 text-xs cursor-pointer hover:bg-accent select-none list-none",children:[(0,t.jsx)("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] font-medium ${e.error?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}`,children:e.error?"FAIL":"OK"}),(0,t.jsx)("span",{className:"shrink-0 font-mono font-medium text-foreground",children:e.operation}),Object.keys(e.input).length>0&&(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:Object.entries(e.input).filter(([,e])=>null!=e&&""!==e).map(([e,t])=>`${e}=${String(t)}`).join(" ")}),(0,t.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:[e.duration,"ms"]}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground",children:new Date(e.timestamp).toLocaleTimeString()}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground group-open:rotate-90 transition-transform",children:"▸"})]}),(0,t.jsxs)("div",{className:"px-3 pb-2 space-y-1 text-xs font-mono",children:[e.error&&(0,t.jsx)("div",{className:"text-red-600 dark:text-red-400 whitespace-pre-wrap break-all",children:e.error}),void 0!==e.output&&!e.error&&(0,t.jsx)("pre",{className:"text-muted-foreground whitespace-pre-wrap break-all max-h-40 overflow-auto",children:"string"==typeof e.output?e.output:JSON.stringify(e.output,null,2)})]})]},e.id))})]})})]})}],448303)},514669,e=>{e.n(e.i(448303))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,113519,212068,119211,e=>{"use strict";var t=e.i(344180),r=e.i(764556),a=e.i(244073),n=e.i(444433),l=e.i(209988),o=e.i(260218),s=e.i(681622),i=e.i(191118),c=e.i(227634),d=e.i(683640),u=e.i(943997),h=e.i(267624),f=e.i(887354);let m=(0,e.i(433721).default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);e.s(["default",0,m],212068),e.s(["Wrench",0,m],119211);var p=e.i(465458);let b={channel:{keys:["CreateCurrentChannelIssue","ViewCurrentChannelIssue","AddCurrentChannelComment"],icon:c.Hash},terminal:{keys:["ReadTerminalOutput","ListQuickCommands","RunQuickCommand","StopQuickCommand"],icon:d.Terminal},database:{keys:["ListDatabases","ListDatabaseNodes","SearchDatabaseNodes","QueryDatabaseVectors","ReadDatabaseNode","ListDatabaseNodeVersions","CreateDatabaseNode","WriteDatabaseNode","DeleteDatabaseNode","MoveDatabaseNode","UpdateDatabaseNodeMeta"],icon:u.Database},kanban:{keys:["ListKanbanBoards","ViewKanbanBoard","CreateKanbanBoard","UpdateKanbanBoard","DeleteKanbanBoard"],icon:h.LayoutGrid}},x=n.BUILT_IN_AGENT_TOOLS??[];e.s(["ToolsDialog",0,function({open:e,onOpenChange:n,standalone:c,selectable:d,selectedTools:u,onSelectedToolsChange:h}){let v=(0,a.useTranslations)("tools"),[g,w]=(0,r.useState)(""),[y,S]=(0,r.useState)("all"),[C,N]=(0,r.useState)(null),[E,D]=(0,r.useState)(new Set),k=d?new Set(u??E):new Set,j=e=>{let t=new Set(k);t.has(e)?t.delete(e):t.add(e),h?h(x.map(e=>e.name).filter(e=>t.has(e))):D(t)},R=(0,r.useMemo)(()=>{let e=x;if("all"!==y){let t=new Set(b[y]?.keys??[]);e=e.filter(e=>t.has(e.name))}if(g.trim()){let t=g.toLowerCase();e=e.filter(e=>e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t))}return e},[y,g]),A=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.DialogHeader,{className:"shrink-0",children:[(0,t.jsx)(l.DialogTitle,{children:v("title")}),(0,t.jsx)(l.DialogDescription,{className:"sr-only",children:v("title")})]}),(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col md:flex-row gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-1",children:[(0,t.jsxs)(o.Button,{variant:"all"===y?"secondary":"ghost",size:"sm",className:"justify-start",onClick:()=>S("all"),children:[(0,t.jsx)(m,{className:"size-3.5 mr-1.5"}),v("filterAll")]}),Object.entries(b).map(([e,{icon:r}])=>(0,t.jsxs)(o.Button,{variant:y===e?"secondary":"ghost",size:"sm",className:"justify-start",onClick:()=>S(e),children:[(0,t.jsx)(r,{className:"size-3.5 mr-1.5"}),v(`categories.${e}`)]},e))]}),(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)(f.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(s.Input,{value:g,onChange:e=>w(e.target.value),placeholder:v("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 overflow-x-auto pb-1",children:[(0,t.jsx)("button",{type:"button",className:(0,p.cn)("shrink-0 px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===y?"bg-muted":"text-muted-foreground hover:text-foreground","cursor-pointer"),onClick:()=>S("all"),children:v("filterAll")}),Object.entries(b).map(([e])=>(0,t.jsx)("button",{type:"button",className:(0,p.cn)("shrink-0 px-2.5 py-1 rounded-md text-xs font-medium transition-colors",y===e?"bg-muted":"text-muted-foreground hover:text-foreground","cursor-pointer"),onClick:()=>S(e),children:v(`categories.${e}`)},e))]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(f.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(s.Input,{value:g,onChange:e=>w(e.target.value),placeholder:v("search"),className:"pl-8"})]}),d&&R.length>0&&(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:v("enabledCount",{count:R.filter(e=>k.has(e.name)).length,total:R.length})}),(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>{let e=R.every(e=>k.has(e.name)),t=new Set(k);e?R.forEach(e=>t.delete(e.name)):R.forEach(e=>t.add(e.name)),h?h(x.map(e=>e.name).filter(e=>t.has(e))):D(t)},children:R.every(e=>k.has(e.name))?v("deselectAll"):v("selectAll")})]}),(0,t.jsx)(i.ScrollArea,{className:"flex-1",children:0===R.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:v("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-2 pr-2",children:R.map(e=>(0,t.jsx)("div",{className:"rounded-lg border border-border bg-background px-3 py-2 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{d?j(e.name):N(e)},children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[d&&(0,t.jsx)("input",{type:"checkbox",checked:k.has(e.name),onChange:()=>j(e.name),onClick:e=>e.stopPropagation(),className:"mt-0.5 size-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"block text-xs font-medium",children:e.label}),(0,t.jsx)("span",{className:"block text-[11px] text-muted-foreground line-clamp-2",children:e.description})]}),d&&(0,t.jsx)("button",{type:"button",className:"shrink-0 text-muted-foreground hover:text-foreground cursor-pointer",onClick:t=>{t.stopPropagation(),N(e)},children:(0,t.jsx)(f.Search,{className:"size-3"})})]})},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[c&&e&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:A}),!c&&(0,t.jsx)(l.Dialog,{open:e,onOpenChange:n,children:(0,t.jsx)(l.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:A})}),(0,t.jsx)(l.Dialog,{open:!!C,onOpenChange:e=>{e||N(null)},children:(0,t.jsxs)(l.DialogContent,{children:[(0,t.jsxs)(l.DialogHeader,{children:[(0,t.jsx)(l.DialogTitle,{children:C?.label}),(0,t.jsx)(l.DialogDescription,{className:"font-mono text-xs text-muted-foreground",children:C?.name})]}),(0,t.jsx)("div",{className:"py-2",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:C?.description})})]})})]})}],113519)},267624,e=>{"use strict";let t=(0,e.i(433721).default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);e.s(["LayoutGrid",0,t],267624)},767467,440897,e=>{"use strict";let t=(0,e.i(433721).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["default",0,t],440897),e.s(["ArrowLeft",0,t],767467)},394394,e=>{"use strict";var t=e.i(764556);let r=t.createContext(void 0),a={disableStyleElements:!1};e.s(["useCSPContext",0,function(){return t.useContext(r)??a}])},464111,e=>{"use strict";e.s(["clamp",0,function(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}])},191118,e=>{"use strict";var t,r,a,n,l,o=e.i(344180);e.s([],556166),e.i(556166),e.i(8890);var s=e.i(764556),i=e.i(29905),c=e.i(232449),d=e.i(267805);let u=s.createContext(void 0);function h(){let e=s.useContext(u);if(void 0===e)throw Error((0,d.default)(53));return e}var f=e.i(969490);let m=((t={}).scrollAreaCornerHeight="--scroll-area-corner-height",t.scrollAreaCornerWidth="--scroll-area-corner-width",t);function p(e,t,r){if(!e)return 0;let a=getComputedStyle(e),n="x"===r?"Inline":"Block";return"x"===r&&"margin"===t?2*parseFloat(a[`${t}InlineStart`]):parseFloat(a[`${t}${n}Start`])+parseFloat(a[`${t}${n}End`])}let b=((r={}).orientation="data-orientation",r.hovering="data-hovering",r.scrolling="data-scrolling",r.hasOverflowX="data-has-overflow-x",r.hasOverflowY="data-has-overflow-y",r.overflowXStart="data-overflow-x-start",r.overflowXEnd="data-overflow-x-end",r.overflowYStart="data-overflow-y-start",r.overflowYEnd="data-overflow-y-end",r),x="base-ui-disable-scrollbar";var v=e.i(139236);let g=((a={}).scrolling="data-scrolling",a.hasOverflowX="data-has-overflow-x",a.hasOverflowY="data-has-overflow-y",a.overflowXStart="data-overflow-x-start",a.overflowXEnd="data-overflow-x-end",a.overflowYStart="data-overflow-y-start",a.overflowYEnd="data-overflow-y-end",a),w={hasOverflowX:e=>e?{[g.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[g.hasOverflowY]:""}:null,overflowXStart:e=>e?{[g.overflowXStart]:""}:null,overflowXEnd:e=>e?{[g.overflowXEnd]:""}:null,overflowYStart:e=>e?{[g.overflowYStart]:""}:null,overflowYEnd:e=>e?{[g.overflowYEnd]:""}:null,cornerHidden:()=>null};var y=e.i(410421),S=e.i(394394);let C={x:0,y:0},N={width:0,height:0},E={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},D={x:!0,y:!0,corner:!0},k=s.forwardRef(function(e,t){let r,{render:a,className:n,overflowEdgeThreshold:l,style:d,...h}=e,g=function(e){if("number"==typeof e){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}(l),k=(0,v.useBaseUiId)(),j=(0,c.useTimeout)(),R=(0,c.useTimeout)(),{nonce:A,disableStyleElements:T}=(0,S.useCSPContext)(),[L,O]=s.useState(!1),[I,M]=s.useState(!1),[X,H]=s.useState(!1),[W,Y]=s.useState(!1),[z,P]=s.useState(!1),[B,K]=s.useState(N),[$,V]=s.useState(N),[U,Q]=s.useState(E),[_,F]=s.useState(D),G=s.useRef(null),q=s.useRef(null),J=s.useRef(null),Z=s.useRef(null),ee=s.useRef(null),et=s.useRef(null),er=s.useRef(null),ea=s.useRef(!1),en=s.useRef(0),el=s.useRef(0),eo=s.useRef(0),es=s.useRef(0),ei=s.useRef("vertical"),ec=s.useRef(C),ed=(0,i.useStableCallback)(e=>{let t=e.x-ec.current.x,r=e.y-ec.current.y;ec.current=e,0!==r&&(H(!0),j.start(500,()=>{H(!1)})),0!==t&&(M(!0),R.start(500,()=>{M(!1)}))}),eu=(0,i.useStableCallback)(e=>{0===e.button&&(ea.current=!0,en.current=e.clientY,el.current=e.clientX,ei.current=e.currentTarget.getAttribute(b.orientation),q.current&&(eo.current=q.current.scrollTop,es.current=q.current.scrollLeft),ee.current&&"vertical"===ei.current&&ee.current.setPointerCapture(e.pointerId),et.current&&"horizontal"===ei.current&&et.current.setPointerCapture(e.pointerId))}),eh=(0,i.useStableCallback)(e=>{if(!ea.current)return;let t=e.clientY-en.current,r=e.clientX-el.current;if(q.current){let a=q.current.scrollHeight,n=q.current.clientHeight,l=q.current.scrollWidth,o=q.current.clientWidth;if(ee.current&&J.current&&"vertical"===ei.current){let r=p(J.current,"padding","y"),l=p(ee.current,"margin","y"),o=ee.current.offsetHeight,s=J.current.offsetHeight-o-r-l;q.current.scrollTop=eo.current+t/s*(a-n),e.preventDefault(),H(!0),j.start(500,()=>{H(!1)})}if(et.current&&Z.current&&"horizontal"===ei.current){let t=p(Z.current,"padding","x"),a=p(et.current,"margin","x"),n=et.current.offsetWidth,s=Z.current.offsetWidth-n-t-a;q.current.scrollLeft=es.current+r/s*(l-o),e.preventDefault(),M(!0),R.start(500,()=>{M(!1)})}}}),ef=(0,i.useStableCallback)(e=>{ea.current=!1,ee.current&&"vertical"===ei.current&&ee.current.releasePointerCapture(e.pointerId),et.current&&"horizontal"===ei.current&&et.current.releasePointerCapture(e.pointerId)});function em(e){Y("touch"===e.pointerType)}function ep(e){em(e),"touch"!==e.pointerType&&O((0,y.contains)(G.current,e.target))}let eb=s.useMemo(()=>({scrolling:I||X,hasOverflowX:!_.x,hasOverflowY:!_.y,overflowXStart:U.xStart,overflowXEnd:U.xEnd,overflowYStart:U.yStart,overflowYEnd:U.yEnd,cornerHidden:_.corner}),[I,X,_.x,_.y,_.corner,U]),ex={role:"presentation",onPointerEnter:ep,onPointerMove:ep,onPointerDown:em,onPointerLeave(){O(!1)},style:{position:"relative",[m.scrollAreaCornerHeight]:`${B.height}px`,[m.scrollAreaCornerWidth]:`${B.width}px`}},ev=(0,f.useRenderElement)("div",e,{state:eb,ref:[t,G],props:[ex,h],stateAttributesMapping:w}),eg=s.useMemo(()=>({handlePointerDown:eu,handlePointerMove:eh,handlePointerUp:ef,handleScroll:ed,cornerSize:B,setCornerSize:K,thumbSize:$,setThumbSize:V,hasMeasuredScrollbar:z,setHasMeasuredScrollbar:P,touchModality:W,cornerRef:er,scrollingX:I,setScrollingX:M,scrollingY:X,setScrollingY:H,hovering:L,setHovering:O,viewportRef:q,rootRef:G,scrollbarYRef:J,scrollbarXRef:Z,thumbYRef:ee,thumbXRef:et,rootId:k,hiddenState:_,setHiddenState:F,overflowEdges:U,setOverflowEdges:Q,viewportState:eb,overflowEdgeThreshold:g}),[eu,eh,ef,ed,B,$,z,W,I,M,X,H,L,O,k,_,U,eb,g]);return(0,o.jsxs)(u.Provider,{value:eg,children:[!T&&(r=A,(0,o.jsx)("style",{nonce:r,href:x,precedence:"base-ui:low",children:`.${x}{scrollbar-width:none}.${x}::-webkit-scrollbar{display:none}`})),ev]})});var j=e.i(277642),R=e.i(454889);let A=s.createContext(void 0);var T=e.i(189131),L=e.i(464111);let O=((n={}).scrollAreaOverflowXStart="--scroll-area-overflow-x-start",n.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",n.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",n.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",n);function I(e,t){if(t<=0)return 0;let r=(0,L.clamp)(e,0,t),a=t-r,n=r<=1,l=a<=1;return n&&l?r<=a?0:t:n?0:l?t:r}let M=!1,X=s.forwardRef(function(e,t){let{render:r,className:a,style:n,...l}=e,{viewportRef:d,scrollbarYRef:u,scrollbarXRef:m,thumbYRef:b,thumbXRef:v,cornerRef:g,cornerSize:y,setCornerSize:S,setThumbSize:C,rootId:N,setHiddenState:E,hiddenState:D,setHasMeasuredScrollbar:k,handleScroll:X,setHovering:H,setOverflowEdges:W,overflowEdges:Y,overflowEdgeThreshold:z,scrollingX:P,scrollingY:B}=h(),K=(0,T.useDirection)(),$=s.useRef(!0),V=s.useRef([NaN,NaN,NaN,NaN]),U=(0,c.useTimeout)(),Q=(0,c.useTimeout)(),_=(0,i.useStableCallback)(()=>{var e;let t,r,a=d.current,n=u.current,l=m.current,o=b.current,s=v.current,i=g.current;if(!a)return;let c=a.scrollHeight,h=a.scrollWidth,f=a.clientHeight,x=a.clientWidth,w=a.scrollTop,N=a.scrollLeft,D=V.current,j=Number.isNaN(D[0]);if(D[0]=f,D[1]=c,D[2]=x,D[3]=h,j&&k(!0),0===c||0===h)return;let R=(t=(e=a).clientHeight>=e.scrollHeight,{y:t,x:r=e.clientWidth>=e.scrollWidth,corner:t||r}),A=R.y,T=R.x,M=x/h,X=f/c,H=Math.max(0,h-x),Y=Math.max(0,c-f),P=0,B=0;!T&&(P=I("rtl"===K?(0,L.clamp)(-N,0,H):(0,L.clamp)(N,0,H),H),B=H-P);let $=A?0:(0,L.clamp)(w,0,Y),U=A?0:I($,Y),Q=A?0:Y-U,_=T?0:x,F=A?0:f,G=0,q=0;T||A||(G=n?.offsetWidth||0,q=l?.offsetHeight||0);let J=0===y.width&&0===y.height,Z=J?G:0,ee=J?q:0,et=p(l,"padding","x"),er=p(n,"padding","y"),ea=p(s,"margin","x"),en=p(o,"margin","y"),el=_-et-ea,eo=F-er-en,es=l?Math.min(l.offsetWidth-Z,el):el,ei=n?Math.min(n.offsetHeight-ee,eo):eo,ec=Math.max(16,es*M),ed=Math.max(16,ei*X);if(C(e=>e.height===ed&&e.width===ec?e:{width:ec,height:ed}),n&&o){let e=n.offsetHeight-ed-er-en,t=c-f,r=Math.min(e,Math.max(0,(0===t?0:w/t)*e));o.style.transform=`translate3d(0,${r}px,0)`}if(l&&s){let e=l.offsetWidth-ec-et-ea,t=h-x,r=0===t?0:N/t,a="rtl"===K?(0,L.clamp)(r*e,-e,0):(0,L.clamp)(r*e,0,e);s.style.transform=`translate3d(${a}px,0,0)`}for(let[e,t]of[[O.scrollAreaOverflowXStart,P],[O.scrollAreaOverflowXEnd,B],[O.scrollAreaOverflowYStart,U],[O.scrollAreaOverflowYEnd,Q]])a.style.setProperty(e,`${t}px`);i&&(T||A?S({width:0,height:0}):T||A||S({width:G,height:q})),E(e=>{var t,r;return t=e,r=R,t.y===r.y&&t.x===r.x&&t.corner===r.corner?t:r});let eu={xStart:!T&&P>z.xStart,xEnd:!T&&B>z.xEnd,yStart:!A&&U>z.yStart,yEnd:!A&&Q>z.yEnd};W(e=>e.xStart===eu.xStart&&e.xEnd===eu.xEnd&&e.yStart===eu.yStart&&e.yEnd===eu.yEnd?e:eu)});function F(){$.current=!1}(0,j.useIsoLayoutEffect)(()=>{d.current&&(M||R.isWebKit||("u">typeof CSS&&"registerProperty"in CSS&&[O.scrollAreaOverflowXStart,O.scrollAreaOverflowXEnd,O.scrollAreaOverflowYStart,O.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),M=!0))},[d]),(0,j.useIsoLayoutEffect)(()=>{queueMicrotask(_)},[_,D,K]),(0,j.useIsoLayoutEffect)(()=>{d.current?.matches(":hover")&&H(!0)},[d,H]),s.useEffect(()=>{let e=d.current;if("u"<typeof ResizeObserver||!e)return;let t=!1,r=new ResizeObserver(()=>{if(!t){t=!0;let r=V.current;if(r[0]===e.clientHeight&&r[1]===e.scrollHeight&&r[2]===e.clientWidth&&r[3]===e.scrollWidth)return}_()});return r.observe(e),Q.start(0,()=>{let t=e.getAnimations({subtree:!0});0!==t.length&&Promise.allSettled(t.map(e=>e.finished)).then(_).catch(()=>{})}),()=>{r.disconnect(),Q.clear()}},[_,d,Q]);let G={role:"presentation",...N&&{"data-id":`${N}-viewport`},tabIndex:D.x&&D.y?-1:0,className:x,style:{overflow:"scroll"},onScroll(){d.current&&(_(),$.current||X({x:d.current.scrollLeft,y:d.current.scrollTop}),U.start(100,()=>{$.current=!0}))},onWheel:F,onTouchMove:F,onPointerMove:F,onPointerEnter:F,onKeyDown:F},q=s.useMemo(()=>({scrolling:P||B,hasOverflowX:!D.x,hasOverflowY:!D.y,overflowXStart:Y.xStart,overflowXEnd:Y.xEnd,overflowYStart:Y.yStart,overflowYEnd:Y.yEnd,cornerHidden:D.corner}),[P,B,D.x,D.y,D.corner,Y]),J=(0,f.useRenderElement)("div",e,{ref:[t,d],state:q,props:[G,l],stateAttributesMapping:w}),Z=s.useMemo(()=>({computeThumbPosition:_}),[_]);return(0,o.jsx)(A.Provider,{value:Z,children:J})});var H=e.i(422561);let W=s.createContext(void 0),Y=((l={}).scrollAreaThumbHeight="--scroll-area-thumb-height",l.scrollAreaThumbWidth="--scroll-area-thumb-width",l),z=s.forwardRef(function(e,t){let{render:r,className:a,orientation:n="vertical",keepMounted:l=!1,style:i,...c}=e,{hovering:d,scrollingX:u,scrollingY:b,hiddenState:x,overflowEdges:v,scrollbarYRef:g,scrollbarXRef:S,viewportRef:C,thumbYRef:N,thumbXRef:E,handlePointerDown:D,handlePointerUp:k,rootId:j,thumbSize:R,hasMeasuredScrollbar:A}=h(),L={hovering:d,scrolling:{horizontal:u,vertical:b}[n],orientation:n,hasOverflowX:!x.x,hasOverflowY:!x.y,overflowXStart:v.xStart,overflowXEnd:v.xEnd,overflowYStart:v.yStart,overflowYEnd:v.yEnd,cornerHidden:x.corner},O=(0,T.useDirection)();s.useEffect(()=>{let e=C.current,t="vertical"===n?g.current:S.current;if(t)return(0,H.addEventListener)(t,"wheel",function(r){if(e&&t&&!r.ctrlKey){if(r.preventDefault(),"vertical"===n){if(0===e.scrollTop&&r.deltaY<0)return}else if(0===e.scrollLeft&&r.deltaX<0)return;if("vertical"===n){if(e.scrollTop===e.scrollHeight-e.clientHeight&&r.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&r.deltaX>0)return;"vertical"===n?e.scrollTop+=r.deltaY:e.scrollLeft+=r.deltaX}},{passive:!1})},[n,S,g,C]);let I={...j&&{"data-id":`${j}-scrollbar`},onPointerDown(e){if(0!==e.button)return;let t=(0,y.getTarget)(e.nativeEvent),r="vertical"===n?N.current:E.current;if(!(r&&(0,y.contains)(r,t))&&C.current){if(N.current&&g.current&&"vertical"===n){let t=p(N.current,"margin","y"),r=p(g.current,"padding","y"),a=N.current.offsetHeight,n=g.current.getBoundingClientRect(),l=e.clientY-n.top-a/2-r+t/2,o=C.current.scrollHeight,s=C.current.clientHeight,i=g.current.offsetHeight-a-r-t;C.current.scrollTop=l/i*(o-s)}if(E.current&&S.current&&"horizontal"===n){let t,r=p(E.current,"margin","x"),a=p(S.current,"padding","x"),n=E.current.offsetWidth,l=S.current.getBoundingClientRect(),o=e.clientX-l.left-n/2-a+r/2,s=C.current.scrollWidth,i=C.current.clientWidth,c=o/(S.current.offsetWidth-n-a-r);"rtl"===O?(t=(1-c)*(s-i),C.current.scrollLeft<=0&&(t=-t)):t=c*(s-i),C.current.scrollLeft=t}D(e)}},onPointerUp:k,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:A||l?void 0:"hidden",..."vertical"===n&&{top:0,bottom:`var(${m.scrollAreaCornerHeight})`,insetInlineEnd:0,[Y.scrollAreaThumbHeight]:`${R.height}px`},..."horizontal"===n&&{insetInlineStart:0,insetInlineEnd:`var(${m.scrollAreaCornerWidth})`,bottom:0,[Y.scrollAreaThumbWidth]:`${R.width}px`}}},M=(0,f.useRenderElement)("div",e,{ref:[t,"vertical"===n?g:S],state:L,props:[I,c],stateAttributesMapping:w}),X=s.useMemo(()=>({orientation:n}),[n]),z="vertical"===n?x.y:x.x;return l||!z?(0,o.jsx)(W.Provider,{value:X,children:M}):null}),P=s.forwardRef(function(e,t){let{render:r,className:a,style:n,...l}=e,o=s.useRef(null),{computeThumbPosition:i}=function(){let e=s.useContext(A);if(void 0===e)throw Error((0,d.default)(55));return e}(),{viewportState:c}=h();return(0,j.useIsoLayoutEffect)(()=>{if("u"<typeof ResizeObserver)return;let e=!1,t=new ResizeObserver(()=>{if(!e){e=!0;return}i()});return o.current&&t.observe(o.current),()=>{t.disconnect()}},[i]),(0,f.useRenderElement)("div",e,{ref:[t,o],state:c,stateAttributesMapping:w,props:[{role:"presentation",style:{minWidth:"fit-content"}},l]})}),B=s.forwardRef(function(e,t){let{render:r,className:a,style:n,...l}=e,{thumbYRef:o,thumbXRef:i,handlePointerDown:c,handlePointerMove:u,handlePointerUp:m,setScrollingX:p,setScrollingY:b,hasMeasuredScrollbar:x}=h(),{orientation:v}=function(){let e=s.useContext(W);if(void 0===e)throw Error((0,d.default)(54));return e}();return(0,f.useRenderElement)("div",e,{ref:[t,"vertical"===v?o:i],state:{orientation:v},props:[{onPointerDown:c,onPointerMove:u,onPointerUp(e){"vertical"===v&&b(!1),"horizontal"===v&&p(!1),m(e)},style:{visibility:x?void 0:"hidden",..."vertical"===v&&{height:`var(${Y.scrollAreaThumbHeight})`},..."horizontal"===v&&{width:`var(${Y.scrollAreaThumbWidth})`}}},l]})}),K=s.forwardRef(function(e,t){let{render:r,className:a,style:n,...l}=e,{cornerRef:o,cornerSize:s,hiddenState:i}=h(),c=(0,f.useRenderElement)("div",e,{ref:[t,o],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},l]});return i.corner?null:c});e.s(["Content",0,P,"Corner",0,K,"Root",0,k,"Scrollbar",0,z,"Thumb",0,B,"Viewport",0,X],787180);var $=e.i(787180),$=$,V=e.i(465458);function U({className:e,orientation:t="vertical",...r}){return(0,o.jsx)($.Scrollbar,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:(0,V.cn)("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...r,children:(0,o.jsx)($.Thumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}e.s(["ScrollArea",0,function({className:e,children:t,...r}){return(0,o.jsxs)($.Root,{"data-slot":"scroll-area",className:(0,V.cn)("relative overflow-hidden",e),...r,children:[(0,o.jsx)($.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:t}),(0,o.jsx)(U,{}),(0,o.jsx)($.Corner,{})]})}],191118)},444433,e=>{"use strict";e.s(["BUILT_IN_AGENT_TOOLS",0,[{name:"CreateCurrentChannelIssue",label:"Create Current Issue",description:"Create and bind an issue for the current channel."},{name:"ViewCurrentChannelIssue",label:"View Current Issue",description:"View the issue and comments bound to the current channel."},{name:"AddCurrentChannelComment",label:"Add Current Comment",description:"Add a comment to the issue bound to the current channel."},{name:"ReadTerminalOutput",label:"Read Terminal Output",description:"Read paginated terminal output by session ID. Defaults to the newest 100 lines."},{name:"ListQuickCommands",label:"List Quick Commands",description:"List all quick commands for a workspace with their running status."},{name:"RunQuickCommand",label:"Run Quick Command",description:"Start a quick command by its ID. Returns the terminal session ID."},{name:"StopQuickCommand",label:"Stop Quick Command",description:"Stop a running quick command by its ID."},{name:"ListDatabases",label:"List Databases",description:"List knowledge base databases in the workspace and their IDs."},{name:"ListDatabaseNodes",label:"List Database Nodes",description:"List knowledge base nodes under a path, optionally filtered by title."},{name:"SearchDatabaseNodes",label:"Search Database Nodes",description:"Search knowledge base nodes by title or content under a path."},{name:"QueryDatabaseVectors",label:"Query Database Vectors",description:"Search knowledge base nodes by vector similarity using the database-bound embedding model."},{name:"ReadDatabaseNode",label:"Read Database Node",description:"Read knowledge base node metadata and content by ID."},{name:"ListDatabaseNodeVersions",label:"List Database Versions",description:"List content version history and diffs for a knowledge base node by ID."},{name:"CreateDatabaseNode",label:"Create Database Node",description:"Create a knowledge base node under a parent path or parent ID."},{name:"WriteDatabaseNode",label:"Write Database Node",description:"Insert, replace, or overwrite knowledge base node content by ID."},{name:"DeleteDatabaseNode",label:"Delete Database Node",description:"Trash or permanently delete a knowledge base node and its descendants."},{name:"MoveDatabaseNode",label:"Move Database Node",description:"Move a knowledge base node or directory to another parent path or ID."},{name:"UpdateDatabaseNodeMeta",label:"Update Database Meta",description:"Update knowledge base node metadata such as title, icon, cover, parent, or trash state."},{name:"ListKanbanBoards",label:"List Kanban Boards",description:"List Kanban boards in the workspace."},{name:"ViewKanbanBoard",label:"View Kanban Board",description:"View Kanban board metadata, columns, and tasks."},{name:"CreateKanbanBoard",label:"Create Kanban Board",description:"Create the workspace Kanban board."},{name:"UpdateKanbanBoard",label:"Update Kanban Board",description:"Update Kanban board metadata, columns, or tasks."},{name:"DeleteKanbanBoard",label:"Delete Kanban Board",description:"Delete the workspace Kanban board with its columns and tasks."}]])}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,282738,e=>{"use strict";var t=e.i(344180),r=e.i(764556),s=e.i(141889),n=e.i(368942),a=e.i(953700),o=e.i(433721);let d=(0,o.default)("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var l=e.i(972846),i=e.i(887354),c=e.i(650654),u=e.i(810051),x=e.i(137340),m=e.i(943997),p=e.i(990336),h=e.i(344118),f=e.i(293818),g=e.i(444204),b=e.i(465458),j=e.i(244073),v=e.i(751962),N=e.i(917955),w=e.i(992764);let y=(0,o.default)("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]),k=["📁","📄","📎","🚀","💡","⭐","🎯","🎨","📇","📈","☑️","🔥","🔍","📮","🧪","✍️","✅","📸","🔀","🧭"];function C({node:e,state:s,rowProps:n,onSelect:o,onAddChild:d,onDelete:l,onRename:i,onUpdateIcon:m,onToggleExpand:p,children:h}){let[f,g]=(0,r.useState)(!1),[j,v]=(0,r.useState)(e.title),[N,D]=(0,r.useState)(!1),S=(0,r.useRef)(null);(0,r.useEffect)(()=>{v(e.title)},[e.title]),(0,r.useEffect)(()=>{let e=e=>{S.current&&!S.current.contains(e.target)&&D(!1)};return N&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[N]);let E=()=>{i(e.id,j.trim()||"未命名文档"),g(!1)};return(0,t.jsxs)("div",{className:"flex flex-col select-none",children:[(0,t.jsxs)("div",{...n,className:(0,b.cn)("group flex items-center h-9 justify-between pr-2 rounded-lg cursor-pointer transition-all gap-1.5 border border-transparent my-0.5",s.isActive?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-accent hover:text-foreground",s.isDraggedOver&&"border-2 border-dashed border-primary/40 bg-primary/5 scale-95",n.className),children:[(0,t.jsxs)("div",{className:"flex items-center min-w-0 flex-1 h-full py-1",children:[(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),p(e.id)},className:(0,b.cn)("p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors shrink-0",!s.hasChildren&&"opacity-0 cursor-default","cursor-pointer"),children:s.isExpanded?(0,t.jsx)(c.ChevronDown,{className:"w-3.5 h-3.5"}):(0,t.jsx)(w.ChevronRight,{className:"w-3.5 h-3.5"})}),(0,t.jsxs)("div",{className:"relative shrink-0",ref:S,children:[(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),D(!N)},className:"text-base p-1.5 rounded-md hover:bg-accent shrink-0 transition-all select-none cursor-pointer",children:e.icon||(s.hasChildren?"📁":"📄")}),N&&(0,t.jsx)("div",{className:"absolute left-1 top-7 bg-popover shadow-2xl rounded-xl border border-border p-2 grid grid-cols-5 gap-1 w-44 z-50",children:k.map(r=>(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),m(e.id,r),D(!1)},className:"w-7 h-7 flex items-center justify-center rounded-lg hover:bg-accent text-base cursor-pointer text-foreground",children:r},r))})]}),(0,t.jsx)("div",{onClick:()=>o(e.id),className:"flex-1 min-w-0 pr-1.5 h-full flex items-center",children:f?(0,t.jsx)("input",{type:"text",value:j,onChange:e=>v(e.target.value),onBlur:E,onKeyDown:t=>{"Enter"===t.key&&E(),"Escape"===t.key&&(v(e.title),g(!1))},onClick:e=>e.stopPropagation(),className:"w-full text-xs font-semibold bg-background border border-border rounded-md px-1.5 py-0.5 focus:outline-none focus:ring-1 focus:ring-ring text-foreground",autoFocus:!0}):(0,t.jsx)("span",{className:(0,b.cn)("text-xs truncate font-medium select-none",s.isActive?"text-primary":"text-foreground/80"),children:e.title||"未命名文档"})})]}),!f&&(0,t.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex items-center gap-0.5 shrink-0 transition-opacity",children:[(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),g(!0)},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",title:"重命名",children:(0,t.jsx)(u.Edit2,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),d(e.id)},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",title:"新建子页面",children:(0,t.jsx)(a.Plus,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),confirm(`要将 "${e.title||"未命名文档"}" 移动到回收站吗?`)&&l(e.id)},className:"p-1 rounded hover:bg-rose-950/60 text-muted-foreground hover:text-rose-400 cursor-pointer",title:"删除",children:(0,t.jsx)(x.Trash2,{className:"w-3 h-3"})}),(0,t.jsx)("div",{className:"p-1 cursor-grab text-muted-foreground/40 pointer-events-none",children:(0,t.jsx)(y,{className:"w-3 h-3"})})]})]}),h&&(0,t.jsx)("div",{className:"flex flex-col",children:h})]})}var D=e.i(833237),S=e.i(437122);function E({workspaceId:e,onOpenSearch:n,onOpenTrash:o,onOpenCreateDatabase:w,onOpenEditDatabase:y,onOpenVectorDialog:k,onSave:I}){let{databases:T,activeDatabaseId:M,nodes:O,activeId:L,openFolders:P,sidebarSearch:A,recentIds:F,setActiveDatabaseId:R,deleteDatabase:z,setActiveId:B,createNode:$,renameNode:U,updateIcon:H,trashNode:V,toggleFolder:X,setSidebarSearch:K}=(0,s.useDatabaseStore)(),W=(0,j.useTranslations)("database"),[q,J]=(0,r.useState)(!1),[G,Q]=(0,r.useState)(!1),[Y,Z]=(0,r.useState)(null),[_,ee]=(0,r.useState)(null),et=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=e=>{et.current&&!et.current.contains(e.target)&&J(!1)};return q&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[q]);let er=T.find(e=>e.id===M)??T[0]??null,es=O.filter(e=>!e.isTrash),en=es.filter(e=>!A||(e.title||"").toLowerCase().includes(A.toLowerCase())).filter(e=>null===e.parentId),ea=(0,r.useCallback)(async(t,r)=>{await $(e,t,r),I()},[e,$,I]),eo=(0,r.useCallback)((t,r)=>{let s=r,n=O.find(e=>e.id===t);n?.icon&&s.trim().startsWith(n.icon)&&(s=s.trim().substring(n.icon.length).trim()),U(e,t,s),I()},[e,O,U,I]),ed=(0,r.useCallback)((e,t)=>{let r=O.find(e=>e.id===t),s=0;for(;r?.parentId&&s<20;){if(r.parentId===e)return!0;r=O.find(e=>e.id===r.parentId),s++}return!1},[O]),el=(0,r.useCallback)((e,t)=>{Z(t),e.dataTransfer.setData("text/plain",t),e.dataTransfer.effectAllowed="move"},[]),ei=(0,r.useCallback)((e,t)=>{if(e.preventDefault(),Y&&Y!==t){if(ed(Y,t)){e.dataTransfer.dropEffect="none";return}ee(t),e.dataTransfer.dropEffect="move"}},[Y,ed]),ec=(0,r.useCallback)(()=>ee(null),[]),eu=(0,r.useCallback)((t,r)=>{t.preventDefault(),ee(null),!Y||Y===r||ed(Y,r)||(s.useDatabaseStore.getState().moveNode(e,Y,r),Z(null),I())},[Y,e,ed,I]),ex=(0,r.useCallback)(t=>{t.preventDefault(),Y&&(s.useDatabaseStore.getState().moveNode(e,Y,null),Z(null),I())},[Y,e,I]),em=(0,r.useCallback)(async()=>{!er||T.length<=1||confirm(W("deleteConfirm",{name:er.name}))&&await z(e,er.id)},[er,T.length,z,e]),ep=(0,r.useCallback)(async t=>{let{activeDatabaseId:r}=s.useDatabaseStore.getState();if(r){for(let n of t){let t=await n.text(),a=n.name.replace(/\.md$/i,""),o=await (0,S.fetchWithAuth)(`/api/workspaces/${e}/database?databaseId=${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a,icon:"📝",content:t,parentId:null})});if(!o.ok)throw Error("Failed to create node");let d=await o.json();s.useDatabaseStore.setState(e=>({nodes:[...e.nodes,d]}))}I()}},[e,I]);return(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsx)("div",{className:"px-4 py-3 border-b border-border bg-sidebar/80 backdrop-blur-md shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-xl bg-gradient-to-tr from-muted to-muted-foreground/20 flex items-center justify-center font-bold text-base text-foreground border border-muted-foreground/20",children:"📁"}),(0,t.jsxs)("div",{className:"hidden",children:[(0,t.jsx)("span",{className:"text-xs font-bold text-foreground tracking-tight",children:W("knowledgeBase")}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground font-medium font-mono leading-none mt-0.5",children:"Database"})]}),(0,t.jsxs)(N.DropdownMenu,{children:[(0,t.jsxs)(N.DropdownMenuTrigger,{className:"min-w-0 flex-1 flex items-center justify-between gap-2 rounded-lg px-1.5 py-1 text-left hover:bg-accent outline-none",title:er?.name??"Database",children:[(0,t.jsxs)("div",{className:"min-w-0 flex flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-bold text-foreground tracking-tight truncate",children:er?.name??"Database"}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground font-medium font-mono leading-none mt-0.5",children:"Database"})]}),(0,t.jsx)(c.ChevronDown,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"})]}),(0,t.jsxs)(N.DropdownMenuContent,{align:"start",className:"w-56",children:[T.map(r=>(0,t.jsxs)(N.DropdownMenuItem,{onClick:()=>{r.id!==M&&R(e,r.id)},className:"cursor-pointer",children:[(0,t.jsx)(m.Database,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"truncate flex-1",children:r.name}),r.id===M&&(0,t.jsx)(h.Check,{className:"w-4 h-4"})]},r.id)),(0,t.jsx)(N.DropdownMenuSeparator,{}),(0,t.jsxs)(N.DropdownMenuItem,{onClick:w,className:"cursor-pointer",children:[(0,t.jsx)(a.Plus,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:W("createDatabase")})]}),(0,t.jsxs)(N.DropdownMenuItem,{onClick:y,disabled:!er,className:"cursor-pointer",children:[(0,t.jsx)(u.Edit2,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:W("editDatabase")})]}),(0,t.jsxs)(N.DropdownMenuItem,{onClick:k,disabled:!er,className:"cursor-pointer",children:[(0,t.jsx)(p.Brain,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:W("vectorSettings")})]}),(0,t.jsxs)(N.DropdownMenuItem,{onClick:em,disabled:!er||T.length<=1,variant:"destructive",className:"cursor-pointer",children:[(0,t.jsx)(x.Trash2,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:W("deleteDatabase")})]})]})]})]})}),(0,t.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto px-3.5 py-4",onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},onDrop:ex,children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-[11px] font-bold text-muted-foreground px-1 mb-2.5 uppercase tracking-wider",children:[(0,t.jsx)("span",{children:W("sidebarTree")}),(0,t.jsxs)("span",{children:["(",es.length,")"]})]}),(0,t.jsxs)("div",{className:"px-1 mb-4 flex items-center gap-2 relative",ref:et,children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)("input",{type:"text",placeholder:W("filterPlaceholder"),value:A,onChange:e=>K(e.target.value),className:"w-full text-xs bg-background border border-border rounded-lg px-2.5 py-1.5 pr-7 text-foreground focus:outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/60"}),A?(0,t.jsx)("button",{onClick:()=>K(""),className:"absolute right-2 top-2 text-muted-foreground hover:text-foreground cursor-pointer",children:(0,t.jsx)(l.X,{className:"w-3.5 h-3.5"})}):(0,t.jsx)(f.SlidersHorizontal,{className:"absolute right-2 top-2.5 w-3 h-3 text-muted-foreground/60 pointer-events-none"})]}),(0,t.jsx)("button",{onClick:()=>J(!q),className:"h-8 w-8 rounded-lg bg-muted hover:bg-muted/80 border border-border hover:border-muted-foreground/40 text-foreground transition-all cursor-pointer flex items-center justify-center shrink-0",title:W("newItem"),children:(0,t.jsx)(a.Plus,{className:"w-4 h-4"})}),q&&(0,t.jsxs)("div",{className:"absolute right-1 top-[calc(100%+4px)] w-36 bg-popover border border-border rounded-lg shadow-2xl py-1 z-50",children:[(0,t.jsxs)("button",{onClick:()=>{ea(null,"folder"),J(!1)},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer",children:[(0,t.jsx)("span",{className:"text-sm",children:"📂"}),(0,t.jsx)("span",{className:"font-medium",children:W("newFolder")})]}),(0,t.jsxs)("button",{onClick:()=>{ea(null,"document"),J(!1)},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer",children:[(0,t.jsx)("span",{className:"text-sm",children:"📝"}),(0,t.jsx)("span",{className:"font-medium",children:W("newDocument")})]}),(0,t.jsxs)("button",{onClick:()=>{Q(!0),J(!1)},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer",children:[(0,t.jsx)("span",{className:"text-sm",children:"📥"}),(0,t.jsx)("span",{className:"font-medium",children:W("importMarkdown")})]})]})]}),0===en.length?(0,t.jsx)("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground italic",children:A?W("noMatch"):W("emptyState")}):(0,t.jsx)("div",{className:"space-y-0.5",children:(0,t.jsx)(v.NestedTree,{nodes:en,getNodeId:e=>e.id,getChildren:e=>es.filter(t=>t.parentId===e.id),activeId:L,expandedIds:P,draggedOverId:_,onDragStart:el,onDragOver:ei,onDragLeave:ec,onDrop:eu,shouldRenderChildren:(e,t)=>t.isExpanded,renderNode:({node:r,state:s,rowProps:n,children:a})=>(0,t.jsx)(C,{node:r,state:s,rowProps:n,onSelect:B,onAddChild:ea,onDelete:t=>{V(e,t),I()},onRename:eo,onUpdateIcon:(t,r)=>{H(e,t,r),I()},onToggleExpand:X,children:a})})})]}),F.length>0&&(0,t.jsxs)("div",{className:"mb-6 pt-4 border-t border-border",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] font-bold text-muted-foreground px-1 mb-2 uppercase tracking-wider",children:[(0,t.jsx)(g.Clock,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,t.jsx)("span",{children:W("recentEdits")})]}),(0,t.jsx)("div",{className:"space-y-1",children:F.map(e=>O.find(t=>t.id===e&&!t.isTrash)).filter(e=>!!e).map(e=>(0,t.jsxs)("button",{onClick:()=>B(e.id),className:(0,b.cn)("w-full text-left p-1.5 rounded-lg flex items-center gap-2 text-xs transition-colors",L===e.id?"bg-accent text-foreground font-semibold":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,t.jsx)("span",{className:"text-sm shrink-0 select-none",children:e.icon||"📝"}),(0,t.jsx)("span",{className:"truncate flex-1",children:e.title||W("untitled")})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"px-2 py-1.5 border-t border-border bg-sidebar flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)("button",{onClick:n,className:"flex-1 flex items-center justify-between bg-background hover:bg-muted border border-border text-muted-foreground hover:text-foreground transition-all h-7 px-2.5 rounded-md text-[11px] cursor-pointer",children:(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(i.Search,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:W("globalSearch")})]})}),(0,t.jsxs)("button",{onClick:o,className:"relative w-7 h-7 shrink-0 flex items-center justify-center rounded-md bg-background hover:bg-muted text-muted-foreground hover:text-rose-400 border border-border transition-all cursor-pointer group",title:W("trashBin"),children:[(0,t.jsx)(d,{className:"w-3 h-3 text-rose-500"}),O.filter(e=>e.isTrash).length>0&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 bg-rose-600 text-white text-[8px] w-3.5 h-3.5 rounded-full flex items-center justify-center font-semibold border border-sidebar",children:O.filter(e=>e.isTrash).length})]})]}),(0,t.jsx)(D.ImportFileDialog,{open:G,onOpenChange:Q,workspaceId:e,targetPath:"",onImported:I,accept:{"text/markdown":[".md"],"text/x-markdown":[".md"]},onUploadFiles:ep})]})}var I=e.i(209988);function T({open:e,database:s,onOpenChange:n,onSave:a}){let[o,d]=(0,r.useState)(""),[l,i]=(0,r.useState)(""),[c,u]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&(d(s?.name??""),i(s?.description??""))},[s,e]);let x=async e=>{e.preventDefault();let t=o.trim();if(t&&!c){u(!0);try{await a({name:t,description:l.trim()}),n(!1)}finally{u(!1)}}};return(0,t.jsx)(I.Dialog,{open:e,onOpenChange:n,children:(0,t.jsx)(I.DialogContent,{className:"sm:max-w-md p-0 gap-0 overflow-hidden",children:(0,t.jsxs)("form",{onSubmit:x,children:[(0,t.jsx)(I.DialogHeader,{className:"px-5 py-4 border-b border-border",children:(0,t.jsx)(I.DialogTitle,{className:"text-sm",children:s?"Edit database":"Create database"})}),(0,t.jsxs)("div",{className:"p-5 space-y-4",children:[(0,t.jsxs)("label",{className:"block space-y-1.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),(0,t.jsx)("input",{value:o,onChange:e=>d(e.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:ring-1 focus:ring-ring",autoFocus:!0})]}),(0,t.jsxs)("label",{className:"block space-y-1.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),(0,t.jsx)("textarea",{value:l,onChange:e=>i(e.target.value),className:"min-h-20 w-full resize-none rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:ring-1 focus:ring-ring"})]})]}),(0,t.jsxs)(I.DialogFooter,{className:"px-5 py-4",children:[(0,t.jsx)("button",{type:"button",onClick:()=>n(!1),className:"px-3 py-1.5 rounded-lg text-xs font-semibold text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:"Cancel"}),(0,t.jsx)("button",{type:"submit",disabled:!o.trim()||c,className:"px-3 py-1.5 rounded-lg text-xs font-semibold bg-primary text-primary-foreground disabled:opacity-50 cursor-pointer",children:c?"Saving...":"Save"})]})]})})})}var M=e.i(100559),O=e.i(889445),L=e.i(260218),P=e.i(681622);function A({open:e,onClose:s,onConfirm:n,title:a="Select Model",description:o,models:d,selected:i,onToggle:c,cancelText:u,confirmText:x,loading:m}){let[h,f]=(0,r.useState)(""),g=(0,r.useMemo)(()=>{if(!h.trim())return d;let e=h.toLowerCase();return d.filter(t=>t.name.toLowerCase().includes(e)||t.modelId.toLowerCase().includes(e)||t.provider.toLowerCase().includes(e))},[d,h]),j=(0,r.useMemo)(()=>(function(e){let t={};for(let r of e){let e=r.provider||"Other";(t[e]??=[]).push(r)}return t})(g),[g]);return(0,t.jsx)(I.Dialog,{open:e,onOpenChange:e=>{e||s()},children:(0,t.jsxs)(I.DialogContent,{className:"sm:max-w-sm flex flex-col gap-0 overflow-hidden p-0",children:[(0,t.jsxs)(I.DialogHeader,{className:"shrink-0 px-6 py-4",children:[(0,t.jsx)(I.DialogTitle,{children:a}),o&&(0,t.jsx)(I.DialogDescription,{children:o})]}),(0,t.jsx)("div",{className:"px-6 pb-2",children:(0,t.jsx)(P.Input,{placeholder:"Search models...",value:h,onChange:e=>f(e.target.value),className:"h-8 text-sm"})}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-2 space-y-3",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[Object.entries(j).map(([e,r])=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1",children:e}),(0,t.jsx)("div",{className:"space-y-0.5",children:r.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>c(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)(p.Brain,{className:"size-4 text-muted-foreground shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground font-mono",children:e.modelId})]}),(0,t.jsx)("div",{className:(0,b.cn)("flex items-center justify-center size-4 rounded border shrink-0",i.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))})]},e)),0===g.length&&(0,t.jsx)("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No models found"})]}),i.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(e=>{let r=d.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)(p.Brain,{className:"size-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:r?.name||e}),(0,t.jsx)("button",{type:"button",onClick:()=>c(e),className:"hover:text-destructive shrink-0 cursor-pointer",children:(0,t.jsx)(l.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)(L.Button,{variant:"outline",onClick:s,children:u||"Cancel"}),(0,t.jsx)(L.Button,{onClick:n,disabled:m||0===i.length,children:x||"Confirm"})]})]})})}function F({open:e,database:s,models:n,providers:a,stats:o,loading:d,indexing:l,onOpenChange:i,onBind:c,onIndex:u}){let[x,m]=(0,r.useState)(!1),[p,h]=(0,r.useState)(null),[f,g]=(0,r.useState)(!1),[b,j]=(0,r.useState)(null),[v,N]=(0,r.useState)(null),w=o?.embeddingModelId??s?.embeddingModelId??null,y=n.find(e=>e.id===w),k=y?a.find(e=>e.name===y.provider):void 0,C=n.filter(e=>e.embedding);(0,r.useEffect)(()=>{e&&(h(w),j(null),N(null))},[w,e]);let D=async()=>{g(!0),N(null),j(null);try{await c(p),j("Embedding model saved."),m(!1)}catch(e){N(e instanceof Error?e.message:"Failed to save embedding model.")}finally{g(!1)}},S=async()=>{g(!0),N(null),j(null);try{await c(null),h(null),j("Embedding model cleared.")}catch(e){N(e instanceof Error?e.message:"Failed to clear embedding model.")}finally{g(!1)}},E=async()=>{N(null),j(null);try{await u(),j("Vector index completed.")}catch(e){N(e instanceof Error?e.message:"Failed to index database.")}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(I.Dialog,{open:e,onOpenChange:i,children:(0,t.jsxs)(I.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",children:[(0,t.jsx)(I.DialogHeader,{className:"px-5 py-4 border-b border-border",children:(0,t.jsx)(I.DialogTitle,{className:"text-sm",children:"Database vectors"})}),(0,t.jsxs)("div",{className:"p-5 space-y-4",children:[(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-xs font-semibold text-foreground",children:"Embedding model"}),(0,t.jsxs)("div",{className:"mt-1 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)(M.Server,{className:"w-3.5 h-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:y?`${y.name} (${k?.name||y.provider})`:"No model bound"})]})]}),(0,t.jsx)("button",{type:"button",onClick:()=>m(!0),className:"shrink-0 rounded-lg border border-border bg-background px-3 py-1.5 text-xs font-semibold hover:bg-muted cursor-pointer",children:"Select"})]}),w&&(0,t.jsx)("button",{type:"button",onClick:S,disabled:f||l,className:"mt-3 text-xs font-semibold text-muted-foreground hover:text-destructive disabled:opacity-50 cursor-pointer",children:"Clear binding"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[(0,t.jsxs)("div",{className:"rounded-lg border border-border p-3",children:[(0,t.jsx)("div",{className:"text-muted-foreground",children:"Documents"}),(0,t.jsx)("div",{className:"mt-1 text-lg font-bold text-foreground",children:o?.nodeCount??"-"})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-border p-3",children:[(0,t.jsx)("div",{className:"text-muted-foreground",children:"Indexed"}),(0,t.jsx)("div",{className:"mt-1 text-lg font-bold text-foreground",children:o?.indexedCount??"-"})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-border p-3",children:[(0,t.jsx)("div",{className:"text-muted-foreground",children:"Updated"}),(0,t.jsx)("div",{className:"mt-1 truncate text-xs font-semibold text-foreground",children:o?.lastIndexedAt?new Date(o.lastIndexedAt).toLocaleString():"-"})]})]}),v&&(0,t.jsx)("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:v}),b&&(0,t.jsx)("div",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-700",children:b})]}),(0,t.jsxs)(I.DialogFooter,{className:"px-5 py-4",children:[(0,t.jsx)("button",{type:"button",onClick:()=>i(!1),className:"px-3 py-1.5 rounded-lg text-xs font-semibold text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:"Close"}),(0,t.jsxs)("button",{type:"button",onClick:E,disabled:d||l||f||!w,className:"px-3 py-1.5 rounded-lg text-xs font-semibold bg-primary text-primary-foreground disabled:opacity-50 inline-flex items-center gap-1.5 cursor-pointer",children:[(0,t.jsx)(O.Play,{className:"w-3.5 h-3.5"}),l?"Indexing...":"Start indexing"]})]})]})}),(0,t.jsx)(A,{open:x,onClose:()=>m(!1),onConfirm:D,title:"Select embedding model",description:"Pick one embedding model. Its provider supplies API base and key.",models:C,selected:p?[p]:[],onToggle:e=>h(t=>t===e?null:e),confirmText:f?"Saving...":"Save",loading:f})]})}var R=e.i(451534);let z=(0,o.default)("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]);function B({isOpen:e,onClose:s,nodes:n,onSelectNode:a}){let[o,d]=(0,r.useState)(""),[c,u]=(0,r.useState)(0),x=(0,r.useRef)(null),m=(0,r.useRef)(null);(0,r.useEffect)(()=>{e&&setTimeout(()=>{m.current?.focus(),d("")},50)},[e]);let p=(0,r.useMemo)(()=>{if(!o)return n.filter(e=>!e.isTrash).sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,5);let e=o.toLowerCase().trim();return n.filter(t=>!t.isTrash&&((t.title||"").toLowerCase().includes(e)||(t.content||"").toLowerCase().includes(e)))},[o,n]);return((0,r.useEffect)(()=>{let t=t=>{e&&("Escape"===t.key?(t.preventDefault(),s()):"ArrowDown"===t.key?(t.preventDefault(),u(e=>(e+1)%Math.max(1,p.length))):"ArrowUp"===t.key?(t.preventDefault(),u(e=>(e-1+p.length)%Math.max(1,p.length))):"Enter"===t.key&&p[c]&&(t.preventDefault(),a(p[c].id),s()))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,p,c,s,a]),(0,r.useEffect)(()=>{let t=e=>{x.current&&!x.current.contains(e.target)&&s()};return e&&document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[e,s]),e)?(0,t.jsx)("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-xs flex items-start justify-center pt-[15vh] px-4 z-50",children:(0,t.jsxs)("div",{ref:x,className:"w-full max-w-2xl bg-card rounded-2xl shadow-2xl border border-border flex flex-col overflow-hidden max-h-[500px]",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3.5 border-b border-border shrink-0",children:[(0,t.jsx)(i.Search,{className:"w-5 h-5 text-muted-foreground"}),(0,t.jsx)("input",{ref:m,type:"text",placeholder:"搜索文档...",value:o,onChange:e=>{d(e.target.value),u(0)},className:"flex-1 bg-transparent text-foreground placeholder:text-muted-foreground text-sm focus:outline-none"}),(0,t.jsx)("button",{onClick:s,className:"p-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground cursor-pointer",children:(0,t.jsx)(l.X,{className:"w-4 h-4"})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto p-2",children:[(0,t.jsx)("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:o?`匹配结果 (${p.length})`:"最近编辑"}),0===p.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,t.jsx)("span",{className:"text-3xl mb-2",children:"🔍"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"没有找到相关文档"})]}):(0,t.jsx)("div",{className:"space-y-0.5",children:p.map((e,o)=>{let d=(e=>{let t=[],r=e,s=0;for(;r?.parentId&&s<10;){let e=n.find(e=>e.id===r.parentId);if(e)t.unshift(e.title||"未命名"),r=e;else break;s++}return t})(e);return(0,t.jsxs)("button",{onClick:()=>{a(e.id),s()},className:(0,b.cn)("w-full text-left p-3 rounded-xl flex items-center gap-3.5 transition-all text-sm cursor-pointer",o===c?"bg-accent text-foreground border-l-2 border-foreground":"text-muted-foreground hover:bg-muted"),children:[(0,t.jsx)("div",{className:"text-lg bg-muted p-1.5 rounded-lg shrink-0 border border-border",children:e.icon||"📝"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"font-medium text-foreground truncate block",children:e.title||"未命名"}),d.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground mt-1 truncate",children:[(0,t.jsx)(R.FolderOpen,{className:"w-3 h-3 text-muted-foreground/60"}),d.map((e,s)=>(0,t.jsxs)(r.default.Fragment,{children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)(w.ChevronRight,{className:"w-2.5 h-2.5 mx-0.5 text-muted-foreground/40"})]},s))]})]}),o===c&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground bg-muted border border-border px-2 py-0.5 rounded-md font-mono",children:[(0,t.jsx)(z,{className:"w-2.5 h-2.5"}),"Enter"]})]},e.id)})})]})]})}):null}var $=e.i(357301),U=e.i(486657),H=e.i(583705);function V({isOpen:e,onClose:s,nodes:n,onRestore:a,onDeletePermanent:o}){let[d,c]=(0,r.useState)(""),u=n.filter(e=>e.isTrash),m=u.filter(e=>(e.title||"").toLowerCase().includes(d.toLowerCase()));return e?(0,t.jsx)("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-xs flex items-start justify-center pt-[15vh] px-4 z-50",children:(0,t.jsxs)("div",{className:"w-full max-w-lg bg-card rounded-2xl shadow-2xl border border-border flex flex-col overflow-hidden max-h-[500px]",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(x.Trash2,{className:"w-5 h-5 text-red-400"}),(0,t.jsx)("h3",{className:"font-semibold text-foreground",children:"回收站"}),(0,t.jsx)("span",{className:"bg-red-950/40 text-red-400 border border-red-900/30 text-[10px] px-1.5 py-0.5 rounded-full font-bold",children:u.length})]}),(0,t.jsx)("button",{onClick:s,className:"p-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground cursor-pointer",children:(0,t.jsx)(l.X,{className:"w-4 h-4"})})]}),u.length>0&&(0,t.jsxs)("div",{className:"px-4 py-2 border-b border-border flex items-center gap-2 bg-muted/40",children:[(0,t.jsx)(i.Search,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,t.jsx)("input",{type:"text",placeholder:"搜索回收站...",value:d,onChange:e=>c(e.target.value),className:"flex-1 bg-transparent text-xs text-foreground placeholder:text-muted-foreground focus:outline-none"}),d&&(0,t.jsx)("button",{onClick:()=>c(""),className:"text-[10px] text-muted-foreground hover:text-foreground cursor-pointer",children:"清除"})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-3",children:0===u.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,t.jsx)("span",{className:"text-3xl mb-1.5",children:"🍃"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"回收站是空的"})]}):0===m.length?(0,t.jsxs)("div",{className:"py-12 text-center text-xs text-muted-foreground italic",children:['未匹配到 "',d,'"']}):(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] text-amber-500 bg-amber-950/20 py-1.5 px-3 rounded-lg mb-2 border border-amber-900/30",children:[(0,t.jsx)(H.Info,{className:"w-3.5 h-3.5 shrink-0"}),(0,t.jsx)("span",{children:"永久删除不可逆,子文件也会被清除。"})]}),m.map(e=>(0,t.jsxs)("div",{className:"group hover:bg-muted/40 p-2.5 rounded-xl border border-transparent hover:border-border flex items-center justify-between gap-3 transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,t.jsx)("span",{className:"text-lg bg-muted border border-border p-1 rounded-md shrink-0",children:e.icon||"📝"}),(0,t.jsx)("span",{className:"text-xs font-medium text-foreground truncate",children:e.title||"未命名"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,t.jsx)("button",{onClick:()=>a(e.id),className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-emerald-400 cursor-pointer",title:"恢复",children:(0,t.jsx)($.RotateCcw,{className:"w-4 h-4"})}),(0,t.jsx)("button",{onClick:()=>{confirm(`永久删除 "${e.title}"?`)&&o(e.id)},className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-red-400 cursor-pointer",title:"永久删除",children:(0,t.jsx)(x.Trash2,{className:"w-4 h-4"})})]})]},e.id))]})}),(0,t.jsxs)("div",{className:"bg-muted border-t border-border px-5 py-3 text-xs text-muted-foreground flex items-center gap-2 shrink-0",children:[(0,t.jsx)(U.AlertTriangle,{className:"w-4 h-4 text-muted-foreground/60"}),"点击按钮恢复或永久删除"]})]})}):null}e.s(["DatabaseSidebarPanel",0,function({workspaceId:e}){let{databases:a,activeDatabaseId:o,nodes:d,vectorStats:l,vectorLoading:i,vectorIndexing:c,loading:u,loaded:x,load:m,loadVectorStats:p,bindEmbeddingModel:h,indexVectors:f,restoreNode:g,deleteNode:b,setActiveId:j,createDatabase:v,updateDatabase:N}=(0,s.useDatabaseStore)(),{models:w,providers:y,ensure:k}=(0,n.useLLMStore)(),[C,D]=(0,r.useState)(!1),[S,I]=(0,r.useState)(!1),[M,O]=(0,r.useState)(!1),[L,P]=(0,r.useState)(!1),[A,R]=(0,r.useState)(null);(0,r.useEffect)(()=>{x||m(e)},[x,m,e]),(0,r.useEffect)(()=>{L&&(k(),o&&p(e,o))},[o,k,p,L,e]);let z=(0,r.useCallback)(()=>{},[]),$=a.find(e=>e.id===o)??a[0]??null,U=(0,r.useCallback)(()=>{R(null),O(!0)},[]),H=(0,r.useCallback)(()=>{R($),O(!0)},[$]),X=(0,r.useCallback)(async t=>{A?await N(e,A.id,t):await v(e,t)},[v,A,N,e]),K=(0,r.useCallback)(async t=>{$&&await h(e,$.id,t)},[$,h,e]),W=(0,r.useCallback)(async()=>{$&&await f(e,$.id)},[$,f,e]);return u&&!x?(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"加载中..."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E,{workspaceId:e,onOpenSearch:()=>D(!0),onOpenTrash:()=>I(!0),onOpenCreateDatabase:U,onOpenEditDatabase:H,onOpenVectorDialog:()=>P(!0),onSave:z}),(0,t.jsx)(B,{isOpen:C,onClose:()=>D(!1),nodes:d,onSelectNode:e=>{j(e),D(!1)}}),(0,t.jsx)(V,{isOpen:S,onClose:()=>I(!1),nodes:d,onRestore:t=>{g(e,t)},onDeletePermanent:t=>{b(e,t)}}),(0,t.jsx)(T,{open:M,database:A,onOpenChange:O,onSave:X}),(0,t.jsx)(F,{open:L,database:$,models:w,providers:y,stats:l,loading:i,indexing:c,onOpenChange:P,onBind:K,onIndex:W})]})}],282738)},115133,e=>{e.n(e.i(282738))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,940361,e=>{"use strict";var t=e.i(344180);e.s([],2365),e.i(2365);var n=e.i(764556),a=e.i(394822),r=e.i(174465),i=e.i(648224),s=e.i(35359);e.i(8890);var o=e.i(422561),l=e.i(526850),c=e.i(232449),u=e.i(410421),d=e.i(150129),m=e.i(969490),p=e.i(602453),x=e.i(817955),h=e.i(742665),f=e.i(87709);let g=n.forwardRef(function(e,t){let{render:a,className:i,style:g,...v}=e,{setAnchor:b,actionsRef:y,internalBackdropRef:M,backdropRef:j,positionerRef:k,allowMouseUpTriggerRef:C,initialCursorPointRef:N,rootId:R}=(0,r.useContextMenuRootContext)(!1),{store:w}=(0,s.useMenuRootContext)(!1),I=w.useState("open"),S=w.useState("disabled"),T=n.useRef(null),D=n.useRef(null),P=(0,c.useTimeout)(),z=(0,c.useTimeout)(),E=n.useRef(!1);function O(e,t,n){let a=n.type.startsWith("touch");N.current={x:e,y:t},b({getBoundingClientRect:()=>DOMRect.fromRect({width:10*!!a,height:10*!!a,x:e,y:t})}),E.current=!1,y.current?.setOpen(!0,(0,p.createChangeEventDetails)(h.REASONS.triggerPress,n)),z.start(500,()=>{E.current=!0})}function A(){P.clear(),D.current=null}return n.useEffect(()=>{let e=(0,l.ownerDocument)(T.current);return(0,o.addEventListener)(e,"contextmenu",function(e){if(S)return;let t=(0,u.getTarget)(e);((0,u.contains)(T.current,t)||(0,u.contains)(M.current,t)||(0,u.contains)(j.current,t))&&e.preventDefault()})},[j,S,M]),(0,m.useRenderElement)("div",e,{state:{open:I},ref:[T,t],props:[{onContextMenu:function(e){if(S)return;C.current=!0,(0,d.stopEvent)(e),O(e.clientX,e.clientY,e.nativeEvent);let t=(0,l.ownerDocument)(T.current);(0,o.addEventListener)(t,"mouseup",e=>{if(C.current=!1,!E.current)return;z.clear(),E.current=!1;let t=(0,u.getTarget)(e);(0,u.contains)(k.current,t)||R&&t&&(0,f.findRootOwnerId)(t)===R||y.current?.setOpen(!1,(0,p.createChangeEventDetails)(h.REASONS.cancelOpen,e))},{once:!0})},onTouchStart:function(e){if(!S&&(C.current=!1,1===e.touches.length)){e.stopPropagation();let t=e.touches[0];D.current={x:t.clientX,y:t.clientY},P.start(500,()=>{D.current&&O(D.current.x,D.current.y,e.nativeEvent)})}},onTouchMove:function(e){if(P.isStarted()&&D.current&&1===e.touches.length){let t=e.touches[0],n=Math.abs(t.clientX-D.current.x),a=Math.abs(t.clientY-D.current.y);(n>10||a>10)&&P.clear()}},onTouchEnd:A,onTouchCancel:A,style:{WebkitTouchCallout:"none"}},v],stateAttributesMapping:x.pressableTriggerOpenStateMapping})});var v=e.i(487455),b=e.i(293209),y=e.i(503662),M=e.i(33427),j=e.i(324573),k=e.i(582883),C=e.i(277658),N=e.i(349204),R=e.i(28051),w=e.i(597375),I=e.i(81752),S=e.i(59354),T=e.i(300637),D=e.i(281478),P=e.i(65255),z=e.i(327794),E=e.i(362962);e.s(["Arrow",()=>j.MenuArrow,"Backdrop",()=>v.MenuBackdrop,"CheckboxItem",()=>R.MenuCheckboxItem,"CheckboxItemIndicator",()=>w.MenuCheckboxItemIndicator,"Group",()=>k.MenuGroup,"GroupLabel",()=>C.MenuGroupLabel,"Item",()=>N.MenuItem,"LinkItem",()=>I.MenuLinkItem,"Popup",()=>M.MenuPopup,"Portal",()=>b.MenuPortal,"Positioner",()=>y.MenuPositioner,"RadioGroup",()=>S.MenuRadioGroup,"RadioItem",()=>T.MenuRadioItem,"RadioItemIndicator",()=>D.MenuRadioItemIndicator,"Root",0,function(e){let[o,l]=n.useState({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,x:0,y:0})}),c=n.useRef(null),u=n.useRef(null),d=n.useRef(null),m=n.useRef(null),p=n.useRef(!0),x=n.useRef(null),h=(0,a.useId)(),f=n.useMemo(()=>({anchor:o,setAnchor:l,actionsRef:d,backdropRef:c,internalBackdropRef:u,positionerRef:m,allowMouseUpTriggerRef:p,initialCursorPointRef:x,rootId:h}),[o,h]);return(0,t.jsx)(r.ContextMenuRootContext.Provider,{value:f,children:(0,t.jsx)(s.MenuRootContext.Provider,{value:void 0,children:(0,t.jsx)(i.Menu.Root,{...e})})})},"Separator",()=>E.Separator,"SubmenuRoot",()=>P.MenuSubmenuRoot,"SubmenuTrigger",()=>z.MenuSubmenuTrigger,"Trigger",0,g],912001);var O=e.i(912001),O=O,A=e.i(465458),B=e.i(932031);function L({className:e,align:n="start",alignOffset:a=4,side:r="right",sideOffset:i=0,...s}){return(0,t.jsx)(O.Portal,{children:(0,t.jsx)(O.Positioner,{className:"isolate z-50 outline-none",align:n,alignOffset:a,side:r,sideOffset:i,children:(0,t.jsx)(O.Popup,{"data-slot":"context-menu-content",className:(0,A.cn)("z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none 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-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),...s})})})}e.i(299648),e.s(["ContextMenu",0,function({...e}){return(0,t.jsx)(O.Root,{"data-slot":"context-menu",...e})},"ContextMenuContent",0,L,"ContextMenuItem",0,function({className:e,inset:n,variant:a="default",...r}){return(0,t.jsx)(O.Item,{"data-slot":"context-menu-item","data-inset":n,"data-variant":a,className:(0,A.cn)("group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",e),...r})},"ContextMenuSeparator",0,function({className:e,...n}){return(0,t.jsx)(O.Separator,{"data-slot":"context-menu-separator",className:(0,A.cn)("-mx-1 my-1 h-px bg-border",e),...n})},"ContextMenuSub",0,function({...e}){return(0,t.jsx)(O.SubmenuRoot,{"data-slot":"context-menu-sub",...e})},"ContextMenuSubContent",0,function({...e}){return(0,t.jsx)(L,{"data-slot":"context-menu-sub-content",className:"shadow-lg",side:"right",...e})},"ContextMenuSubTrigger",0,function({className:e,inset:n,children:a,...r}){return(0,t.jsxs)(O.SubmenuTrigger,{"data-slot":"context-menu-sub-trigger","data-inset":n,className:(0,A.cn)("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a,(0,t.jsx)(B.ChevronRightIcon,{className:"ml-auto"})]})},"ContextMenuTrigger",0,function({className:e,...n}){return(0,t.jsx)(O.Trigger,{"data-slot":"context-menu-trigger",className:(0,A.cn)("select-none",e),...n})}],940361)},272736,e=>{"use strict";function t(e){return e.name?.trim()||e.role}e.s(["getAgentDisplayName",0,t,"getMemberDisplayName",0,function(e,n){if("user"===n)return"user";let a=e.find(e=>e.id===n);return a?t(a):n},"normalizeChannelMembersToAgentIds",0,function(e,t){let n=new Set(e.map(e=>e.id)),a=[],r=new Set;for(let e of t)n.has(e)&&(r.has(e)||(r.add(e),a.push(e)));return a}])},595390,e=>{"use strict";var t=e.i(344180),n=e.i(764556),a=e.i(681622),r=e.i(611176),i=e.i(972846);let s=e=>!["scheduler","task_creator","bot"].includes(e.description||"")&&"agent-generator"!==e.id;e.s(["MemberPicker",0,function({candidates:e,selected:o,onToggle:l,searchPlaceholder:c,emptyText:u,label:d,filter:m}){let[p,x]=(0,n.useState)(""),h=e.filter(m??s).sort((e,t)=>(e.sortIndex??0)-(t.sortIndex??0)).filter(e=>`${e.label} ${e.description||""}`.toLowerCase().includes(p.toLowerCase()));return(0,t.jsxs)("div",{className:"space-y-2",children:[d&&(0,t.jsx)("label",{className:"text-sm font-medium",children:d}),(0,t.jsx)(a.Input,{value:p,onChange:e=>x(e.target.value),placeholder:c}),(0,t.jsxs)("div",{className:"max-h-40 overflow-y-auto space-y-0.5",children:[0===h.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground py-2 text-center",children:u||"No items found"}),h.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>l(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)(r.AgentIcon,{agentId:"user"!==e.id?e.id:void 0,name:e.label,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.label}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:`flex items-center justify-center size-4 rounded border shrink-0 ${o.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input"}`})]},e.id))]}),o.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:o.map(n=>{let a=e.find(e=>e.id===n),s=a?.label||n;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:["user"===n?(0,t.jsx)("span",{className:"truncate",children:s}):(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 min-w-0",children:[(0,t.jsx)(r.AgentIcon,{agentId:n,name:s,className:"size-3.5 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s})]}),(0,t.jsx)("button",{type:"button",onClick:()=>l(n),className:"hover:text-destructive shrink-0 cursor-pointer",children:(0,t.jsx)(i.X,{className:"size-3"})})]},n)})})]})}])},444204,e=>{"use strict";let t=(0,e.i(433721).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);e.s(["Clock",0,t],444204)},867295,e=>{"use strict";let t=(0,e.i(433721).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["default",0,t])},600304,759309,e=>{"use strict";let t=(0,e.i(433721).default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["default",0,t],759309),e.s(["Send",0,t],600304)},79882,e=>{"use strict";let t=(0,e.i(433721).default)("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);e.s(["Archive",0,t],79882)},478117,e=>{"use strict";var t=e.i(344180),n=e.i(764556),a=e.i(244073),r=e.i(209988),i=e.i(681622),s=e.i(260218),o=e.i(595390),l=e.i(272736);e.s(["ChannelDialog",0,function({open:e,onOpenChange:c,channel:u,agents:d=[],onSubmit:m}){let p=(0,a.useTranslations)("chat"),x=(0,a.useTranslations)("common"),[h,f]=(0,n.useState)(""),[g,v]=(0,n.useState)("general"),[b,y]=(0,n.useState)([]),[M,j]=(0,n.useState)(""),[k,C]=(0,n.useState)(0),N=d.filter(e=>!1!==e.enabled).map((e,t)=>({id:e.id,label:(0,l.getMemberDisplayName)(d,e.id),sortIndex:t})),R=1===b.length?b[0]:null;(0,n.useEffect)(()=>{e&&queueMicrotask(()=>{u?(f(u.name),v(u.type),y([...u.members])):(f(""),v("general"),y([])),j(""),C(e=>e+1)})},[e,u]);let w=()=>{m({name:h.trim(),type:g,members:b,initialMessage:R&&M.trim()?M.trim():void 0}),c(!1)};return(0,t.jsx)(r.Dialog,{open:e,onOpenChange:c,children:(0,t.jsxs)(r.DialogContent,{className:"sm:max-w-md max-h-[85vh] p-0 gap-0 flex flex-col overflow-hidden",children:[(0,t.jsxs)(r.DialogHeader,{className:"px-4 py-4 shrink-0",children:[(0,t.jsx)(r.DialogTitle,{children:p(u?"channel.edit":"channel.create")}),(0,t.jsx)(r.DialogDescription,{children:p(u?"channel.edit":"channel.create")})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 pb-4",children:(0,t.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("name")}),(0,t.jsx)(i.Input,{value:h,onChange:e=>f(e.target.value),placeholder:p("channel.namePlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]}),(0,t.jsx)(o.MemberPicker,{candidates:N,selected:b,onToggle:e=>{y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},label:p("channel.members"),searchPlaceholder:p("channel.addMember"),emptyText:p("channel.noAgents")||"No agents found"},k),R&&!u&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:p("channel.initialMessage")}),(0,t.jsx)(i.Input,{value:M,onChange:e=>j(e.target.value),placeholder:p("channel.initialMessagePlaceholder"),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),w())}})]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(s.Button,{variant:"outline",onClick:()=>c(!1),children:x("cancel")}),(0,t.jsx)(s.Button,{onClick:w,children:x(u?"save":"create")})]})]})})]})})}])},250438,e=>{"use strict";var t=e.i(558680);e.s(["ChevronDownIcon",()=>t.default])},588785,e=>{"use strict";let t=(0,e.i(433721).default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);e.s(["Maximize2",0,t],588785)},735207,e=>{"use strict";let t=(0,e.i(433721).default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);e.s(["default",0,t])}]);
@@ -0,0 +1 @@
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),l=e.i(137340),c=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 g=(0,d.useTranslations)("workspaces");(0,d.useTranslations)("common");let j=(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,C]=(0,t.useState)(null),T=(0,x.useWorkspaceStore)(e=>e.createDialogOpen),D=(0,x.useWorkspaceStore)(e=>e.setCreateDialogOpen);(0,t.useEffect)(()=>{w(e)},[e,w]);let W=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())}},O=async e=>{confirm(g("deleteConfirm",{name:e.name}))&&(await fetch(`/api/workspaces/${e.id}`,{method:"DELETE"}),N(e.id))},P=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:g("title")}),(0,s.jsxs)(p.Button,{onClick:()=>{C(null),y(!0)},size:"sm",className:"rounded-full px-4",children:[(0,s.jsx)(n.Plus,{className:"size-3.5"}),g("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:g("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)(j,`/workspace/${e.id}`),onKeyDown:s=>{"Enter"===s.key&&(0,h.tauriNavigate)(j,`/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(),C(e),y(!0)},children:[(0,s.jsx)(i.Pencil,{className:"size-3.5"}),g("edit")]}),(0,s.jsxs)(u.DropdownMenuItem,{onClick:s=>{s.stopPropagation(),P(e)},children:[(0,s.jsx)(c.FolderSearch,{className:"size-3.5"}),g("reveal")]}),(0,s.jsxs)(u.DropdownMenuItem,{variant:"destructive",onClick:s=>{s.stopPropagation(),O(e)},children:[(0,s.jsx)(l.Trash2,{className:"size-3.5"}),g("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||T,onOpenChange:e=>{y(e),e||(D(!1),C(null))},workspace:T?null:S,onSubmit:W})]})}var g=e.i(437122);e.s(["default",0,function(){let[e,a]=(0,t.useState)([]);return(0,t.useEffect)(()=>{fetch("/api/workspaces",{headers:(0,g.authHeaders)()}).then(e=>e.ok?e.json():[]).then(a)},[]),(0,s.jsx)(f,{initialWorkspaces:e})}],259295)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,191871,e=>{"use strict";var t=e.i(344180),s=e.i(887836),l=e.i(764556),a=e.i(799543),r=e.i(361031),n=e.i(233297);let o=(0,s.default)(()=>e.A(638150).then(e=>e.MobileTabBar),{loadableGenerated:{modules:[404069]},ssr:!1,loading:()=>null}),i=(0,s.default)(()=>e.A(255299).then(e=>e.WorkspaceShell),{loadableGenerated:{modules:[817465]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:"Loading..."})});e.s(["WorkspaceClient",0,function(){let e=function(){let e=(0,a.useSearchParams)().get("workspaceId")||"",[t,s]=(0,l.useState)("");return(0,l.useEffect)(()=>{let e=window.location.pathname.match(/\/workspace\/([^/]+)/);s(e?.[1]||"")},[]),(0,l.useMemo)(()=>e||t,[t,e])}(),s=(0,a.useRouter)(),[c,u]=(0,l.useState)(null),[d,h]=(0,l.useState)(null),m=(0,r.useWorkspaceStore)(e=>e.upsertWorkspace);return((0,l.useEffect)(()=>{e&&fetch(`/api/workspaces/${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(t=>{u(t),m(t),localStorage.setItem("lastWorkspaceId",e)}).catch(e=>h(e.message))},[e,m]),d)?(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center gap-4",children:[(0,t.jsx)("p",{className:"text-destructive",children:d}),(0,t.jsx)("button",{type:"button",onClick:()=>(0,n.tauriNavigate)(s,"/"),className:"text-sm underline",children:"Back to home"})]}):c?(0,t.jsxs)("div",{className:"h-full min-h-0 flex flex-col overflow-hidden",children:[(0,t.jsx)(o,{}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:(0,t.jsx)(i,{workspaceId:c.id,boundDirs:c.boundDirs})})]}):(0,t.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:"Loading..."})}])},638150,e=>{e.v(t=>Promise.all(["static/chunks/17k~zbv0_4rep.js"].map(t=>e.l(t))).then(()=>t(404069)))},255299,e=>{e.v(t=>Promise.all(["static/chunks/09h23logvq65m.js","static/chunks/0vbqaynjq8ga..js"].map(t=>e.l(t))).then(()=>t(817465)))}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,191871,e=>{"use strict";var t=e.i(344180),s=e.i(887836),l=e.i(764556),a=e.i(799543),r=e.i(361031),n=e.i(233297);let o=(0,s.default)(()=>e.A(638150).then(e=>e.MobileTabBar),{loadableGenerated:{modules:[404069]},ssr:!1,loading:()=>null}),i=(0,s.default)(()=>e.A(255299).then(e=>e.WorkspaceShell),{loadableGenerated:{modules:[817465]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:"Loading..."})});e.s(["WorkspaceClient",0,function(){let e=function(){let e=(0,a.useSearchParams)().get("workspaceId")||"",[t,s]=(0,l.useState)("");return(0,l.useEffect)(()=>{let e=window.location.pathname.match(/\/workspace\/([^/]+)/);s(e?.[1]||"")},[]),(0,l.useMemo)(()=>e||t,[t,e])}(),s=(0,a.useRouter)(),[c,u]=(0,l.useState)(null),[d,h]=(0,l.useState)(null),m=(0,r.useWorkspaceStore)(e=>e.upsertWorkspace);return((0,l.useEffect)(()=>{e&&fetch(`/api/workspaces/${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(t=>{u(t),m(t),localStorage.setItem("lastWorkspaceId",e)}).catch(e=>h(e.message))},[e,m]),d)?(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center gap-4",children:[(0,t.jsx)("p",{className:"text-destructive",children:d}),(0,t.jsx)("button",{type:"button",onClick:()=>(0,n.tauriNavigate)(s,"/"),className:"text-sm underline",children:"Back to home"})]}):c?(0,t.jsxs)("div",{className:"h-full min-h-0 flex flex-col overflow-hidden",children:[(0,t.jsx)(o,{}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:(0,t.jsx)(i,{workspaceId:c.id,boundDirs:c.boundDirs})})]}):(0,t.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:"Loading..."})}])},638150,e=>{e.v(t=>Promise.all(["static/chunks/03f1bwuynjdmk.js"].map(t=>e.l(t))).then(()=>t(404069)))},255299,e=>{e.v(t=>Promise.all(["static/chunks/0~sh93re1-_rp.js","static/chunks/0-yizd8osmas2.js"].map(t=>e.l(t))).then(()=>t(817465)))}]);
@@ -0,0 +1 @@
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 a(t){try{var a;return a=JSON.parse(localStorage.getItem(e(t))||"[]"),Array.isArray(a)?a.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 s(t,a){localStorage.setItem(e(t),JSON.stringify(a.slice(0,50)))}let i=(0,t.i(816709).create)(t=>({histories:{},pendingJump:null,setPendingJump:e=>t({pendingJump:e}),loadHistory:e=>{let s=a(e);t(t=>({histories:{...t.histories,[e]:s}}))},addEntry:(e,i)=>{let r={...i,id:i.id??`${i.timestamp}-${Math.random().toString(36).slice(2,8)}`,column:i.column??1,timestamp:i.timestamp??Date.now()},o=a(e).filter(t=>t.path!==r.path||t.line!==r.line||t.column!==r.column),n=[r,...o].slice(0,50);s(e,n),t(t=>({histories:{...t.histories,[e]:n}}))},setHistory:(e,a)=>{s(e,a),t(t=>({histories:{...t.histories,[e]:a}}))},clearHistory:e=>{s(e,[]),t(t=>({histories:{...t.histories,[e]:[]}}))}}));t.s(["useInspectorHistoryStore",0,i])},141889,t=>{"use strict";var e=t.i(816709),a=t.i(437122);let s=["linear-gradient(to right, #10b981, #06b6d4)","linear-gradient(to right, #ec4899, #8b5cf6)","linear-gradient(to right, #f43f5e, #f97316)","linear-gradient(to right, #1e293b, #0f172a)","linear-gradient(to right, #3b82f6, #06b6d4)","linear-gradient(to right, #f59e0b, #e11d48)","linear-gradient(to right, #475569, #1e293b)"];async function i(t,e,s){let i=await (0,a.fetchWithAuth)(`/api/workspaces/${t}/database${e}`,{headers:{"Content-Type":"application/json"},...s});if(!i.ok){let t=await i.json().catch(()=>null);throw Error(t?.error||`Database API error: ${i.status}`)}return i.json()}function r(t,e){if(!e)return t;let a=t.includes("?")?"&":"?";return`${t}${a}databaseId=${encodeURIComponent(e)}`}let o=new Map,n=(0,e.create)((t,e)=>({databases:[],activeDatabaseId:null,nodes:[],activeId:null,openTabs:[],recentIds:[],editorMode:"notion",theme:"sans",isFullWidth:!1,openFolders:{},sidebarSearch:"",vectorStats:null,vectorLoading:!1,vectorIndexing:!1,loading:!1,loaded:!1,loadedWorkspaceId:null,load:async a=>{let{loadedWorkspaceId:s}=e();if(s!==a||!e().loaded){t({loading:!0});try{let s=await i(a,"/databases"),o=e().activeDatabaseId&&s.some(t=>t.id===e().activeDatabaseId)?e().activeDatabaseId:s[0]?.id??null,n=o?await i(a,r("",o)):[],c=o?await i(a,`/databases/${o}/vector`).catch(()=>null):null,l=n.filter(t=>!t.isTrash);t({databases:s,activeDatabaseId:o,nodes:n,vectorStats:c,loading:!1,loaded:!0,loadedWorkspaceId:a,activeId:l.length>0?l[0].id:null,openTabs:[],recentIds:[]})}catch{t({loading:!1})}}},loadNodes:async(a,s)=>{t({loading:!0});try{let o=await i(a,r("",s)),n=o.filter(t=>!t.isTrash);t({nodes:o,loading:!1,activeId:n.length>0?n[0].id:null,openTabs:[],recentIds:[],openFolders:{},sidebarSearch:"",vectorStats:null}),await e().loadVectorStats(a,s)}catch{t({loading:!1})}},setActiveDatabaseId:async(a,s)=>{t({activeDatabaseId:s}),await e().loadNodes(a,s)},createDatabase:async(a,s)=>{let r=await i(a,"/databases",{method:"POST",body:JSON.stringify(s)});return t(t=>({databases:[...t.databases,r],activeDatabaseId:r.id})),await e().loadNodes(a,r.id),r},updateDatabase:async(e,a,s)=>{let r=await i(e,`/databases/${a}`,{method:"PUT",body:JSON.stringify(s)});return t(t=>({databases:t.databases.map(t=>t.id===r.id?r:t)})),r},deleteDatabase:async(a,s)=>{await i(a,`/databases/${s}`,{method:"DELETE"});let r=await i(a,"/databases"),o=r[0]?.id??null;t({databases:r,activeDatabaseId:o}),o&&await e().loadNodes(a,o)},loadVectorStats:async(e,a)=>{t({vectorLoading:!0});try{let s=await i(e,`/databases/${a}/vector`);t({vectorStats:s,vectorLoading:!1})}catch{t({vectorStats:null,vectorLoading:!1})}},bindEmbeddingModel:async(e,a,s)=>{let r=await i(e,`/databases/${a}/vector`,{method:"PUT",body:JSON.stringify({embeddingModelId:s})});t(t=>({vectorStats:r,databases:t.databases.map(t=>t.id===a?{...t,embeddingModelId:s||void 0}:t)}))},indexVectors:async(e,a)=>{t({vectorIndexing:!0});try{let s=await i(e,`/databases/${a}/vector/index`,{method:"POST"});return t({vectorStats:s,vectorIndexing:!1}),s}catch(e){throw t({vectorIndexing:!1}),e}},setActiveId:e=>{t(t=>{let a=e&&!t.openTabs.includes(e)?[...t.openTabs,e]:t.openTabs,s=e?[e,...t.recentIds.filter(t=>t!==e)].slice(0,4):t.recentIds;return{activeId:e,openTabs:a,recentIds:s}})},createNode:async(a,o,n)=>{let c=e().activeDatabaseId,l=n?"folder"===n:!o,d=s[Math.floor(Math.random()*s.length)],h=await i(a,r("",c),{method:"POST",body:JSON.stringify({title:l?"未命名文件夹":"未命名页面",icon:l?"📂":"📝",cover:d,content:l?"<h1>📂 未命名文件夹</h1><p>这是一个新建的目录夹。</p>":"<h1>新创建的文档</h1><p>点击在此处开始编写...</p>",parentId:o})});return t(t=>{let e=[...t.openTabs,h.id];return o?{nodes:[...t.nodes,h],activeId:h.id,openTabs:e,openFolders:{...t.openFolders,[o]:!0}}:{nodes:[...t.nodes,h],activeId:h.id,openTabs:e}}),h},updateContent:async(a,s,n)=>{let c=e().activeDatabaseId;t(t=>({nodes:t.nodes.map(t=>t.id===s?{...t,content:n,updatedAt:Date.now()}:t)})),function(t,e,a,s){let n=`${t}:${e??"default"}:${a}`,c=o.get(n);if(c){c.content=s;return}let l=setTimeout(()=>{let c=o.get(n);o.delete(n),i(t,r(`/${a}`,e),{method:"PUT",body:JSON.stringify({content:c?.content??s})})},3e3);o.set(n,{timer:l,content:s})}(a,c,s,n)},listNodeVersions:async(t,a)=>i(t,r(`/${a}/versions`,e().activeDatabaseId)),renameNode:async(a,s,o)=>{let n=e().activeDatabaseId;t(t=>({nodes:t.nodes.map(t=>t.id===s?{...t,title:o,updatedAt:Date.now()}:t)})),await i(a,r(`/${s}`,n),{method:"PUT",body:JSON.stringify({title:o})})},updateIcon:async(a,s,o)=>{let n=e().activeDatabaseId;t(t=>({nodes:t.nodes.map(t=>t.id===s?{...t,icon:o,updatedAt:Date.now()}:t)})),await i(a,r(`/${s}`,n),{method:"PUT",body:JSON.stringify({icon:o})})},updateCover:async(a,s,o)=>{let n=e().activeDatabaseId;t(t=>({nodes:t.nodes.map(t=>t.id===s?{...t,cover:o,updatedAt:Date.now()}:t)})),await i(a,r(`/${s}`,n),{method:"PUT",body:JSON.stringify({cover:o})})},trashNode:async(a,s)=>{let o=e().activeDatabaseId,{nodes:n,activeId:c}=e(),l=new Set([s]),d=t=>{n.filter(e=>e.parentId===t).forEach(t=>{l.add(t.id),d(t.id)})};if(d(s),t(t=>({nodes:t.nodes.map(t=>l.has(t.id)?{...t,isTrash:!0}:t)})),await i(a,r(`/${s}/trash`,o),{method:"PUT"}),l.has(c||"")){let a=e().nodes.filter(t=>!t.isTrash);t({activeId:a.length>0?a[0].id:null})}},restoreNode:async(a,s)=>{let o=e().activeDatabaseId;await i(a,r(`/${s}/restore`,o),{method:"PUT"});let{nodes:n}=e(),c=n.find(t=>t.id===s),l=c?.parentId??null;if(l){let t=n.find(t=>t.id===l);(!t||t.isTrash)&&(l=null)}t(t=>({nodes:t.nodes.map(t=>t.id===s?{...t,isTrash:!1,parentId:l}:t),activeId:s}))},deleteNode:async(a,s)=>{let o=e().activeDatabaseId,{nodes:n,activeId:c}=e(),l=new Set([s]),d=t=>{n.filter(e=>e.parentId===t).forEach(t=>{l.add(t.id),d(t.id)})};if(d(s),t(t=>({nodes:t.nodes.filter(t=>!l.has(t.id))})),await i(a,r(`/${s}`,o),{method:"DELETE"}),l.has(c||"")){let a=e().nodes.filter(t=>!t.isTrash);t({activeId:a.length>0?a[0].id:null})}},moveNode:async(a,s,o)=>{let n=e().activeDatabaseId;t(t=>({nodes:t.nodes.map(t=>t.id===s?{...t,parentId:o,updatedAt:Date.now()}:t)})),await i(a,r(`/${s}/move`,n),{method:"PUT",body:JSON.stringify({parentId:o})}),o&&t(t=>({openFolders:{...t.openFolders,[o]:!0}}))},setEditorMode:e=>t({editorMode:e}),setTheme:e=>t({theme:e}),setIsFullWidth:e=>t({isFullWidth:e}),toggleFolder:e=>t(t=>({openFolders:{...t.openFolders,[e]:!t.openFolders[e]}})),setSidebarSearch:e=>t({sidebarSearch:e}),addTab:e=>t(t=>t.openTabs.includes(e)?t:{openTabs:[...t.openTabs,e]}),closeTab:e=>t(t=>{let a=t.openTabs.filter(t=>t!==e),s=t.activeId===e?a.length>0?a[a.length-1]:null:t.activeId;return{openTabs:a,activeId:s}})}));t.s(["useDatabaseStore",0,n])},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 a=/not a git repository/i;function s(t){return t instanceof Error&&a.test(t.message)}let i=(0,e.create)(t=>({status:null,diffs:[],selectedFile:null,log:[],branches:[],loading:!1,error:null,notGitRepo:!1,commitMsg:"",loadStatus:async e=>{try{let a=await fetch(`/api/workspaces/${e}/git/status`);if(!a.ok)throw Error(await a.text());let s=await a.json();t({status:s,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:s(e)})}},loadDiffs:async(e,a)=>{t({loading:!0});try{let s=a?`/api/workspaces/${e}/git/diff?path=${encodeURIComponent(a)}`:`/api/workspaces/${e}/git/diff`,i=await fetch(s);if(!i.ok)throw Error(await i.text());let r=await i.json();t({diffs:r,loading:!1,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),loading:!1,notGitRepo:s(e)})}},loadLog:async e=>{try{let a=await fetch(`/api/workspaces/${e}/git/log`);if(!a.ok)throw Error(await a.text());let s=await a.json();t({log:s,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:s(e)})}},loadBranches:async e=>{try{let a=await fetch(`/api/workspaces/${e}/git/branches`);if(!a.ok)throw Error(await a.text());let s=await a.json();t({branches:s,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:s(e)})}},initRepo:async e=>{try{let a=await fetch(`/api/workspaces/${e}/git/init`,{method:"POST"});if(!a.ok)throw Error(await a.text());t({error:null,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e)})}},commit:async(e,a)=>{try{let t=await fetch(`/api/workspaces/${e}/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},discard:async(e,a)=>{try{let t=await fetch(`/api/workspaces/${e}/git/discard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});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,a)=>{try{let t=await fetch(`/api/workspaces/${e}/git/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},unstage:async(e,a)=>{try{let t=await fetch(`/api/workspaces/${e}/git/unstage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},resolveFile:async(t,e,a,s=!0)=>{let i=await fetch(`/api/workspaces/${t}/git/resolve-file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:a,stage:s})});if(!i.ok)throw Error(await i.text())},checkout:async(e,a)=>{try{let t=await fetch(`/api/workspaces/${e}/git/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:a})});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,a)=>{let s=await fetch(`/api/workspaces/${t}/git/remotes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,url:a})});if(!s.ok)throw Error((await s.json().catch(()=>({error:"Failed to add remote"}))).error)},selectFile:e=>t({selectedFile:e}),setCommitMsg:e=>t({commitMsg:e}),checkoutDetached:async(t,e)=>{let a=await fetch(`/api/workspaces/${t}/git/checkout-detached`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:e})});if(!a.ok)throw Error((await a.json().catch(()=>({}))).error)},cherryPick:async(t,e)=>{let a=await fetch(`/api/workspaces/${t}/git/cherry-pick`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:e})});if(!a.ok)throw Error((await a.json().catch(()=>({}))).error)},createBranch:async(t,e,a)=>{let s=await fetch(`/api/workspaces/${t}/git/create-branch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,startPoint:a})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error)},deleteBranch:async(t,e,a)=>{let s=await fetch(`/api/workspaces/${t}/git/delete-branch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,force:a})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error)},createTag:async(t,e,a)=>{let s=await fetch(`/api/workspaces/${t}/git/create-tag`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,commitHash:a})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error)},getCommitDiff:async(t,e)=>{let a=await fetch(`/api/workspaces/${t}/git/commit-diff?hash=${encodeURIComponent(e)}`);if(!a.ok)throw Error((await a.json().catch(()=>({}))).error);return a.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,i])},524360,t=>{"use strict";var e=t.i(816709),a=t.i(360112);let s=new Map,i=(0,e.create)((t,e)=>({sessions:[],activeId:null,ws:null,workspaceId:null,_initialized:!1,_restored:!1,init:(i,r)=>{let o=e();if(o._initialized&&o.ws===i)return;let n=o.workspaceId!==i.workspaceId;n&&s.clear(),t({ws:i,workspaceId:i.workspaceId,sessions:n?[]:o.sessions,activeId:n?null:o.activeId,_initialized:!0,_restored:!1}),i.on("terminal.created",e=>{let{sessionId:a,cwd:s,shell:i}=e;t(t=>t.sessions.some(t=>t.id===a)?t:{sessions:[...t.sessions,{id:a,cwd:s,shell:i}],activeId:a})}),i.on("terminal.error",t=>{let{error:e}=t;a.toast.error(e)}),i.on("terminal.closed",e=>{let{sessionId:a}=e;t(t=>{let e=t.sessions.filter(t=>t.id!==a),s=t.activeId===a?e[0]?.id??null:t.activeId;return{sessions:e,activeId:s}})}),i.on("terminal.sessions",e=>{let{sessions:a}=e;t(t=>{let e=new Map(t.sessions.map(t=>[t.id,t])),i=a.map(t=>{let a=e.get(t.sessionId);return t.buffer&&s.set(t.sessionId,t.buffer),{...a,id:t.sessionId,cwd:t.cwd,shell:t.shell??a?.shell}}),r=!!t.activeId&&i.some(e=>e.id===t.activeId);for(let t of a)t.buffer||s.delete(t.sessionId);return{sessions:i,activeId:r?t.activeId:i[0]?.id??null,_restored:!0}}),r?.()})},createSession:(t,a)=>{let{ws:s}=e();s?.send("terminal.create",{sessionId:crypto.randomUUID?.()??crypto.getRandomValues(new Uint8Array(16)).reduce((t,e)=>t+e.toString(16).padStart(2,"0"),""),shell:t,cwd:a})},setActive:e=>t({activeId:e}),setSessionName:(e,a)=>t(t=>({sessions:t.sessions.map(t=>t.id===e?{...t,name:a}:t)})),removeSession:a=>{let{ws:s,sessions:i,activeId:r}=e();s?.send("terminal.close",{sessionId:a});let o=i.filter(t=>t.id!==a),n=r===a?o[0]?.id??null:r;t({sessions:o,activeId:n})},sendInput:(t,a)=>{e().ws?.send("terminal.input",{sessionId:t,data:a})},resize:(t,a,s)=>{e().ws?.send("terminal.resize",{sessionId:t,cols:a,rows:s})}}));t.s(["consumeSessionBuffer",0,function(t){let e=s.get(t);return s.delete(t),e},"useTerminalStore",0,i])},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)},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),a=t.i(227634),s=t.i(191441),i=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 d=t.i(253307),h=t.i(194228),p=t.i(210),u=t.i(255742),m=t.i(943997);let g=(0,c.default)("kanban",[["path",{d:"M5 3v14",key:"9nsxs2"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"M19 3v18",key:"1sk56x"}]]);var f=t.i(327962);let w=[{id:"channel-list",icon:a.Hash,group:"channel"},{id:"chat",icon:o.MessageSquare,group:"channel"},{id:"issue-list",icon:s.ListChecks,group:"issue"},{id:"issue-detail",icon:d.FileDiff,group:"issue"},{id:"workfolder",icon:i.FolderOpen,group:"workfolder"},{id:"code-editor",icon:r.Code2,group:"workfolder"},{id:"terminal",icon:l,group:"tools"},{id:"git-commits",icon:h.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:"database"},{id:"database-list",icon:m.Database,group:"database"},{id:"kanban",icon:g,group:"workfolder"},{id:"worktree-panel",icon:f.GitBranch,group:"git"}],k={"channel-list":(0,e.jsx)(a.Hash,{size:16}),"issue-list":(0,e.jsx)(s.ListChecks,{size:16}),workfolder:(0,e.jsx)(i.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)(h.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}),"database-list":(0,e.jsx)(m.Database,{size:16}),kanban:(0,e.jsx)(g,{size:16}),"worktree-panel":(0,e.jsx)(f.GitBranch,{size:16}),...{}};function y(t,a,s,i,r){if("git-commits"===t&&a&&!a.clean){let t=a.insertions>0||a.deletions>0,s=(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:[a.insertions>0&&(0,e.jsxs)("span",{className:"text-green-600",children:["+",a.insertions]}),a.deletions>0&&(0,e.jsxs)("span",{className:"text-red-500",children:["-",a.deletions]})]}):(0,e.jsx)("span",{className:"text-orange-500",children:a.files.length})}),i=a.files.length;return{trailing:s,badge:i>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:i}):null}}if("terminal"===t&&s.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:s.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(i).some(t=>Array.isArray(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:"database-list"},"TAB_ITEMS",0,w,"getTabBadge",0,y,"renderTabIcon",0,function(t,a,s,i,r,o){let n=k[t];if(!n)return null;let{trailing:c,badge:l}=y(t,s,i,r,o);return(0,e.jsxs)("span",{title:a,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/0clnj-1fi6u8j.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/0l1lkd-wcotma.js","static/chunks/016xz2o-hv3am.js","static/chunks/0-~4vw4_9z_0_.js","static/chunks/0_y9nskc-xt2k.js","static/chunks/0lcc9r.o.p.sc.js","static/chunks/0_8dm7bxp18xo.js","static/chunks/0-utii~i2fncd.js","static/chunks/0-92u-tiuy40a.js","static/chunks/0ow~co9wcleka.js","static/chunks/05psi2gtx~bev.js","static/chunks/0.006.ycpe92w.js","static/chunks/0bbmx45w_h5np.js","static/chunks/0wwwq.gyyz0vg.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/0ncxf_zr4n839.js","static/chunks/01y3e9pemva7b.js","static/chunks/17oc2l.ekcs8b.css"].map(e=>t.l(e))).then(()=>e(608745)))},329052,t=>{t.v(e=>Promise.all(["static/chunks/09vpocs4zuc8h.js"].map(e=>t.l(e))).then(()=>e(878166)))},126861,t=>{t.v(e=>Promise.all(["static/chunks/0zwebpitvpuv1.js","static/chunks/0jq.16sozqik..js","static/chunks/12jm4gwmvq-0q.js","static/chunks/0_y9nskc-xt2k.js","static/chunks/0j-l7l_k9jt45.js"].map(e=>t.l(e))).then(()=>e(773354)))},124383,t=>{t.v(e=>Promise.all(["static/chunks/0v8nof~waedlu.js"].map(e=>t.l(e))).then(()=>e(783481)))},318599,t=>{t.v(e=>Promise.all(["static/chunks/13iye4rv5p31b.js","static/chunks/033.awk90g6eh.js","static/chunks/02802taez976w.js","static/chunks/12jm4gwmvq-0q.js"].map(e=>t.l(e))).then(()=>e(706304)))},222445,t=>{t.v(e=>Promise.all(["static/chunks/0xon_.4-o0_zq.js","static/chunks/0.ln~3mnv8.69.js"].map(e=>t.l(e))).then(()=>e(514669)))},78906,t=>{t.v(e=>Promise.all(["static/chunks/12x5.go_x9mfk.js"].map(e=>t.l(e))).then(()=>e(985646)))},857328,t=>{t.v(e=>Promise.all(["static/chunks/0ndo7um~v7vco.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)))},145098,t=>{t.v(e=>Promise.all(["static/chunks/0gv40by0zzxs_.js"].map(e=>t.l(e))).then(()=>e(648944)))},951923,t=>{t.v(e=>Promise.all(["static/chunks/0iusr8y88.kjg.js"].map(e=>t.l(e))).then(()=>e(264223)))},422720,t=>{t.v(e=>Promise.all(["static/chunks/04de6ha5_e3pp.js"].map(e=>t.l(e))).then(()=>e(319727)))},823528,t=>{t.v(e=>Promise.all(["static/chunks/0taui9--5n6-5.js","static/chunks/0p3h-h3zj5ujg.js","static/chunks/0_y9nskc-xt2k.js","static/chunks/12jm4gwmvq-0q.js"].map(e=>t.l(e))).then(()=>e(394896)))},173820,t=>{t.v(e=>Promise.all(["static/chunks/0j-8418fxvkd1.js","static/chunks/0t64.9jd00hio.js","static/chunks/0zncg76rgtbm-.js"].map(e=>t.l(e))).then(()=>e(115133)))},903135,t=>{t.v(e=>Promise.all(["static/chunks/0rt9bofnn6qvn.js","static/chunks/0l1lkd-wcotma.js","static/chunks/151wzhb5q0lo5.js"].map(e=>t.l(e))).then(()=>e(683223)))},907400,t=>{t.v(e=>Promise.all(["static/chunks/0_o2exgr0e_nh.js"].map(e=>t.l(e))).then(()=>e(882130)))},622168,t=>{t.v(e=>Promise.all(["static/chunks/0ty39169lh~z3.js"].map(e=>t.l(e))).then(()=>e(694205)))},185682,t=>{t.v(e=>Promise.all(["static/chunks/02l~tmzrgny.~.js"].map(e=>t.l(e))).then(()=>e(217832)))}]);