@lovelybunch/api 1.0.76-alpha.10 → 1.0.76-alpha.11
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.
- package/dist/lib/git.d.ts +3 -0
- package/dist/lib/git.js +35 -0
- package/dist/routes/api/v1/git/index.js +27 -1
- package/dist/routes/api/v1/resources/generate/route.js +10 -3
- package/dist/routes/api/v1/slack/route.d.ts +6 -6
- package/package.json +4 -4
- package/static/assets/{ActivityPage-B3rsYt_4.js → ActivityPage-CUPUsmhW.js} +1 -1
- package/static/assets/ActivityPage-DGW0f70r.js +1 -0
- package/static/assets/{AgentsContextEditPage-4D7qO4S-.js → AgentsContextEditPage-CBZaG033.js} +1 -1
- package/static/assets/AgentsContextEditPage-CJbx9qwA.js +9 -0
- package/static/assets/{AgentsContextPage-NmvLRo0k.js → AgentsContextPage-BWzSvM5V.js} +1 -1
- package/static/assets/AgentsContextPage-C1wcPVUs.js +1 -0
- package/static/assets/{ApiKeysSettingsPage-BGj5p9zw.js → ApiKeysSettingsPage-CauZEPsx.js} +1 -1
- package/static/assets/ApiKeysSettingsPage-Ceww_YUR.js +2 -0
- package/static/assets/{ArchitectureEditPage-DI2jNmc9.js → ArchitectureEditPage-DZhYQihz.js} +1 -1
- package/static/assets/ArchitectureEditPage-Dk8NNc4k.js +15 -0
- package/static/assets/{ArchitecturePage-DiIuThUM.js → ArchitecturePage-Cvj4j0Mo.js} +1 -1
- package/static/assets/ArchitecturePage-D0gLaPg5.js +1 -0
- package/static/assets/{AuthSettingsPage-DWuwxAS0.js → AuthSettingsPage-22eaC7la.js} +1 -1
- package/static/assets/AuthSettingsPage-BHPV0uSB.js +11 -0
- package/static/assets/{CallbackPage-BCmkYhEr.js → CallbackPage-DCf0WTl0.js} +1 -1
- package/static/assets/CallbackPage-buKCnkYC.js +1 -0
- package/static/assets/{CodePage-BZhIkymg.js → CodePage-CuyF2xDA.js} +1 -1
- package/static/assets/CodePage-x32C4yuN.js +2 -0
- package/static/assets/{CollapsibleSection-BJzLVd-x.js → CollapsibleSection-CUHXgJIe.js} +1 -1
- package/static/assets/CollapsibleSection-DMf0wWjc.js +1 -0
- package/static/assets/{DashboardPage-DtwE553F.js → DashboardPage-DIU-4dPO.js} +1 -1
- package/static/assets/DashboardPage-Dr4S3wVm.js +41 -0
- package/static/assets/{GitPage-qG7VYL9b.js → GitPage-BGHRNljT.js} +1 -1
- package/static/assets/GitPage-DpCcZosR.js +16 -0
- package/static/assets/{GitSettingsPage-C8Bgpj-X.js → GitSettingsPage-A4ty6ftB.js} +1 -1
- package/static/assets/GitSettingsPage-BRuP4Ihk.js +6 -0
- package/static/assets/{IdentityPage-Cf8Ruu-g.js → IdentityPage-4xn0DPW8.js} +1 -1
- package/static/assets/IdentityPage-Bps9Zjk3.js +6 -0
- package/static/assets/{ImplementationStepsEditor-BXIRT7o1.js → ImplementationStepsEditor-CaMsbJPb.js} +1 -1
- package/static/assets/ImplementationStepsEditor-KJkRc2Jn.js +6 -0
- package/static/assets/{IntegrationsSettingsPage-th56kUgi.js → IntegrationsSettingsPage-B1sX003q.js} +1 -1
- package/static/assets/IntegrationsSettingsPage-CpTuAA-H.js +1 -0
- package/static/assets/{JobDetailPage-ZyEcbPAe.js → JobDetailPage-BdYlGn4G.js} +1 -1
- package/static/assets/JobDetailPage-C5N3IyX3.js +1 -0
- package/static/assets/{KnowledgeDetailPage-BklEOfs0.js → KnowledgeDetailPage-Dvk-QAJJ.js} +1 -1
- package/static/assets/KnowledgeDetailPage-Dy0M4FgC.js +1 -0
- package/static/assets/{KnowledgeEditPage-BGqzVqHi.js → KnowledgeEditPage-CN0wPWMV.js} +1 -1
- package/static/assets/KnowledgeEditPage-DEP0bweP.js +1 -0
- package/static/assets/{KnowledgePage-Dmm7vzAj.js → KnowledgePage-BLe2lXja.js} +1 -1
- package/static/assets/KnowledgePage-_bvnWXPU.js +3 -0
- package/static/assets/{LoginPage-PDafaEnq.js → LoginPage-BkZt_pMw.js} +1 -1
- package/static/assets/LoginPage-VfOnXGad.js +1 -0
- package/static/assets/{MailInboxPage-M5_2gGkB.js → MailInboxPage-DklkHMyO.js} +1 -1
- package/static/assets/MailInboxPage-UF82OTOE.js +1 -0
- package/static/assets/{MailProcessingModal-C4PotIFc.js → MailProcessingModal-BHFYVTQc.js} +1 -1
- package/static/assets/MailProcessingModal-rKHRB-wC.js +6 -0
- package/static/assets/{MailReadPage-D32FUx5o.js → MailReadPage-B-vLDq-6.js} +1 -1
- package/static/assets/MailReadPage-mg3Wqvqh.js +1 -0
- package/static/assets/{MailSentPage-CjBrbezf.js → MailSentPage-DIJJ8I5v.js} +1 -1
- package/static/assets/MailSentPage-OJeb1vU9.js +1 -0
- package/static/assets/{McpSettingsPage-DxE-4YPc.js → McpSettingsPage-CgOnXuHZ.js} +1 -1
- package/static/assets/McpSettingsPage-Mi2-nB-i.js +1 -0
- package/static/assets/{MemoryEditPage-BlQ5EN1w.js → MemoryEditPage-CR6SmDXU.js} +1 -1
- package/static/assets/MemoryEditPage-D8i7XQ5l.js +13 -0
- package/static/assets/{MemoryPage-B8fsgW7z.js → MemoryPage-BcWVGuiS.js} +1 -1
- package/static/assets/MemoryPage-vbCtMG4L.js +1 -0
- package/static/assets/{NewKnowledgePage-CuH201xQ.js → NewKnowledgePage-BE4X0pSc.js} +1 -1
- package/static/assets/NewKnowledgePage-CL3dpMwb.js +1 -0
- package/static/assets/{NewSkillPage-BdX7eNoi.js → NewSkillPage-B3prwJ_n.js} +1 -1
- package/static/assets/NewSkillPage-BCJ68pFK.js +1 -0
- package/static/assets/{NewTaskPage-D9W2Yi0r.js → NewTaskPage-DszXfHrv.js} +1 -1
- package/static/assets/NewTaskPage-vj0LvAb_.js +91 -0
- package/static/assets/{NotFoundPage-D9tmTVho.js → NotFoundPage-D3K7UoeF.js} +1 -1
- package/static/assets/NotFoundPage-DqwQiMc8.js +6 -0
- package/static/assets/{NotificationsSettingsPage-B4lBxS8D.js → NotificationsSettingsPage-BSuXKPiG.js} +1 -1
- package/static/assets/NotificationsSettingsPage-C4Gthita.js +1 -0
- package/static/assets/{ProjectEditPage-DdqUI91K.js → ProjectEditPage-DTdhZKQg.js} +1 -1
- package/static/assets/ProjectEditPage-ia6zDqUf.js +11 -0
- package/static/assets/{ProjectPage-DB7ugw8l.js → ProjectPage-BIk487-h.js} +1 -1
- package/static/assets/ProjectPage-DJ5wGekX.js +1 -0
- package/static/assets/{PromptsSettingsPage-DFXoKUjj.js → PromptsSettingsPage-4iJoggN0.js} +1 -1
- package/static/assets/PromptsSettingsPage-COjiXPsT.js +1 -0
- package/static/assets/{ResourceDetailPage-CWc4YIMc.js → ResourceDetailPage-DJN3Rax4.js} +1 -1
- package/static/assets/ResourceDetailPage-DKs83OyV.js +1 -0
- package/static/assets/ResourcesPage-CO45MzEx.js +41 -0
- package/static/assets/ResourcesPage-DF8x1i_a.js +41 -0
- package/static/assets/{RoleEditPage-B20UAC2r.js → RoleEditPage-B0pm5rVn.js} +1 -1
- package/static/assets/RoleEditPage-CBl-M2s3.js +13 -0
- package/static/assets/{RolePage-C5Jf7wxY.js → RolePage-B7JswOZC.js} +1 -1
- package/static/assets/RolePage-IVBtcgCf.js +1 -0
- package/static/assets/{RulesSettingsPage-91WP1FQf.js → RulesSettingsPage-CB6YdyhI.js} +1 -1
- package/static/assets/RulesSettingsPage-CKUt1JkO.js +16 -0
- package/static/assets/{SchedulePage-BijprHGn.js → SchedulePage-TCeGDlnw.js} +1 -1
- package/static/assets/SchedulePage-_NAbasKs.js +4 -0
- package/static/assets/{SkillDetailPage-Cpxz_wmk.js → SkillDetailPage-7EzSwjPh.js} +1 -1
- package/static/assets/SkillDetailPage-jTeSohec.js +1 -0
- package/static/assets/{SkillEditPage-Cz7VRg0r.js → SkillEditPage-CpouyjFV.js} +1 -1
- package/static/assets/SkillEditPage-D_e69AQk.js +1 -0
- package/static/assets/{SkillsPage-Bxmsi6Xd.js → SkillsPage-DP8zSnPo.js} +1 -1
- package/static/assets/SkillsPage-xfv43oJ4.js +8 -0
- package/static/assets/{SkillsSettingsPage-Cysx53Au.js → SkillsSettingsPage-CktzJBa7.js} +1 -1
- package/static/assets/SkillsSettingsPage-jhNVgVSA.js +1 -0
- package/static/assets/{SourceInput-D59F7hff.js → SourceInput-CQnyDxzl.js} +1 -1
- package/static/assets/SourceInput-KeAQ1PMl.js +1 -0
- package/static/assets/{TagInput-BH6wDXWJ.js → TagInput-DoO2Dwj6.js} +1 -1
- package/static/assets/TagInput-ZyP8Rq8B.js +1 -0
- package/static/assets/{TaskDetailPage-5ktdWaTr.js → TaskDetailPage-C6xKC_IM.js} +1 -1
- package/static/assets/TaskDetailPage-z557zwfE.js +16 -0
- package/static/assets/{TaskEditPage-CIZWp_s4.js → TaskEditPage-DPLOeh7K.js} +1 -1
- package/static/assets/TaskEditPage-XuWzVm-k.js +1 -0
- package/static/assets/{TasksPage-BNXDm-Er.js → TasksPage-C-toKZIZ.js} +1 -1
- package/static/assets/TasksPage-CwfLwTAV.js +17 -0
- package/static/assets/{TeamEditPage-C10siqme.js → TeamEditPage-B8qk6fWu.js} +1 -1
- package/static/assets/TeamEditPage-Dk7Yxh1i.js +9 -0
- package/static/assets/{TeamPage-CXpZVAfy.js → TeamPage-CQ4EE1rP.js} +1 -1
- package/static/assets/TeamPage-Dmrjf_RA.js +1 -0
- package/static/assets/{TerminalPage-DJ-Tu_hG.js → TerminalPage-C0CSp8st.js} +1 -1
- package/static/assets/TerminalPage-Y59DZGfZ.js +1 -0
- package/static/assets/{TerminalSessionPage-BLryJlkL.js → TerminalSessionPage-BQOMLYPX.js} +1 -1
- package/static/assets/TerminalSessionPage-HvnYJEpU.js +3 -0
- package/static/assets/{UserPreferencesPage-BvAcv5tt.js → UserPreferencesPage-1l5T8TaE.js} +1 -1
- package/static/assets/UserPreferencesPage-BSIvW5UI.js +1 -0
- package/static/assets/{UserSettingsPage-NQfoOvHf.js → UserSettingsPage-CS7BrEZJ.js} +1 -1
- package/static/assets/UserSettingsPage-o4ikmR9k.js +1 -0
- package/static/assets/{UtilitiesPage-NnBCWVn8.js → UtilitiesPage-D1YCA1eC.js} +1 -1
- package/static/assets/UtilitiesPage-O5kjW0V2.js +1 -0
- package/static/assets/{alert-CMfexl-V.js → alert-DOfUEE4H.js} +1 -1
- package/static/assets/alert-u79hLEuY.js +1 -0
- package/static/assets/{arrow-down-7VoAlw8h.js → arrow-down-DumN-Nal.js} +1 -1
- package/static/assets/arrow-down-Y539lEoZ.js +6 -0
- package/static/assets/{arrow-left-CkQCXG-O.js → arrow-left-B_QwfLPP.js} +1 -1
- package/static/assets/arrow-left-DmNgC0xD.js +6 -0
- package/static/assets/{arrow-up-Bozm6eto.js → arrow-up-B3Oj7MxZ.js} +1 -1
- package/static/assets/arrow-up-BbDrY9nh.js +6 -0
- package/static/assets/{arrow-up-down-BgZelEPF.js → arrow-up-down-D8T0kR2Q.js} +1 -1
- package/static/assets/arrow-up-down-DDTTwJEF.js +6 -0
- package/static/assets/{badge-CKqDVhJv.js → badge-BmHXIBBB.js} +1 -1
- package/static/assets/badge-BzEwwrAP.js +1 -0
- package/static/assets/{browser-modal-CIOZi1Jw.js → browser-modal-4AfJ98X7.js} +1 -1
- package/static/assets/browser-modal-CY4F-Mm8.js +6 -0
- package/static/assets/{card-jBf8qQSy.js → card-BpqK1BMM.js} +1 -1
- package/static/assets/card-Btt3HmXT.js +1 -0
- package/static/assets/{chevron-left-D1qHCYRd.js → chevron-left-CSCdB-iz.js} +1 -1
- package/static/assets/chevron-left-DztJMlwc.js +6 -0
- package/static/assets/{chevron-up-CcwaoTsZ.js → chevron-up-DaWWwb87.js} +1 -1
- package/static/assets/chevron-up-gnoSEbf_.js +6 -0
- package/static/assets/{chevrons-up-BtlNQbrw.js → chevrons-up-B2GdB4F7.js} +1 -1
- package/static/assets/chevrons-up-D7gsSI9g.js +11 -0
- package/static/assets/{circle-alert-DqK0nUqF.js → circle-alert-CQ-Ir4mS.js} +1 -1
- package/static/assets/circle-alert-Coa2ulVd.js +6 -0
- package/static/assets/{circle-check-qo4cPVA1.js → circle-check-01UufaGN.js} +1 -1
- package/static/assets/circle-check-C9wy7OAO.js +6 -0
- package/static/assets/{circle-check-big-DDQIqE0G.js → circle-check-big-CVbQ_zpj.js} +1 -1
- package/static/assets/circle-check-big-DqKKs8fZ.js +6 -0
- package/static/assets/{circle-play-CQ-UItmT.js → circle-play-COMPwZ00.js} +1 -1
- package/static/assets/circle-play-DoomwgYb.js +6 -0
- package/static/assets/{circle-x-Bd57ohC5.js → circle-x-Cs5S3HID.js} +1 -1
- package/static/assets/circle-x-Du7Cp5MD.js +6 -0
- package/static/assets/{clipboard-JQLlAwqS.js → clipboard-C-VV2jbC.js} +1 -1
- package/static/assets/clipboard-CqRqQoij.js +11 -0
- package/static/assets/{clock-DTp411N-.js → clock-BKOkXNLP.js} +1 -1
- package/static/assets/clock-ehUSUqcI.js +6 -0
- package/static/assets/{code-Bi-U-NxE.js → code-CmFlYUo3.js} +1 -1
- package/static/assets/code-kQPD6ttp.js +6 -0
- package/static/assets/{download-DNaE6rtO.js → download-Cg0a1Yh4.js} +1 -1
- package/static/assets/download-D8TKj0Hc.js +6 -0
- package/static/assets/{external-link-DRsIhdWR.js → external-link-BSAlwNHq.js} +1 -1
- package/static/assets/external-link-BVrPPG_7.js +6 -0
- package/static/assets/{eye-jqpFU8Rl.js → eye-AP4j25wH.js} +1 -1
- package/static/assets/eye-DWC_Vybx.js +6 -0
- package/static/assets/{folder-git-2-ixHmuqNj.js → folder-git-2-CMtTePKY.js} +1 -1
- package/static/assets/folder-git-2-Ds9p-D0Q.js +6 -0
- package/static/assets/{globe-BZEWER4V.js → globe-CJrZCIc6.js} +1 -1
- package/static/assets/globe-DwQuaM7_.js +6 -0
- package/static/assets/{index-UDlexUv4.js → index-0sq0wwbr.js} +1 -1
- package/static/assets/{index-M-XcYp88.js → index-B0Cea36W.js} +1 -1
- package/static/assets/{index-D-5sddKG.js → index-B0g-CMWG.js} +1 -1
- package/static/assets/{index-CiS46Fde.js → index-BFEMYO_w.js} +1 -1
- package/static/assets/{index-htJaaOEZ.js → index-BFevJCwl.js} +1 -1
- package/static/assets/{index-CK5AHHmM.js → index-BK1-hIKa.js} +1 -1
- package/static/assets/index-BMie63_b.js +1 -0
- package/static/assets/{index-2_Tb936f.js → index-BZvWD4ai.js} +1 -1
- package/static/assets/{index-C3ao8yMv.js → index-BlyysfDZ.js} +1 -1
- package/static/assets/{index-BGKQ2Csq.js → index-BpQ9T8mu.js} +1 -1
- package/static/assets/{index-CoeRBZRl.js → index-Bpm_mSd3.js} +1 -1
- package/static/assets/{index-B8B_4B2l.js → index-Brkkhgwq.js} +1 -1
- package/static/assets/{index-BD47WGC6.js → index-Bvj_HZmE.js} +1 -1
- package/static/assets/index-CE8kBKLn.js +1 -0
- package/static/assets/index-CL_XsRD7.js +1 -0
- package/static/assets/index-C_KCaLlP.js +502 -0
- package/static/assets/index-CfcUrE_I.js +1 -0
- package/static/assets/index-CisT9m8F.js +3 -0
- package/static/assets/index-CiyjdZHh.js +1 -0
- package/static/assets/index-CtnO1D9D.js +1 -0
- package/static/assets/{index-Bft1WzL9.js → index-D3hMbDtK.js} +1 -1
- package/static/assets/{index-DHAvHhw0.js → index-DBS4Ya9k.js} +1 -1
- package/static/assets/index-DEmcF6vO.js +1 -0
- package/static/assets/index-DYBGl9Zy.js +1 -0
- package/static/assets/{index-DffngCzC.js → index-DgeHIphZ.js} +1 -1
- package/static/assets/{index-BLjvGp1F.js → index-Digxc7bT.js} +1 -1
- package/static/assets/index-Dih0CGHs.js +1 -0
- package/static/assets/index-DoDazQp9.js +1 -0
- package/static/assets/index-DvviZzdo.js +1 -0
- package/static/assets/index-Dz52SxOy.js +2 -0
- package/static/assets/{index-CdmUQF6-.js → index-J8MrpD0P.js} +1 -1
- package/static/assets/index-NgkIT4SV.js +1 -0
- package/static/assets/index-PBkZiuRI.js +1 -0
- package/static/assets/{index-CtWTFIFI.js → index-ZJ8xZq44.js} +1 -1
- package/static/assets/index-oKV7MVo_.js +1 -0
- package/static/assets/{index-BWhM9fZn.js → index-opozMhku.js} +2 -2
- package/static/assets/index-vk3KOxHi.js +7 -0
- package/static/assets/index-wmWBSeOM.js +1 -0
- package/static/assets/{info-Na9GqbtC.js → info-D-7cQBbP.js} +1 -1
- package/static/assets/info-NEnL4zqX.js +6 -0
- package/static/assets/{label-CHVVHrlr.js → label-bMzKAcdZ.js} +1 -1
- package/static/assets/label-wtSCiOqT.js +1 -0
- package/static/assets/{markdown-editor-CT9CPLw5.js → markdown-editor-B3gIcmI2.js} +3 -3
- package/static/assets/markdown-editor-D_er7zWv.js +111 -0
- package/static/assets/{message-square-B5NR6hzj.js → message-square-Ca07XC8m.js} +1 -1
- package/static/assets/message-square-CvZFZAL0.js +6 -0
- package/static/assets/{paperclip-SI0kWfGf.js → paperclip-BICwD8BW.js} +1 -1
- package/static/assets/paperclip-D9bkHCO9.js +6 -0
- package/static/assets/{pause-DKI9nsrI.js → pause-CZwBxJjx.js} +1 -1
- package/static/assets/pause-DrtOMeDr.js +6 -0
- package/static/assets/{play-BTA0gBuh.js → play-BjDbhEcg.js} +1 -1
- package/static/assets/play-CQk31OJN.js +6 -0
- package/static/assets/{radio-group-BO2__pxZ.js → radio-group-BpmJzTM1.js} +1 -1
- package/static/assets/radio-group-DqCmfTij.js +1 -0
- package/static/assets/{refresh-cw-DLJpfa8_.js → refresh-cw-CZLHY6zD.js} +1 -1
- package/static/assets/refresh-cw-yMcSYdEF.js +6 -0
- package/static/assets/{search-SRuczbr5.js → search-Cz2_2BkO.js} +1 -1
- package/static/assets/search-_5ueAoCg.js +6 -0
- package/static/assets/{select-D8HyxWyg.js → select-9YyUa5YH.js} +1 -1
- package/static/assets/select-BKdFrV6O.js +1 -0
- package/static/assets/{switch-Ck0OeSLk.js → switch-Bhm5em7I.js} +1 -1
- package/static/assets/switch-D7e1drXt.js +1 -0
- package/static/assets/{tabs-CmFe8eVW.js → tabs-oeAz0IIg.js} +1 -1
- package/static/assets/tabs-qMSIjEoX.js +1 -0
- package/static/assets/{tag-BTjGQC_2.js → tag-D5LBbacJ.js} +1 -1
- package/static/assets/tag-dBrNwRvH.js +6 -0
- package/static/assets/{terminal-preview-BkQIuk__.js → terminal-preview-BZXyNaM9.js} +1 -1
- package/static/assets/terminal-preview-C3WCC5tV.js +1 -0
- package/static/assets/{use-terminal-CrqBojgD.js → use-terminal-CSttRkql.js} +1 -1
- package/static/assets/use-terminal-FzuSKCnc.js +1 -0
- package/static/assets/{video-BlwRNgSo.js → video-D7SzAtAp.js} +1 -1
- package/static/assets/video-DKqt_ev6.js +36 -0
- package/static/index.html +1 -1
- package/static/assets/ResourcesPage-BK-EXoIA.js +0 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as R,u as U,a as H,r as c,A,j as e,B as h,L as p,I as O,X as V,a1 as _}from"./index-
|
|
1
|
+
import{y as R,u as U,a as H,r as c,A,j as e,B as h,L as p,I as O,X as V,a1 as _}from"./index-C_KCaLlP.js";import{L as j}from"./label-wtSCiOqT.js";import{S as D,a as L,b as F,c as I,d as r}from"./select-BKdFrV6O.js";import{C as f,b as $,a as v,c as q,d as J}from"./card-BpqK1BMM.js";import{M as K}from"./markdown-editor-D_er7zWv.js";import{C as W}from"./CollapsibleSection-DMf0wWjc.js";import{I as X,L as G}from"./ImplementationStepsEditor-CaMsbJPb.js";import{T as Q}from"./TagInput-ZyP8Rq8B.js";import{A as N}from"./arrow-left-B_QwfLPP.js";import"./index-PBkZiuRI.js";import"./chevron-up-DaWWwb87.js";import"./badge-BzEwwrAP.js";function oe(){const{id:i}=R(),P=U(),{toast:y}=H(),[z,S]=c.useState(!0),[u,k]=c.useState(!1),[C,w]=c.useState(null),[n,o]=c.useState({title:"",description:"",priority:"medium",status:"draft",author:{id:"current-user",name:"Current User",email:"user@example.com"}}),[m,b]=c.useState([]),[T,E]=c.useState([]);c.useEffect(()=>{i&&B()},[i]);const B=async()=>{try{S(!0);const t=await fetch(`${A}/api/v1/tasks/${i}`),s=await t.json();if(s.success||s.data||t.ok){const a=s.data||s;o({title:a.title||a.intent||"",description:a.content||"",priority:a.metadata?.priority||"medium",status:a.status||"draft",author:{id:a.author?.id||"current-user",name:a.author?.name||"Current User",email:a.author?.email||"user@example.com"}});const g=Array.isArray(a.planSteps)?a.planSteps:[];b(g.map((d,x)=>({id:d.id||`step-${x+1}`,description:d.description||"",status:d.status||"pending"}))),E(a.metadata?.tags||[])}else w(s.error?.message||"Failed to fetch task")}catch(t){w(t instanceof Error?t.message:"An error occurred")}finally{S(!1)}},M=async t=>{t.preventDefault(),k(!0);try{const s=m.map(l=>({id:l.id,description:l.description.trim(),status:l.status})).filter(l=>l.description.length>0),a=T.map(l=>l.trim()).filter(l=>l.length>0),g={title:n.title,status:n.status,planSteps:s,metadata:{priority:n.priority,tags:a},content:n.description},d=await fetch(`${A}/api/v1/tasks/${i}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),x=await d.json();if(x.success||d.ok)y({title:"Success",description:"Task updated successfully."}),P(`/tasks/${i}`);else throw new Error(x.error?.message||"Failed to update task")}catch(s){y({title:"Error",description:`Failed to update task: ${s instanceof Error?s.message:"An error occurred"}`,variant:"destructive"})}finally{k(!1)}};return z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Task"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading task data..."})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(p,{to:`/tasks/${i}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsxs(f,{children:[e.jsx($,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-1/2 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-3/4 animate-pulse"})]})}),e.jsx(v,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-64 bg-muted rounded animate-pulse"})]})})]})]}):C?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(p,{to:"/tasks",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx(f,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:C})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Task"}),e.jsxs("p",{className:"text-muted-foreground",children:["Editing ",i]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(p,{to:`/tasks/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:M,children:e.jsxs(f,{children:[e.jsxs($,{children:[e.jsx(q,{children:"Task Details"}),e.jsx(J,{children:"Update the information for your task"})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"title",children:"Title *"}),e.jsx(O,{id:"title",placeholder:"Brief description of what you want to change",value:n.title,onChange:t=>o(s=>({...s,title:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"description",children:"Description"}),e.jsx(K,{value:n.description,onChange:t=>o(s=>({...s,description:t||""})),placeholder:"Write your task description in markdown...",height:400})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"status",children:"Status"}),e.jsxs(D,{value:n.status,onValueChange:t=>o(s=>({...s,status:t})),children:[e.jsx(L,{children:e.jsx(F,{placeholder:"Select status"})}),e.jsxs(I,{children:[e.jsx(r,{value:"draft",children:"Draft"}),e.jsx(r,{value:"proposed",children:"Proposed"}),e.jsx(r,{value:"in-review",children:"In Review"}),e.jsx(r,{value:"approved",children:"Approved"}),e.jsx(r,{value:"code-complete",children:"Code Complete"}),e.jsx(r,{value:"rejected",children:"Rejected"}),e.jsx(r,{value:"merged",children:"Merged"})]})]})]}),e.jsx(W,{defaultOpen:!0,icon:e.jsx(G,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"priority",children:"Priority"}),e.jsxs(D,{value:n.priority,onValueChange:t=>o(s=>({...s,priority:t})),children:[e.jsx(L,{children:e.jsx(F,{placeholder:"Select priority"})}),e.jsxs(I,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keep the implementation plan accurate as work progresses."})]}),m.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," step",m.length===1?"":"s"]})]}),e.jsx(X,{steps:m,onChange:b,disabled:u})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tags power filtering and discovery across the task list."}),e.jsx(Q,{tags:T,onChange:E,disabled:u,placeholder:"Add a tag (e.g. backend, rollout)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(h,{type:"button",variant:"outline",asChild:!0,children:e.jsxs(p,{to:`/tasks/${i}`,children:[e.jsx(V,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),e.jsx(h,{type:"submit",disabled:u||!n.title,children:u?e.jsx(e.Fragment,{children:"Saving..."}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Save Changes"]})})]})]})]})})]})}export{oe as TaskEditPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as R,u as U,a as H,r as c,A,j as e,B as h,L as p,I as O,X as V,a1 as _}from"./index-opozMhku.js";import{L as j}from"./label-bMzKAcdZ.js";import{S as D,a as L,b as F,c as I,d as r}from"./select-9YyUa5YH.js";import{C as f,b as $,a as v,c as q,d as J}from"./card-Btt3HmXT.js";import{M as K}from"./markdown-editor-B3gIcmI2.js";import{C as W}from"./CollapsibleSection-CUHXgJIe.js";import{I as X,L as G}from"./ImplementationStepsEditor-KJkRc2Jn.js";import{T as Q}from"./TagInput-DoO2Dwj6.js";import{A as N}from"./arrow-left-DmNgC0xD.js";import"./index-J8MrpD0P.js";import"./chevron-up-gnoSEbf_.js";import"./badge-BmHXIBBB.js";function oe(){const{id:i}=R(),P=U(),{toast:y}=H(),[z,S]=c.useState(!0),[u,k]=c.useState(!1),[C,w]=c.useState(null),[n,o]=c.useState({title:"",description:"",priority:"medium",status:"draft",author:{id:"current-user",name:"Current User",email:"user@example.com"}}),[m,b]=c.useState([]),[T,E]=c.useState([]);c.useEffect(()=>{i&&B()},[i]);const B=async()=>{try{S(!0);const t=await fetch(`${A}/api/v1/tasks/${i}`),s=await t.json();if(s.success||s.data||t.ok){const a=s.data||s;o({title:a.title||a.intent||"",description:a.content||"",priority:a.metadata?.priority||"medium",status:a.status||"draft",author:{id:a.author?.id||"current-user",name:a.author?.name||"Current User",email:a.author?.email||"user@example.com"}});const g=Array.isArray(a.planSteps)?a.planSteps:[];b(g.map((d,x)=>({id:d.id||`step-${x+1}`,description:d.description||"",status:d.status||"pending"}))),E(a.metadata?.tags||[])}else w(s.error?.message||"Failed to fetch task")}catch(t){w(t instanceof Error?t.message:"An error occurred")}finally{S(!1)}},M=async t=>{t.preventDefault(),k(!0);try{const s=m.map(l=>({id:l.id,description:l.description.trim(),status:l.status})).filter(l=>l.description.length>0),a=T.map(l=>l.trim()).filter(l=>l.length>0),g={title:n.title,status:n.status,planSteps:s,metadata:{priority:n.priority,tags:a},content:n.description},d=await fetch(`${A}/api/v1/tasks/${i}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),x=await d.json();if(x.success||d.ok)y({title:"Success",description:"Task updated successfully."}),P(`/tasks/${i}`);else throw new Error(x.error?.message||"Failed to update task")}catch(s){y({title:"Error",description:`Failed to update task: ${s instanceof Error?s.message:"An error occurred"}`,variant:"destructive"})}finally{k(!1)}};return z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Task"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading task data..."})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(p,{to:`/tasks/${i}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsxs(f,{children:[e.jsx($,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-1/2 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-3/4 animate-pulse"})]})}),e.jsx(v,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-64 bg-muted rounded animate-pulse"})]})})]})]}):C?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(p,{to:"/tasks",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx(f,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:C})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Task"}),e.jsxs("p",{className:"text-muted-foreground",children:["Editing ",i]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(p,{to:`/tasks/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:M,children:e.jsxs(f,{children:[e.jsxs($,{children:[e.jsx(q,{children:"Task Details"}),e.jsx(J,{children:"Update the information for your task"})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"title",children:"Title *"}),e.jsx(O,{id:"title",placeholder:"Brief description of what you want to change",value:n.title,onChange:t=>o(s=>({...s,title:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"description",children:"Description"}),e.jsx(K,{value:n.description,onChange:t=>o(s=>({...s,description:t||""})),placeholder:"Write your task description in markdown...",height:400})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"status",children:"Status"}),e.jsxs(D,{value:n.status,onValueChange:t=>o(s=>({...s,status:t})),children:[e.jsx(L,{children:e.jsx(F,{placeholder:"Select status"})}),e.jsxs(I,{children:[e.jsx(r,{value:"draft",children:"Draft"}),e.jsx(r,{value:"proposed",children:"Proposed"}),e.jsx(r,{value:"in-review",children:"In Review"}),e.jsx(r,{value:"approved",children:"Approved"}),e.jsx(r,{value:"code-complete",children:"Code Complete"}),e.jsx(r,{value:"rejected",children:"Rejected"}),e.jsx(r,{value:"merged",children:"Merged"})]})]})]}),e.jsx(W,{defaultOpen:!0,icon:e.jsx(G,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"priority",children:"Priority"}),e.jsxs(D,{value:n.priority,onValueChange:t=>o(s=>({...s,priority:t})),children:[e.jsx(L,{children:e.jsx(F,{placeholder:"Select priority"})}),e.jsxs(I,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keep the implementation plan accurate as work progresses."})]}),m.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," step",m.length===1?"":"s"]})]}),e.jsx(X,{steps:m,onChange:b,disabled:u})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tags power filtering and discovery across the task list."}),e.jsx(Q,{tags:T,onChange:E,disabled:u,placeholder:"Add a tag (e.g. backend, rollout)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(h,{type:"button",variant:"outline",asChild:!0,children:e.jsxs(p,{to:`/tasks/${i}`,children:[e.jsx(V,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),e.jsx(h,{type:"submit",disabled:u||!n.title,children:u?e.jsx(e.Fragment,{children:"Saving..."}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Save Changes"]})})]})]})]})})]})}export{oe as TaskEditPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ce,x as Ke,u as ze,s as Ve,r as A,j as t,B as P,L as te,P as ue,I as We,X,K as Ue,p as Ge,n as He,G as Qe,C as Ye,A as Xe}from"./index-
|
|
1
|
+
import{c as Ce,x as Ke,u as ze,s as Ve,r as A,j as t,B as P,L as te,P as ue,I as We,X,K as Ue,p as Ge,n as He,G as Qe,C as Ye,A as Xe}from"./index-opozMhku.js";import{C as J,a as Z,c as Je}from"./card-Btt3HmXT.js";import{B as se}from"./badge-BmHXIBBB.js";import{S as oe,a as he,b as de,c as me,d as B}from"./select-9YyUa5YH.js";import{A as Ze,a as Ee,T as qe,g as et}from"./status-utils-PwF3DXLL.js";import{S as tt}from"./search-Cz2_2BkO.js";import{C as st}from"./chevron-up-gnoSEbf_.js";import{C as rt}from"./chevron-left-DztJMlwc.js";import"./index-J8MrpD0P.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{c as Ce,x as Ke,u as ze,s as Ve,r as A,j as t,B as P,L as te,P as ue,I as We,X,K as Ue,p as Ge,n as He,G as Qe,C as Ye,A as Xe}from"./index-C_KCaLlP.js";import{C as J,a as Z,c as Je}from"./card-BpqK1BMM.js";import{B as se}from"./badge-BzEwwrAP.js";import{S as oe,a as he,b as de,c as me,d as B}from"./select-BKdFrV6O.js";import{A as Ze,a as Ee,T as qe,g as et}from"./status-utils-PwF3DXLL.js";import{S as tt}from"./search-_5ueAoCg.js";import{C as st}from"./chevron-up-DaWWwb87.js";import{C as rt}from"./chevron-left-CSCdB-iz.js";import"./index-PBkZiuRI.js";/**
|
|
2
|
+
* @license lucide-react v0.542.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const nt=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],at=Ce("arrow-down-wide-narrow",nt);/**
|
|
7
|
+
* @license lucide-react v0.542.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const it=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],ct=Ce("arrow-up-narrow-wide",it);/**
|
|
12
|
+
* @license lucide-react v0.542.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const lt=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],be=Ce("funnel",lt);function K(s){return Array.isArray?Array.isArray(s):_e(s)==="[object Array]"}function ut(s){if(typeof s=="string")return s;let e=s+"";return e=="0"&&1/s==-1/0?"-0":e}function ot(s){return s==null?"":ut(s)}function O(s){return typeof s=="string"}function De(s){return typeof s=="number"}function ht(s){return s===!0||s===!1||dt(s)&&_e(s)=="[object Boolean]"}function ke(s){return typeof s=="object"}function dt(s){return ke(s)&&s!==null}function D(s){return s!=null}function fe(s){return!s.trim().length}function _e(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const mt="Incorrect 'index' type",ft=s=>`Invalid value for key ${s}`,gt=s=>`Pattern length exceeds max of ${s}.`,xt=s=>`Missing ${s} property in key`,pt=s=>`Property 'weight' in key '${s}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class At{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let a=Ie(n);this._keys.push(a),this._keyMap[a.id]=a,r+=a.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ie(s){let e=null,r=null,n=null,a=1,c=null;if(O(s)||K(s))n=s,e=Fe(s),r=ge(s);else{if(!ve.call(s,"name"))throw new Error(xt("name"));const l=s.name;if(n=l,ve.call(s,"weight")&&(a=s.weight,a<=0))throw new Error(pt(l));e=Fe(l),r=ge(l),c=s.getFn}return{path:e,id:r,weight:a,src:n,getFn:c}}function Fe(s){return K(s)?s:s.split(".")}function ge(s){return K(s)?s.join("."):s}function jt(s,e){let r=[],n=!1;const a=(c,l,u)=>{if(D(c))if(!l[u])r.push(c);else{let o=l[u];const h=c[o];if(!D(h))return;if(u===l.length-1&&(O(h)||De(h)||ht(h)))r.push(ot(h));else if(K(h)){n=!0;for(let d=0,f=h.length;d<f;d+=1)a(h[d],l,u+1)}else l.length&&a(h,l,u+1)}};return a(s,O(e)?e.split("."):e,0),n?r:r[0]}const yt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Ct={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(s,e)=>s.score===e.score?s.idx<e.idx?-1:1:s.score<e.score?-1:1},Nt={location:0,threshold:.6,distance:100},wt={useExtendedSearch:!1,getFn:jt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var m={...Ct,...yt,...Nt,...wt};const Et=/[^ ]+/g;function bt(s=1,e=3){const r=new Map,n=Math.pow(10,e);return{get(a){const c=a.match(Et).length;if(r.has(c))return r.get(c);const l=1/Math.pow(c,.5*s),u=parseFloat(Math.round(l*n)/n);return r.set(c,u),u},clear(){r.clear()}}}class Ne{constructor({getFn:e=m.getFn,fieldNormWeight:r=m.fieldNormWeight}={}){this.norm=bt(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,O(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){const r=this.size();O(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!D(e)||fe(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((a,c)=>{let l=a.getFn?a.getFn(e):this.getFn(e,a.path);if(D(l)){if(K(l)){let u=[];const o=[{nestedArrIndex:-1,value:l}];for(;o.length;){const{nestedArrIndex:h,value:d}=o.pop();if(D(d))if(O(d)&&!fe(d)){let f={v:d,i:h,n:this.norm.get(d)};u.push(f)}else K(d)&&d.forEach((f,p)=>{o.push({nestedArrIndex:p,value:f})})}n.$[c]=u}else if(O(l)&&!fe(l)){let u={v:l,n:this.norm.get(l)};n.$[c]=u}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Le(s,e,{getFn:r=m.getFn,fieldNormWeight:n=m.fieldNormWeight}={}){const a=new Ne({getFn:r,fieldNormWeight:n});return a.setKeys(s.map(Ie)),a.setSources(e),a.create(),a}function vt(s,{getFn:e=m.getFn,fieldNormWeight:r=m.fieldNormWeight}={}){const{keys:n,records:a}=s,c=new Ne({getFn:e,fieldNormWeight:r});return c.setKeys(n),c.setIndexRecords(a),c}function re(s,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:a=m.distance,ignoreLocation:c=m.ignoreLocation}={}){const l=e/s.length;if(c)return l;const u=Math.abs(n-r);return a?l+u/a:u?1:l}function Ft(s=[],e=m.minMatchCharLength){let r=[],n=-1,a=-1,c=0;for(let l=s.length;c<l;c+=1){let u=s[c];u&&n===-1?n=c:!u&&n!==-1&&(a=c-1,a-n+1>=e&&r.push([n,a]),n=-1)}return s[c-1]&&c-n>=e&&r.push([n,c-1]),r}const U=32;function Mt(s,e,r,{location:n=m.location,distance:a=m.distance,threshold:c=m.threshold,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,includeMatches:o=m.includeMatches,ignoreLocation:h=m.ignoreLocation}={}){if(e.length>U)throw new Error(gt(U));const d=e.length,f=s.length,p=Math.max(0,Math.min(n,f));let x=c,j=p;const C=u>1||o,M=C?Array(f):[];let v;for(;(v=s.indexOf(e,j))>-1;){let E=re(e,{currentLocation:v,expectedLocation:p,distance:a,ignoreLocation:h});if(x=Math.min(E,x),j=v+d,C){let R=0;for(;R<d;)M[v+R]=1,R+=1}}j=-1;let k=[],F=1,L=d+f;const ie=1<<d-1;for(let E=0;E<d;E+=1){let R=0,_=L;for(;R<_;)re(e,{errors:E,currentLocation:p+_,expectedLocation:p,distance:a,ignoreLocation:h})<=x?R=_:L=_,_=Math.floor((L-R)/2+R);L=_;let G=Math.max(1,p-_+1),w=l?f:Math.min(p+_,f)+d,I=Array(w+2);I[w+1]=(1<<E)-1;for(let b=w;b>=G;b-=1){let W=b-1,ee=r[s.charAt(W)];if(C&&(M[W]=+!!ee),I[b]=(I[b+1]<<1|1)&ee,E&&(I[b]|=(k[b+1]|k[b])<<1|1|k[b+1]),I[b]&ie&&(F=re(e,{errors:E,currentLocation:W,expectedLocation:p,distance:a,ignoreLocation:h}),F<=x)){if(x=F,j=W,j<=p)break;G=Math.max(1,2*p-j)}}if(re(e,{errors:E+1,currentLocation:p,expectedLocation:p,distance:a,ignoreLocation:h})>x)break;k=I}const T={isMatch:j>=0,score:Math.max(.001,F)};if(C){const E=Ft(M,u);E.length?o&&(T.indices=E):T.isMatch=!1}return T}function St(s){let e={};for(let r=0,n=s.length;r<n;r+=1){const a=s.charAt(r);e[a]=(e[a]||0)|1<<n-r-1}return e}const ne=String.prototype.normalize?(s=>s.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(s=>s);class Te{constructor(e,{location:r=m.location,threshold:n=m.threshold,distance:a=m.distance,includeMatches:c=m.includeMatches,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,isCaseSensitive:o=m.isCaseSensitive,ignoreDiacritics:h=m.ignoreDiacritics,ignoreLocation:d=m.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:a,includeMatches:c,findAllMatches:l,minMatchCharLength:u,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d},e=o?e:e.toLowerCase(),e=h?ne(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const f=(x,j)=>{this.chunks.push({pattern:x,alphabet:St(x),startIndex:j})},p=this.pattern.length;if(p>U){let x=0;const j=p%U,C=p-j;for(;x<C;)f(this.pattern.substr(x,U),x),x+=U;if(j){const M=p-U;f(this.pattern.substr(M),M)}}else f(this.pattern,0)}searchIn(e){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a}=this.options;if(e=r?e:e.toLowerCase(),e=n?ne(e):e,this.pattern===e){let C={isMatch:!0,score:0};return a&&(C.indices=[[0,e.length-1]]),C}const{location:c,distance:l,threshold:u,findAllMatches:o,minMatchCharLength:h,ignoreLocation:d}=this.options;let f=[],p=0,x=!1;this.chunks.forEach(({pattern:C,alphabet:M,startIndex:v})=>{const{isMatch:k,score:F,indices:L}=Mt(e,C,M,{location:c+v,distance:l,threshold:u,findAllMatches:o,minMatchCharLength:h,includeMatches:a,ignoreLocation:d});k&&(x=!0),p+=F,k&&L&&(f=[...f,...L])});let j={isMatch:x,score:x?p/this.chunks.length:1};return x&&a&&(j.indices=f),j}}class V{constructor(e){this.pattern=e}static isMultiMatch(e){return Me(e,this.multiRegex)}static isSingleMatch(e){return Me(e,this.singleRegex)}search(){}}function Me(s,e){const r=s.match(e);return r?r[1]:null}class Bt extends V{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class Dt extends V{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class kt extends V{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class _t extends V{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class It extends V{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Lt extends V{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Re extends V{constructor(e,{location:r=m.location,threshold:n=m.threshold,distance:a=m.distance,includeMatches:c=m.includeMatches,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,isCaseSensitive:o=m.isCaseSensitive,ignoreDiacritics:h=m.ignoreDiacritics,ignoreLocation:d=m.ignoreLocation}={}){super(e),this._bitapSearch=new Te(e,{location:r,threshold:n,distance:a,includeMatches:c,findAllMatches:l,minMatchCharLength:u,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class $e extends V{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n;const a=[],c=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+c,a.push([n,r-1]);const l=!!a.length;return{isMatch:l,score:l?0:1,indices:a}}}const xe=[Bt,$e,kt,_t,Lt,It,Dt,Re],Se=xe.length,Tt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Rt="|";function $t(s,e={}){return s.split(Rt).map(r=>{let n=r.trim().split(Tt).filter(c=>c&&!!c.trim()),a=[];for(let c=0,l=n.length;c<l;c+=1){const u=n[c];let o=!1,h=-1;for(;!o&&++h<Se;){const d=xe[h];let f=d.isMultiMatch(u);f&&(a.push(new d(f,e)),o=!0)}if(!o)for(h=-1;++h<Se;){const d=xe[h];let f=d.isSingleMatch(u);if(f){a.push(new d(f,e));break}}}return a})}const Ot=new Set([Re.type,$e.type]);class Pt{constructor(e,{isCaseSensitive:r=m.isCaseSensitive,ignoreDiacritics:n=m.ignoreDiacritics,includeMatches:a=m.includeMatches,minMatchCharLength:c=m.minMatchCharLength,ignoreLocation:l=m.ignoreLocation,findAllMatches:u=m.findAllMatches,location:o=m.location,threshold:h=m.threshold,distance:d=m.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a,minMatchCharLength:c,findAllMatches:u,ignoreLocation:l,location:o,threshold:h,distance:d},e=r?e:e.toLowerCase(),e=n?ne(e):e,this.pattern=e,this.query=$t(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:a,ignoreDiacritics:c}=this.options;e=a?e:e.toLowerCase(),e=c?ne(e):e;let l=0,u=[],o=0;for(let h=0,d=r.length;h<d;h+=1){const f=r[h];u.length=0,l=0;for(let p=0,x=f.length;p<x;p+=1){const j=f[p],{isMatch:C,indices:M,score:v}=j.search(e);if(C){if(l+=1,o+=v,n){const k=j.constructor.type;Ot.has(k)?u=[...u,...M]:u.push(M)}}else{o=0,l=0,u.length=0;break}}if(l){let p={isMatch:!0,score:o/l};return n&&(p.indices=u),p}}return{isMatch:!1,score:1}}}const pe=[];function Kt(...s){pe.push(...s)}function Ae(s,e){for(let r=0,n=pe.length;r<n;r+=1){let a=pe[r];if(a.condition(s,e))return new a(s,e)}return new Te(s,e)}const ae={AND:"$and",OR:"$or"},je={PATH:"$path",PATTERN:"$val"},ye=s=>!!(s[ae.AND]||s[ae.OR]),zt=s=>!!s[je.PATH],Vt=s=>!K(s)&&ke(s)&&!ye(s),Be=s=>({[ae.AND]:Object.keys(s).map(e=>({[e]:s[e]}))});function Oe(s,e,{auto:r=!0}={}){const n=a=>{let c=Object.keys(a);const l=zt(a);if(!l&&c.length>1&&!ye(a))return n(Be(a));if(Vt(a)){const o=l?a[je.PATH]:c[0],h=l?a[je.PATTERN]:a[o];if(!O(h))throw new Error(ft(o));const d={keyId:ge(o),pattern:h};return r&&(d.searcher=Ae(h,e)),d}let u={children:[],operator:c[0]};return c.forEach(o=>{const h=a[o];K(h)&&h.forEach(d=>{u.children.push(n(d))})}),u};return ye(s)||(s=Be(s)),n(s)}function Wt(s,{ignoreFieldNorm:e=m.ignoreFieldNorm}){s.forEach(r=>{let n=1;r.matches.forEach(({key:a,norm:c,score:l})=>{const u=a?a.weight:null;n*=Math.pow(l===0&&u?Number.EPSILON:l,(u||1)*(e?1:c))}),r.score=n})}function Ut(s,e){const r=s.matches;e.matches=[],D(r)&&r.forEach(n=>{if(!D(n.indices)||!n.indices.length)return;const{indices:a,value:c}=n;let l={indices:a,value:c};n.key&&(l.key=n.key.src),n.idx>-1&&(l.refIndex=n.idx),e.matches.push(l)})}function Gt(s,e){e.score=s.score}function Ht(s,e,{includeMatches:r=m.includeMatches,includeScore:n=m.includeScore}={}){const a=[];return r&&a.push(Ut),n&&a.push(Gt),s.map(c=>{const{idx:l}=c,u={item:e[l],refIndex:l};return a.length&&a.forEach(o=>{o(c,u)}),u})}class H{constructor(e,r={},n){this.options={...m,...r},this.options.useExtendedSearch,this._keyStore=new At(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof Ne))throw new Error(mt);this._myIndex=r||Le(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){D(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const r=[];for(let n=0,a=this._docs.length;n<a;n+=1){const c=this._docs[n];e(c,n)&&(this.removeAt(n),n-=1,a-=1,r.push(c))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){const{includeMatches:n,includeScore:a,shouldSort:c,sortFn:l,ignoreFieldNorm:u}=this.options;let o=O(e)?O(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Wt(o,{ignoreFieldNorm:u}),c&&o.sort(l),De(r)&&r>-1&&(o=o.slice(0,r)),Ht(o,this._docs,{includeMatches:n,includeScore:a})}_searchStringList(e){const r=Ae(e,this.options),{records:n}=this._myIndex,a=[];return n.forEach(({v:c,i:l,n:u})=>{if(!D(c))return;const{isMatch:o,score:h,indices:d}=r.searchIn(c);o&&a.push({item:c,idx:l,matches:[{score:h,value:c,norm:u,indices:d}]})}),a}_searchLogical(e){const r=Oe(e,this.options),n=(u,o,h)=>{if(!u.children){const{keyId:f,searcher:p}=u,x=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(o,f),searcher:p});return x&&x.length?[{idx:h,item:o,matches:x}]:[]}const d=[];for(let f=0,p=u.children.length;f<p;f+=1){const x=u.children[f],j=n(x,o,h);if(j.length)d.push(...j);else if(u.operator===ae.AND)return[]}return d},a=this._myIndex.records,c={},l=[];return a.forEach(({$:u,i:o})=>{if(D(u)){let h=n(r,u,o);h.length&&(c[o]||(c[o]={idx:o,item:u,matches:[]},l.push(c[o])),h.forEach(({matches:d})=>{c[o].matches.push(...d)}))}}),l}_searchObjectList(e){const r=Ae(e,this.options),{keys:n,records:a}=this._myIndex,c=[];return a.forEach(({$:l,i:u})=>{if(!D(l))return;let o=[];n.forEach((h,d)=>{o.push(...this._findMatches({key:h,value:l[d],searcher:r}))}),o.length&&c.push({idx:u,item:l,matches:o})}),c}_findMatches({key:e,value:r,searcher:n}){if(!D(r))return[];let a=[];if(K(r))r.forEach(({v:c,i:l,n:u})=>{if(!D(c))return;const{isMatch:o,score:h,indices:d}=n.searchIn(c);o&&a.push({score:h,key:e,value:c,idx:l,norm:u,indices:d})});else{const{v:c,n:l}=r,{isMatch:u,score:o,indices:h}=n.searchIn(c);u&&a.push({score:o,key:e,value:c,norm:l,indices:h})}return a}}H.version="7.1.0";H.createIndex=Le;H.parseIndex=vt;H.config=m;H.parseQuery=Oe;Kt(Pt);function Qt(s){switch(s){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}const q=20;function ns(){const[s]=Ke(),e=ze(),r=Ve(),[n,a]=A.useState([]),[c,l]=A.useState([]),[u,o]=A.useState(!0),[h,d]=A.useState(null),[f,p]=A.useState(s.get("status")||"_default"),[x,j]=A.useState(s.get("priority")||"all"),[C,M]=A.useState(s.get("search")||""),[v,k]=A.useState(s.get("sortBy")||"created"),[F,L]=A.useState(s.get("order")||"desc"),[ie,T]=A.useState(()=>{const i=parseInt(s.get("page")||"1",10);return Number.isNaN(i)||i<1?1:i}),[E,R]=A.useState(!1),_=A.useRef(null),G=[f!=="_default",x!=="all",v!=="created",F!=="desc"].filter(Boolean).length,w=A.useCallback(i=>{const g=new URLSearchParams(s);Object.entries(i).forEach(([S,z])=>{z&&z!=="all"&&z!=="_default"&&z!==""?g.set(S,z):g.delete(S)});const y=g.toString(),N=y?`?${y}`:"";e(`${r.pathname}${N}`)},[s,e,r.pathname]),I=A.useCallback(i=>{p(i),T(1),w({status:i==="_default"?null:i,page:null})},[w]),Q=A.useCallback(i=>{j(i),T(1),w({priority:i==="all"?null:i,page:null})},[w]),b=A.useCallback(i=>{M(i),T(1),w({search:i||null,page:null})},[w]),W=A.useCallback(i=>{k(i),T(1),w({sortBy:i==="created"?null:i,page:null})},[w]),ee=A.useCallback(()=>{const i=F==="asc"?"desc":"asc";L(i),T(1),w({order:i==="desc"?null:i,page:null})},[F,w]),ce=A.useCallback(i=>{T(i),w({page:i===1?null:String(i)}),window.scrollTo({top:0,behavior:"smooth"})},[w]),le=A.useCallback(i=>{if(i.key==="s"||i.key==="S"){const g=document.activeElement;g?.tagName==="INPUT"||g?.tagName==="TEXTAREA"||g?.getAttribute("contenteditable")==="true"||(i.preventDefault(),_.current?.focus())}},[]);A.useEffect(()=>(document.addEventListener("keydown",le),()=>{document.removeEventListener("keydown",le)}),[le]);const we=A.useMemo(()=>{const i={keys:[{name:"title",weight:.4},{name:"intent",weight:.3},{name:"id",weight:.2},{name:"author.name",weight:.05},{name:"metadata.tags",weight:.05}],threshold:.3,includeScore:!0};return new H(n,i)},[n]);A.useEffect(()=>{async function i(){try{o(!0);const y=await(await fetch(`${Xe}/api/v1/tasks`)).json();y.success?(a(y.data),l(y.data)):d(y.error?.message||"Failed to fetch tasks")}catch(g){d(g instanceof Error?g.message:"Unknown error")}finally{o(!1)}}i()},[]),A.useEffect(()=>{let i=n;if(f==="_default"?i=i.filter(g=>Ze.includes(g.status)):f!=="all"&&(i=i.filter(g=>g.status===f)),x!=="all"&&(i=i.filter(g=>g.metadata.priority===x)),C.trim()){const g=we.search(C),y=new Set(g.map(N=>N.item.id));i=i.filter(N=>y.has(N.id))}i=i.sort((g,y)=>{let N,S;switch(v){case"created":{N=new Date(g.metadata.createdAt).getTime(),S=new Date(y.metadata.createdAt).getTime();break}case"updated":{N=new Date(g.metadata.updatedAt).getTime(),S=new Date(y.metadata.updatedAt).getTime();break}case"status":{N=g.status,S=y.status;break}case"priority":{const z={critical:4,high:3,medium:2,low:1};N=z[g.metadata.priority]||0,S=z[y.metadata.priority]||0;break}case"intent":{N=(g.title||g.intent||"").toLowerCase(),S=(y.title||y.intent||"").toLowerCase();break}default:N=new Date(g.metadata.createdAt).getTime(),S=new Date(y.metadata.createdAt).getTime()}return F==="asc"?N<S?-1:N>S?1:0:N>S?-1:N<S?1:0}),l(i)},[n,f,x,C,v,F,we]);const Y=Math.max(1,Math.ceil(c.length/q)),$=Math.min(ie,Y),Pe=c.slice(($-1)*q,$*q);return h?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),t.jsx(P,{asChild:!0,children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsx("div",{className:"text-center",children:t.jsxs("p",{className:"text-destructive",children:["Error: ",h]})})})})]}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),t.jsx(P,{asChild:!0,children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"relative",children:[t.jsx(tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t.jsx(We,{ref:_,placeholder:"Search tasks...",value:C,onChange:i=>b(i.target.value),className:"pl-9 pr-20 h-11 bg-muted/40 border-muted-foreground/20 focus:bg-background transition-colors"}),t.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:C?t.jsx("button",{onClick:()=>b(""),className:"h-5 w-5 rounded-full bg-muted-foreground/20 hover:bg-muted-foreground/30 flex items-center justify-center transition-colors",children:t.jsx(X,{className:"h-3 w-3"})}):t.jsx(Ue,{children:t.jsx(Ge,{children:"S"})})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>R(!E),className:"flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg border border-muted-foreground/20 hover:bg-muted/50 transition-colors",children:[t.jsx(be,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Filters & Sort"}),t.jsx("span",{className:"sm:hidden",children:"Filters"}),G>0&&t.jsx("span",{className:"flex items-center justify-center h-5 w-5 text-xs font-bold rounded-full bg-primary text-primary-foreground",children:G}),E?t.jsx(st,{className:"h-4 w-4 ml-1"}):t.jsx(He,{className:"h-4 w-4 ml-1"})]}),t.jsxs("div",{className:"flex-1 flex items-center gap-2 overflow-x-auto scrollbar-hide",children:[f!=="_default"&&t.jsxs("button",{onClick:()=>I("_default"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-blue-500/15 text-blue-600 dark:text-blue-400 hover:bg-blue-500/25 transition-colors whitespace-nowrap",children:[f==="all"?"All statuses":Ee(f),t.jsx(X,{className:"h-3 w-3"})]}),x!=="all"&&t.jsxs("button",{onClick:()=>Q("all"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors whitespace-nowrap",children:[x," priority",t.jsx(X,{className:"h-3 w-3"})]}),(v!=="created"||F!=="desc")&&t.jsxs("button",{onClick:()=>{W("created"),L("desc"),w({sortBy:null,order:null})},className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-purple-500/15 text-purple-600 dark:text-purple-400 hover:bg-purple-500/25 transition-colors whitespace-nowrap",children:[v," ",F==="asc"?"↑":"↓",t.jsx(X,{className:"h-3 w-3"})]})]}),!u&&t.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[c.length," result",c.length!==1?"s":""]})]}),E&&t.jsxs("div",{className:"p-4 rounded-lg border border-muted-foreground/20 bg-muted/30 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsxs(oe,{value:f,onValueChange:I,children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{placeholder:"Filter by status"})}),t.jsxs(me,{children:[t.jsx(B,{value:"_default",children:"Active (Default)"}),t.jsx(B,{value:"all",children:"All statuses"}),qe.map(i=>t.jsx(B,{value:i,children:Ee(i)},i))]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Priority"}),t.jsxs(oe,{value:x,onValueChange:Q,children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{placeholder:"Filter by priority"})}),t.jsxs(me,{children:[t.jsx(B,{value:"all",children:"All priorities"}),t.jsx(B,{value:"low",children:"Low"}),t.jsx(B,{value:"medium",children:"Medium"}),t.jsx(B,{value:"high",children:"High"}),t.jsx(B,{value:"critical",children:"Critical"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Sort By"}),t.jsxs(oe,{value:v,onValueChange:i=>W(i),children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{})}),t.jsxs(me,{children:[t.jsx(B,{value:"created",children:"Created Date"}),t.jsx(B,{value:"updated",children:"Updated Date"}),t.jsx(B,{value:"status",children:"Status"}),t.jsx(B,{value:"priority",children:"Priority"}),t.jsx(B,{value:"intent",children:"Title"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Order"}),t.jsx(P,{variant:"outline",onClick:ee,className:"w-full justify-between bg-background",children:F==="asc"?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Ascending"}),t.jsx(ct,{className:"h-4 w-4"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Descending"}),t.jsx(at,{className:"h-4 w-4"})]})})]})]}),G>0&&t.jsx("div",{className:"pt-2 border-t border-muted-foreground/10",children:t.jsxs(P,{variant:"ghost",size:"sm",onClick:()=>{I("_default"),Q("all"),b("")},className:"text-muted-foreground hover:text-foreground",children:[t.jsx(X,{className:"h-3 w-3 mr-1"}),"Reset all filters"]})})]})]}),u?t.jsx("div",{className:"space-y-3",children:Array.from({length:6}).map((i,g)=>t.jsx(J,{className:"overflow-hidden",children:t.jsx(Z,{className:"py-4",children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsx("div",{className:"h-5 bg-muted rounded w-2/3 animate-pulse"}),t.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[t.jsx("div",{className:"h-5 w-14 bg-muted rounded-full animate-pulse"}),t.jsx("div",{className:"h-5 w-14 bg-muted rounded-full animate-pulse"})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"h-3.5 bg-muted rounded w-full animate-pulse"}),t.jsx("div",{className:"h-3.5 bg-muted rounded w-4/5 animate-pulse"})]}),t.jsxs("div",{className:"flex justify-between items-center pt-1",children:[t.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"}),t.jsx("div",{className:"h-3 bg-muted rounded w-1/6 animate-pulse"})]})]})})},g))}):c.length===0&&n.length>0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(be,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No tasks match your filters"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Try adjusting your status or priority filters."}),t.jsx(P,{variant:"outline",className:"mt-4",onClick:()=>{I("_default"),Q("all"),b("")},children:"Clear Filters"})]})})}):n.length===0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(Qe,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No tasks yet"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first task to get started."}),t.jsx(P,{asChild:!0,className:"mt-4",children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]})})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"space-y-3",children:Pe.map(i=>t.jsx(te,{to:`/tasks/${i.id}`,className:"block",children:t.jsx(J,{className:"hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:t.jsx(Z,{className:"py-4",children:t.jsx("div",{className:"flex justify-between items-start gap-4",children:t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsx(Je,{className:"text-base leading-tight",children:i.title||i.intent}),t.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[i.metadata.priority&&t.jsx(se,{variant:Qt(i.metadata.priority),className:"text-xs",children:i.metadata.priority}),t.jsx(se,{variant:et(i.status),className:"text-xs",children:i.status})]})]}),i.content&&t.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[i.content.split(`
|
|
17
|
+
`).slice(0,2).join(" ").substring(0,150),i.content.length>150?"...":""]}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"text-xs text-muted-foreground",children:[i.id," • by ",i.author.name," • ",new Date(i.metadata.createdAt).toLocaleDateString()]}),t.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[i.planSteps.length>0&&t.jsxs("span",{children:[i.planSteps.length," step",i.planSteps.length!==1?"s":""]}),i.metadata.tags&&i.metadata.tags.length>0&&t.jsxs("span",{children:[i.metadata.tags.length," tag",i.metadata.tags.length!==1?"s":""]})]})]}),i.metadata.tags&&i.metadata.tags.length>0&&t.jsxs("div",{className:"flex gap-1 mt-2",children:[i.metadata.tags.slice(0,3).map(g=>t.jsx(se,{variant:"outline",className:"text-xs",children:g},g)),i.metadata.tags.length>3&&t.jsxs(se,{variant:"outline",className:"text-xs",children:["+",i.metadata.tags.length-3]})]})]})})})})},i.id))}),Y>1&&t.jsxs("div",{className:"flex items-center justify-between pt-2",children:[t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",($-1)*q+1,"–",Math.min($*q,c.length)," of ",c.length]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(P,{variant:"outline",size:"sm",disabled:$<=1,onClick:()=>ce($-1),children:t.jsx(rt,{className:"h-4 w-4"})}),Array.from({length:Y},(i,g)=>g+1).filter(i=>i===1||i===Y||Math.abs(i-$)<=1).reduce((i,g,y,N)=>(y>0&&g-N[y-1]>1&&i.push("ellipsis"),i.push(g),i),[]).map((i,g)=>i==="ellipsis"?t.jsx("span",{className:"px-2 text-sm text-muted-foreground",children:"…"},`e${g}`):t.jsx(P,{variant:i===$?"default":"outline",size:"sm",className:"min-w-[2rem]",onClick:()=>ce(i),children:i},i)),t.jsx(P,{variant:"outline",size:"sm",disabled:$>=Y,onClick:()=>ce($+1),children:t.jsx(Ye,{className:"h-4 w-4"})})]})]})]})]})}export{ns as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as p,a as v,r as a,A as l,j as e,B as m,L as g,a1 as N}from"./index-
|
|
1
|
+
import{u as p,a as v,r as a,A as l,j as e,B as m,L as g,a1 as N}from"./index-C_KCaLlP.js";import{C as h,a as x,b as C,c as S}from"./card-BpqK1BMM.js";import{M as w}from"./markdown-editor-D_er7zWv.js";import{A as y}from"./arrow-left-B_QwfLPP.js";import{C as b}from"./circle-check-big-DqKKs8fZ.js";import"./index-PBkZiuRI.js";function F(){const u=p(),{toast:t}=v(),[n,i]=a.useState(""),[f,r]=a.useState(!0),[o,c]=a.useState(!1);a.useEffect(()=>{fetch(`${l}/api/v1/context/team`).then(s=>s.json()).then(s=>{s.success&&i(s.document.content.trim()),r(!1)}).catch(s=>{console.error("Failed to load context:",s),t({title:"Error",description:"Failed to load team definition",variant:"destructive"}),r(!1)})},[t]);const j=async()=>{c(!0);try{const d=await(await fetch(`${l}/api/v1/context/team`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,metadata:{}})})).json();if(d.success)t({title:"Success",description:"Team definition saved successfully",action:e.jsx(b,{className:"h-4 w-4"})}),u("/context/team");else throw new Error(d.error||"Failed to save")}catch(s){console.error("Save error:",s),t({title:"Error",description:"Failed to save team definition",variant:"destructive"})}finally{c(!1)}};return f?e.jsx("div",{className:"space-y-6",children:e.jsx(h,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Team Definition"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Define team structure, members, and communication"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(g,{to:"/context/team",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(y,{className:"w-4 h-4"})})}),e.jsxs(m,{onClick:j,disabled:o,size:"sm",children:[e.jsx(N,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:o?"Saving...":"Save"})]})]})]}),e.jsxs(h,{children:[e.jsx(C,{children:e.jsx(S,{children:"Team Documentation"})}),e.jsx(x,{children:e.jsx(w,{value:n,onChange:s=>i(s||""),placeholder:`Write your team definition in markdown...
|
|
2
2
|
|
|
3
3
|
## Team Members
|
|
4
4
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{u as p,a as v,r as a,A as l,j as e,B as m,L as g,a1 as N}from"./index-opozMhku.js";import{C as h,a as x,b as C,c as S}from"./card-Btt3HmXT.js";import{M as w}from"./markdown-editor-B3gIcmI2.js";import{A as y}from"./arrow-left-DmNgC0xD.js";import{C as b}from"./circle-check-big-CVbQ_zpj.js";import"./index-J8MrpD0P.js";function F(){const u=p(),{toast:t}=v(),[n,i]=a.useState(""),[f,r]=a.useState(!0),[o,c]=a.useState(!1);a.useEffect(()=>{fetch(`${l}/api/v1/context/team`).then(s=>s.json()).then(s=>{s.success&&i(s.document.content.trim()),r(!1)}).catch(s=>{console.error("Failed to load context:",s),t({title:"Error",description:"Failed to load team definition",variant:"destructive"}),r(!1)})},[t]);const j=async()=>{c(!0);try{const d=await(await fetch(`${l}/api/v1/context/team`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,metadata:{}})})).json();if(d.success)t({title:"Success",description:"Team definition saved successfully",action:e.jsx(b,{className:"h-4 w-4"})}),u("/context/team");else throw new Error(d.error||"Failed to save")}catch(s){console.error("Save error:",s),t({title:"Error",description:"Failed to save team definition",variant:"destructive"})}finally{c(!1)}};return f?e.jsx("div",{className:"space-y-6",children:e.jsx(h,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Team Definition"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Define team structure, members, and communication"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(g,{to:"/context/team",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(y,{className:"w-4 h-4"})})}),e.jsxs(m,{onClick:j,disabled:o,size:"sm",children:[e.jsx(N,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:o?"Saving...":"Save"})]})]})]}),e.jsxs(h,{children:[e.jsx(C,{children:e.jsx(S,{children:"Team Documentation"})}),e.jsx(x,{children:e.jsx(w,{value:n,onChange:s=>i(s||""),placeholder:`Write your team definition in markdown...
|
|
2
|
+
|
|
3
|
+
## Team Members
|
|
4
|
+
|
|
5
|
+
List team members, their roles, and responsibilities.
|
|
6
|
+
|
|
7
|
+
## Communication
|
|
8
|
+
|
|
9
|
+
Team communication channels and conventions.`,height:800})})]})]})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N,r as t,A as v,j as e,v as C,ax as w,B as a,L as o,_ as d,M as g,av as y,ar as b}from"./index-
|
|
1
|
+
import{a as N,r as t,A as v,j as e,v as C,ax as w,B as a,L as o,_ as d,M as g,av as y,ar as b}from"./index-opozMhku.js";import{C as i,a as r,b as E}from"./card-Btt3HmXT.js";import{c as T}from"./clipboard-B9ndUJKl.js";function D(){const{toast:c}=N(),[l,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${v}/api/v1/context/team`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/team.md";try{await T(s),c({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),c({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"team-md",filename:"team.md",name:"team.md",path:".nut/context/team.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading team definition..."})]})})})}):!u||!l?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(w,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Team Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Team definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(o,{to:"/context/team/edit",children:[e.jsx(d,{className:"h-4 w-4 mr-2"}),"Create Team Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Team"}),e.jsx("p",{className:"text-muted-foreground",children:"Team structure and member information"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(g,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(o,{to:"/context/team/edit",children:[e.jsx(d,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(E,{className:"pb-0"}),e.jsx(r,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(b,{children:l.content||"No content available"})})})]})]})}export{D as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as N,r as t,A as v,j as e,v as C,ax as w,B as a,L as o,_ as d,M as g,av as y,ar as b}from"./index-C_KCaLlP.js";import{C as i,a as r,b as E}from"./card-BpqK1BMM.js";import{c as T}from"./clipboard-B9ndUJKl.js";function D(){const{toast:c}=N(),[l,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${v}/api/v1/context/team`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/team.md";try{await T(s),c({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),c({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"team-md",filename:"team.md",name:"team.md",path:".nut/context/team.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading team definition..."})]})})})}):!u||!l?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(w,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Team Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Team definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(o,{to:"/context/team/edit",children:[e.jsx(d,{className:"h-4 w-4 mr-2"}),"Create Team Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Team"}),e.jsx("p",{className:"text-muted-foreground",children:"Team structure and member information"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(g,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(o,{to:"/context/team/edit",children:[e.jsx(d,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(E,{className:"pb-0"}),e.jsx(r,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(b,{children:l.content||"No content available"})})})]})]})}export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as U,a as J,r as i,j as e,B as r,T as C,n as K,X as L,v as H,a2 as G}from"./index-
|
|
1
|
+
import{u as U,a as J,r as i,j as e,B as r,T as C,n as K,X as L,v as H,a2 as G}from"./index-opozMhku.js";import{C as p,a as W}from"./card-Btt3HmXT.js";import{u as X}from"./use-terminal-CSttRkql.js";import{T as _}from"./terminal-preview-BZXyNaM9.js";/* empty css */import{R as q}from"./refresh-cw-CZLHY6zD.js";import{C as Q,a as V}from"./chevrons-up-B2GdB4F7.js";import{C as Y}from"./chevron-up-gnoSEbf_.js";import{P as M}from"./play-CQk31OJN.js";import{C as Z}from"./circle-play-COMPwZ00.js";import"./xterm-DTxiCjtJ.js";function he(){const m=U(),{sessions:f,loading:d,error:S,refreshSessions:h,createSession:j,destroySession:B}=X(),{toast:l}=J(),[x,u]=i.useState(""),[g,T]=i.useState(!1),[v,I]=i.useState(!1),[N,$]=i.useState([]),[,w]=i.useState(null),O=s=>{const t=Date.now(),a=new Date(s).getTime(),n=Math.max(0,Math.floor((t-a)/1e3));if(n<60)return`${n}s ago`;const b=Math.floor(n/60);if(b<60)return`${b}m ago`;const k=Math.floor(b/60);return k<24?`${k}h ago`:`${Math.floor(k/24)}d ago`};i.useEffect(()=>{h()},[h]),i.useEffect(()=>{y(s=>{const t={...s};return f.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[f]),i.useEffect(()=>{try{const s=localStorage.getItem("terminal.commandHistory");s&&$(JSON.parse(s))}catch{}},[]);const D=s=>{s&&($(t=>{const a=[s,...t.filter(n=>n!==s)].slice(0,5);try{localStorage.setItem("terminal.commandHistory",JSON.stringify(a))}catch{}return a}),w(null))},c=f.filter(s=>!s.taskId?.startsWith("cp-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[o,y]=i.useState(()=>{const s={};return f.forEach(t=>{s[t.id]=!0}),s}),R=async()=>{const s=`session-${Date.now()}`;await j(s)&&(l({title:"New terminal started",description:`${s}`}),m(`/terminal/${s}`))},E=async()=>{const s=x.trim();if(!s)return;const t=`session-${Date.now()}`;T(!0);try{await j(t,s)?(D(s),l({title:"Session started",description:`${t}`}),m(`/terminal/${t}`)):l({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{T(!1)}},A=async()=>{const s=x.trim();if(!s)return;const t=`session-${Date.now()}`;I(!0);try{await j(t,s)?(D(s),setTimeout(()=>h(),150),u(""),l({title:"Started in background",description:`${t}`,action:e.jsx(G,{altText:"Open session",onClick:()=>m(`/terminal/${t}`),children:"Open"})})):l({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{I(!1)}},P=async s=>{await B(s)?(l({title:"Session closed",description:s}),setTimeout(()=>h(),100)):l({title:"Failed to close session",description:s,variant:"destructive"})},F=()=>{const s=c.every(a=>o[a.id]),t={};c.forEach(a=>{t[a.id]=!s}),y(t)},z=c.length>0&&c.every(s=>o[s.id]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Terminal"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Manage terminal sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",onClick:()=>h(),disabled:d,children:[e.jsx(q,{className:`h-4 w-4 sm:mr-2 ${d?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),c.length>0&&e.jsx(r,{variant:"outline",onClick:F,children:z?e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Hide All"})]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Show All"})]})}),e.jsxs(r,{onClick:R,disabled:d,children:[e.jsx(C,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"New Terminal"})]})]})]}),S&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:S})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),d?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,t)=>e.jsx(p,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),e.jsxs("div",{children:[e.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),e.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},t))}):c.length===0?e.jsx(p,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(C,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No active sessions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Get started by launching a new terminal session with the"," ",e.jsx("button",{onClick:R,className:"text-primary hover:underline font-medium",children:"New Terminal"})," ","button above."]})]})]})}):e.jsx("div",{className:"space-y-2",children:c.slice(0,10).map(s=>e.jsxs(p,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{className:"h-4 w-4"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.taskId}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",s.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",O(s.lastActivity)]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[e.jsx("div",{className:`flex items-center gap-1 ${s.connected?"text-green-600":"text-gray-400"}`,title:s.connected?"Connected":"Disconnected",children:e.jsx("div",{className:`w-2 h-2 rounded-full ${s.connected?"bg-green-500":"bg-gray-400"}`})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>{y(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":o[s.id]?"Hide preview":"Show preview",title:o[s.id]?"Hide preview":"Show preview",children:o[s.id]?e.jsx(Y,{className:"h-4 w-4"}):e.jsx(K,{className:"h-4 w-4"})}),e.jsxs(r,{size:"sm",variant:"outline",onClick:()=>m(`/terminal/${s.taskId}`),children:[e.jsx(M,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Open"})]}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>P(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(L,{className:"h-4 w-4"})})]})]}),o[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>m(`/terminal/${s.taskId}`),title:"Click to open full terminal session",children:e.jsx(_,{sessionId:s.id,heightPx:160,maxScrollback:200})})]},s.id))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Run Custom Command"}),e.jsx(p,{children:e.jsxs(W,{className:"py-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:x,onChange:s=>u(s.target.value),onKeyDown:s=>{s.key==="Enter"?(s.preventDefault(),s.shiftKey?A():E()):s.key==="ArrowUp"?(s.preventDefault(),w(t=>{const a=t===null?0:Math.min((t??0)+1,N.length-1),n=N[a];return n&&u(n),a})):s.key==="ArrowDown"&&(s.preventDefault(),w(t=>{if(t===null)return null;const a=t-1;if(a<0)return u(""),null;const n=N[a];return n&&u(n),a}))},placeholder:"npm run dev",className:"flex-1 h-9 rounded-md border px-3 text-sm bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400"}),e.jsxs(r,{onClick:A,variant:"secondary",disabled:d||!x.trim()||v||g,children:[v?e.jsx(H,{className:"h-4 w-4 animate-spin sm:mr-1"}):e.jsx(Z,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Background"})]}),e.jsxs(r,{onClick:E,disabled:d||!x.trim()||g||v,children:[g?e.jsx(H,{className:"h-4 w-4 animate-spin sm:mr-2"}):e.jsx(M,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Run"})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Enter to Run • Shift+Enter to Run in background"})]})})]})]})}export{he as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as U,a as J,r as i,j as e,B as r,T as C,n as K,X as L,v as H,a2 as G}from"./index-C_KCaLlP.js";import{C as p,a as W}from"./card-BpqK1BMM.js";import{u as X}from"./use-terminal-FzuSKCnc.js";import{T as _}from"./terminal-preview-C3WCC5tV.js";/* empty css */import{R as q}from"./refresh-cw-yMcSYdEF.js";import{C as Q,a as V}from"./chevrons-up-D7gsSI9g.js";import{C as Y}from"./chevron-up-DaWWwb87.js";import{P as M}from"./play-BjDbhEcg.js";import{C as Z}from"./circle-play-DoomwgYb.js";import"./xterm-DTxiCjtJ.js";function he(){const m=U(),{sessions:f,loading:d,error:S,refreshSessions:h,createSession:j,destroySession:B}=X(),{toast:l}=J(),[x,u]=i.useState(""),[g,T]=i.useState(!1),[v,I]=i.useState(!1),[N,$]=i.useState([]),[,w]=i.useState(null),O=s=>{const t=Date.now(),a=new Date(s).getTime(),n=Math.max(0,Math.floor((t-a)/1e3));if(n<60)return`${n}s ago`;const b=Math.floor(n/60);if(b<60)return`${b}m ago`;const k=Math.floor(b/60);return k<24?`${k}h ago`:`${Math.floor(k/24)}d ago`};i.useEffect(()=>{h()},[h]),i.useEffect(()=>{y(s=>{const t={...s};return f.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[f]),i.useEffect(()=>{try{const s=localStorage.getItem("terminal.commandHistory");s&&$(JSON.parse(s))}catch{}},[]);const D=s=>{s&&($(t=>{const a=[s,...t.filter(n=>n!==s)].slice(0,5);try{localStorage.setItem("terminal.commandHistory",JSON.stringify(a))}catch{}return a}),w(null))},c=f.filter(s=>!s.taskId?.startsWith("cp-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[o,y]=i.useState(()=>{const s={};return f.forEach(t=>{s[t.id]=!0}),s}),R=async()=>{const s=`session-${Date.now()}`;await j(s)&&(l({title:"New terminal started",description:`${s}`}),m(`/terminal/${s}`))},E=async()=>{const s=x.trim();if(!s)return;const t=`session-${Date.now()}`;T(!0);try{await j(t,s)?(D(s),l({title:"Session started",description:`${t}`}),m(`/terminal/${t}`)):l({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{T(!1)}},A=async()=>{const s=x.trim();if(!s)return;const t=`session-${Date.now()}`;I(!0);try{await j(t,s)?(D(s),setTimeout(()=>h(),150),u(""),l({title:"Started in background",description:`${t}`,action:e.jsx(G,{altText:"Open session",onClick:()=>m(`/terminal/${t}`),children:"Open"})})):l({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{I(!1)}},P=async s=>{await B(s)?(l({title:"Session closed",description:s}),setTimeout(()=>h(),100)):l({title:"Failed to close session",description:s,variant:"destructive"})},F=()=>{const s=c.every(a=>o[a.id]),t={};c.forEach(a=>{t[a.id]=!s}),y(t)},z=c.length>0&&c.every(s=>o[s.id]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Terminal"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Manage terminal sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",onClick:()=>h(),disabled:d,children:[e.jsx(q,{className:`h-4 w-4 sm:mr-2 ${d?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),c.length>0&&e.jsx(r,{variant:"outline",onClick:F,children:z?e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Hide All"})]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Show All"})]})}),e.jsxs(r,{onClick:R,disabled:d,children:[e.jsx(C,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"New Terminal"})]})]})]}),S&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:S})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),d?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,t)=>e.jsx(p,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),e.jsxs("div",{children:[e.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),e.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},t))}):c.length===0?e.jsx(p,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(C,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No active sessions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Get started by launching a new terminal session with the"," ",e.jsx("button",{onClick:R,className:"text-primary hover:underline font-medium",children:"New Terminal"})," ","button above."]})]})]})}):e.jsx("div",{className:"space-y-2",children:c.slice(0,10).map(s=>e.jsxs(p,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{className:"h-4 w-4"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.taskId}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",s.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",O(s.lastActivity)]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[e.jsx("div",{className:`flex items-center gap-1 ${s.connected?"text-green-600":"text-gray-400"}`,title:s.connected?"Connected":"Disconnected",children:e.jsx("div",{className:`w-2 h-2 rounded-full ${s.connected?"bg-green-500":"bg-gray-400"}`})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>{y(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":o[s.id]?"Hide preview":"Show preview",title:o[s.id]?"Hide preview":"Show preview",children:o[s.id]?e.jsx(Y,{className:"h-4 w-4"}):e.jsx(K,{className:"h-4 w-4"})}),e.jsxs(r,{size:"sm",variant:"outline",onClick:()=>m(`/terminal/${s.taskId}`),children:[e.jsx(M,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Open"})]}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>P(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(L,{className:"h-4 w-4"})})]})]}),o[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>m(`/terminal/${s.taskId}`),title:"Click to open full terminal session",children:e.jsx(_,{sessionId:s.id,heightPx:160,maxScrollback:200})})]},s.id))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Run Custom Command"}),e.jsx(p,{children:e.jsxs(W,{className:"py-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:x,onChange:s=>u(s.target.value),onKeyDown:s=>{s.key==="Enter"?(s.preventDefault(),s.shiftKey?A():E()):s.key==="ArrowUp"?(s.preventDefault(),w(t=>{const a=t===null?0:Math.min((t??0)+1,N.length-1),n=N[a];return n&&u(n),a})):s.key==="ArrowDown"&&(s.preventDefault(),w(t=>{if(t===null)return null;const a=t-1;if(a<0)return u(""),null;const n=N[a];return n&&u(n),a}))},placeholder:"npm run dev",className:"flex-1 h-9 rounded-md border px-3 text-sm bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400"}),e.jsxs(r,{onClick:A,variant:"secondary",disabled:d||!x.trim()||v||g,children:[v?e.jsx(H,{className:"h-4 w-4 animate-spin sm:mr-1"}):e.jsx(Z,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Background"})]}),e.jsxs(r,{onClick:E,disabled:d||!x.trim()||g||v,children:[g?e.jsx(H,{className:"h-4 w-4 animate-spin sm:mr-2"}):e.jsx(M,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Run"})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Enter to Run • Shift+Enter to Run in background"})]})})]})]})}export{he as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e,B as w,p as oe,r as a,a3 as Ye,y as Xe,s as Qe,u as et,x as tt,a as rt,T as ve,X as ye,P as je,k as we,l as st,a4 as Be,Z as at,G as nt,D as it,b as ct,d as lt,f as ot,a5 as Oe,a6 as $e,n as Ie,a7 as _e,a8 as ze,a9 as Fe,aa as De,ab as dt,A as de}from"./index-
|
|
1
|
+
import{j as e,B as w,p as oe,r as a,a3 as Ye,y as Xe,s as Qe,u as et,x as tt,a as rt,T as ve,X as ye,P as je,k as we,l as st,a4 as Be,Z as at,G as nt,D as it,b as ct,d as lt,f as ot,a5 as Oe,a6 as $e,n as Ie,a7 as _e,a8 as ze,a9 as Fe,aa as De,ab as dt,A as de}from"./index-C_KCaLlP.js";import{C as mt,a as ut}from"./card-BpqK1BMM.js";import{B as Je}from"./badge-BzEwwrAP.js";import{S as ke,a as Ne,b as Se,c as Ce,d as $}from"./select-BKdFrV6O.js";import{R as xt,a as Ae}from"./radio-group-BpmJzTM1.js";import{C as ht}from"./CollapsibleSection-DMf0wWjc.js";import{L as xe}from"./label-wtSCiOqT.js";import{u as ft}from"./use-terminal-FzuSKCnc.js";import{x as gt,a as pt}from"./xterm-DTxiCjtJ.js";import{A as bt}from"./arrow-down-DumN-Nal.js";/* empty css */import{b as Ge,a as vt,c as yt,d as jt,e as wt}from"./pipeline-builders-Bkf0wt_O.js";import{C as Te}from"./code-CmFlYUo3.js";import{R as kt}from"./refresh-cw-yMcSYdEF.js";import{P as Ee}from"./play-BjDbhEcg.js";import{E as Nt}from"./eye-AP4j25wH.js";import{M as St}from"./message-square-Ca07XC8m.js";import"./index-PBkZiuRI.js";import"./chevron-up-DaWWwb87.js";var We={exports:{}},Ue;function Ct(){return Ue||(Ue=1,(function(r,k){(function(I,P){r.exports=P()})(self,(()=>(()=>{var I={6:(o,c)=>{function D(C){try{const n=new URL(C),d=n.password&&n.username?`${n.protocol}//${n.username}:${n.password}@${n.host}`:n.username?`${n.protocol}//${n.username}@${n.host}`:`${n.protocol}//${n.host}`;return C.toLocaleLowerCase().startsWith(d.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(c,"__esModule",{value:!0}),c.LinkComputer=c.WebLinkProvider=void 0,c.WebLinkProvider=class{constructor(C,n,d,u={}){this._terminal=C,this._regex=n,this._handler=d,this._options=u}provideLinks(C,n){const d=g.computeLink(C,this._regex,this._terminal,this._handler);n(this._addCallbacks(d))}_addCallbacks(C){return C.map((n=>(n.leave=this._options.leave,n.hover=(d,u)=>{if(this._options.hover){const{range:p}=n;this._options.hover(d,u,p)}},n)))}};class g{static computeLink(n,d,u,p){const M=new RegExp(d.source,(d.flags||"")+"g"),[f,y]=g._getWindowedLineStrings(n-1,u),x=f.join("");let m;const R=[];for(;m=M.exec(x);){const b=m[0];if(!D(b))continue;const[h,Y]=g._mapStrIdx(u,y,0,m.index),[X,K]=g._mapStrIdx(u,h,Y,b.length);if(h===-1||Y===-1||X===-1||K===-1)continue;const H={start:{x:Y+1,y:h+1},end:{x:K,y:X+1}};R.push({range:H,text:b,activate:p})}return R}static _getWindowedLineStrings(n,d){let u,p=n,M=n,f=0,y="";const x=[];if(u=d.buffer.active.getLine(n)){const m=u.translateToString(!0);if(u.isWrapped&&m[0]!==" "){for(f=0;(u=d.buffer.active.getLine(--p))&&f<2048&&(y=u.translateToString(!0),f+=y.length,x.push(y),u.isWrapped&&y.indexOf(" ")===-1););x.reverse()}for(x.push(m),f=0;(u=d.buffer.active.getLine(++M))&&u.isWrapped&&f<2048&&(y=u.translateToString(!0),f+=y.length,x.push(y),y.indexOf(" ")===-1););}return[x,p]}static _mapStrIdx(n,d,u,p){const M=n.buffer.active,f=M.getNullCell();let y=u;for(;p;){const x=M.getLine(d);if(!x)return[-1,-1];for(let m=y;m<x.length;++m){x.getCell(m,f);const R=f.getChars();if(f.getWidth()&&(p-=R.length||1,m===x.length-1&&R==="")){const b=M.getLine(d+1);b&&b.isWrapped&&(b.getCell(0,f),f.getWidth()===2&&(p+=1))}if(p<0)return[d,m]}d++,y=0}return[d,y]}}c.LinkComputer=g}},P={};function E(o){var c=P[o];if(c!==void 0)return c.exports;var D=P[o]={exports:{}};return I[o](D,D.exports,E),D.exports}var W={};return(()=>{var o=W;Object.defineProperty(o,"__esModule",{value:!0}),o.WebLinksAddon=void 0;const c=E(6),D=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(C,n){const d=window.open();if(d){try{d.opener=null}catch{}d.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}o.WebLinksAddon=class{constructor(C=g,n={}){this._handler=C,this._options=n}activate(C){this._terminal=C;const n=this._options,d=n.urlRegex||D;this._linkProvider=this._terminal.registerLinkProvider(new c.WebLinkProvider(this._terminal,d,this._handler,n))}dispose(){this._linkProvider?.dispose()}}})(),W})()))})(We)),We.exports}var At=Ct();function Tt({onJumpToBottom:r,onSendKey:k}){return e.jsxs("div",{className:"w-full border-t border-gray-700/50 bg-[#252525] px-4 py-2.5 flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:r&&e.jsxs(w,{variant:"outline",size:"sm",onClick:r,className:"h-8 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] text-gray-200 hover:text-white transition-colors",title:"Jump to bottom and set focus",children:[e.jsx(bt,{className:"h-3.5 w-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Jump to Bottom"})]})}),k&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>k(""),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-red-900/40 hover:border-red-700 text-gray-200 hover:text-red-300 transition-colors",title:"Send Ctrl+C (interrupt)",children:[e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"⌃"}),e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"C"})]}),e.jsxs("button",{onClick:()=>k(""),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white transition-colors",title:"Send Ctrl+Z (suspend)",children:[e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"⌃"}),e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"Z"})]}),e.jsx("button",{onClick:()=>k("\x1B"),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white transition-colors",title:"Send Escape key",children:e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"Esc"})})]})]})}function Et({sessionId:r,onResize:k,onDestroy:I,pendingCommand:P,onCommandExecuted:E,showToolbar:W=!0}){const o=a.useRef(null),c=a.useRef(null),D=a.useRef(null),g=a.useRef(null),[C,n]=a.useState(!1),[d,u]=a.useState(null),[p,M]=a.useState(!0),f=a.useRef(0),y=5,x=a.useRef(null),m=a.useRef(null),R=a.useRef(P??null),b=a.useRef(!1),h=a.useRef(null),Y=a.useRef(E),X=a.useRef(I),K=a.useRef(k);a.useEffect(()=>{Y.current=E},[E]),a.useEffect(()=>{X.current=I},[I]),a.useEffect(()=>{K.current=k},[k]);const H=a.useCallback(N=>{!R.current||b.current||(h.current!==null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{if(!R.current||b.current){h.current=null;return}g.current?.readyState===WebSocket.OPEN&&(g.current.send(JSON.stringify({type:"input",data:R.current+"\r"})),b.current=!0,Y.current?.()),h.current=null},N))},[]);a.useEffect(()=>{if(R.current=P??null,b.current=!1,!R.current){h.current!==null&&(window.clearTimeout(h.current),h.current=null);return}const N=g.current?.readyState===WebSocket.OPEN;return H(N?200:800),()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[P,r,H]),a.useEffect(()=>{n(!1),M(!0),u(null)},[r]),a.useEffect(()=>{if(!o.current||!r)return;const N=T=>{const v=T.getBoundingClientRect();return v.width>0&&v.height>0},A=new gt.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"'IBM Plex Mono', 'Source Code Pro', 'Fira Code', ui-monospace, Menlo, Monaco, monospace",lineHeight:1.35,letterSpacing:.5,convertEol:!0,theme:{background:"#1a1b26",foreground:"#c0caf5",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"#33467c",selectionForeground:"#c0caf5",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}}),_=new pt.FitAddon,fe=new At.WebLinksAddon;A.loadAddon(_),A.loadAddon(fe),A.open(o.current),c.current=A,D.current=_;let S=null,B=null;const U=()=>{if(!A||!A.element||!A.element.parentElement)return;const T=A.cols??0,v=A.rows??0;if(T>0&&v>0){g.current?.readyState===WebSocket.OPEN&&g.current.send(JSON.stringify({type:"resize",cols:T,rows:v}));const O=K.current;O&&O(T,v)}},ae=()=>{const T=o.current;if(T&&N(T)&&!(!A||!A.element||!A.element.parentElement))try{const v=T.getBoundingClientRect();if(v.width<10||v.height<10)return;_.fit(),U()}catch(v){console.warn("xterm fit() failed, will retry if needed:",v)}},j=()=>{S&&cancelAnimationFrame(S),S=requestAnimationFrame(()=>{ae()})},Q=()=>{if(!r)return;x.current&&(window.clearTimeout(x.current),x.current=null);const T=`${Ye}/ws/terminal/${r}`,v=new WebSocket(T);return g.current=v,v.onopen=()=>{n(!0),u(null),f.current=0,console.log("Terminal WebSocket connected"),m.current&&window.clearInterval(m.current),m.current=window.setInterval(()=>{v.readyState===WebSocket.OPEN&&v.send(JSON.stringify({type:"keepalive"}))},120*1e3),j(),setTimeout(()=>{M(!1),j(),setTimeout(()=>j(),50),setTimeout(()=>j(),150)},400),H(1200)},v.onmessage=O=>{try{const L=JSON.parse(O.data);switch(L.type){case"snapshot":if(typeof L.data=="string"&&L.data.length&&c.current){const z=c.current;z.write(L.data,()=>{z.scrollToBottom()})}break;case"data":if(c.current){const z=c.current,V=z.buffer.active.viewportY+z.rows>=z.buffer.active.baseY+z.buffer.active.cursorY;z.write(L.data,()=>{V&&z.scrollToBottom()})}break;case"exit":c.current&&c.current.write(`\r
|
|
2
2
|
\x1B[31mProcess exited with code ${L.exitCode}\x1B[0m\r
|
|
3
3
|
`),X.current?.();break}}catch(L){console.error("Error parsing WebSocket message:",L)}},v.onclose=O=>{if(n(!1),console.log("Terminal WebSocket disconnected",O.code,O.reason),m.current&&(window.clearInterval(m.current),m.current=null),O.code!==1e3&&f.current<y&&r){f.current++;const L=Math.min(1e3*Math.pow(2,f.current-1),1e4);console.log(`Attempting to reconnect (${f.current}/${y}) in ${L}ms`),x.current=window.setTimeout(()=>{Q()},L)}else f.current>=y&&u("Connection lost. Please refresh the page to reconnect.")},v.onerror=O=>{console.error("Terminal WebSocket error:",O),f.current===0&&u("WebSocket connection failed")},v};Q(),A.onData(T=>{g.current?.readyState===WebSocket.OPEN&&g.current.send(JSON.stringify({type:"input",data:T}))});const J=()=>{j()},ne=new ResizeObserver(J);o.current&&ne.observe(o.current),window.addEventListener("resize",J),window.addEventListener("orientationchange",J);const G=()=>{document.visibilityState==="visible"&&(B&&clearTimeout(B),B=window.setTimeout(()=>{j()},50))};document.addEventListener("visibilitychange",G);let ie=0;const ce=20,me=()=>{const T=o.current;if(T){if(N(T)){ae();return}ie+=1,ie<ce?S=requestAnimationFrame(me):B=window.setTimeout(()=>{ae()},100)}};return S=requestAnimationFrame(me),()=>{ne.disconnect(),window.removeEventListener("resize",J),window.removeEventListener("orientationchange",J),document.removeEventListener("visibilitychange",G),S&&cancelAnimationFrame(S),B&&clearTimeout(B),x.current&&(window.clearTimeout(x.current),x.current=null),m.current&&(window.clearInterval(m.current),m.current=null),g.current?.readyState===WebSocket.OPEN&&g.current.close(),h.current!==null&&(window.clearTimeout(h.current),h.current=null),A.dispose()}},[r,H]);const he=a.useCallback(()=>{c.current&&(c.current.scrollToBottom(),c.current.focus())},[]),te=a.useCallback(N=>{g.current?.readyState===WebSocket.OPEN&&(g.current.send(JSON.stringify({type:"input",data:N})),c.current&&c.current.focus())},[]);return d?e.jsx("div",{className:"flex items-center justify-center h-full bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-red-600 font-medium",children:"Terminal Connection Error"}),e.jsx("div",{className:"text-red-500 text-sm mt-1",children:d})]})}):e.jsxs("div",{className:"relative h-full flex flex-col bg-[#1a1b26] overflow-hidden",children:[!C&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1a1b26] bg-opacity-95 z-10 backdrop-blur-sm",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),e.jsx("div",{className:"text-gray-300 mt-2",children:"Connecting to terminal..."})]})}),C&&p&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1a1b26] bg-opacity-50 z-10 transition-opacity duration-300 backdrop-blur-sm",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-pulse rounded-full h-6 w-6 bg-blue-500 mx-auto"}),e.jsx("div",{className:"text-gray-300 text-sm mt-2",children:"Loading terminal..."})]})}),e.jsx("div",{ref:o,className:"flex-1 w-full overflow-hidden",style:{minHeight:"400px"}}),W&&e.jsx(Tt,{onJumpToBottom:he,onSendKey:te})]})}const Wt=r=>r?Array.isArray(r)?r.filter(k=>typeof k=="string").map(k=>k.trim()).filter(Boolean):typeof r=="string"?r.split(",").map(k=>k.trim()).filter(Boolean):[]:[];function Yt(){const{taskId:r}=Xe(),k=Qe(),I=et(),[P]=tt(),{toast:E}=rt(),W=r?.startsWith("session-"),o=a.useMemo(()=>!!r&&r.startsWith("cp-"),[r]),c=a.useMemo(()=>!!r&&r.startsWith("sk-"),[r]),D=P.get("reviewOnly")==="true",g=P.get("startOnly")==="true",C=o&&!g,n=!D,d=a.useMemo(()=>c&&r?r.replace("sk-",""):null,[c,r]),{sessions:u,loading:p,error:M,createSession:f,destroySession:y,refreshSessions:x}=ft(),[m,R]=a.useState([]),[b,h]=a.useState(null),[Y,X]=a.useState(null),[K,H]=a.useState("claude"),[he,te]=a.useState(!1),[N,A]=a.useState("claude"),[_,fe]=a.useState([]),[S,B]=a.useState([]),[U,ae]=a.useState([]),[j,Q]=a.useState([]),[J,ne]=a.useState(!0),[G,ie]=a.useState(""),[ce,me]=a.useState(!1),[T,v]=a.useState({}),[O,L]=a.useState(null),z=a.useRef([]),[V,Pe]=a.useState("current"),[ue,Ve]=a.useState("main"),ee=a.useMemo(()=>r?`terminal.cp.config.${r}`:null,[r]);a.useEffect(()=>{if(!(!o&&!c||!ee))try{const t=localStorage.getItem(ee);if(t){const s=JSON.parse(t);s.cliAgent&&A(s.cliAgent),Array.isArray(s.selectedMcpServers)&&B(s.selectedMcpServers),Array.isArray(s.selectedSkillIds)&&Q(s.selectedSkillIds),typeof s.automationEnabled=="boolean"&&ne(s.automationEnabled),typeof s.customInstruction=="string"&&ie(s.customInstruction),typeof s.createWorktree=="boolean"&&me(s.createWorktree),s.branchMode&&Pe(s.branchMode)}}catch{console.error("Failed to load config",ee)}},[o,c,ee]);const ge=a.useCallback(()=>{if(!ee)return;const t={cliAgent:N,selectedMcpServers:S,selectedSkillIds:j,automationEnabled:J,customInstruction:G,createWorktree:ce,branchMode:V};try{localStorage.setItem(ee,JSON.stringify(t))}catch{console.error("Failed to persist config",ee)}},[ee,N,S,j,J,G,ce,V]);a.useEffect(()=>{ge()},[G,ge]);const re=t=>`feat/cp-${t.startsWith("cp-")?t.slice(5):t}`,qe=async t=>{try{const s=re(t),l=await(await fetch(`${de}/api/v1/git/branches`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,from:ue})})).json();if(!l.success){const F=l.error?.message||"Unknown error";return E({title:"Branch creation failed",description:F,variant:"destructive"}),!1}return E({title:"Branch created",description:`Created branch: ${s}`}),!0}catch{return E({title:"Branch creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}},Le=async t=>{try{const s=re(t),l=await(await fetch(`${de}/api/v1/git/worktrees`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:s,from:ue})})).json();if(!l.success){const F=l.error?.message||"Unknown error";return E({title:"Worktree creation failed",description:F,variant:"destructive"}),!1}return E({title:"Worktree created",description:`Created branch: ${s}`}),!0}catch{return E({title:"Worktree creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}};a.useEffect(()=>{(o||c)&&r&&(async()=>{try{const s=await fetch(`${de}/api/v1/git/status`);if(s.ok){const l=await s.json();l?.success&&l.data?.branch&&Ve(l.data.branch)}const i=await fetch(`${de}/api/v1/mcp`);if(i.ok){const l=await i.json();l?.success&&Array.isArray(l.servers)&&(fe(l.servers),B(F=>F.filter(q=>l.servers.includes(q))),l.mcpServers&&typeof l.mcpServers=="object"&&v(l.mcpServers))}}catch(s){console.error("Failed to load MCP servers",s)}try{const s=await fetch(`${de}/api/v1/skills`);if(s.ok){const i=await s.json(),F=(Array.isArray(i?.documents)?i.documents:[]).map(q=>({id:q.id,name:q?.metadata?.name||q.id,mcpServers:Wt(q?.metadata?.metadata?.mcpServers)}));ae(F),Q(q=>{const le=q.filter(Z=>F.some(be=>be.id===Z));if(c&&d&&le.length===0){const Z=F.find(be=>be.id===d);if(Z)return[Z.id]}return le})}}catch(s){console.error("Failed to load skills",s)}})()},[o,c,r,d]),a.useEffect(()=>{const t=z.current,s=j.filter(i=>!t.includes(i));s.length>0&&B(i=>{const l=new Set(i),F=_.length>0?new Set(_):void 0;return s.forEach(q=>{const le=U.find(Z=>Z.id===q);le&&le.mcpServers.forEach(Z=>{(!F||F.has(Z))&&l.add(Z)})}),Array.from(l)}),z.current=j},[j,U,_]),a.useEffect(()=>{r&&x(r)},[r,x]),a.useEffect(()=>{if(!r)return;const s=u.filter(i=>i.taskId===r).map(i=>i.id);R(s),!b&&s.length>0&&h(s[0]),b&&!s.includes(b)&&h(s.length>0?s[0]:null)},[u,r,b]);const se=async t=>{if(!r)return;const s=t||void 0,i=await f(r,s);i&&(h(i),!s&&t&&X(t),setTimeout(()=>x(r),100))},Me=(t,s)=>{const l={taskId:r,contextType:s??(o?"change-task":c?"skill":"general"),selectedMcpServers:S,selectedSkillIds:j,automationEnabled:J,customInstruction:G};switch(t){case"claude":return Ge(l);case"gemini":return wt(l);case"codex":return jt(l);case"droid":return yt(l);case"kiro":return vt(l);default:return Ge(l)}},pe=async()=>{o&&r&&(V==="new-branch"?await qe(r)||console.warn("Branch creation failed, continuing with terminal creation"):V==="new-worktree"&&(await Le(r)||console.warn("Worktree creation failed, continuing with terminal creation"))),o&&ce&&V==="current"&&r&&(await Le(r)||console.warn("Worktree creation failed, continuing with terminal creation"));const s=Me(o||c?N:K);await se(s)},Ke=async()=>{const s=Me(N,"prepare-task");await se(s)},Re=async t=>{if(await y(t)&&b===t){const i=m.filter(l=>l!==t);i.length>0?h(i[0]):r?.startsWith("session-")?I("/agents"):h(null)}},He=t=>{Re(t)},Ze=async()=>{for(const t of m)await y(t);I("/agents")};return r?e.jsxs("div",{className:"flex flex-col h-full",children:[W&&m.length===0&&r&&e.jsx(Pt,{taskId:r,onStart:se,locationSearch:k.search}),e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-lg",children:o||c?e.jsx(Te,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):e.jsx(ve,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:W?"Terminal":"Agent Session"}),!W&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r}),W&&e.jsxs("span",{className:"text-sm text-gray-500 font-mono",children:["(",r,")"]})]})]})}),e.jsx("div",{className:"flex items-center gap-2 sm:gap-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>r&&x(r),disabled:p,className:"bg-white dark:bg-gray-800",children:[e.jsx(kt,{className:`h-4 w-4 sm:mr-2 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),e.jsx(w,{size:"sm",variant:"destructive",onClick:Ze,title:"Close session","aria-label":"Close session",className:"h-9 w-9 p-0",children:e.jsx(ye,{className:"h-4 w-4"})}),!W&&!o&&!c&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ke,{value:K,onValueChange:H,children:[e.jsx(Ne,{className:"w-24",children:e.jsx(Se,{})}),e.jsxs(Ce,{children:[e.jsx($,{value:"claude",children:"Claude Code"}),e.jsx($,{value:"gemini",children:"Google Gemini"}),e.jsx($,{value:"codex",children:"OpenAI Codex"}),e.jsx($,{value:"kiro",children:"Kiro"})]})]}),e.jsxs(w,{onClick:pe,disabled:p,size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ee,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Start Agent"})]})]}),!o&&!c&&(!W||m.length===0)&&e.jsxs(w,{onClick:()=>se(),disabled:p,size:"sm",children:[e.jsx(je,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"New Terminal"})]})]})})]}),M&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-1.5 bg-red-100 dark:bg-red-900/40 rounded-lg flex-shrink-0",children:e.jsx(ye,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),e.jsx("div",{className:"text-red-800 dark:text-red-200 text-sm font-medium",children:M})]})}),m.length>0&&e.jsx("div",{className:"flex items-center gap-1 border-b dark:border-gray-700",children:m.map(t=>{const s=u.find(l=>l.id===t),i=b===t;return e.jsxs("div",{className:`flex items-center gap-2 px-4 py-3 border-b-1 cursor-pointer rounded-t-lg transition-all duration-200 ${i?"border-gray-400 bg-white dark:bg-gray-800 dark:border-gray-500 shadow-sm":"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800 hover:border-gray-300"}`,onClick:()=>h(t),children:[e.jsx("div",{className:`p-1.5 rounded-md ${i?"bg-gray-200 dark:bg-gray-700":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(ve,{className:`h-3.5 w-3.5 ${i?"text-gray-700 dark:text-gray-300":"text-gray-600 dark:text-gray-400"}`})}),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["Terminal ",t.split("-").slice(-1)[0].substring(0,6)]}),e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s?.connected?"bg-green-500":"bg-gray-400"}`}),e.jsx(w,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-red-100 dark:hover:bg-red-900/30 rounded-md opacity-60 hover:opacity-100 transition-opacity",onClick:l=>{l.stopPropagation(),Re(t)},children:e.jsx(ye,{className:"h-3 w-3"})})]},t)})}),e.jsx("div",{className:"flex-1 min-h-0",children:m.length===0?e.jsx(mt,{className:"h-full",children:e.jsx(ut,{className:"flex items-center justify-center h-full p-8",children:e.jsxs("div",{className:"text-center w-full max-w-[33vw] min-w-[400px]",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full w-fit mx-auto mb-2",children:o||c?e.jsx(we,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"}):e.jsx(ve,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"Prepare Agent"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6 leading-relaxed",children:W?"Create a new terminal session":e.jsxs(e.Fragment,{children:["Configure the agent to start working on ",r,"."]})}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[!W&&!o&&!c&&e.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[e.jsxs("div",{className:"w-full space-y-3",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Choose your AI agent"}),e.jsxs(ke,{value:K,onValueChange:H,children:[e.jsx(Ne,{className:"w-full h-11 bg-white dark:bg-gray-800",children:e.jsx(Se,{})}),e.jsxs(Ce,{children:[e.jsx($,{value:"claude",children:"Claude Code (default)"}),e.jsx($,{value:"gemini",children:"Google Gemini"}),e.jsx($,{value:"codex",children:"OpenAI Codex"}),e.jsx($,{value:"kiro",children:"Kiro"})]})]})]}),e.jsxs(w,{onClick:pe,disabled:p,className:"bg-green-600 hover:bg-green-700 w-full h-11 text-base font-medium",size:"lg",children:[e.jsx(Ee,{className:"h-5 w-5 mr-2"}),"Start Agent"]}),e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"}),e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 font-medium",children:"or"}),e.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"})]}),e.jsxs(w,{onClick:()=>se(),disabled:p,variant:"outline",className:"w-full h-11 bg-white dark:bg-gray-800",size:"lg",children:[e.jsx(je,{className:"h-5 w-5 mr-2"}),"New Terminal"]})]}),!W&&(o||c)&&e.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[C&&e.jsxs(w,{onClick:Ke,disabled:p,className:"w-full bg-blue-600 hover:bg-blue-700 h-11 text-base font-medium",size:"lg",children:[e.jsx(Nt,{className:"h-5 w-5 mr-2"}),"Review & Prepare"]}),e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsxs(w,{variant:"outline",onClick:()=>te(!0),className:"flex-1 h-11 bg-white dark:bg-gray-800",size:"lg",children:[e.jsx(st,{className:"h-5 w-5 mr-2"}),"Configure"]}),n&&e.jsxs(w,{onClick:pe,disabled:p,className:"flex-1 bg-green-600 hover:bg-green-700 h-11 text-base font-medium",size:"lg",children:[e.jsx(Ee,{className:"h-5 w-5 mr-2"}),"Start Agent"]})]}),e.jsxs("div",{className:"w-full space-y-3",children:[e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-500 dark:text-gray-400",children:"Agent Configuration"}),e.jsxs("div",{className:"text-left text-sm text-gray-700 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Agent:"}),e.jsx("span",{className:"font-mono text-sm",children:N==="claude"?"Claude Code":N.charAt(0).toUpperCase()+N.slice(1)})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Te,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Skills:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:j.length?j.map(t=>{const s=U.find(i=>i.id===t);return e.jsx(Je,{variant:"secondary",className:"font-mono text-xs",children:s?.name||t},t)}):e.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Be,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"MCP Servers:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:S.length?S.map(t=>e.jsx(Je,{variant:"secondary",className:"font-mono text-xs",children:t},t)):e.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(at,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Full Environment Access:"}),e.jsx("span",{className:"font-mono text-sm",children:J?"Enabled":"Disabled"})]}),o&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(nt,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Branch:"}),e.jsx("span",{className:"font-mono text-sm",children:V==="current"?`Current (${ue})`:V==="new-branch"?`New branch (${re(r||"")})`:`New worktree (${re(r||"")})`})]})]}),e.jsxs("div",{className:"text-left",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2 text-gray-700 dark:text-gray-300",children:[e.jsx(St,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),"Additional Instructions"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[G.length,"/500"]})]}),e.jsx("textarea",{className:"w-full min-h-[80px] rounded-md border p-3 text-sm bg-gray-50 dark:bg-gray-900/50 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 resize-none",placeholder:"Add specific instructions to guide the agent...",value:G,onChange:t=>ie(t.target.value),rows:3}),G.length>500&&e.jsx("div",{className:"text-xs text-red-600 mt-1",children:"Custom instruction is too long (max 500 characters)"})]})]})]}),W&&m.length===0&&e.jsx("div",{className:"p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:e.jsxs(w,{onClick:()=>se(),disabled:p,className:"w-full h-11 text-base font-medium",size:"lg",children:[e.jsx(je,{className:"h-5 w-5 mr-2"}),"New Terminal"]})})]})]})})}):b?e.jsx("div",{className:"h-full overflow-hidden rounded-b-lg",children:e.jsx(Et,{sessionId:b,onDestroy:()=>He(b),pendingCommand:Y,onCommandExecuted:()=>X(null),showToolbar:!0})}):null}),e.jsx(it,{open:he,onOpenChange:te,children:e.jsxs(ct,{className:"max-w-3xl max-h-[85vh] overflow-y-auto",children:[e.jsxs(lt,{children:[e.jsx(ot,{children:"Configure Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Customize the agent's capabilities and configure it's environment."})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(we,{className:"h-4 w-4"}),"Agent"]}),e.jsxs(ke,{value:N,onValueChange:t=>A(t),children:[e.jsx(Ne,{className:"w-full",children:e.jsx(Se,{placeholder:"Select agent"})}),e.jsxs(Ce,{children:[e.jsx($,{value:"claude",children:"Claude Code"}),e.jsx($,{value:"gemini",children:"Google Gemini"}),e.jsx($,{value:"codex",children:"OpenAI Codex"}),e.jsx($,{value:"droid",children:"Factory Droid"}),e.jsx($,{value:"kiro",children:"Kiro"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Te,{className:"h-4 w-4"}),"Skills"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[j.length," of ",U.length," selected"]})]}),e.jsxs(Oe,{children:[e.jsx($e,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:"w-full justify-between",children:[j.length===0?"Select skills...":j.length===U.length?"All skills selected":`${j.length} skill${j.length!==1?"s":""} selected`,e.jsx(Ie,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(_e,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(ze,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Skills"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(w,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),Q(U.map(s=>s.id))},children:"All"}),e.jsx(w,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),Q([])},children:"None"})]})]}),e.jsx(Fe,{}),U.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No skills found"}):U.map(t=>e.jsx(De,{checked:j.includes(t.id),onCheckedChange:s=>{Q(i=>s?i.includes(t.id)?i:[...i,t.id]:i.filter(l=>l!==t.id))},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:t.name}),t.mcpServers.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",t.mcpServers.join(", ")]}),t.mcpServers.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},t.id))]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[S.length," of ",_.length," selected"]})]}),e.jsxs(Oe,{children:[e.jsx($e,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:"w-full justify-between",children:[S.length===0?"Select MCP servers...":S.length===_.length?"All servers selected":`${S.length} server${S.length!==1?"s":""} selected`,e.jsx(Ie,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(_e,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(ze,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Servers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(w,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),B(_)},children:"All"}),e.jsx(w,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),B([])},children:"None"})]})]}),e.jsx(Fe,{}),_.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):_.map(t=>e.jsx(De,{checked:S.includes(t),onCheckedChange:s=>{B(i=>s?i.includes(t)?i:[...i,t]:i.filter(l=>l!==t))},children:t},t))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-md bg-amber-50/50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800",children:[e.jsx(dt,{id:"automation",checked:J,onCheckedChange:t=>ne(t===!0),className:"data-[state=checked]:bg-red-600 data-[state=checked]:border-red-600 data-[state=checked]:text-white border-red-400",disabled:N==="droid"}),e.jsx("label",{htmlFor:"automation",className:"text-sm font-medium text-red-600 dark:text-red-400 cursor-pointer",children:"Full environment access (recommended in secure environments only)"})]}),N==="droid"&&e.jsxs("p",{className:"text-xs text-muted-foreground px-1",children:[e.jsx("span",{className:"font-medium",children:"Droid:"})," Automation level is set in the REPL. Press ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-[10px] font-mono",children:"shift+tab"})," to cycle through Off → Low → Medium → High."]})]}),o&&e.jsx(ht,{title:"Advanced Settings",description:"Configure branch and worktree options",defaultOpen:!1,children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(xe,{className:"text-sm font-medium mb-3 block",children:"Branch Management"}),e.jsxs(xt,{value:V,onValueChange:t=>Pe(t),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ae,{value:"current",id:"branch-current"}),e.jsxs(xe,{htmlFor:"branch-current",className:"cursor-pointer font-normal",children:["Stay on current branch (",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:ue}),")"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ae,{value:"new-branch",id:"branch-new"}),e.jsxs(xe,{htmlFor:"branch-new",className:"cursor-pointer font-normal",children:["Create new branch: ",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:re(r||"")})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ae,{value:"new-worktree",id:"branch-worktree"}),e.jsxs(xe,{htmlFor:"branch-worktree",className:"cursor-pointer font-normal",children:["Create new worktree: ",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:re(r||"")})]})]})]})]})})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(w,{variant:"outline",onClick:()=>te(!1),children:"Close"}),e.jsx(w,{onClick:()=>{if(G.length>500){L("Please shorten the custom instruction to 500 characters.");return}L(null),ge(),te(!1)},children:"Save"})]}),O&&e.jsx("div",{className:"text-xs text-red-600 text-right",children:O})]})]})})]}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-red-600 font-medium",children:"Invalid Task ID"}),e.jsx(w,{onClick:()=>I("/tasks"),className:"mt-4",children:"Back to Tasks"})]})})}function Pt({taskId:r,onStart:k,locationSearch:I}){return a.useEffect(()=>{if(!r)return;const P=new URLSearchParams(I);if(!P.has("autostart"))return;const E=`terminal.autostart.${r}`;if(sessionStorage.getItem(E)==="done")return;sessionStorage.setItem(E,"done");const o=P.get("run")||void 0;k(o||void 0)},[r]),null}export{Yt as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as e,B as w,p as oe,r as a,a3 as Ye,y as Xe,s as Qe,u as et,x as tt,a as rt,T as ve,X as ye,P as je,k as we,l as st,a4 as Be,Z as at,G as nt,D as it,b as ct,d as lt,f as ot,a5 as Oe,a6 as $e,n as Ie,a7 as _e,a8 as ze,a9 as Fe,aa as De,ab as dt,A as de}from"./index-opozMhku.js";import{C as mt,a as ut}from"./card-Btt3HmXT.js";import{B as Je}from"./badge-BmHXIBBB.js";import{S as ke,a as Ne,b as Se,c as Ce,d as $}from"./select-9YyUa5YH.js";import{R as xt,a as Ae}from"./radio-group-DqCmfTij.js";import{C as ht}from"./CollapsibleSection-CUHXgJIe.js";import{L as xe}from"./label-bMzKAcdZ.js";import{u as ft}from"./use-terminal-CSttRkql.js";import{x as gt,a as pt}from"./xterm-DTxiCjtJ.js";import{A as bt}from"./arrow-down-Y539lEoZ.js";/* empty css */import{b as Ge,a as vt,c as yt,d as jt,e as wt}from"./pipeline-builders-Bkf0wt_O.js";import{C as Te}from"./code-kQPD6ttp.js";import{R as kt}from"./refresh-cw-CZLHY6zD.js";import{P as Ee}from"./play-CQk31OJN.js";import{E as Nt}from"./eye-DWC_Vybx.js";import{M as St}from"./message-square-CvZFZAL0.js";import"./index-J8MrpD0P.js";import"./chevron-up-gnoSEbf_.js";var We={exports:{}},Ue;function Ct(){return Ue||(Ue=1,(function(r,k){(function(I,P){r.exports=P()})(self,(()=>(()=>{var I={6:(o,c)=>{function D(C){try{const n=new URL(C),d=n.password&&n.username?`${n.protocol}//${n.username}:${n.password}@${n.host}`:n.username?`${n.protocol}//${n.username}@${n.host}`:`${n.protocol}//${n.host}`;return C.toLocaleLowerCase().startsWith(d.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(c,"__esModule",{value:!0}),c.LinkComputer=c.WebLinkProvider=void 0,c.WebLinkProvider=class{constructor(C,n,d,u={}){this._terminal=C,this._regex=n,this._handler=d,this._options=u}provideLinks(C,n){const d=g.computeLink(C,this._regex,this._terminal,this._handler);n(this._addCallbacks(d))}_addCallbacks(C){return C.map((n=>(n.leave=this._options.leave,n.hover=(d,u)=>{if(this._options.hover){const{range:p}=n;this._options.hover(d,u,p)}},n)))}};class g{static computeLink(n,d,u,p){const M=new RegExp(d.source,(d.flags||"")+"g"),[f,y]=g._getWindowedLineStrings(n-1,u),x=f.join("");let m;const R=[];for(;m=M.exec(x);){const b=m[0];if(!D(b))continue;const[h,Y]=g._mapStrIdx(u,y,0,m.index),[X,K]=g._mapStrIdx(u,h,Y,b.length);if(h===-1||Y===-1||X===-1||K===-1)continue;const H={start:{x:Y+1,y:h+1},end:{x:K,y:X+1}};R.push({range:H,text:b,activate:p})}return R}static _getWindowedLineStrings(n,d){let u,p=n,M=n,f=0,y="";const x=[];if(u=d.buffer.active.getLine(n)){const m=u.translateToString(!0);if(u.isWrapped&&m[0]!==" "){for(f=0;(u=d.buffer.active.getLine(--p))&&f<2048&&(y=u.translateToString(!0),f+=y.length,x.push(y),u.isWrapped&&y.indexOf(" ")===-1););x.reverse()}for(x.push(m),f=0;(u=d.buffer.active.getLine(++M))&&u.isWrapped&&f<2048&&(y=u.translateToString(!0),f+=y.length,x.push(y),y.indexOf(" ")===-1););}return[x,p]}static _mapStrIdx(n,d,u,p){const M=n.buffer.active,f=M.getNullCell();let y=u;for(;p;){const x=M.getLine(d);if(!x)return[-1,-1];for(let m=y;m<x.length;++m){x.getCell(m,f);const R=f.getChars();if(f.getWidth()&&(p-=R.length||1,m===x.length-1&&R==="")){const b=M.getLine(d+1);b&&b.isWrapped&&(b.getCell(0,f),f.getWidth()===2&&(p+=1))}if(p<0)return[d,m]}d++,y=0}return[d,y]}}c.LinkComputer=g}},P={};function E(o){var c=P[o];if(c!==void 0)return c.exports;var D=P[o]={exports:{}};return I[o](D,D.exports,E),D.exports}var W={};return(()=>{var o=W;Object.defineProperty(o,"__esModule",{value:!0}),o.WebLinksAddon=void 0;const c=E(6),D=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(C,n){const d=window.open();if(d){try{d.opener=null}catch{}d.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}o.WebLinksAddon=class{constructor(C=g,n={}){this._handler=C,this._options=n}activate(C){this._terminal=C;const n=this._options,d=n.urlRegex||D;this._linkProvider=this._terminal.registerLinkProvider(new c.WebLinkProvider(this._terminal,d,this._handler,n))}dispose(){this._linkProvider?.dispose()}}})(),W})()))})(We)),We.exports}var At=Ct();function Tt({onJumpToBottom:r,onSendKey:k}){return e.jsxs("div",{className:"w-full border-t border-gray-700/50 bg-[#252525] px-4 py-2.5 flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:r&&e.jsxs(w,{variant:"outline",size:"sm",onClick:r,className:"h-8 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] text-gray-200 hover:text-white transition-colors",title:"Jump to bottom and set focus",children:[e.jsx(bt,{className:"h-3.5 w-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Jump to Bottom"})]})}),k&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>k(""),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-red-900/40 hover:border-red-700 text-gray-200 hover:text-red-300 transition-colors",title:"Send Ctrl+C (interrupt)",children:[e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"⌃"}),e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"C"})]}),e.jsxs("button",{onClick:()=>k(""),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white transition-colors",title:"Send Ctrl+Z (suspend)",children:[e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"⌃"}),e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"Z"})]}),e.jsx("button",{onClick:()=>k("\x1B"),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white transition-colors",title:"Send Escape key",children:e.jsx(oe,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"Esc"})})]})]})}function Et({sessionId:r,onResize:k,onDestroy:I,pendingCommand:P,onCommandExecuted:E,showToolbar:W=!0}){const o=a.useRef(null),c=a.useRef(null),D=a.useRef(null),g=a.useRef(null),[C,n]=a.useState(!1),[d,u]=a.useState(null),[p,M]=a.useState(!0),f=a.useRef(0),y=5,x=a.useRef(null),m=a.useRef(null),R=a.useRef(P??null),b=a.useRef(!1),h=a.useRef(null),Y=a.useRef(E),X=a.useRef(I),K=a.useRef(k);a.useEffect(()=>{Y.current=E},[E]),a.useEffect(()=>{X.current=I},[I]),a.useEffect(()=>{K.current=k},[k]);const H=a.useCallback(N=>{!R.current||b.current||(h.current!==null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{if(!R.current||b.current){h.current=null;return}g.current?.readyState===WebSocket.OPEN&&(g.current.send(JSON.stringify({type:"input",data:R.current+"\r"})),b.current=!0,Y.current?.()),h.current=null},N))},[]);a.useEffect(()=>{if(R.current=P??null,b.current=!1,!R.current){h.current!==null&&(window.clearTimeout(h.current),h.current=null);return}const N=g.current?.readyState===WebSocket.OPEN;return H(N?200:800),()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[P,r,H]),a.useEffect(()=>{n(!1),M(!0),u(null)},[r]),a.useEffect(()=>{if(!o.current||!r)return;const N=T=>{const v=T.getBoundingClientRect();return v.width>0&&v.height>0},A=new gt.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"'IBM Plex Mono', 'Source Code Pro', 'Fira Code', ui-monospace, Menlo, Monaco, monospace",lineHeight:1.35,letterSpacing:.5,convertEol:!0,theme:{background:"#1a1b26",foreground:"#c0caf5",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"#33467c",selectionForeground:"#c0caf5",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}}),_=new pt.FitAddon,fe=new At.WebLinksAddon;A.loadAddon(_),A.loadAddon(fe),A.open(o.current),c.current=A,D.current=_;let S=null,B=null;const U=()=>{if(!A||!A.element||!A.element.parentElement)return;const T=A.cols??0,v=A.rows??0;if(T>0&&v>0){g.current?.readyState===WebSocket.OPEN&&g.current.send(JSON.stringify({type:"resize",cols:T,rows:v}));const O=K.current;O&&O(T,v)}},ae=()=>{const T=o.current;if(T&&N(T)&&!(!A||!A.element||!A.element.parentElement))try{const v=T.getBoundingClientRect();if(v.width<10||v.height<10)return;_.fit(),U()}catch(v){console.warn("xterm fit() failed, will retry if needed:",v)}},j=()=>{S&&cancelAnimationFrame(S),S=requestAnimationFrame(()=>{ae()})},Q=()=>{if(!r)return;x.current&&(window.clearTimeout(x.current),x.current=null);const T=`${Ye}/ws/terminal/${r}`,v=new WebSocket(T);return g.current=v,v.onopen=()=>{n(!0),u(null),f.current=0,console.log("Terminal WebSocket connected"),m.current&&window.clearInterval(m.current),m.current=window.setInterval(()=>{v.readyState===WebSocket.OPEN&&v.send(JSON.stringify({type:"keepalive"}))},120*1e3),j(),setTimeout(()=>{M(!1),j(),setTimeout(()=>j(),50),setTimeout(()=>j(),150)},400),H(1200)},v.onmessage=O=>{try{const L=JSON.parse(O.data);switch(L.type){case"snapshot":if(typeof L.data=="string"&&L.data.length&&c.current){const z=c.current;z.write(L.data,()=>{z.scrollToBottom()})}break;case"data":if(c.current){const z=c.current,V=z.buffer.active.viewportY+z.rows>=z.buffer.active.baseY+z.buffer.active.cursorY;z.write(L.data,()=>{V&&z.scrollToBottom()})}break;case"exit":c.current&&c.current.write(`\r
|
|
2
|
+
\x1B[31mProcess exited with code ${L.exitCode}\x1B[0m\r
|
|
3
|
+
`),X.current?.();break}}catch(L){console.error("Error parsing WebSocket message:",L)}},v.onclose=O=>{if(n(!1),console.log("Terminal WebSocket disconnected",O.code,O.reason),m.current&&(window.clearInterval(m.current),m.current=null),O.code!==1e3&&f.current<y&&r){f.current++;const L=Math.min(1e3*Math.pow(2,f.current-1),1e4);console.log(`Attempting to reconnect (${f.current}/${y}) in ${L}ms`),x.current=window.setTimeout(()=>{Q()},L)}else f.current>=y&&u("Connection lost. Please refresh the page to reconnect.")},v.onerror=O=>{console.error("Terminal WebSocket error:",O),f.current===0&&u("WebSocket connection failed")},v};Q(),A.onData(T=>{g.current?.readyState===WebSocket.OPEN&&g.current.send(JSON.stringify({type:"input",data:T}))});const J=()=>{j()},ne=new ResizeObserver(J);o.current&&ne.observe(o.current),window.addEventListener("resize",J),window.addEventListener("orientationchange",J);const G=()=>{document.visibilityState==="visible"&&(B&&clearTimeout(B),B=window.setTimeout(()=>{j()},50))};document.addEventListener("visibilitychange",G);let ie=0;const ce=20,me=()=>{const T=o.current;if(T){if(N(T)){ae();return}ie+=1,ie<ce?S=requestAnimationFrame(me):B=window.setTimeout(()=>{ae()},100)}};return S=requestAnimationFrame(me),()=>{ne.disconnect(),window.removeEventListener("resize",J),window.removeEventListener("orientationchange",J),document.removeEventListener("visibilitychange",G),S&&cancelAnimationFrame(S),B&&clearTimeout(B),x.current&&(window.clearTimeout(x.current),x.current=null),m.current&&(window.clearInterval(m.current),m.current=null),g.current?.readyState===WebSocket.OPEN&&g.current.close(),h.current!==null&&(window.clearTimeout(h.current),h.current=null),A.dispose()}},[r,H]);const he=a.useCallback(()=>{c.current&&(c.current.scrollToBottom(),c.current.focus())},[]),te=a.useCallback(N=>{g.current?.readyState===WebSocket.OPEN&&(g.current.send(JSON.stringify({type:"input",data:N})),c.current&&c.current.focus())},[]);return d?e.jsx("div",{className:"flex items-center justify-center h-full bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-red-600 font-medium",children:"Terminal Connection Error"}),e.jsx("div",{className:"text-red-500 text-sm mt-1",children:d})]})}):e.jsxs("div",{className:"relative h-full flex flex-col bg-[#1a1b26] overflow-hidden",children:[!C&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1a1b26] bg-opacity-95 z-10 backdrop-blur-sm",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),e.jsx("div",{className:"text-gray-300 mt-2",children:"Connecting to terminal..."})]})}),C&&p&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1a1b26] bg-opacity-50 z-10 transition-opacity duration-300 backdrop-blur-sm",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-pulse rounded-full h-6 w-6 bg-blue-500 mx-auto"}),e.jsx("div",{className:"text-gray-300 text-sm mt-2",children:"Loading terminal..."})]})}),e.jsx("div",{ref:o,className:"flex-1 w-full overflow-hidden",style:{minHeight:"400px"}}),W&&e.jsx(Tt,{onJumpToBottom:he,onSendKey:te})]})}const Wt=r=>r?Array.isArray(r)?r.filter(k=>typeof k=="string").map(k=>k.trim()).filter(Boolean):typeof r=="string"?r.split(",").map(k=>k.trim()).filter(Boolean):[]:[];function Yt(){const{taskId:r}=Xe(),k=Qe(),I=et(),[P]=tt(),{toast:E}=rt(),W=r?.startsWith("session-"),o=a.useMemo(()=>!!r&&r.startsWith("cp-"),[r]),c=a.useMemo(()=>!!r&&r.startsWith("sk-"),[r]),D=P.get("reviewOnly")==="true",g=P.get("startOnly")==="true",C=o&&!g,n=!D,d=a.useMemo(()=>c&&r?r.replace("sk-",""):null,[c,r]),{sessions:u,loading:p,error:M,createSession:f,destroySession:y,refreshSessions:x}=ft(),[m,R]=a.useState([]),[b,h]=a.useState(null),[Y,X]=a.useState(null),[K,H]=a.useState("claude"),[he,te]=a.useState(!1),[N,A]=a.useState("claude"),[_,fe]=a.useState([]),[S,B]=a.useState([]),[U,ae]=a.useState([]),[j,Q]=a.useState([]),[J,ne]=a.useState(!0),[G,ie]=a.useState(""),[ce,me]=a.useState(!1),[T,v]=a.useState({}),[O,L]=a.useState(null),z=a.useRef([]),[V,Pe]=a.useState("current"),[ue,Ve]=a.useState("main"),ee=a.useMemo(()=>r?`terminal.cp.config.${r}`:null,[r]);a.useEffect(()=>{if(!(!o&&!c||!ee))try{const t=localStorage.getItem(ee);if(t){const s=JSON.parse(t);s.cliAgent&&A(s.cliAgent),Array.isArray(s.selectedMcpServers)&&B(s.selectedMcpServers),Array.isArray(s.selectedSkillIds)&&Q(s.selectedSkillIds),typeof s.automationEnabled=="boolean"&&ne(s.automationEnabled),typeof s.customInstruction=="string"&&ie(s.customInstruction),typeof s.createWorktree=="boolean"&&me(s.createWorktree),s.branchMode&&Pe(s.branchMode)}}catch{console.error("Failed to load config",ee)}},[o,c,ee]);const ge=a.useCallback(()=>{if(!ee)return;const t={cliAgent:N,selectedMcpServers:S,selectedSkillIds:j,automationEnabled:J,customInstruction:G,createWorktree:ce,branchMode:V};try{localStorage.setItem(ee,JSON.stringify(t))}catch{console.error("Failed to persist config",ee)}},[ee,N,S,j,J,G,ce,V]);a.useEffect(()=>{ge()},[G,ge]);const re=t=>`feat/cp-${t.startsWith("cp-")?t.slice(5):t}`,qe=async t=>{try{const s=re(t),l=await(await fetch(`${de}/api/v1/git/branches`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,from:ue})})).json();if(!l.success){const F=l.error?.message||"Unknown error";return E({title:"Branch creation failed",description:F,variant:"destructive"}),!1}return E({title:"Branch created",description:`Created branch: ${s}`}),!0}catch{return E({title:"Branch creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}},Le=async t=>{try{const s=re(t),l=await(await fetch(`${de}/api/v1/git/worktrees`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:s,from:ue})})).json();if(!l.success){const F=l.error?.message||"Unknown error";return E({title:"Worktree creation failed",description:F,variant:"destructive"}),!1}return E({title:"Worktree created",description:`Created branch: ${s}`}),!0}catch{return E({title:"Worktree creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}};a.useEffect(()=>{(o||c)&&r&&(async()=>{try{const s=await fetch(`${de}/api/v1/git/status`);if(s.ok){const l=await s.json();l?.success&&l.data?.branch&&Ve(l.data.branch)}const i=await fetch(`${de}/api/v1/mcp`);if(i.ok){const l=await i.json();l?.success&&Array.isArray(l.servers)&&(fe(l.servers),B(F=>F.filter(q=>l.servers.includes(q))),l.mcpServers&&typeof l.mcpServers=="object"&&v(l.mcpServers))}}catch(s){console.error("Failed to load MCP servers",s)}try{const s=await fetch(`${de}/api/v1/skills`);if(s.ok){const i=await s.json(),F=(Array.isArray(i?.documents)?i.documents:[]).map(q=>({id:q.id,name:q?.metadata?.name||q.id,mcpServers:Wt(q?.metadata?.metadata?.mcpServers)}));ae(F),Q(q=>{const le=q.filter(Z=>F.some(be=>be.id===Z));if(c&&d&&le.length===0){const Z=F.find(be=>be.id===d);if(Z)return[Z.id]}return le})}}catch(s){console.error("Failed to load skills",s)}})()},[o,c,r,d]),a.useEffect(()=>{const t=z.current,s=j.filter(i=>!t.includes(i));s.length>0&&B(i=>{const l=new Set(i),F=_.length>0?new Set(_):void 0;return s.forEach(q=>{const le=U.find(Z=>Z.id===q);le&&le.mcpServers.forEach(Z=>{(!F||F.has(Z))&&l.add(Z)})}),Array.from(l)}),z.current=j},[j,U,_]),a.useEffect(()=>{r&&x(r)},[r,x]),a.useEffect(()=>{if(!r)return;const s=u.filter(i=>i.taskId===r).map(i=>i.id);R(s),!b&&s.length>0&&h(s[0]),b&&!s.includes(b)&&h(s.length>0?s[0]:null)},[u,r,b]);const se=async t=>{if(!r)return;const s=t||void 0,i=await f(r,s);i&&(h(i),!s&&t&&X(t),setTimeout(()=>x(r),100))},Me=(t,s)=>{const l={taskId:r,contextType:s??(o?"change-task":c?"skill":"general"),selectedMcpServers:S,selectedSkillIds:j,automationEnabled:J,customInstruction:G};switch(t){case"claude":return Ge(l);case"gemini":return wt(l);case"codex":return jt(l);case"droid":return yt(l);case"kiro":return vt(l);default:return Ge(l)}},pe=async()=>{o&&r&&(V==="new-branch"?await qe(r)||console.warn("Branch creation failed, continuing with terminal creation"):V==="new-worktree"&&(await Le(r)||console.warn("Worktree creation failed, continuing with terminal creation"))),o&&ce&&V==="current"&&r&&(await Le(r)||console.warn("Worktree creation failed, continuing with terminal creation"));const s=Me(o||c?N:K);await se(s)},Ke=async()=>{const s=Me(N,"prepare-task");await se(s)},Re=async t=>{if(await y(t)&&b===t){const i=m.filter(l=>l!==t);i.length>0?h(i[0]):r?.startsWith("session-")?I("/agents"):h(null)}},He=t=>{Re(t)},Ze=async()=>{for(const t of m)await y(t);I("/agents")};return r?e.jsxs("div",{className:"flex flex-col h-full",children:[W&&m.length===0&&r&&e.jsx(Pt,{taskId:r,onStart:se,locationSearch:k.search}),e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-lg",children:o||c?e.jsx(Te,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):e.jsx(ve,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:W?"Terminal":"Agent Session"}),!W&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r}),W&&e.jsxs("span",{className:"text-sm text-gray-500 font-mono",children:["(",r,")"]})]})]})}),e.jsx("div",{className:"flex items-center gap-2 sm:gap-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>r&&x(r),disabled:p,className:"bg-white dark:bg-gray-800",children:[e.jsx(kt,{className:`h-4 w-4 sm:mr-2 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),e.jsx(w,{size:"sm",variant:"destructive",onClick:Ze,title:"Close session","aria-label":"Close session",className:"h-9 w-9 p-0",children:e.jsx(ye,{className:"h-4 w-4"})}),!W&&!o&&!c&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ke,{value:K,onValueChange:H,children:[e.jsx(Ne,{className:"w-24",children:e.jsx(Se,{})}),e.jsxs(Ce,{children:[e.jsx($,{value:"claude",children:"Claude Code"}),e.jsx($,{value:"gemini",children:"Google Gemini"}),e.jsx($,{value:"codex",children:"OpenAI Codex"}),e.jsx($,{value:"kiro",children:"Kiro"})]})]}),e.jsxs(w,{onClick:pe,disabled:p,size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ee,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Start Agent"})]})]}),!o&&!c&&(!W||m.length===0)&&e.jsxs(w,{onClick:()=>se(),disabled:p,size:"sm",children:[e.jsx(je,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"New Terminal"})]})]})})]}),M&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-1.5 bg-red-100 dark:bg-red-900/40 rounded-lg flex-shrink-0",children:e.jsx(ye,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),e.jsx("div",{className:"text-red-800 dark:text-red-200 text-sm font-medium",children:M})]})}),m.length>0&&e.jsx("div",{className:"flex items-center gap-1 border-b dark:border-gray-700",children:m.map(t=>{const s=u.find(l=>l.id===t),i=b===t;return e.jsxs("div",{className:`flex items-center gap-2 px-4 py-3 border-b-1 cursor-pointer rounded-t-lg transition-all duration-200 ${i?"border-gray-400 bg-white dark:bg-gray-800 dark:border-gray-500 shadow-sm":"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800 hover:border-gray-300"}`,onClick:()=>h(t),children:[e.jsx("div",{className:`p-1.5 rounded-md ${i?"bg-gray-200 dark:bg-gray-700":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(ve,{className:`h-3.5 w-3.5 ${i?"text-gray-700 dark:text-gray-300":"text-gray-600 dark:text-gray-400"}`})}),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["Terminal ",t.split("-").slice(-1)[0].substring(0,6)]}),e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s?.connected?"bg-green-500":"bg-gray-400"}`}),e.jsx(w,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-red-100 dark:hover:bg-red-900/30 rounded-md opacity-60 hover:opacity-100 transition-opacity",onClick:l=>{l.stopPropagation(),Re(t)},children:e.jsx(ye,{className:"h-3 w-3"})})]},t)})}),e.jsx("div",{className:"flex-1 min-h-0",children:m.length===0?e.jsx(mt,{className:"h-full",children:e.jsx(ut,{className:"flex items-center justify-center h-full p-8",children:e.jsxs("div",{className:"text-center w-full max-w-[33vw] min-w-[400px]",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full w-fit mx-auto mb-2",children:o||c?e.jsx(we,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"}):e.jsx(ve,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"Prepare Agent"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6 leading-relaxed",children:W?"Create a new terminal session":e.jsxs(e.Fragment,{children:["Configure the agent to start working on ",r,"."]})}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[!W&&!o&&!c&&e.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[e.jsxs("div",{className:"w-full space-y-3",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Choose your AI agent"}),e.jsxs(ke,{value:K,onValueChange:H,children:[e.jsx(Ne,{className:"w-full h-11 bg-white dark:bg-gray-800",children:e.jsx(Se,{})}),e.jsxs(Ce,{children:[e.jsx($,{value:"claude",children:"Claude Code (default)"}),e.jsx($,{value:"gemini",children:"Google Gemini"}),e.jsx($,{value:"codex",children:"OpenAI Codex"}),e.jsx($,{value:"kiro",children:"Kiro"})]})]})]}),e.jsxs(w,{onClick:pe,disabled:p,className:"bg-green-600 hover:bg-green-700 w-full h-11 text-base font-medium",size:"lg",children:[e.jsx(Ee,{className:"h-5 w-5 mr-2"}),"Start Agent"]}),e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"}),e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 font-medium",children:"or"}),e.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"})]}),e.jsxs(w,{onClick:()=>se(),disabled:p,variant:"outline",className:"w-full h-11 bg-white dark:bg-gray-800",size:"lg",children:[e.jsx(je,{className:"h-5 w-5 mr-2"}),"New Terminal"]})]}),!W&&(o||c)&&e.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[C&&e.jsxs(w,{onClick:Ke,disabled:p,className:"w-full bg-blue-600 hover:bg-blue-700 h-11 text-base font-medium",size:"lg",children:[e.jsx(Nt,{className:"h-5 w-5 mr-2"}),"Review & Prepare"]}),e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsxs(w,{variant:"outline",onClick:()=>te(!0),className:"flex-1 h-11 bg-white dark:bg-gray-800",size:"lg",children:[e.jsx(st,{className:"h-5 w-5 mr-2"}),"Configure"]}),n&&e.jsxs(w,{onClick:pe,disabled:p,className:"flex-1 bg-green-600 hover:bg-green-700 h-11 text-base font-medium",size:"lg",children:[e.jsx(Ee,{className:"h-5 w-5 mr-2"}),"Start Agent"]})]}),e.jsxs("div",{className:"w-full space-y-3",children:[e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-500 dark:text-gray-400",children:"Agent Configuration"}),e.jsxs("div",{className:"text-left text-sm text-gray-700 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Agent:"}),e.jsx("span",{className:"font-mono text-sm",children:N==="claude"?"Claude Code":N.charAt(0).toUpperCase()+N.slice(1)})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Te,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Skills:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:j.length?j.map(t=>{const s=U.find(i=>i.id===t);return e.jsx(Je,{variant:"secondary",className:"font-mono text-xs",children:s?.name||t},t)}):e.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Be,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"MCP Servers:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:S.length?S.map(t=>e.jsx(Je,{variant:"secondary",className:"font-mono text-xs",children:t},t)):e.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(at,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Full Environment Access:"}),e.jsx("span",{className:"font-mono text-sm",children:J?"Enabled":"Disabled"})]}),o&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(nt,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Branch:"}),e.jsx("span",{className:"font-mono text-sm",children:V==="current"?`Current (${ue})`:V==="new-branch"?`New branch (${re(r||"")})`:`New worktree (${re(r||"")})`})]})]}),e.jsxs("div",{className:"text-left",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2 text-gray-700 dark:text-gray-300",children:[e.jsx(St,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),"Additional Instructions"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[G.length,"/500"]})]}),e.jsx("textarea",{className:"w-full min-h-[80px] rounded-md border p-3 text-sm bg-gray-50 dark:bg-gray-900/50 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 resize-none",placeholder:"Add specific instructions to guide the agent...",value:G,onChange:t=>ie(t.target.value),rows:3}),G.length>500&&e.jsx("div",{className:"text-xs text-red-600 mt-1",children:"Custom instruction is too long (max 500 characters)"})]})]})]}),W&&m.length===0&&e.jsx("div",{className:"p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:e.jsxs(w,{onClick:()=>se(),disabled:p,className:"w-full h-11 text-base font-medium",size:"lg",children:[e.jsx(je,{className:"h-5 w-5 mr-2"}),"New Terminal"]})})]})]})})}):b?e.jsx("div",{className:"h-full overflow-hidden rounded-b-lg",children:e.jsx(Et,{sessionId:b,onDestroy:()=>He(b),pendingCommand:Y,onCommandExecuted:()=>X(null),showToolbar:!0})}):null}),e.jsx(it,{open:he,onOpenChange:te,children:e.jsxs(ct,{className:"max-w-3xl max-h-[85vh] overflow-y-auto",children:[e.jsxs(lt,{children:[e.jsx(ot,{children:"Configure Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Customize the agent's capabilities and configure it's environment."})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(we,{className:"h-4 w-4"}),"Agent"]}),e.jsxs(ke,{value:N,onValueChange:t=>A(t),children:[e.jsx(Ne,{className:"w-full",children:e.jsx(Se,{placeholder:"Select agent"})}),e.jsxs(Ce,{children:[e.jsx($,{value:"claude",children:"Claude Code"}),e.jsx($,{value:"gemini",children:"Google Gemini"}),e.jsx($,{value:"codex",children:"OpenAI Codex"}),e.jsx($,{value:"droid",children:"Factory Droid"}),e.jsx($,{value:"kiro",children:"Kiro"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Te,{className:"h-4 w-4"}),"Skills"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[j.length," of ",U.length," selected"]})]}),e.jsxs(Oe,{children:[e.jsx($e,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:"w-full justify-between",children:[j.length===0?"Select skills...":j.length===U.length?"All skills selected":`${j.length} skill${j.length!==1?"s":""} selected`,e.jsx(Ie,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(_e,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(ze,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Skills"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(w,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),Q(U.map(s=>s.id))},children:"All"}),e.jsx(w,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),Q([])},children:"None"})]})]}),e.jsx(Fe,{}),U.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No skills found"}):U.map(t=>e.jsx(De,{checked:j.includes(t.id),onCheckedChange:s=>{Q(i=>s?i.includes(t.id)?i:[...i,t.id]:i.filter(l=>l!==t.id))},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:t.name}),t.mcpServers.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",t.mcpServers.join(", ")]}),t.mcpServers.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},t.id))]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[S.length," of ",_.length," selected"]})]}),e.jsxs(Oe,{children:[e.jsx($e,{asChild:!0,children:e.jsxs(w,{variant:"outline",className:"w-full justify-between",children:[S.length===0?"Select MCP servers...":S.length===_.length?"All servers selected":`${S.length} server${S.length!==1?"s":""} selected`,e.jsx(Ie,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(_e,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(ze,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Servers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(w,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),B(_)},children:"All"}),e.jsx(w,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),B([])},children:"None"})]})]}),e.jsx(Fe,{}),_.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):_.map(t=>e.jsx(De,{checked:S.includes(t),onCheckedChange:s=>{B(i=>s?i.includes(t)?i:[...i,t]:i.filter(l=>l!==t))},children:t},t))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-md bg-amber-50/50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800",children:[e.jsx(dt,{id:"automation",checked:J,onCheckedChange:t=>ne(t===!0),className:"data-[state=checked]:bg-red-600 data-[state=checked]:border-red-600 data-[state=checked]:text-white border-red-400",disabled:N==="droid"}),e.jsx("label",{htmlFor:"automation",className:"text-sm font-medium text-red-600 dark:text-red-400 cursor-pointer",children:"Full environment access (recommended in secure environments only)"})]}),N==="droid"&&e.jsxs("p",{className:"text-xs text-muted-foreground px-1",children:[e.jsx("span",{className:"font-medium",children:"Droid:"})," Automation level is set in the REPL. Press ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-[10px] font-mono",children:"shift+tab"})," to cycle through Off → Low → Medium → High."]})]}),o&&e.jsx(ht,{title:"Advanced Settings",description:"Configure branch and worktree options",defaultOpen:!1,children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(xe,{className:"text-sm font-medium mb-3 block",children:"Branch Management"}),e.jsxs(xt,{value:V,onValueChange:t=>Pe(t),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ae,{value:"current",id:"branch-current"}),e.jsxs(xe,{htmlFor:"branch-current",className:"cursor-pointer font-normal",children:["Stay on current branch (",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:ue}),")"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ae,{value:"new-branch",id:"branch-new"}),e.jsxs(xe,{htmlFor:"branch-new",className:"cursor-pointer font-normal",children:["Create new branch: ",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:re(r||"")})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ae,{value:"new-worktree",id:"branch-worktree"}),e.jsxs(xe,{htmlFor:"branch-worktree",className:"cursor-pointer font-normal",children:["Create new worktree: ",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:re(r||"")})]})]})]})]})})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(w,{variant:"outline",onClick:()=>te(!1),children:"Close"}),e.jsx(w,{onClick:()=>{if(G.length>500){L("Please shorten the custom instruction to 500 characters.");return}L(null),ge(),te(!1)},children:"Save"})]}),O&&e.jsx("div",{className:"text-xs text-red-600 text-right",children:O})]})]})})]}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-red-600 font-medium",children:"Invalid Task ID"}),e.jsx(w,{onClick:()=>I("/tasks"),className:"mt-4",children:"Back to Tasks"})]})})}function Pt({taskId:r,onStart:k,locationSearch:I}){return a.useEffect(()=>{if(!r)return;const P=new URLSearchParams(I);if(!P.has("autostart"))return;const E=`terminal.autostart.${r}`;if(sessionStorage.getItem(E)==="done")return;sessionStorage.setItem(E,"done");const o=P.get("run")||void 0;k(o||void 0)},[r]),null}export{Yt as default};
|