@lovelybunch/api 1.0.76-alpha.8 → 1.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/lib/git.d.ts +3 -0
  2. package/dist/lib/git.js +35 -0
  3. package/dist/routes/api/v1/ai/route.js +214 -152
  4. package/dist/routes/api/v1/config/route.js +13 -9
  5. package/dist/routes/api/v1/context/agents/route.js +159 -0
  6. package/dist/routes/api/v1/context/index.js +6 -4
  7. package/dist/routes/api/v1/context/memory/route.js +163 -0
  8. package/dist/routes/api/v1/context/team/route.js +159 -0
  9. package/dist/routes/api/v1/git/index.js +27 -1
  10. package/dist/routes/api/v1/jobs/[id]/route.d.ts +26 -32
  11. package/dist/routes/api/v1/jobs/[id]/route.js +3 -3
  12. package/dist/routes/api/v1/jobs/route.d.ts +33 -33
  13. package/dist/routes/api/v1/jobs/route.js +17 -2
  14. package/dist/routes/api/v1/mcp/index.js +194 -21
  15. package/dist/routes/api/v1/resources/generate/route.js +10 -3
  16. package/package.json +4 -4
  17. package/static/assets/ActivityPage-sJEQn6DK.js +1 -0
  18. package/static/assets/AgentsContextEditPage-DU3qIXk9.js +9 -0
  19. package/static/assets/AgentsContextPage-tJ-LhFYb.js +1 -0
  20. package/static/assets/{ApiKeysSettingsPage-BhaH6ZYP.js → ApiKeysSettingsPage-Bg84BQHV.js} +2 -2
  21. package/static/assets/{AuthSettingsPage-D0MQlHyh.js → AuthSettingsPage-Bwr7uP3z.js} +1 -1
  22. package/static/assets/{CallbackPage-Bz4m3_W8.js → CallbackPage-BFn0Np2S.js} +1 -1
  23. package/static/assets/CodePage-kp4s3wCJ.js +2 -0
  24. package/static/assets/{CollapsibleSection-CxX11hr-.js → CollapsibleSection-CNs1mvsZ.js} +1 -1
  25. package/static/assets/{DashboardPage-B3HR1UM7.js → DashboardPage-DMJSzzgD.js} +9 -19
  26. package/static/assets/{GitPage-Dm36PRw_.js → GitPage-uqene8zj.js} +3 -3
  27. package/static/assets/{GitSettingsPage-CRWcjgVI.js → GitSettingsPage-CLswbZsT.js} +2 -2
  28. package/static/assets/{IdentityPage-YCkmdyzR.js → IdentityPage-BDTPXEo7.js} +2 -2
  29. package/static/assets/{ImplementationStepsEditor-u3dPxmKW.js → ImplementationStepsEditor-D4cvhPhz.js} +2 -2
  30. package/static/assets/IntegrationsSettingsPage-o7NXZGt9.js +1 -0
  31. package/static/assets/JobDetailPage-DuEiPz6X.js +1 -0
  32. package/static/assets/KnowledgeDetailPage-DFVud_VC.js +1 -0
  33. package/static/assets/{KnowledgeEditPage-DhrF6UPg.js → KnowledgeEditPage-XG6HKK7E.js} +1 -1
  34. package/static/assets/{KnowledgePage-_gZhpTe3.js → KnowledgePage-B2zI3xwW.js} +2 -2
  35. package/static/assets/{LoginPage-Cc1Ac2j4.js → LoginPage-CUJRxwXy.js} +1 -1
  36. package/static/assets/MailInboxPage-BlCG-tba.js +1 -0
  37. package/static/assets/MailProcessingModal-BJIdHOqK.js +1 -0
  38. package/static/assets/MailReadPage-MoNo_gmW.js +1 -0
  39. package/static/assets/{MailSentPage-Dj63oQ5D.js → MailSentPage-QzpuIJmT.js} +1 -1
  40. package/static/assets/{McpSettingsPage-DYZ0QNbp.js → McpSettingsPage-BZcCGkGM.js} +1 -1
  41. package/static/assets/MemoryEditPage-DXSQoCT4.js +13 -0
  42. package/static/assets/MemoryPage-oBnyuvSf.js +1 -0
  43. package/static/assets/NewKnowledgePage-deMsezK8.js +1 -0
  44. package/static/assets/{NewSkillPage-BEn18f2A.js → NewSkillPage-DRYWdrlV.js} +1 -1
  45. package/static/assets/{NewTaskPage-CSlncpI5.js → NewTaskPage-B6xdic5_.js} +2 -2
  46. package/static/assets/{NotFoundPage-C4x0lGai.js → NotFoundPage-Bxu9uKFO.js} +1 -1
  47. package/static/assets/{NotificationsSettingsPage-C9YnfRlj.js → NotificationsSettingsPage-CLgtsCVM.js} +1 -1
  48. package/static/assets/{PromptsSettingsPage-Chc4da1S.js → PromptsSettingsPage-BWaELCjG.js} +1 -1
  49. package/static/assets/{ResourceDetailPage-DDYKQxpM.js → ResourceDetailPage-CMPDRdVM.js} +1 -1
  50. package/static/assets/ResourcesPage-DspYILfG.js +41 -0
  51. package/static/assets/{RoleEditPage-Ccfu1tn1.js → RoleEditPage-DXtzicVZ.js} +1 -1
  52. package/static/assets/{RolePage-CcdEUjSm.js → RolePage-DafGURGp.js} +1 -1
  53. package/static/assets/{RulesSettingsPage-Cz1g_eAj.js → RulesSettingsPage-E8V9cexV.js} +1 -1
  54. package/static/assets/RunDetailPage-DsxkqFst.js +1 -0
  55. package/static/assets/SchedulePage-B2YvNDHr.js +4 -0
  56. package/static/assets/{SkillDetailPage-sJg-L8A8.js → SkillDetailPage-CWkqSfuT.js} +1 -1
  57. package/static/assets/{SkillEditPage-BksV7GmD.js → SkillEditPage-DwyebzFV.js} +1 -1
  58. package/static/assets/{SkillsPage-CwarkJmZ.js → SkillsPage-CauK65X_.js} +2 -2
  59. package/static/assets/{SkillsSettingsPage-DTnBlBdE.js → SkillsSettingsPage-DXMRv3jR.js} +1 -1
  60. package/static/assets/{SourceInput-CWazIr6v.js → SourceInput-C0iKqbQ1.js} +1 -1
  61. package/static/assets/{TagInput-Bgyxb_JU.js → TagInput-Ct-WRvTs.js} +1 -1
  62. package/static/assets/{TaskDetailPage-DlmG1kZR.js → TaskDetailPage-CApk2iBh.js} +1 -1
  63. package/static/assets/{TaskEditPage-BnpNeed_.js → TaskEditPage-NgOVShfK.js} +1 -1
  64. package/static/assets/{TasksPage-CXeTMpgy.js → TasksPage-BoPrP_Rl.js} +3 -3
  65. package/static/assets/TeamEditPage-ChY6mYm8.js +9 -0
  66. package/static/assets/TeamPage-DH-dJhFG.js +1 -0
  67. package/static/assets/{TerminalPage-BLcPt381.js → TerminalPage-CRhcscF2.js} +1 -1
  68. package/static/assets/TerminalSessionPage-CSCQg2sn.js +3 -0
  69. package/static/assets/{UserPreferencesPage-BNwEqlRW.js → UserPreferencesPage-DxCSWJnS.js} +1 -1
  70. package/static/assets/{UserSettingsPage-BRafqkiD.js → UserSettingsPage-DKkOLNPV.js} +1 -1
  71. package/static/assets/UtilitiesPage-CBNSvixW.js +1 -0
  72. package/static/assets/{alert-Ci2-OWZ_.js → alert-Dw_RSroN.js} +1 -1
  73. package/static/assets/{arrow-down-C6Flf0DF.js → arrow-down-UClxXzT-.js} +1 -1
  74. package/static/assets/{arrow-left-7TCkaJlN.js → arrow-left-DWmf9YJp.js} +1 -1
  75. package/static/assets/{arrow-up-down-tqbfiBy6.js → arrow-up-down-Btc3okb3.js} +1 -1
  76. package/static/assets/{arrow-up-DeQAxOPq.js → arrow-up-fLCh7Hvh.js} +1 -1
  77. package/static/assets/{badge-D4vHU_w_.js → badge-vIqE5SOP.js} +1 -1
  78. package/static/assets/{browser-modal-BiaqhKHm.js → browser-modal-DgMJTsMd.js} +2 -2
  79. package/static/assets/{card-xkODbJy-.js → card-DPLdBoa5.js} +1 -1
  80. package/static/assets/{chevron-left-CvpfJBPQ.js → chevron-left-CiNaLX-v.js} +1 -1
  81. package/static/assets/{chevron-up-BB-6OS4z.js → chevron-up-DFd-7wxW.js} +1 -1
  82. package/static/assets/{chevrons-up-CLKrQHMU.js → chevrons-up-BfU70OcQ.js} +1 -1
  83. package/static/assets/{circle-alert-lnP0-w3N.js → circle-alert-Mv00T-P2.js} +1 -1
  84. package/static/assets/{circle-check-big-Dbo-OmWQ.js → circle-check-big-BEY1IoIP.js} +1 -1
  85. package/static/assets/{circle-check-BPkEav83.js → circle-check-xMiP6SLO.js} +1 -1
  86. package/static/assets/{circle-play-BbtBIeo3.js → circle-play-iZZwaGbV.js} +1 -1
  87. package/static/assets/{circle-x-BBwi8e5G.js → circle-x-z3iynaE7.js} +1 -1
  88. package/static/assets/{clipboard-Ce816tAO.js → clipboard-C8wZRPDH.js} +1 -1
  89. package/static/assets/{clock-BIeoO5Mt.js → clock-C_9shc08.js} +1 -1
  90. package/static/assets/{code-DTW3giBe.js → code-DH-sRhus.js} +1 -1
  91. package/static/assets/{download-BgKxfry9.js → download-CE8b59ER.js} +1 -1
  92. package/static/assets/{external-link--RjKXREe.js → external-link-DPyKt8NE.js} +1 -1
  93. package/static/assets/{eye--K-OgK7L.js → eye-BpGD-yoS.js} +1 -1
  94. package/static/assets/{folder-git-2-Bgv7r0zC.js → folder-git-2-BIw4zbmy.js} +1 -1
  95. package/static/assets/globe-CUo7eHKN.js +6 -0
  96. package/static/assets/{index-Di7xMYoG.js → index-B07hel4U.js} +1 -1
  97. package/static/assets/{index-DF_KNbKf.js → index-BCwmQxLC.js} +1 -1
  98. package/static/assets/{index-D9xZafJb.js → index-BOKaM9K-.js} +1 -1
  99. package/static/assets/{index-Cd5hBt4x.js → index-BaR4iUzg.js} +1 -1
  100. package/static/assets/index-BcCuKdbf.css +1 -0
  101. package/static/assets/{index-Db5-BoCU.js → index-Bfb3OTwj.js} +1 -1
  102. package/static/assets/{index-Do92mBFr.js → index-Bkt1rQVV.js} +1 -1
  103. package/static/assets/{index-BD9UBXsr.js → index-C65b3D5_.js} +1 -1
  104. package/static/assets/{index-BbrX1XcC.js → index-CGbmjmEy.js} +1 -1
  105. package/static/assets/{index-4RuWYO4M.js → index-CTouvf2d.js} +1 -1
  106. package/static/assets/{index-Dt_WtbUU.js → index-Cdwx6Zps.js} +1 -1
  107. package/static/assets/{index-iIFwHD3L.js → index-ClO9-JVh.js} +1 -1
  108. package/static/assets/{index-BteQHbZ1.js → index-CpJ0uBf3.js} +1 -1
  109. package/static/assets/{index-LMsLdXw_.js → index-CsBxEWw5.js} +1 -1
  110. package/static/assets/{index-CW9pK_cZ.js → index-DZAYfTI2.js} +1 -1
  111. package/static/assets/{index-BkEdELOI.js → index-Dkr9CBL7.js} +1 -1
  112. package/static/assets/{index-BQYB8kWb.js → index-DnZKG-_7.js} +1 -1
  113. package/static/assets/index-UXL5-kaP.js +497 -0
  114. package/static/assets/{index-Ch4GVR8L.js → index-iB8oed57.js} +1 -1
  115. package/static/assets/{index-R44k73Ca.js → index-jaRIZ6SY.js} +1 -1
  116. package/static/assets/{info-DgZN3xWF.js → info-D-UNBNx2.js} +1 -1
  117. package/static/assets/{label-DvPENm3h.js → label-8VKluf9w.js} +1 -1
  118. package/static/assets/{markdown-editor-DpZxV-fa.js → markdown-editor-DBdRsbP2.js} +3 -3
  119. package/static/assets/{message-square-CoaQYehb.js → message-square-CO8kDUed.js} +1 -1
  120. package/static/assets/{paperclip-ChugoOAp.js → paperclip-DlLXZbru.js} +1 -1
  121. package/static/assets/{pause-m9YcgxdE.js → pause-zSiaxJBu.js} +1 -1
  122. package/static/assets/{play-DtFz_MLh.js → play-DVBhRokt.js} +1 -1
  123. package/static/assets/{radio-group-C5Te9bVb.js → radio-group-CThYUcA4.js} +1 -1
  124. package/static/assets/{refresh-cw-B1bWW9Rg.js → refresh-cw-tXYl1ePu.js} +1 -1
  125. package/static/assets/{search-CPOHeeUa.js → search-BxF7Wwex.js} +1 -1
  126. package/static/assets/{select-B1v2u6hQ.js → select-CyHFRA1Y.js} +1 -1
  127. package/static/assets/server-lRxThHjr.js +6 -0
  128. package/static/assets/{switch-Bf1Cq3P6.js → switch-BUpDbrux.js} +1 -1
  129. package/static/assets/tabs-DkvCmQEX.js +1 -0
  130. package/static/assets/{tag-Cz4z82t0.js → tag-CkcZNLnh.js} +1 -1
  131. package/static/assets/{terminal-preview-DTUohQ5b.js → terminal-preview-CLWDhoOZ.js} +1 -1
  132. package/static/assets/triangle-alert-CmjG_mbF.js +6 -0
  133. package/static/assets/{use-terminal-CFbQv1ie.js → use-terminal-D3iV7-iC.js} +1 -1
  134. package/static/assets/{video-B6ZJ-Epb.js → video-CY_dOujm.js} +1 -1
  135. package/static/index.html +2 -2
  136. package/dist/lib/mcp-client.d.ts +0 -39
  137. package/dist/lib/mcp-client.js +0 -131
  138. package/dist/routes/api/v1/ai/tools.d.ts +0 -17
  139. package/dist/routes/api/v1/ai/tools.js +0 -931
  140. package/dist/routes/api/v1/context/knowledge/[filename]/index.d.ts +0 -1
  141. package/dist/routes/api/v1/context/knowledge/[filename]/index.js +0 -1
  142. package/dist/routes/api/v1/context/knowledge/[filename]/route.js +0 -254
  143. package/dist/routes/api/v1/context/knowledge/index.d.ts +0 -1
  144. package/dist/routes/api/v1/context/knowledge/index.js +0 -1
  145. package/dist/routes/api/v1/context/knowledge/route.js +0 -176
  146. package/dist/routes/api/v1/proposals/[id]/route.d.ts +0 -337
  147. package/dist/routes/api/v1/proposals/[id]/route.js +0 -165
  148. package/dist/routes/api/v1/proposals/index.d.ts +0 -3
  149. package/dist/routes/api/v1/proposals/index.js +0 -10
  150. package/dist/routes/api/v1/proposals/route.d.ts +0 -315
  151. package/dist/routes/api/v1/proposals/route.js +0 -129
  152. package/dist/routes/api/v1/terminal/[proposalId]/create/index.d.ts +0 -3
  153. package/dist/routes/api/v1/terminal/[proposalId]/create/index.js +0 -5
  154. package/dist/routes/api/v1/terminal/[proposalId]/create/route.d.ts +0 -10
  155. package/dist/routes/api/v1/terminal/[proposalId]/create/route.js +0 -27
  156. package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.js +0 -5
  157. package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.d.ts +0 -10
  158. package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.js +0 -21
  159. package/dist/routes/api/v1/terminal/[proposalId]/resize/index.d.ts +0 -3
  160. package/dist/routes/api/v1/terminal/[proposalId]/resize/index.js +0 -5
  161. package/dist/routes/api/v1/terminal/[proposalId]/resize/route.d.ts +0 -10
  162. package/dist/routes/api/v1/terminal/[proposalId]/resize/route.js +0 -21
  163. package/static/assets/ActivityPage-uL-Qknui.js +0 -1
  164. package/static/assets/ArchitectureEditPage-BWKyKi3T.js +0 -21
  165. package/static/assets/ArchitecturePage-Dtm0OAac.js +0 -1
  166. package/static/assets/CodePage-BuO2K_xx.js +0 -2
  167. package/static/assets/IntegrationsSettingsPage-Z8xCUmX9.js +0 -1
  168. package/static/assets/JobDetailPage-B8Za82RA.js +0 -1
  169. package/static/assets/KnowledgeDetailPage-CR9c4_WD.js +0 -1
  170. package/static/assets/MailInboxPage-B_h1Kz4D.js +0 -1
  171. package/static/assets/MailProcessingModal-D_qEwqmL.js +0 -6
  172. package/static/assets/MailReadPage-_q-xk_cX.js +0 -1
  173. package/static/assets/NewKnowledgePage-BEVMYnKG.js +0 -9
  174. package/static/assets/ProjectEditPage-X0-4mEAS.js +0 -11
  175. package/static/assets/ProjectPage-D8OX1GKt.js +0 -1
  176. package/static/assets/ResourcesPage-BmOpgt3L.js +0 -41
  177. package/static/assets/SchedulePage-CGxZHEL-.js +0 -4
  178. package/static/assets/TerminalSessionPage-CeAd8IAy.js +0 -8
  179. package/static/assets/UtilitiesPage-BPX_Unxu.js +0 -1
  180. package/static/assets/index-DH_vXhd4.css +0 -1
  181. package/static/assets/index-PyVlsLW8.js +0 -487
  182. package/static/assets/tabs-DAbCZiFC.js +0 -1
  183. /package/dist/routes/api/v1/context/{knowledge/[filename] → agents}/route.d.ts +0 -0
  184. /package/dist/routes/api/v1/context/{knowledge → memory}/route.d.ts +0 -0
  185. /package/dist/routes/api/v1/{terminal/[proposalId]/destroy/index.d.ts → context/team/route.d.ts} +0 -0
@@ -1,2 +0,0 @@
1
- import{u as ce,a as de,r as i,j as e,B as r,T as oe,n as M,X as me,F as xe,Y as he,D as ue,b as fe,d as pe,f as je,k as ge,a2 as B,a3 as R,a4 as H,a5 as L,a6 as O,aa as G,a9 as ve,o as Ne,A as T}from"./index-PyVlsLW8.js";import{C as g,b as ye,a as _,c as we}from"./card-xkODbJy-.js";import{B as U}from"./badge-D4vHU_w_.js";import{u as Se}from"./use-terminal-CFbQv1ie.js";import{T as Ce}from"./terminal-preview-DTUohQ5b.js";import{S as be,a as ke,b as Ae,c as De,d as w}from"./select-B1v2u6hQ.js";import{b as Me,e as Te,d as Ie,c as $e,a as Ee}from"./pipeline-builders-Bkf0wt_O.js";import{R as Pe}from"./refresh-cw-B1bWW9Rg.js";import{C as ze,a as Fe}from"./chevrons-up-CLKrQHMU.js";import{P as Be}from"./play-DtFz_MLh.js";import{C as Re}from"./code-DTW3giBe.js";import{C as He}from"./chevron-up-BB-6OS4z.js";import"./xterm-DTxiCjtJ.js";import"./index-BQYB8kWb.js";const Le=c=>c?Array.isArray(c)?c.filter(x=>typeof x=="string").map(x=>x.trim()).filter(Boolean):typeof c=="string"?c.split(",").map(x=>x.trim()).filter(Boolean):[]:[];function ss(){const c=ce(),{sessions:x,loading:b,error:I,refreshSessions:S,createSession:V,destroySession:K}=Se(),{toast:v}=de(),[$,W]=i.useState([]),[q,X]=i.useState(!0),[j,k]=i.useState(()=>({})),[A,N]=i.useState(!1),[f,Y]=i.useState("claude"),[E,J]=i.useState(""),[D,P]=i.useState(!1),[h,Q]=i.useState([]),[p,y]=i.useState([]),[Z,ee]=i.useState({}),[u,se]=i.useState([]),[o,C]=i.useState([]),te=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 d=Math.floor(n/60);if(d<60)return`${d}m ago`;const l=Math.floor(d/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`};i.useEffect(()=>{(async()=>{try{const t=await fetch(`${T}/api/v1/tasks`);if(t.ok){const a=await t.json(),n=a.data||a;W(Array.isArray(n)?n:[])}}catch(t){console.error("Error loading tasks:",t)}finally{X(!1)}})()},[]),i.useEffect(()=>{S()},[S]),i.useEffect(()=>{if(!A)return;(async()=>{try{const t=await fetch(`${T}/api/v1/mcp`);if(t.ok){const a=await t.json();a?.success&&Array.isArray(a.servers)&&(Q(a.servers),y(n=>n.filter(d=>a.servers.includes(d))),a.mcpServers&&typeof a.mcpServers=="object"&&ee(a.mcpServers))}}catch(t){console.error("Failed to load MCP servers",t)}try{const t=await fetch(`${T}/api/v1/skills`);if(t.ok){const a=await t.json(),d=(Array.isArray(a?.documents)?a.documents:[]).map(l=>({id:l.id,name:l?.metadata?.name||l.id,mcpServers:Le(l?.metadata?.metadata?.mcpServers)}));se(d),C(l=>l.filter(F=>d.some(le=>le.id===F)))}}catch(t){console.error("Failed to load skills",t)}})()},[A]),i.useEffect(()=>{o.length!==0&&y(s=>{const t=new Set(s),a=h.length>0?new Set(h):void 0;return o.forEach(n=>{const d=u.find(l=>l.id===n);d&&d.mcpServers.forEach(l=>{(!a||a.has(l))&&t.add(l)})}),Array.from(t)})},[o,u,h]);const m=i.useMemo(()=>x.filter(s=>s.taskId?.startsWith("cp-")||s.taskId?.startsWith("ag-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[x]);i.useEffect(()=>{k(s=>{const t={...s};return m.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[m]);const z=i.useMemo(()=>$.filter(s=>s.status==="draft"||s.status==="ready").sort((s,t)=>new Date(t.metadata.createdAt).getTime()-new Date(s.metadata.createdAt).getTime()).slice(0,3),[$]),ae=()=>{const s=m.every(a=>j[a.id]),t={};m.forEach(a=>{t[a.id]=!s}),k(t)},ie=m.length>0&&m.every(s=>j[s.id]),ne=async s=>{await K(s)?(v({title:"Session closed",description:s}),setTimeout(()=>S(),100)):v({title:"Failed to close session",description:s,variant:"destructive"})},re=async()=>{P(!0);try{const s=`session-${Date.now()}`,t={taskId:s,contextType:"change-task",cliAgent:f,mcpServersMap:Z,selectedMcpServers:p,skills:u,selectedSkillIds:o,automationEnabled:!1,customInstruction:E.trim(),includeDefaultInstructions:!1};let a="";f==="claude"?a=Me(t):f==="gemini"?a=Te(t):f==="codex"?a=Ie(t):f==="droid"?a=$e(t):f==="kiro"&&(a=Ee(t)),await V(s,a)?(v({title:"Coding session started",description:`Session ${s} created`}),N(!1),c(`/terminal/${s}`)):v({title:"Failed to start session",description:"Could not create terminal session",variant:"destructive"})}catch(s){console.error("Error starting coding session:",s),v({title:"Error",description:"Failed to start coding session",variant:"destructive"})}finally{P(!1)}};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:"Agents"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Manage agents and their active sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>S(),disabled:b,children:[e.jsx(Pe,{className:`h-4 w-4 sm:mr-2 ${b?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),m.length>0&&e.jsx(r,{variant:"outline",size:"sm",onClick:ae,children:ie?e.jsxs(e.Fragment,{children:[e.jsx(ze,{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(Fe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Show All"})]})}),e.jsxs(r,{size:"sm",onClick:()=>N(!0),children:[e.jsx(Be,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Interactive Session"})]})]})]}),I&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:I})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),b?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,t)=>e.jsx(g,{className:"p-3",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))}):m.length===0?e.jsx(g,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(Re,{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 an"," ",e.jsx("button",{onClick:()=>N(!0),className:"text-primary hover:underline font-medium",children:"Interactive Session"})," ","or working on a"," ",e.jsx("button",{onClick:()=>c("/tasks"),className:"text-primary hover:underline font-medium",children:"New Task"})]})]})]})}):e.jsx("div",{className:"space-y-2",children:m.slice(0,10).map(s=>e.jsxs(g,{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(oe,{className:"h-4 w-4 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",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 ",te(s.lastActivity)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",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:()=>{k(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":j[s.id]?"Hide preview":"Show preview",title:j[s.id]?"Hide preview":"Show preview",children:j[s.id]?e.jsx(He,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>c(`/terminal/${s.taskId}`),children:"Open"}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>ne(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(me,{className:"h-4 w-4"})})]})]}),j[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>c(`/terminal/${s.taskId}`),title:"Click to open full terminal session",children:e.jsx(Ce,{sessionId:s.id,heightPx:160,maxScrollback:200})})]},s.id))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"New Tasks"}),q?e.jsx("div",{className:"space-y-3",children:[...Array(3)].map((s,t)=>e.jsx(g,{children:e.jsx(ye,{className:"py-3",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-2/3 animate-pulse"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"})]}),e.jsx("div",{className:"h-5 bg-muted rounded w-16 animate-pulse"})]})})},t))}):z.length===0?e.jsx(g,{children:e.jsx(_,{className:"flex items-center justify-center py-6",children:e.jsx("div",{className:"text-center text-sm text-gray-500",children:"No draft or approved tasks found"})})}):e.jsx("div",{className:"space-y-2",children:z.map(s=>e.jsx(g,{className:"hover:shadow-md transition-all cursor-pointer hover:border-primary/50",onClick:()=>c(`/terminal/${s.id}`),children:e.jsx(_,{className:"py-4",children:e.jsx("div",{className:"flex justify-between items-start gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(we,{className:"text-base leading-tight",children:s.title||s.intent}),e.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[s.priority&&e.jsx(U,{variant:s.priority==="high"||s.priority==="critical"?"destructive":s.priority==="medium"?"secondary":"outline",className:"text-xs",children:s.priority}),e.jsx(U,{variant:"default",className:"text-xs",children:s.status})]})]}),s.content&&e.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[s.content.split(`
2
- `).slice(0,2).join(" ").substring(0,150),s.content.length>150?"...":""]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.id," • by ",s.author.name," • ",new Date(s.metadata.createdAt).toLocaleDateString()]}),e.jsxs("div",{className:"flex gap-2",onClick:t=>t.stopPropagation(),children:[e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/tasks/${s.id}`),className:"h-7 px-2 text-xs",children:[e.jsx(xe,{className:"h-3 w-3 mr-1"})," View"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/tasks/${s.id}/edit`),className:"h-7 px-2 text-xs",children:[e.jsx(he,{className:"h-3 w-3 mr-1"})," Edit"]})]})]})]})})})},s.id))})]}),e.jsx(ue,{open:A,onOpenChange:N,children:e.jsxs(fe,{className:"max-w-lg",children:[e.jsxs(pe,{children:[e.jsx(je,{children:"Start Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Start an interactive session"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Agent"}),e.jsxs(be,{value:f,onValueChange:s=>Y(s),children:[e.jsx(ke,{className:"w-full",children:e.jsx(Ae,{placeholder:"Select coding agent"})}),e.jsxs(De,{children:[e.jsx(w,{value:"claude",children:"Claude Code"}),e.jsx(w,{value:"gemini",children:"Google Gemini"}),e.jsx(w,{value:"codex",children:"OpenAI Codex"}),e.jsx(w,{value:"droid",children:"Factory Droid"}),e.jsx(w,{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(ge,{className:"h-4 w-4"}),"Skills"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[o.length," of ",u.length," selected"]})]}),e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[o.length===0?"Select skills...":o.length===u.length?"All skills selected":`${o.length} skill${o.length!==1?"s":""} selected`,e.jsx(M,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(H,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(L,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Skills"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),C(u.map(t=>t.id))},children:"All"}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),C([])},children:"None"})]})]}),e.jsx(O,{}),u.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No skills found"}):u.map(s=>e.jsx(G,{checked:o.includes(s.id),onCheckedChange:t=>{C(a=>t?a.includes(s.id)?a:[...a,s.id]:a.filter(n=>n!==s.id))},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:s.name}),s.mcpServers.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",s.mcpServers.join(", ")]}),s.mcpServers.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},s.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(ve,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[p.length," of ",h.length," selected"]})]}),e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[p.length===0?"Select MCP servers...":p.length===h.length?"All servers selected":`${p.length} server${p.length!==1?"s":""} selected`,e.jsx(M,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(H,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(L,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Servers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),y(h)},children:"All"}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),y([])},children:"None"})]})]}),e.jsx(O,{}),h.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):h.map(s=>e.jsx(G,{checked:p.includes(s),onCheckedChange:t=>{y(a=>t?a.includes(s)?a:[...a,s]:a.filter(n=>n!==s))},children:s},s))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Additional Instructions (optional)"}),e.jsx(Ne,{value:E,onChange:s=>J(s.target.value),placeholder:"Add any custom instructions for the coding agent...",rows:4,className:"resize-none"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(r,{variant:"outline",onClick:()=>N(!1),disabled:D,children:"Cancel"}),e.jsx(r,{onClick:re,disabled:D,children:D?"Starting...":"Start Session"})]})]})]})})]})}export{ss as default};
@@ -1 +0,0 @@
1
- import{r as d,bw as A,v as l,j as e,bv as T,e as j,n as y,C as v,ae as N,I as b,B as r,E as k,a0 as w,h as $}from"./index-PyVlsLW8.js";import{C as U,b as Y,c as q,d as B,a as H}from"./card-xkODbJy-.js";import{L as m}from"./label-DvPENm3h.js";import{S as Q,a as W,b as X,c as Z,d as ee}from"./select-B1v2u6hQ.js";import"./index-BQYB8kWb.js";import"./chevron-up-BB-6OS4z.js";const se=[{id:"openai/gpt-4o",label:"GPT-4o",provider:"openai",supportsMCP:!0,strengths:["balanced","reasoning","code","tools"],notes:"Great general model with tool/function calling support."},{id:"openai/gpt-4o-mini",label:"GPT-4o Mini",provider:"openai",supportsMCP:!0,strengths:["cost-effective","fast","tools"],notes:"Good for quick, inexpensive tasks with function calling."},{id:"openai/gpt-4.1",label:"GPT-4.1",provider:"openai",supportsMCP:!0,strengths:["coding","instruction following","long context"],notes:"Latest GPT-4 series with enhanced capabilities."},{id:"openai/o3-mini",label:"o3-mini",provider:"openai",supportsMCP:!0,strengths:["reasoning","math","coding"],notes:"Reasoning model optimized for efficiency."},{id:"anthropic/claude-sonnet-4.5",label:"Claude Sonnet 4.5",provider:"anthropic",supportsMCP:!0,strengths:["agents","coding","tools","fast","long context"],notes:"Most advanced Sonnet - 1.5-2x faster, optimized for agents and tool orchestration."},{id:"anthropic/claude-sonnet-4",label:"Claude Sonnet 4",provider:"anthropic",supportsMCP:!0,strengths:["reasoning","analysis","tools","coding"],notes:"Excellent tool use and reasoning capabilities."},{id:"anthropic/claude-3.5-sonnet",label:"Claude 3.5 Sonnet",provider:"anthropic",supportsMCP:!0,strengths:["reasoning","analysis","tools"],notes:"Reliable Claude model with strong tool support."},{id:"google/gemini-2.0-flash-001",label:"Gemini 2.0 Flash",provider:"google",supportsMCP:!0,strengths:["speed","multimodal","tools"],notes:"Fast Google model with function calling."},{id:"meta-llama/llama-3.1-405b-instruct",label:"Llama 3.1 405B",provider:"meta-llama",supportsMCP:!0,strengths:["reasoning","open weights","code"],notes:"High-capacity open model; function calling often available."},{id:"qwen/qwen-2.5-72b-instruct",label:"Qwen 2.5 72B",provider:"qwen",supportsMCP:!0,strengths:["cost-effective","code","tools"],notes:"Strong value open model with tool support."}],te={models:se},ae=te;function E(){return ae.models}function de(){const[t,F]=d.useState({}),[i,M]=d.useState(!0),[_,G]=d.useState(!1),[p,z]=d.useState({}),[I,R]=d.useState({}),[O,L]=d.useState(E()[0]?.id||"openai/gpt-4o"),[n,J]=d.useState({openrouter:!1,replicate:!1,anthropic:!1,openai:!1,gemini:!1,factorydroid:!1});d.useEffect(()=>{P()},[]);const P=async()=>{try{M(!0);const s=await A("/api/v1/config?type=global");if(s.success&&s.data){const a=s.data.apiKeys||{},o={},c={};for(const C of["openrouter","replicate","anthropic","openai","gemini","factorydroid"]){const K=a[C];K&&typeof K=="string"&&K.trim()!==""?(o[C]=!0,c[C]="***"):(o[C]=!1,c[C]="")}F(c);const S=s.data.defaults&&s.data.defaults.model?String(s.data.defaults.model):void 0;L(S||E()[0]?.id||"openai/gpt-4o")}}catch(s){console.error("Failed to load API keys:",s),l({title:"Error",description:"Failed to load API keys",variant:"destructive"})}finally{M(!1)}},x=(s,a)=>{F(o=>({...o,[s]:a}))},D=async s=>{try{R(S=>({...S,[s]:!0}));const a=t[s],o={provider:s};a&&a!=="***"&&(o.key=a);const c=await A("/api/v1/config/test",{method:"POST",body:JSON.stringify(o)});c.success&&c.message?l({title:"Test Result",description:c.message}):c.success?l({title:"Test Result",description:"Success"}):l({title:"Test Failed",description:c.message||"Unknown error",variant:"destructive"})}catch(a){l({title:"Test Failed",description:a instanceof Error?a.message:"Unknown error",variant:"destructive"})}finally{R(a=>({...a,[s]:!1}))}},h=s=>{J(a=>({...a,[s]:!a[s]}))},u=async s=>{try{const a={[s]:""};await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({apiKeys:a})}),l({title:"Success",description:`${s} API key cleared`}),await P()}catch(a){console.error("Failed to clear API key:",a),l({title:"Error",description:"Failed to clear API key",variant:"destructive"})}},g=async s=>{try{z(o=>({...o,[s]:!0}));const a={[s]:t[s]};await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({apiKeys:a})}),l({title:"Success",description:`${s} API key saved`}),await P()}catch(a){console.error("Failed to save API key:",a),l({title:"Error",description:"Failed to save API key",variant:"destructive"})}finally{z(a=>({...a,[s]:!1}))}},V=async()=>{try{G(!0),await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({defaults:{model:O}})}),l({title:"Success",description:"Default model saved successfully"})}catch(s){console.error("Failed to save default model:",s),l({title:"Error",description:"Failed to save default model",variant:"destructive"})}finally{G(!1)}},f={openrouter:"OPENROUTER_API_KEY",replicate:"REPLICATE_API_TOKEN",anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GEMINI_API_KEY",factorydroid:"FACTORY_API_KEY"};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"AI & LLM"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Coconut's connections to LLM providers."})]}),e.jsx(T,{}),e.jsxs(U,{children:[e.jsxs(Y,{children:[e.jsx(q,{children:"API Keys & Authentication"}),e.jsx(B,{children:"Manage API keys and authentication tokens for integrated services."})]}),e.jsxs(H,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"AI Assistant API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keys used by the AI Assistant sidebar for chat and code suggestions."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("openrouter"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:j("flex items-center justify-center w-8 h-8 rounded-md",t.openrouter&&t.openrouter!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:n.openrouter?e.jsx(y,{className:"h-4 w-4"}):e.jsx(v,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"OpenRouter"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.openrouter})]})]}),t.openrouter&&t.openrouter!==""&&e.jsx(N,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),n.openrouter&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"openrouterKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{id:"openrouterKey",type:"password",placeholder:"sk-or-v1-...",className:"flex-1",value:t.openrouter||"",onChange:s=>x("openrouter",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("openrouter"),title:"Clear API key",children:e.jsx(k,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>D("openrouter"),disabled:!!I.openrouter,title:"Test API key",children:I.openrouter?"Testing...":"Test"}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("openrouter"),disabled:p.openrouter||i,title:"Save API key",children:e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"OpenRouter"})]})]})]}),e.jsx(T,{className:"my-6"}),e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Resource Creation API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keys used for generating images and other resources."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("replicate"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:j("flex items-center justify-center w-8 h-8 rounded-md",t.replicate&&t.replicate!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:n.replicate?e.jsx(y,{className:"h-4 w-4"}):e.jsx(v,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Replicate"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.replicate})]})]}),t.replicate&&t.replicate!==""&&e.jsx(N,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),n.replicate&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"replicateKey",children:"API Token"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{id:"replicateKey",type:"password",placeholder:"r8_...",className:"flex-1",value:t.replicate||"",onChange:s=>x("replicate",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("replicate"),title:"Clear API token",children:e.jsx(k,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>D("replicate"),disabled:!!I.replicate,title:"Test API token",children:I.replicate?"Testing...":"Test"}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("replicate"),disabled:p.replicate||i,title:"Save API token",children:e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token from"," ",e.jsx("a",{href:"https://replicate.com/account/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Replicate"})]})]})]}),e.jsx(T,{className:"my-6"}),e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Coding Agent API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These keys are automatically provided to coding agents when they start running."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("anthropic"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:j("flex items-center justify-center w-8 h-8 rounded-md",t.anthropic&&t.anthropic!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:n.anthropic?e.jsx(y,{className:"h-4 w-4"}):e.jsx(v,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Anthropic Claude"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.anthropic})]})]}),t.anthropic&&t.anthropic!==""&&e.jsx(N,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),n.anthropic&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"anthropicKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{id:"anthropicKey",type:"password",placeholder:"sk-ant-...",className:"flex-1",value:t.anthropic||"",onChange:s=>x("anthropic",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("anthropic"),title:"Clear API key",children:e.jsx(k,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("anthropic"),disabled:p.anthropic||i,title:"Save API key",children:e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://console.anthropic.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Anthropic Console"})]})]})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("openai"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:j("flex items-center justify-center w-8 h-8 rounded-md",t.openai&&t.openai!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:n.openai?e.jsx(y,{className:"h-4 w-4"}):e.jsx(v,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"OpenAI"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.openai})]})]}),t.openai&&t.openai!==""&&e.jsx(N,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),n.openai&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"openaiKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{id:"openaiKey",type:"password",placeholder:"sk-...",className:"flex-1",value:t.openai||"",onChange:s=>x("openai",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("openai"),title:"Clear API key",children:e.jsx(k,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("openai"),disabled:p.openai||i,title:"Save API key",children:e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"OpenAI Platform"})]})]})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("gemini"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:j("flex items-center justify-center w-8 h-8 rounded-md",t.gemini&&t.gemini!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:n.gemini?e.jsx(y,{className:"h-4 w-4"}):e.jsx(v,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Google Gemini"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.gemini})]})]}),t.gemini&&t.gemini!==""&&e.jsx(N,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),n.gemini&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"geminiKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{id:"geminiKey",type:"password",placeholder:"AIza...",className:"flex-1",value:t.gemini||"",onChange:s=>x("gemini",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("gemini"),title:"Clear API key",children:e.jsx(k,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("gemini"),disabled:p.gemini||i,title:"Save API key",children:e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://makersuite.google.com/app/apikey",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Google AI Studio"})]})]})]}),e.jsxs("div",{className:"border rounded-lg mt-4",children:[e.jsxs("button",{onClick:()=>h("factorydroid"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:j("flex items-center justify-center w-8 h-8 rounded-md",t.factorydroid&&t.factorydroid!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:n.factorydroid?e.jsx(y,{className:"h-4 w-4"}):e.jsx(v,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Factory Droid"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.factorydroid})]})]}),t.factorydroid&&t.factorydroid!==""&&e.jsx(N,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),n.factorydroid&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"factorydroidKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{id:"factorydroidKey",type:"password",placeholder:"fd-...",className:"flex-1",value:t.factorydroid||"",onChange:s=>x("factorydroid",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("factorydroid"),title:"Clear API key",children:e.jsx(k,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("factorydroid"),disabled:p.factorydroid||i,title:"Save API key",children:e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://factorydroid.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Factory Droid"})]})]})]})]})]}),e.jsxs(U,{children:[e.jsxs(Y,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{className:"h-5 w-5"}),e.jsx(q,{children:"AI Assistant Settings"})]}),e.jsx(B,{children:"Configure default AI model and behavior for the AI assistant sidebar."})]}),e.jsxs(H,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"defaultModel",children:"Default AI Model"}),e.jsxs(Q,{value:O,onValueChange:L,children:[e.jsx(W,{children:e.jsx(X,{placeholder:"Select default AI model"})}),e.jsx(Z,{children:E().map(s=>e.jsx(ee,{value:s.id,children:s.label},s.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This model will be selected by default when opening the AI assistant."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{onClick:V,disabled:_||i,children:_?"Saving...":"Save"})})]})]})]})}export{de as default};
@@ -1 +0,0 @@
1
- import{x as se,u as te,a as ae,ad as re,r as d,j as e,B as c,L as N,t as C,y as ne,z as ie,E as de,H as le,J as ce,N as oe,O as me,Q as xe,R as ue,U as he,k as H,a9 as pe,n as je,F as ge,Y as fe,bv as O,m as Ne,A as v}from"./index-PyVlsLW8.js";import{c as ve}from"./clipboard-B9ndUJKl.js";import{C as o,b as g,a as m,c as b,d as G}from"./card-xkODbJy-.js";import{B as w}from"./badge-D4vHU_w_.js";import{A as D}from"./arrow-left-7TCkaJlN.js";import{P as S}from"./play-DtFz_MLh.js";import{C as be,a as we}from"./clipboard-Ce816tAO.js";import{R as ye}from"./refresh-cw-B1bWW9Rg.js";import{C as Ce}from"./chevron-up-BB-6OS4z.js";import{P as Se}from"./pause-m9YcgxdE.js";import{C as q}from"./clock-BIeoO5Mt.js";const ke=[{id:"claude",label:"Claude Code"},{id:"gemini",label:"Google Gemini"},{id:"codex",label:"OpenAI Codex"},{id:"droid",label:"Factory Droid"},{id:"kiro",label:"Kiro"}],f=a=>{if(!a)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(a))}catch{return a}},L=a=>{if(!a)return"—";const i=new Date(a).getTime()-Date.now(),l=Math.round(i/(1e3*60));if(Number.isNaN(l))return f(a);if(Math.abs(l)<1)return"now";if(l>0){if(l<60)return`in ${l}m`;const h=Math.round(l/60);return h<24?`in ${h}h`:`in ${Math.round(h/24)}d`}const t=Math.abs(l);if(t<60)return`${t}m ago`;const u=Math.round(t/60);return u<24?`${u}h ago`:`${Math.round(u/24)}d ago`},Ae=a=>{if(a.type==="interval"){const x=a.daysOfWeek.map(i=>i.slice(0,3).toUpperCase()).join(", ");return`Every ${a.hours}h (${x||"All days"})`}return a.description||`Cron: ${a.expression}`},Re=a=>{const x=ke.find(i=>i.id===a);return x?x.label:a},T=a=>{switch(a){case"active":case"succeeded":return"default";case"paused":case"running":return"secondary";case"failed":return"destructive";default:return"outline"}};function Me(){const{id:a}=se(),x=te(),{toast:i}=ae(),{refresh:l}=re(),[t,u]=d.useState(null),[$,h]=d.useState(!0),[y,E]=d.useState(null),[P,F]=d.useState(!1),[k,J]=d.useState(!1),[p,U]=d.useState(!1),[K,z]=d.useState(!1),[Q,V]=d.useState(new Set),[B,A]=d.useState({}),[W,M]=d.useState(new Set),R=async()=>{if(a)try{h(!0);const r=await(await fetch(`${v}/api/v1/jobs/${a}`)).json();r.success?u(r.data):E(r.error?.message||"Failed to fetch job")}catch(s){E(s instanceof Error?s.message:"Unknown error")}finally{h(!1)}};d.useEffect(()=>{R()},[a]);const Y=async()=>{if(a){F(!0);try{const r=await(await fetch(`${v}/api/v1/jobs/${a}`,{method:"DELETE"})).json();r.success?(i({title:"Job deleted",description:t?.name||"Scheduled job has been deleted"}),x("/schedule")):i({title:"Failed to delete job",description:r.error?.message||"Unknown error",variant:"destructive"})}catch(s){i({title:"Failed to delete job",description:s instanceof Error?s.message:"Unknown error",variant:"destructive"})}finally{F(!1)}}},X=async()=>{if(!t||!a)return;J(!0);const s=t.status==="active"?"paused":"active";try{const n=await(await fetch(`${v}/api/v1/jobs/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:s})})).json();n.success?(u(n.data),await l(),i({title:s==="active"?"Job resumed":"Job paused",description:t.name})):i({title:"Failed to update job",description:n.error?.message||"Unknown error",variant:"destructive"})}catch(r){i({title:"Failed to update job",description:r instanceof Error?r.message:"Unknown error",variant:"destructive"})}finally{J(!1)}},_=async()=>{if(!(!t||!a)){U(!0);try{const s=await fetch(`${v}/api/v1/jobs/${a}/run`,{method:"POST"}),r=await s.json();r.success||s.ok?(i({title:"Run started",description:`${t.name} is executing.`}),await R(),await l()):i({title:"Failed to start run",description:r.error?.message||"Unknown error",variant:"destructive"})}catch(s){i({title:"Failed to start run",description:s instanceof Error?s.message:"Unknown error",variant:"destructive"})}finally{U(!1)}}},Z=async s=>{V(r=>{const n=new Set(r);return n.has(s)?n.delete(s):(n.add(s),!B[s]&&a&&ee(s)),n})},ee=async s=>{if(a){M(r=>new Set(r).add(s));try{const r=await fetch(`${v}/api/v1/jobs/${a}/runs/${s}/log`);if(r.ok){const n=await r.text();A(j=>({...j,[s]:n}))}else{const n=await r.json().catch(()=>({}));A(j=>({...j,[s]:n.error?.message||"Log not available"}))}}catch(r){A(n=>({...n,[s]:r instanceof Error?r.message:"Failed to load log"}))}finally{M(r=>{const n=new Set(r);return n.delete(s),n})}}};if($)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx(c,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(N,{to:"/schedule",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})})]}),e.jsxs(o,{children:[e.jsx(g,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]})}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})]})]});if(y||!t)return 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:y||"Job not found"})}),e.jsx(c,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(N,{to:"/schedule",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})})]}),e.jsx(o,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:y||"Job not found"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['The job with ID "',a,'" could not be found.']}),e.jsx(c,{asChild:!0,className:"mt-4",children:e.jsx(N,{to:"/schedule",children:"Back to Schedule"})})]})})})]});const I=t.agentIds||(t.agentId?[t.agentId]:[]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:t.name}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(c,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(N,{to:"/schedule",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})}),e.jsxs(c,{variant:"default",size:"sm",onClick:_,disabled:p||!!t._error,children:[p?e.jsx(C,{className:"h-4 w-4 animate-spin sm:mr-2"}):e.jsx(S,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:p?"Running...":"Run Now"})]}),e.jsxs(ne,{children:[e.jsx(ie,{asChild:!0,children:e.jsxs(c,{variant:"destructive",size:"sm",disabled:P,children:[e.jsx(de,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:P?"Deleting...":"Delete"})]})}),e.jsxs(le,{children:[e.jsxs(ce,{children:[e.jsx(oe,{children:"Are you absolutely sure?"}),e.jsxs(me,{children:["This action cannot be undone. This will permanently delete the scheduled job",e.jsxs("span",{className:"font-semibold",children:[' "',t.name,'"']}),". Existing run logs will remain in ",e.jsx("code",{children:".nut/jobs/logs"}),"."]})]}),e.jsxs(xe,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(he,{onClick:Y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Job"})]})]})]})]})]}),e.jsxs("button",{type:"button",onClick:async()=>{const s=`.nut/jobs/job-${t.id}.md`;try{await ve(s),z(!0),i({title:"Copied!",description:`${s} copied to clipboard`}),setTimeout(()=>z(!1),2e3)}catch(r){console.error("Failed to copy path:",r),i({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono",children:[e.jsx("span",{children:`.nut/jobs/job-${t.id}.md`}),K?e.jsx(be,{className:"h-3.5 w-3.5"}):e.jsx(we,{className:"h-3.5 w-3.5"})]})]}),t._error&&e.jsx(o,{className:"border-destructive/50 bg-destructive/5",children:e.jsxs(m,{className:"pt-6",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:t._error}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Please review the job file at ",e.jsxs("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:[".nut/jobs/job-",t.id,".md"]})]})]})}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(o,{children:[e.jsxs(g,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(b,{children:"Job Configuration"}),e.jsx(w,{variant:T(t.status),className:"capitalize",children:t.status})]}),t.description&&e.jsx(G,{children:t.description})]}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Instructions"}),e.jsx("div",{className:"rounded-md bg-muted/50 p-3 font-mono text-sm whitespace-pre-wrap",children:t.prompt})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground mb-1",children:"AI Model"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:Re(t.model)})]})]}),I.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Custom Agents"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:I.map(s=>e.jsxs("div",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 text-xs",children:[e.jsx(H,{className:"h-3 w-3 text-blue-600 dark:text-blue-400"}),e.jsx("span",{className:"font-medium text-blue-900 dark:text-blue-100",children:s.replace(".md","")})]},s))})]}),t.mcpServers&&t.mcpServers.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground mb-1",children:"MCP Servers"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.mcpServers.map(s=>e.jsxs("div",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-purple-50 dark:bg-purple-950/20 border border-purple-200 dark:border-purple-800 text-xs",children:[e.jsx(pe,{className:"h-3 w-3 text-purple-600 dark:text-purple-400"}),e.jsx("span",{className:"font-medium text-purple-900 dark:text-purple-100",children:s})]},s))})]})]})]})]}),e.jsxs(o,{children:[e.jsx(g,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{children:"Run History"}),e.jsxs(G,{children:[t.runs.length," recorded run",t.runs.length!==1?"s":""]})]}),e.jsxs(c,{variant:"outline",size:"sm",onClick:R,children:[e.jsx(ye,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})}),e.jsx(m,{children:t.runs.length===0?e.jsx("div",{className:"rounded-md border border-dashed bg-muted/20 p-6 text-center text-sm text-muted-foreground",children:'No runs yet. Click "Run Now" to execute this job.'}):e.jsx("div",{className:"space-y-3",children:t.runs.map(s=>{const r=Q.has(s.id),n=W.has(s.id),j=B[s.id];return e.jsxs("div",{className:"rounded-md border bg-card/50 overflow-hidden",children:[e.jsxs("div",{className:"p-3 cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>Z(s.id),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx(w,{variant:T(s.status),className:"capitalize text-xs",children:s.status}),e.jsx("span",{className:"text-sm text-muted-foreground",children:f(s.startedAt)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",L(s.startedAt),")"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.trigger==="manual"&&e.jsx(w,{variant:"outline",className:"text-xs",children:"manual"}),r?e.jsx(Ce,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(je,{className:"h-4 w-4 text-muted-foreground"})]})]}),s.error&&e.jsx("p",{className:"text-sm text-destructive font-medium mb-2",children:s.error}),s.summary&&!r&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:s.summary})]}),r&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t bg-muted/20",children:[e.jsxs("div",{className:"pt-3 grid gap-2 text-xs",children:[s.finishedAt&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Finished:"}),e.jsx("span",{children:f(s.finishedAt)})]}),s.cliCommand&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Command:"}),e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-xs break-all",children:s.cliCommand})]}),s.outputPath&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Log path:"}),e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-xs",children:s.outputPath})]})]}),s.summary&&e.jsxs("div",{children:[e.jsx("h5",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Summary"}),e.jsx("div",{className:"rounded bg-muted/50 p-2 font-mono text-xs leading-relaxed whitespace-pre-wrap",children:s.summary})]}),e.jsxs("div",{children:[e.jsxs("h5",{className:"text-xs font-medium text-muted-foreground mb-1 flex items-center gap-1.5",children:[e.jsx(ge,{className:"h-3 w-3"}),"Full Log"]}),n?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground p-2",children:[e.jsx(C,{className:"h-3 w-3 animate-spin"}),"Loading log..."]}):j?e.jsx("div",{className:"rounded bg-muted/50 p-2 font-mono text-xs leading-relaxed max-h-96 overflow-auto whitespace-pre-wrap",children:j}):e.jsx("div",{className:"text-xs text-muted-foreground p-2",children:"Log not available"})]})]})]},s.id)})})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(o,{children:[e.jsx(g,{children:e.jsx(b,{children:"Actions"})}),e.jsxs(m,{className:"space-y-2",children:[e.jsxs(c,{variant:"default",className:"w-full justify-start",onClick:_,disabled:p||!!t._error,children:[p?e.jsx(C,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(S,{className:"h-4 w-4 mr-2"}),p?"Running...":"Run Now"]}),e.jsxs(c,{variant:"outline",className:"w-full justify-start",onClick:X,disabled:k||!!t._error,children:[k?e.jsx(C,{className:"h-4 w-4 mr-2 animate-spin"}):t.status==="active"?e.jsx(Se,{className:"h-4 w-4 mr-2"}):e.jsx(S,{className:"h-4 w-4 mr-2"}),k?"Updating...":t.status==="active"?"Pause Job":"Resume Job"]}),e.jsx(c,{variant:"outline",className:"w-full justify-start",asChild:!0,disabled:!!t._error,children:e.jsxs(N,{to:"/schedule",state:{editJobId:t.id},children:[e.jsx(fe,{className:"h-4 w-4 mr-2"}),"Edit Job"]})})]})]}),e.jsxs(o,{children:[e.jsx(g,{children:e.jsx(b,{children:"Schedule"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(q,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:Ae(t.schedule)})]}),t.schedule.type==="interval"&&t.schedule.anchorHour!==void 0&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Start hour:"})," ",e.jsxs("span",{children:[t.schedule.anchorHour,":00"]})]}),e.jsx(O,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Next run:"}),e.jsx("span",{className:"font-medium",children:L(t.metadata.nextRunAt)})]}),t.metadata.nextRunAt&&e.jsx("div",{className:"text-xs text-muted-foreground",children:f(t.metadata.nextRunAt)})]})]})]}),e.jsxs(o,{children:[e.jsx(g,{children:e.jsx(b,{children:"Information"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ne,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Created:"}),e.jsx("span",{children:f(t.metadata.createdAt)})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(q,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Updated:"}),e.jsx("span",{children:f(t.metadata.updatedAt)})]}),t.metadata.lastRunAt&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(S,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Last run:"}),e.jsx("span",{children:L(t.metadata.lastRunAt)})]}),e.jsx(O,{}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Status:"}),e.jsx("div",{className:"mt-1",children:e.jsx(w,{variant:T(t.status),className:"capitalize",children:t.status})})]}),t.tags&&t.tags.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.map(s=>e.jsx(w,{variant:"outline",className:"text-xs",children:s},s))})]})]})]})]})]})]})}export{Me as default};
@@ -1 +0,0 @@
1
- import{x as A,u as T,a as F,r as i,A as p,j as e,t as g,B as o,L as x,M as L,Y as S,y as $,z,E as P,H as B,J as K,N as U,O as _,Q as H,R as M,U as R,ae as q,af as I,m as W,_ as J}from"./index-PyVlsLW8.js";import{C as d,a as m,b as O,c as Q}from"./card-xkODbJy-.js";import{B as V}from"./badge-D4vHU_w_.js";import{c as Y}from"./clipboard-B9ndUJKl.js";import{A as j}from"./arrow-left-7TCkaJlN.js";import{T as G}from"./tag-Cz4z82t0.js";import{E as X}from"./external-link--RjKXREe.js";function Z(n){return typeof n=="string"?n.startsWith("http://")||n.startsWith("https://")?{title:n,url:n}:{title:n}:n}function ie(){const n=A(),N=T(),{toast:r}=F(),l=n.filename,[s,v]=i.useState(null),[w,k]=i.useState(!0),[h,u]=i.useState(!1),[y,f]=i.useState(!1);i.useEffect(()=>{l&&C()},[l]);const C=async()=>{try{const a=await(await fetch(`${p}/api/v1/knowledge/${l}`)).json();a.success?v(a.document):r({title:"Error",description:"Failed to load knowledge document",variant:"destructive"})}catch(t){console.error("Error fetching document:",t),r({title:"Error",description:"Failed to load knowledge document",variant:"destructive"})}finally{k(!1)}},D=async()=>{if(!s)return;const t=`.nut/knowledge/${s.filename}`;try{await Y(t),f(!0),setTimeout(()=>f(!1),2e3),r({title:"Copied!",description:`Path copied to clipboard: ${t}`})}catch(a){console.error("Failed to copy path:",a),r({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},b=()=>{if(!s)return;const t=new CustomEvent("discuss-in-chat",{detail:{type:"knowledge",id:`knowledge-${s.filename.replace(".md","")}`,filename:s.filename,name:s.filename,path:`.nut/knowledge/${s.filename}`}});window.dispatchEvent(t)},E=async()=>{if(s){u(!0);try{const a=await(await fetch(`${p}/api/v1/knowledge/${l}`,{method:"DELETE"})).json();a.success?(r({title:"Success",description:"Knowledge document deleted successfully"}),N("/knowledge")):r({title:"Error",description:a.error||"Failed to delete knowledge document",variant:"destructive"})}catch(t){console.error("Error deleting document:",t),r({title:"Error",description:"Failed to delete knowledge document",variant:"destructive"})}finally{u(!1)}}};return w?e.jsx("div",{className:"space-y-6",children:e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(g,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading knowledge document..."})]})})})}):s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(o,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(x,{to:"/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(j,{className:"h-4 w-4"})})}),e.jsxs(o,{variant:"outline",size:"sm",onClick:b,children:[e.jsx(L,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsx(o,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(x,{to:`/knowledge/${l}/edit`,children:[e.jsx(S,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs($,{children:[e.jsx(z,{asChild:!0,children:e.jsxs(o,{variant:"destructive",size:"sm",children:[e.jsx(P,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Delete"})]})}),e.jsxs(B,{children:[e.jsxs(K,{children:[e.jsx(U,{children:"Delete Knowledge Document"}),e.jsxs(_,{children:["Are you sure you want to delete “",s.title,"”? This action cannot be undone."]})]}),e.jsxs(H,{children:[e.jsx(M,{children:"Cancel"}),e.jsx(R,{onClick:E,disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?e.jsx(g,{className:"w-4 h-4 animate-spin"}):"Delete"})]})]})]})]})]}),e.jsx("div",{className:"text-left",children:e.jsxs("button",{type:"button",onClick:D,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono text-left",children:[e.jsxs("span",{className:"break-all",children:[".nut/knowledge/",s.filename]}),y?e.jsx(q,{className:"h-3.5 w-3.5 flex-shrink-0 text-green-600"}):e.jsx(I,{className:"h-3.5 w-3.5 flex-shrink-0"})]})})]}),e.jsxs("div",{className:"flex flex-col gap-2 text-sm text-muted-foreground sm:flex-row sm:flex-wrap sm:items-center sm:gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(W,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Updated ",s.metadata.updated]})]}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{className:"flex items-start gap-1.5 sm:items-center",children:[e.jsx(G,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5 sm:mt-0"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.metadata.tags.map((t,a)=>e.jsx(V,{variant:"outline",className:"text-xs",children:t},a))})]})]}),s.metadata.sources&&s.metadata.sources.length>0&&e.jsxs(d,{children:[e.jsx(O,{children:e.jsx(Q,{children:"Sources"})}),e.jsx(m,{children:e.jsx("ul",{className:"space-y-2",children:s.metadata.sources.map((t,a)=>{const c=Z(t);return e.jsx("li",{children:c.url?e.jsxs("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-foreground hover:text-primary transition-colors group",children:[e.jsx("span",{className:"group-hover:underline",children:c.title}),e.jsx(X,{className:"w-3.5 h-3.5 text-muted-foreground group-hover:text-primary flex-shrink-0"})]}):e.jsx("span",{className:"text-muted-foreground",children:c.title})},a)})})})]}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsx(J,{children:s.content})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold",children:"Knowledge Document Not Found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(o,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:"/knowledge",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(j,{className:"h-4 w-4"})})})})]}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Knowledge Document Not Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"The requested knowledge document could not be found."})]})})})]})}export{ie as default};
@@ -1 +0,0 @@
1
- import{a as A,r as i,A as N,j as e,bJ as D,B as v,bK as T,t as w,k,bL as L,n as R}from"./index-PyVlsLW8.js";import{C as y,a as C}from"./card-xkODbJy-.js";import{B as j}from"./badge-D4vHU_w_.js";import{M as B}from"./MailProcessingModal-D_qEwqmL.js";import{R as U}from"./refresh-cw-B1bWW9Rg.js";import{P as M}from"./paperclip-ChugoOAp.js";import{C as $}from"./chevron-up-BB-6OS4z.js";import{C as F}from"./clock-BIeoO5Mt.js";function O(a){if(!a)return"";try{const s=new Date(a),x=new Date().getTime()-s.getTime(),o=Math.floor(x/(1e3*60*60*24));return o===0?s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}):o<7?s.toLocaleDateString("en-US",{weekday:"short",hour:"numeric",minute:"2-digit"}):s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return a}}function z(a){const s=a.match(/^([^<]+)\s*</);return s?s[1].trim():a.split("@")[0]||a}function J(a,s=120){const c=a.replace(/\n+/g," ").trim();return c.length<=s?c:c.slice(0,s)+"..."}function _({startedAt:a}){const[s,c]=i.useState("");return i.useEffect(()=>{function x(){const f=new Date(a).getTime(),h=Date.now(),m=Math.floor((h-f)/1e3);if(m<60)c(`${m}s`);else{const p=Math.floor(m/60),d=m%60;c(`${p}m ${d}s`)}}x();const o=setInterval(x,1e3);return()=>clearInterval(o)},[a]),e.jsxs("span",{className:"flex items-center gap-1 text-blue-600 dark:text-blue-400",children:[e.jsx(F,{className:"h-3 w-3"}),s]})}function Y(){const{toast:a}=A(),[s,c]=i.useState([]),[x,o]=i.useState(!0),[f,h]=i.useState(null),[m,p]=i.useState(null),[d,g]=i.useState(null),l=i.useRef(null),u=i.useCallback(async(t=!1)=>{try{t||o(!0);const r=await(await fetch(`${N}/api/v1/mail/inbox`)).json();r.success&&c(r.data.messages||[])}catch(n){console.error("Failed to fetch inbox:",n)}finally{t||o(!1)}},[]);i.useEffect(()=>{u()},[u]),i.useEffect(()=>{const t=s.some(n=>n.processing);return t&&!l.current?l.current=setInterval(()=>u(!0),5e3):!t&&l.current&&(clearInterval(l.current),l.current=null),()=>{l.current&&(clearInterval(l.current),l.current=null)}},[s,u]);const S=async(t,n)=>{n.stopPropagation(),p(t);try{const b=await(await fetch(`${N}/api/v1/mail/${t}/status`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"read"})})).json();b.success?(c(P=>P.filter(E=>E.id!==t)),f===t&&h(null),a({title:"Marked as read",description:"Email moved to Read folder."})):a({title:"Error",description:b.error||"Failed to mark as read",variant:"destructive"})}catch{a({title:"Error",description:"Failed to mark as read",variant:"destructive"})}finally{p(null)}},I=d?s.find(t=>t.id===d):null;return x?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h2",{className:"text-lg font-semibold",children:"Inbox"})}),[1,2,3].map(t=>e.jsx(D,{className:"h-20 w-full"},t))]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Inbox"}),s.length>0&&e.jsx(j,{variant:"secondary",children:s.length})]}),e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>u(),children:e.jsx(U,{className:"h-4 w-4"})})]}),s.length===0?e.jsx(y,{children:e.jsxs(C,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(T,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-muted-foreground",children:"No emails in inbox"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Incoming emails will appear here when received."})]})}):e.jsx("div",{className:"space-y-2",children:s.map(t=>{const n=f===t.id;return e.jsx(y,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>h(n?null:t.id),children:e.jsxs(C,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-semibold text-sm truncate",children:z(t.from)}),t.processing&&!t.action&&e.jsxs(j,{variant:"outline",className:"text-[10px] px-1.5 py-0 border-blue-300 text-blue-600 dark:border-blue-700 dark:text-blue-400 gap-1",children:[e.jsx(w,{className:"h-2.5 w-2.5 animate-spin"}),"Processing"]}),!t.processing&&t.action&&e.jsxs(j,{variant:"outline",className:"text-[10px] px-1.5 py-0 border-green-300 text-green-600 dark:border-green-700 dark:text-green-400 gap-1",children:[e.jsx(k,{className:"h-2.5 w-2.5"}),"Processed"]}),t.attachments.length>0&&e.jsx(M,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-xs text-muted-foreground ml-auto flex-shrink-0",children:O(t.receivedAt)})]}),e.jsx("p",{className:"text-sm font-medium truncate",children:t.subject}),!n&&t.content&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:J(t.content)})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:r=>S(t.id,r),disabled:m===t.id,title:"Mark as read",children:e.jsx(L,{className:"h-4 w-4"})}),n?e.jsx($,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(R,{className:"h-4 w-4 text-muted-foreground"})]})]}),n&&e.jsxs("div",{className:"mt-4 pt-4 border-t space-y-3",children:[e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"From:"})," ",t.from]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"To:"})," ",t.to.join(", ")]}),t.cc.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"CC:"})," ",t.cc.join(", ")]})]}),t.attachments.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:t.attachments.map(r=>e.jsxs(j,{variant:"outline",className:"text-xs",children:[e.jsx(M,{className:"h-3 w-3 mr-1"}),r.filename]},r.id))}),e.jsx("div",{className:"text-sm whitespace-pre-wrap bg-muted/50 rounded-md p-3",children:t.content||e.jsx("span",{className:"text-muted-foreground italic",children:"No content"})}),t.processing&&!t.action&&e.jsx("button",{type:"button",className:"w-full text-left bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 rounded-lg p-3 text-sm cursor-pointer hover:bg-blue-100 dark:hover:bg-blue-950/50 transition-colors",onClick:r=>{r.stopPropagation(),g(t.id)},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-blue-700 dark:text-blue-400 font-medium text-xs",children:[e.jsx(w,{className:"h-3.5 w-3.5 animate-spin"}),"Processing email..."]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.processingStartedAt&&e.jsx(_,{startedAt:t.processingStartedAt}),e.jsx("span",{className:"text-blue-500 dark:text-blue-400 text-[10px] font-medium",children:"View details"})]})]})}),t.action&&e.jsxs("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium text-xs mb-1",children:[e.jsx(k,{className:"h-3.5 w-3.5"}),"Agent Action"]}),e.jsx("p",{className:"text-green-900 dark:text-green-200",children:t.action})]})]})]})},t.id)})}),d&&e.jsx(B,{open:!!d,onOpenChange:t=>{t||g(null)},mailId:d,subject:I?.subject||"",onStopped:()=>u(!0)})]})}export{Y as default};
@@ -1,6 +0,0 @@
1
- import{c as M,a as D,r as t,A as k,j as e,D as R,b as T,d as $,f as C,k as P,g as I,B as S,bM as B,T as L}from"./index-PyVlsLW8.js";import{B as x}from"./badge-D4vHU_w_.js";import{C as F}from"./clock-BIeoO5Mt.js";import{R as _}from"./refresh-cw-B1bWW9Rg.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 z=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],y=M("triangle-alert",z);function E(i){const p=new Date(i).getTime(),o=Date.now(),c=Math.floor((o-p)/1e3);if(c<60)return`${c}s`;const l=Math.floor(c/60),d=c%60;if(l<60)return`${l}m ${d}s`;const s=Math.floor(l/60),f=l%60;return`${s}h ${f}m`}function V({open:i,onOpenChange:p,mailId:o,subject:c,onStopped:l}){const{toast:d}=D(),[s,f]=t.useState(null),[h,j]=t.useState(!1),[u,v]=t.useState(!1),[b,g]=t.useState(""),N=t.useRef(null),a=t.useRef(null),m=t.useCallback(async()=>{try{const r=await(await fetch(`${k}/api/v1/mail/${o}/processing`)).json();r.success&&f(r.data)}catch(n){console.error("[mail] Failed to fetch processing status:",n)}},[o]);t.useEffect(()=>{if(!i){a.current&&(clearInterval(a.current),a.current=null);return}return j(!0),m().finally(()=>j(!1)),a.current=setInterval(m,4e3),()=>{a.current&&(clearInterval(a.current),a.current=null)}},[i,m]),t.useEffect(()=>{const n=s?.active?.startedAt||s?.processingStartedAt;if(!n||!s?.processing){g("");return}g(E(n));const r=setInterval(()=>{g(E(n))},1e3);return()=>clearInterval(r)},[s?.active?.startedAt,s?.processingStartedAt,s?.processing]),t.useEffect(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[s?.log]),t.useEffect(()=>{s&&!s.processing&&!u&&a.current&&(clearInterval(a.current),a.current=null)},[s,u]);const A=async()=>{v(!0);try{const r=await(await fetch(`${k}/api/v1/mail/${o}/processing/stop`,{method:"POST"})).json();r.success?(d({title:"Processing stopped",description:r.message}),setTimeout(()=>{m(),l?.()},1500)):d({title:"Error",description:r.error||"Failed to stop processing",variant:"destructive"})}catch{d({title:"Error",description:"Failed to stop processing",variant:"destructive"})}finally{v(!1)}},w=s?.processing&&!s?.active;return e.jsx(R,{open:i,onOpenChange:p,children:e.jsxs(T,{className:"max-w-2xl max-h-[80vh] flex flex-col",children:[e.jsxs($,{children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(P,{className:"h-5 w-5"}),"Mail Processing"]}),e.jsx(I,{className:"truncate",children:c})]}),e.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s?.processing?w?e.jsxs(x,{variant:"outline",className:"text-amber-600 border-amber-300 dark:text-amber-400 dark:border-amber-700",children:[e.jsx(y,{className:"h-3 w-3 mr-1"}),"Stuck"]}):e.jsxs(x,{variant:"outline",className:"text-blue-600 border-blue-300 dark:text-blue-400 dark:border-blue-700",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse mr-1.5"}),"Running"]}):s?e.jsx(x,{variant:"outline",className:"text-muted-foreground",children:"Completed"}):null,s?.active?.agent&&e.jsx(x,{variant:"secondary",className:"text-xs",children:s.active.agent}),b&&e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(F,{className:"h-3 w-3"}),b]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"ghost",size:"sm",onClick:()=>m(),disabled:h,title:"Refresh",children:e.jsx(_,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`})}),s?.processing&&e.jsxs(S,{variant:"destructive",size:"sm",onClick:A,disabled:u,children:[e.jsx(B,{className:"h-3.5 w-3.5 mr-1.5"}),u?"Stopping...":"Stop"]})]})]}),w&&e.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3 text-sm text-amber-800 dark:text-amber-300",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-xs mb-1",children:[e.jsx(y,{className:"h-3.5 w-3.5"}),"Processing appears stuck"]}),e.jsx("p",{className:"text-xs",children:"The processing flag is set but no active agent process was found on the server. This can happen if the agent crashed or the server restarted. You can stop processing to clear the flag and try again."})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mb-2",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"font-medium",children:"Agent Log"}),s?.logPath&&e.jsx("span",{className:"text-[10px] opacity-60 truncate ml-1",children:s.logPath})]}),e.jsx("div",{className:"flex-1 min-h-0 max-h-[40vh] overflow-auto rounded-md border bg-muted/30 p-3 font-mono text-xs leading-relaxed",children:s?.log?e.jsxs(e.Fragment,{children:[e.jsx("pre",{className:"whitespace-pre-wrap break-words text-foreground/80",children:s.log}),e.jsx("div",{ref:N})]}):h?e.jsx("span",{className:"text-muted-foreground italic",children:"Loading logs..."}):e.jsx("span",{className:"text-muted-foreground italic",children:"No log output available yet."})})]})]})]})})}export{V as M};
@@ -1 +0,0 @@
1
- import{a as T,r as l,A as v,j as e,bJ as A,B as w,bL as L,t as k,k as C,bK as R,E as $,n as B}from"./index-PyVlsLW8.js";import{C as E,a as M}from"./card-xkODbJy-.js";import{B as g}from"./badge-D4vHU_w_.js";import{M as F}from"./MailProcessingModal-D_qEwqmL.js";import{R as U}from"./refresh-cw-B1bWW9Rg.js";import{P as S}from"./paperclip-ChugoOAp.js";import{C as z}from"./chevron-up-BB-6OS4z.js";import{C as O}from"./clock-BIeoO5Mt.js";function J(a){if(!a)return"";try{const s=new Date(a),m=new Date().getTime()-s.getTime(),o=Math.floor(m/(1e3*60*60*24));return o===0?s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}):o<7?s.toLocaleDateString("en-US",{weekday:"short",hour:"numeric",minute:"2-digit"}):s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return a}}function _(a){const s=a.match(/^([^<]+)\s*</);return s?s[1].trim():a.split("@")[0]||a}function K(a,s=120){const i=a.replace(/\n+/g," ").trim();return i.length<=s?i:i.slice(0,s)+"..."}function V({startedAt:a}){const[s,i]=l.useState("");return l.useEffect(()=>{function m(){const f=new Date(a).getTime(),p=Date.now(),d=Math.floor((p-f)/1e3);if(d<60)i(`${d}s`);else{const u=Math.floor(d/60),x=d%60;i(`${u}m ${x}s`)}}m();const o=setInterval(m,1e3);return()=>clearInterval(o)},[a]),e.jsxs("span",{className:"flex items-center gap-1 text-blue-600 dark:text-blue-400",children:[e.jsx(O,{className:"h-3 w-3"}),s]})}function ee(){const{toast:a}=T(),[s,i]=l.useState([]),[m,o]=l.useState(!0),[f,p]=l.useState(null),[d,u]=l.useState(null),[x,y]=l.useState(null),c=l.useRef(null),h=l.useCallback(async(t=!1)=>{try{t||o(!0);const n=await(await fetch(`${v}/api/v1/mail/read`)).json();n.success&&i(n.data.messages||[])}catch(r){console.error("Failed to fetch read mail:",r)}finally{t||o(!1)}},[]);l.useEffect(()=>{h()},[h]),l.useEffect(()=>{const t=s.some(r=>r.processing);return t&&!c.current?c.current=setInterval(()=>h(!0),5e3):!t&&c.current&&(clearInterval(c.current),c.current=null),()=>{c.current&&(clearInterval(c.current),c.current=null)}},[s,h]);const I=async(t,r)=>{r.stopPropagation(),u(t);try{const j=await(await fetch(`${v}/api/v1/mail/${t}/status`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"unread"})})).json();j.success?(i(b=>b.filter(N=>N.id!==t)),f===t&&p(null),a({title:"Moved to Inbox",description:"Email moved back to Inbox."})):a({title:"Error",description:j.error||"Failed to move email",variant:"destructive"})}catch{a({title:"Error",description:"Failed to move email",variant:"destructive"})}finally{u(null)}},P=async(t,r)=>{r.stopPropagation(),u(t);try{const j=await(await fetch(`${v}/api/v1/mail/read/${t}`,{method:"DELETE"})).json();j.success?(i(b=>b.filter(N=>N.id!==t)),f===t&&p(null),a({title:"Deleted",description:"Email has been deleted."})):a({title:"Error",description:j.error||"Failed to delete email",variant:"destructive"})}catch{a({title:"Error",description:"Failed to delete email",variant:"destructive"})}finally{u(null)}},D=x?s.find(t=>t.id===x):null;return m?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h2",{className:"text-lg font-semibold",children:"Read"})}),[1,2,3].map(t=>e.jsx(A,{className:"h-20 w-full"},t))]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Read"}),s.length>0&&e.jsx(g,{variant:"secondary",children:s.length})]}),e.jsx(w,{variant:"ghost",size:"sm",onClick:()=>h(),children:e.jsx(U,{className:"h-4 w-4"})})]}),s.length===0?e.jsx(E,{children:e.jsxs(M,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(L,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-muted-foreground",children:"No read emails"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Emails marked as read will appear here."})]})}):e.jsx("div",{className:"space-y-2",children:s.map(t=>{const r=f===t.id;return e.jsx(E,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>p(r?null:t.id),children:e.jsxs(M,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm text-muted-foreground truncate",children:_(t.from)}),t.processing&&!t.action&&e.jsxs(g,{variant:"outline",className:"text-[10px] px-1.5 py-0 border-blue-300 text-blue-600 dark:border-blue-700 dark:text-blue-400 gap-1",children:[e.jsx(k,{className:"h-2.5 w-2.5 animate-spin"}),"Processing"]}),!t.processing&&t.action&&e.jsxs(g,{variant:"outline",className:"text-[10px] px-1.5 py-0 border-green-300 text-green-600 dark:border-green-700 dark:text-green-400 gap-1",children:[e.jsx(C,{className:"h-2.5 w-2.5"}),"Processed"]}),t.attachments.length>0&&e.jsx(S,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-xs text-muted-foreground ml-auto flex-shrink-0",children:J(t.receivedAt)})]}),e.jsx("p",{className:"text-sm truncate",children:t.subject}),!r&&t.content&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:K(t.content)})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(w,{variant:"ghost",size:"sm",onClick:n=>I(t.id,n),disabled:d===t.id,title:"Move to Inbox",children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(w,{variant:"ghost",size:"sm",onClick:n=>P(t.id,n),disabled:d===t.id,title:"Delete",className:"text-destructive hover:text-destructive",children:e.jsx($,{className:"h-4 w-4"})}),r?e.jsx(z,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(B,{className:"h-4 w-4 text-muted-foreground"})]})]}),r&&e.jsxs("div",{className:"mt-4 pt-4 border-t space-y-3",children:[e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"From:"})," ",t.from]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"To:"})," ",t.to.join(", ")]}),t.cc.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"CC:"})," ",t.cc.join(", ")]})]}),t.attachments.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:t.attachments.map(n=>e.jsxs(g,{variant:"outline",className:"text-xs",children:[e.jsx(S,{className:"h-3 w-3 mr-1"}),n.filename]},n.id))}),e.jsx("div",{className:"text-sm whitespace-pre-wrap bg-muted/50 rounded-md p-3",children:t.content||e.jsx("span",{className:"text-muted-foreground italic",children:"No content"})}),t.processing&&!t.action&&e.jsx("button",{type:"button",className:"w-full text-left bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 rounded-lg p-3 text-sm cursor-pointer hover:bg-blue-100 dark:hover:bg-blue-950/50 transition-colors",onClick:n=>{n.stopPropagation(),y(t.id)},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-blue-700 dark:text-blue-400 font-medium text-xs",children:[e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}),"Processing email..."]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.processingStartedAt&&e.jsx(V,{startedAt:t.processingStartedAt}),e.jsx("span",{className:"text-blue-500 dark:text-blue-400 text-[10px] font-medium",children:"View details"})]})]})}),t.action&&e.jsxs("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium text-xs mb-1",children:[e.jsx(C,{className:"h-3.5 w-3.5"}),"Agent Action"]}),e.jsx("p",{className:"text-green-900 dark:text-green-200",children:t.action})]})]})]})},t.id)})}),x&&e.jsx(F,{open:!!x,onOpenChange:t=>{t||y(null)},mailId:x,subject:D?.subject||"",onStopped:()=>h(!0)})]})}export{ee as default};
@@ -1,9 +0,0 @@
1
- import{u as S,a as y,r,j as e,B as j,t as E,a0 as T,L,I as b,A as I}from"./index-PyVlsLW8.js";import{C as i,b as c,c as l,a as d}from"./card-xkODbJy-.js";import{L as m}from"./label-DvPENm3h.js";import{M as A}from"./markdown-editor-DpZxV-fa.js";import{T as B}from"./TagInput-Bgyxb_JU.js";import{S as P}from"./SourceInput-CWazIr6v.js";import{A as M}from"./arrow-left-7TCkaJlN.js";import"./index-BQYB8kWb.js";import"./badge-D4vHU_w_.js";import"./external-link--RjKXREe.js";function U(){const g=S(),{toast:s}=y(),[u,h]=r.useState(!1),[a,f]=r.useState(""),[n,v]=r.useState(""),[x,w]=r.useState([]),[p,C]=r.useState([]),k=async()=>{if(!a.trim()){s({title:"Error",description:"Please provide a title for the knowledge document",variant:"destructive"});return}if(!n.trim()){s({title:"Error",description:"Please provide content for the knowledge document",variant:"destructive"});return}h(!0);try{const o=await(await fetch(`${I}/api/v1/knowledge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a.trim(),content:n.trim(),metadata:{tags:x,sources:p}})})).json();if(o.success){s({title:"Success",description:"Knowledge document created successfully"});const N=o.document.filename.replace(".md","");g(`/knowledge/${N}`)}else s({title:"Error",description:o.error||"Failed to create knowledge document",variant:"destructive"})}catch(t){console.error("Error creating document:",t),s({title:"Error",description:"Failed to create knowledge document",variant:"destructive"})}finally{h(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-3xl font-bold",children:"Create Knowledge Document"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{onClick:k,disabled:u||!a.trim()||!n.trim(),size:"sm",children:[u?e.jsx(E,{className:"w-4 h-4 animate-spin"}):e.jsx(T,{className:"w-4 h-4"}),"Create Document"]}),e.jsx(j,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(L,{to:"/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(M,{className:"h-4 w-4"})})})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Basic Information"})}),e.jsx(d,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(m,{htmlFor:"title",children:"Title *"}),e.jsx(b,{id:"title",value:a,onChange:t=>f(t.target.value),placeholder:"Enter document title...",className:"text-lg"})]})})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Metadata"})}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{children:"Tags"}),e.jsx(B,{tags:x,onChange:w,placeholder:"Add a tag"})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Sources"}),e.jsx(P,{sources:p,onChange:C})]})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Content *"})}),e.jsx(d,{children:e.jsx(A,{value:n,onChange:t=>v(t||""),placeholder:`Enter your knowledge content in Markdown...
2
-
3
- You can use:
4
- - **Bold text**
5
- - *Italic text*
6
- - # Headers
7
- - - Lists
8
- - [Links](https://example.com)
9
- - Code blocks and more!`})})]})]})}export{U as default};
@@ -1,11 +0,0 @@
1
- import{u as L,a as I,r as i,A as S,j as e,B as C,L as M,a0 as A,I as p}from"./index-PyVlsLW8.js";import{C as h,a as x,b,c as P}from"./card-xkODbJy-.js";import{L as l}from"./label-DvPENm3h.js";import{S as B,a as D,b as T,c as O,d as j}from"./select-B1v2u6hQ.js";import{M as V}from"./markdown-editor-DpZxV-fa.js";import{A as W}from"./arrow-left-7TCkaJlN.js";import{C as z}from"./circle-check-big-Dbo-OmWQ.js";import"./index-BQYB8kWb.js";import"./chevron-up-BB-6OS4z.js";function Q(){const E=L(),{toast:d}=I(),[a,v]=i.useState({project:{name:"",description:"",website:"",version:"1.0.0",stage:"development"}}),[u,g]=i.useState(""),[F,f]=i.useState(!0),[y,w]=i.useState(!1);i.useEffect(()=>{fetch(`${S}/api/v1/context/project`).then(t=>t.json()).then(t=>{if(t.success){const s=t.document;v({project:{name:s.metadata.project?.name||"",description:s.metadata.project?.description||"",website:s.metadata.project?.website||s.metadata.project?.repository||"",version:s.metadata.project?.version||"1.0.0",stage:s.metadata.project?.stage||"development"}}),g(s.content.trim())}f(!1)}).catch(t=>{console.error("Failed to load context:",t),d({title:"Error",description:"Failed to load project context",variant:"destructive"}),f(!1)})},[d]);const k=async()=>{w(!0);try{const s={project:Object.fromEntries(Object.entries(a.project).map(([o,r])=>[o,typeof r=="string"?r.trim():r]))},n=await(await fetch(`${S}/api/v1/context/project`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u,metadata:s})})).json();if(n.success)d({title:"Success",description:"Project context saved successfully",action:e.jsx(z,{className:"h-4 w-4"})}),E("/context/project");else throw new Error(n.error||"Failed to save context")}catch(t){console.error("Save error:",t),d({title:"Error",description:"Failed to save project context",variant:"destructive"})}finally{w(!1)}},c=(t,s)=>{v(N=>{const n={...N},o=t.split(".");let r=n;for(let m=0;m<o.length-1;m++)r=r[o[m]];return r[o[o.length-1]]=s,n})};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-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Edit project information and documentation"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(M,{to:"/context/project",children:[e.jsx(W,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Back"})]})}),e.jsxs(C,{size:"sm",onClick:k,disabled:y,children:[e.jsx(A,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Saving...":"Save"})]})]})]}),e.jsxs(h,{children:[e.jsx(b,{children:e.jsx(P,{children:"Project Information"})}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-name",children:"Project Name"}),e.jsx(p,{id:"project-name",value:a.project.name,onChange:t=>c("project.name",t.target.value),placeholder:"My Awesome Project"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-version",children:"Version"}),e.jsx(p,{id:"project-version",value:a.project.version,onChange:t=>c("project.version",t.target.value),placeholder:"1.0.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-description",children:"Description"}),e.jsx(p,{id:"project-description",value:a.project.description,onChange:t=>c("project.description",t.target.value),placeholder:"Brief description of what this project does"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-website",children:"Website"}),e.jsx(p,{id:"project-website",value:a.project.website,onChange:t=>c("project.website",t.target.value),placeholder:"https://yourproject.com"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-stage",children:"Development Stage"}),e.jsxs(B,{value:a.project.stage,onValueChange:t=>c("project.stage",t),children:[e.jsx(D,{children:e.jsx(T,{placeholder:"Select stage"})}),e.jsxs(O,{children:[e.jsx(j,{value:"prototype",children:"Prototype"}),e.jsx(j,{value:"development",children:"Development"}),e.jsx(j,{value:"mvp",children:"MVP"}),e.jsx(j,{value:"production",children:"Production"})]})]})]})]})]})]}),e.jsxs(h,{children:[e.jsx(b,{children:e.jsx(P,{children:"Documentation"})}),e.jsx(x,{children:e.jsx(V,{value:u,onChange:t=>g(t||""),placeholder:`Write your project documentation in markdown...
2
-
3
- ## What is this project?
4
-
5
- Describe what your project does, who it's for, and why it exists.
6
-
7
- ## Current State
8
-
9
- - Development stage
10
- - Key features that are working
11
- - What's planned for next releases`,height:800})})]})]})}export{Q as default};
@@ -1 +0,0 @@
1
- import{a as w,r,A as y,j as e,t as C,F as b,B as n,M as P,au as E,L as k,Y as L,ar as z}from"./index-PyVlsLW8.js";import{C as c,a as i,b as p,c as F}from"./card-xkODbJy-.js";import{B as x}from"./badge-D4vHU_w_.js";import{c as B}from"./clipboard-B9ndUJKl.js";import{E as D}from"./external-link--RjKXREe.js";function I(){const{toast:d}=w(),[o,h]=r.useState(null),[j,u]=r.useState(!0),[f,l]=r.useState(!1);r.useEffect(()=>{fetch(`${y}/api/v1/context/project`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(h(s.document),l(!0)):l(!1)}).catch(()=>{l(!1)}).finally(()=>{u(!1)})},[]);const v=async()=>{const s=".nut/context/project.md";try{await B(s),d({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(m){console.error("Failed to copy path:",m),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},N=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"project-md",filename:"project.md",name:"project.md",path:".nut/context/project.md"}});window.dispatchEvent(s)};if(j)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{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 Project Overview..."})]})})})});if(!f||!o)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(b,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Project Overview Found"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Run ",e.jsx("code",{className:"bg-muted px-2 py-1 rounded",children:"coconut init"})," to create the project overview."]})]})})})});const t=o.metadata,a=t.project?.website||t.project?.repository,g=a?(s=>{try{return new URL(s.startsWith("http")?s:`https://${s}`).host.replace(/^www\./,"")}catch{return s.replace(/^https?:\/\//,"")}})(a):null;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:"Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Core project information and configuration"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(P,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(n,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(n,{size:"sm",asChild:!0,children:e.jsxs(k,{to:"/context/project/edit",children:[e.jsx(L,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),t&&e.jsx("div",{className:"grid grid-cols-1 gap-4",children:e.jsxs(c,{children:[e.jsx(p,{className:"pb-3",children:e.jsx(F,{className:"text-lg font-semibold",children:"Project Info"})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.project?.name||"Unnamed Project"}),t.project?.description&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t.project.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(D,{className:"w-3 h-3 mr-2"}),g||"Website"]})}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[t.project?.version&&e.jsxs(x,{variant:"secondary",children:["v",t.project.version]}),t.project?.stage&&e.jsx(x,{variant:t.project.stage==="mvp"?"default":"secondary",children:t.project.stage})]})]})]})]})}),e.jsxs(c,{children:[e.jsx(p,{}),e.jsx(i,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(z,{children:o.content||"No content available"})})})]})]})}export{I as default};