@lovelybunch/api 1.0.71 → 1.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/auth/auth-manager.d.ts.map +1 -0
- package/dist/lib/auth/auth-manager.js.map +1 -0
- package/dist/lib/gait-path.d.ts.map +1 -0
- package/dist/lib/gait-path.js.map +1 -0
- package/dist/lib/git-settings.d.ts.map +1 -0
- package/dist/lib/git-settings.js.map +1 -0
- package/dist/lib/git.d.ts.map +1 -0
- package/dist/lib/git.js.map +1 -0
- package/dist/lib/jobs/global-job-scheduler.d.ts.map +1 -0
- package/dist/lib/jobs/global-job-scheduler.js.map +1 -0
- package/dist/lib/jobs/job-runner.d.ts.map +1 -0
- package/dist/lib/jobs/job-runner.js.map +1 -0
- package/dist/lib/jobs/job-scheduler.d.ts.map +1 -0
- package/dist/lib/jobs/job-scheduler.js.map +1 -0
- package/dist/lib/jobs/job-store.d.ts.map +1 -0
- package/dist/lib/jobs/job-store.js.map +1 -0
- package/dist/lib/project-paths.d.ts.map +1 -0
- package/dist/lib/project-paths.js.map +1 -0
- package/dist/lib/storage/file-storage.d.ts.map +1 -0
- package/dist/lib/storage/file-storage.js.map +1 -0
- package/dist/lib/symlinks/symlink-manager.d.ts.map +1 -0
- package/dist/lib/symlinks/symlink-manager.js.map +1 -0
- package/dist/lib/symlinks/types.d.ts.map +1 -0
- package/dist/lib/symlinks/types.js.map +1 -0
- package/dist/lib/terminal/context-helper.d.ts +1 -1
- package/dist/lib/terminal/context-helper.d.ts.map +1 -0
- package/dist/lib/terminal/context-helper.js +4 -16
- package/dist/lib/terminal/context-helper.js.map +1 -0
- package/dist/lib/terminal/global-manager.d.ts.map +1 -0
- package/dist/lib/terminal/global-manager.js.map +1 -0
- package/dist/lib/terminal/shell-utils.d.ts.map +1 -0
- package/dist/lib/terminal/shell-utils.js.map +1 -0
- package/dist/lib/terminal/terminal-manager.d.ts.map +1 -0
- package/dist/lib/terminal/terminal-manager.js.map +1 -0
- package/dist/lib/user-preferences.d.ts.map +1 -0
- package/dist/lib/user-preferences.js.map +1 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/routes/api/v1/agents/[id]/index.d.ts.map +1 -0
- package/dist/routes/api/v1/agents/[id]/index.js.map +1 -0
- package/dist/routes/api/v1/agents/[id]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/agents/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/agents/index.d.ts.map +1 -0
- package/dist/routes/api/v1/agents/index.js.map +1 -0
- package/dist/routes/api/v1/agents/route.d.ts.map +1 -0
- package/dist/routes/api/v1/agents/route.js.map +1 -0
- package/dist/routes/api/v1/ai/index.d.ts.map +1 -0
- package/dist/routes/api/v1/ai/index.js.map +1 -0
- package/dist/routes/api/v1/ai/route.d.ts.map +1 -0
- package/dist/routes/api/v1/ai/route.js +134 -33
- package/dist/routes/api/v1/ai/route.js.map +1 -0
- package/dist/routes/api/v1/ai/tools.js +157 -34
- package/dist/routes/api/v1/api-keys/index.d.ts.map +1 -0
- package/dist/routes/api/v1/api-keys/index.js.map +1 -0
- package/dist/routes/api/v1/api-keys/route.d.ts.map +1 -0
- package/dist/routes/api/v1/api-keys/route.js.map +1 -0
- package/dist/routes/api/v1/auth/index.d.ts.map +1 -0
- package/dist/routes/api/v1/auth/index.js.map +1 -0
- package/dist/routes/api/v1/auth/route.d.ts.map +1 -0
- package/dist/routes/api/v1/auth/route.js.map +1 -0
- package/dist/routes/api/v1/auth-settings/index.d.ts.map +1 -0
- package/dist/routes/api/v1/auth-settings/index.js.map +1 -0
- package/dist/routes/api/v1/auth-settings/route.d.ts.map +1 -0
- package/dist/routes/api/v1/auth-settings/route.js.map +1 -0
- package/dist/routes/api/v1/chats/[id]/index.d.ts.map +1 -0
- package/dist/routes/api/v1/chats/[id]/index.js.map +1 -0
- package/dist/routes/api/v1/chats/[id]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/chats/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/chats/index.d.ts.map +1 -0
- package/dist/routes/api/v1/chats/index.js.map +1 -0
- package/dist/routes/api/v1/chats/route.d.ts.map +1 -0
- package/dist/routes/api/v1/chats/route.js.map +1 -0
- package/dist/routes/api/v1/config/index.d.ts.map +1 -0
- package/dist/routes/api/v1/config/index.js.map +1 -0
- package/dist/routes/api/v1/config/route.d.ts.map +1 -0
- package/dist/routes/api/v1/config/route.js.map +1 -0
- package/dist/routes/api/v1/context/architecture/route.d.ts.map +1 -0
- package/dist/routes/api/v1/context/architecture/route.js.map +1 -0
- package/dist/routes/api/v1/context/index.d.ts.map +1 -0
- package/dist/routes/api/v1/context/index.js +2 -0
- package/dist/routes/api/v1/context/index.js.map +1 -0
- package/dist/routes/api/v1/context/knowledge/[filename]/index.d.ts.map +1 -0
- package/dist/routes/api/v1/context/knowledge/[filename]/index.js.map +1 -0
- package/dist/routes/api/v1/context/knowledge/[filename]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/context/knowledge/[filename]/route.js.map +1 -0
- package/dist/routes/api/v1/context/knowledge/index.d.ts.map +1 -0
- package/dist/routes/api/v1/context/knowledge/index.js.map +1 -0
- package/dist/routes/api/v1/context/knowledge/route.d.ts.map +1 -0
- package/dist/routes/api/v1/context/knowledge/route.js.map +1 -0
- package/dist/routes/api/v1/context/project/route.d.ts.map +1 -0
- package/dist/routes/api/v1/context/project/route.js.map +1 -0
- package/dist/routes/api/v1/context/role/route.d.ts +3 -0
- package/dist/routes/api/v1/context/role/route.js +198 -0
- package/dist/routes/api/v1/events/status/route.d.ts +1 -1
- package/dist/routes/api/v1/git/index.d.ts.map +1 -0
- package/dist/routes/api/v1/git/index.js.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/run/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/[id]/run/route.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/run/route.js.map +1 -0
- package/dist/routes/api/v1/jobs/[id]/runs/[runId]/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/index.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/index.js.map +1 -0
- package/dist/routes/api/v1/jobs/route.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/route.js.map +1 -0
- package/dist/routes/api/v1/jobs/status/route.d.ts +1 -1
- package/dist/routes/api/v1/jobs/status/route.d.ts.map +1 -0
- package/dist/routes/api/v1/jobs/status/route.js.map +1 -0
- package/dist/routes/api/v1/mcp/index.d.ts.map +1 -0
- package/dist/routes/api/v1/mcp/index.js +116 -3
- package/dist/routes/api/v1/mcp/index.js.map +1 -0
- package/dist/routes/api/v1/mcp/route.d.ts.map +1 -0
- package/dist/routes/api/v1/mcp/route.js.map +1 -0
- package/dist/routes/api/v1/proposals/[id]/route.d.ts +8 -8
- package/dist/routes/api/v1/proposals/[id]/route.d.ts.map +1 -0
- package/dist/routes/api/v1/proposals/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/proposals/index.d.ts.map +1 -0
- package/dist/routes/api/v1/proposals/index.js.map +1 -0
- package/dist/routes/api/v1/proposals/route.d.ts.map +1 -0
- package/dist/routes/api/v1/proposals/route.js.map +1 -0
- package/dist/routes/api/v1/resources/[id]/index.d.ts.map +1 -0
- package/dist/routes/api/v1/resources/[id]/index.js.map +1 -0
- package/dist/routes/api/v1/resources/[id]/route.js.map +1 -0
- package/dist/routes/api/v1/resources/[id]/thumbnail/index.d.ts.map +1 -0
- package/dist/routes/api/v1/resources/[id]/thumbnail/index.js.map +1 -0
- package/dist/routes/api/v1/resources/[id]/thumbnail/route.js.map +1 -0
- package/dist/routes/api/v1/resources/generate/route.js +24 -3
- package/dist/routes/api/v1/resources/index.d.ts.map +1 -0
- package/dist/routes/api/v1/resources/index.js.map +1 -0
- package/dist/routes/api/v1/resources/route.d.ts.map +1 -0
- package/dist/routes/api/v1/resources/route.js.map +1 -0
- package/dist/routes/api/v1/symlinks/index.d.ts.map +1 -0
- package/dist/routes/api/v1/symlinks/index.js.map +1 -0
- package/dist/routes/api/v1/symlinks/route.d.ts.map +1 -0
- package/dist/routes/api/v1/symlinks/route.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/create/index.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/create/index.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/create/route.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/create/route.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/resize/index.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/resize/index.js.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/resize/route.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/[proposalId]/resize/route.js.map +1 -0
- package/dist/routes/api/v1/terminal/sessions/index.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/sessions/index.js.map +1 -0
- package/dist/routes/api/v1/terminal/sessions/route.d.ts.map +1 -0
- package/dist/routes/api/v1/terminal/sessions/route.js.map +1 -0
- package/dist/routes/api/v1/user/index.d.ts.map +1 -0
- package/dist/routes/api/v1/user/index.js.map +1 -0
- package/dist/routes/api/v1/user/settings/index.d.ts.map +1 -0
- package/dist/routes/api/v1/user/settings/index.js.map +1 -0
- package/dist/routes/api/v1/user/settings/route.d.ts.map +1 -0
- package/dist/routes/api/v1/user/settings/route.js.map +1 -0
- package/dist/server-with-static.d.ts.map +1 -0
- package/dist/server-with-static.js.map +1 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js.map +1 -0
- package/package.json +4 -4
- package/static/assets/ActivityPage-qJKqmwv7.js +1 -0
- package/static/assets/{AgentDetailPage-CZ2tz-Ol.js → AgentDetailPage-Dww8h17d.js} +1 -1
- package/static/assets/AgentEditPage-K6I9kvCf.js +1 -0
- package/static/assets/AgentsPage-nnMzCmw9.js +3 -0
- package/static/assets/AgentsSettingsPage-Dnkw87_8.js +6 -0
- package/static/assets/{ApiKeysSettingsPage-C7Xlzj-X.js → ApiKeysSettingsPage-DY0vNNSR.js} +3 -3
- package/static/assets/{ArchitectureEditPage-B9nVQn0B.js → ArchitectureEditPage-wx1LBCGC.js} +1 -1
- package/static/assets/ArchitecturePage-C4bkskmN.js +1 -0
- package/static/assets/{AuthSettingsPage-CaeV2cQ4.js → AuthSettingsPage-AXU_vx8p.js} +2 -2
- package/static/assets/{CallbackPage-DmeStBSx.js → CallbackPage-B6CJkdJu.js} +1 -1
- package/static/assets/CodePage-DGxzOKzh.js +2 -0
- package/static/assets/{CollapsibleSection-Cb80fCCb.js → CollapsibleSection-DgGytfeZ.js} +1 -1
- package/static/assets/DashboardPage-3PlgC6UV.js +41 -0
- package/static/assets/{GitPage-D2aJfzTq.js → GitPage-vBLrGiwG.js} +3 -3
- package/static/assets/{GitSettingsPage-Bz17VWrK.js → GitSettingsPage-D22W0fXd.js} +2 -2
- package/static/assets/{IdentityPage-O7o2b4JB.js → IdentityPage-B8xDJx3W.js} +3 -3
- package/static/assets/{ImplementationStepsEditor-BkJjQBc-.js → ImplementationStepsEditor-BY7wwwdO.js} +2 -2
- package/static/assets/IntegrationsSettingsPage-CSr-dlmL.js +1 -0
- package/static/assets/JobDetailPage-BUHRLYvQ.js +1 -0
- package/static/assets/KnowledgeDetailPage-8q-MYEOA.js +1 -0
- package/static/assets/{KnowledgeEditPage-DgyPoIJv.js → KnowledgeEditPage-Di63BhFz.js} +1 -1
- package/static/assets/{KnowledgePage-Ck_FeruK.js → KnowledgePage-BuEcOdou.js} +2 -2
- package/static/assets/{LoginPage-IqcnIlMj.js → LoginPage-CBRJBmlC.js} +1 -1
- package/static/assets/McpSettingsPage-gariusH3.js +1 -0
- package/static/assets/NewAgentPage-DDkFaqIq.js +1 -0
- package/static/assets/{NewKnowledgePage-xBm9PTKB.js → NewKnowledgePage-BqMSsS53.js} +2 -2
- package/static/assets/NewProposalPage-C77pO28o.js +90 -0
- package/static/assets/{ProjectEditPage-BlA-908F.js → ProjectEditPage-Dp5M7aXW.js} +1 -1
- package/static/assets/ProjectPage-BBL0XITa.js +1 -0
- package/static/assets/{PromptsSettingsPage-BvU01T7L.js → PromptsSettingsPage-DOcni_gq.js} +1 -1
- package/static/assets/ProposalDetailPage-5b6lLZRq.js +1 -0
- package/static/assets/ProposalEditPage-lm9wiiHa.js +1 -0
- package/static/assets/{ProposalsPage-erDBdH7Z.js → ProposalsPage-Dcms-16A.js} +2 -2
- package/static/assets/ResourcesPage-BGugJIYF.js +71 -0
- package/static/assets/RoleEditPage-DI1lGRK2.js +13 -0
- package/static/assets/RolePage-B1kmmDDF.js +1 -0
- package/static/assets/{RulesSettingsPage-DurFFm98.js → RulesSettingsPage-Br_c4fhl.js} +1 -1
- package/static/assets/SchedulePage-DMBddFXL.js +4 -0
- package/static/assets/SourceInput-BuPLoJuZ.js +1 -0
- package/static/assets/{TagInput-2_jYxO52.js → TagInput-CkZQYmnO.js} +1 -1
- package/static/assets/TerminalPage-CYqTT1pK.js +1 -0
- package/static/assets/{TerminalSessionPage-BjvQegW1.js → TerminalSessionPage-a9QWo08R.js} +4 -4
- package/static/assets/UserPreferencesPage-IVxOVtNk.js +1 -0
- package/static/assets/{UserSettingsPage-DhOu8xZ3.js → UserSettingsPage-Dsop4_yN.js} +1 -1
- package/static/assets/{UtilitiesPage-olcchfEX.js → UtilitiesPage-CZCmnyTp.js} +1 -1
- package/static/assets/{alert-bP1PxakB.js → alert-nipAjehb.js} +1 -1
- package/static/assets/{arrow-down-BoBPr1Sn.js → arrow-down-DQTEjf4E.js} +1 -1
- package/static/assets/{arrow-left-orDiJ2Pw.js → arrow-left-BgRi6mQL.js} +1 -1
- package/static/assets/{arrow-up-CCloQpeV.js → arrow-up-jLj_KhSo.js} +1 -1
- package/static/assets/{badge-D7styiB7.js → badge-CqnJU-OF.js} +1 -1
- package/static/assets/{browser-modal-n0MeSpgA.js → browser-modal-DBBFKngy.js} +2 -2
- package/static/assets/{calendar-w3geg78-.js → calendar-CA_W4UKa.js} +1 -1
- package/static/assets/{card-pzUJtmwJ.js → card-DdTVdbjN.js} +1 -1
- package/static/assets/{chevron-left-B6nXpDLi.js → chevron-left-CM04t09S.js} +1 -1
- package/static/assets/chevrons-up-DgSgy4LT.js +11 -0
- package/static/assets/{circle-alert-BcFpY-ZU.js → circle-alert-UErAnUQ-.js} +1 -1
- package/static/assets/{circle-check-HRharHjy.js → circle-check-2oo3aeGx.js} +1 -1
- package/static/assets/{circle-check-big-B2CFEks4.js → circle-check-big-CQsXU9Fx.js} +1 -1
- package/static/assets/{circle-play-CfrNAC9J.js → circle-play-BHGmBl9H.js} +1 -1
- package/static/assets/{circle-x-CNn7_0Ew.js → circle-x-DoAXluPx.js} +1 -1
- package/static/assets/{clipboard-LaXihY2m.js → clipboard-NaRSfq4S.js} +1 -1
- package/static/assets/{clock-By2Dd4u0.js → clock-C1lOY_Qr.js} +1 -1
- package/static/assets/{download--HiFU7TR.js → download-Co1Xt7Td.js} +1 -1
- package/static/assets/droid-Caom7ttu.js +4 -0
- package/static/assets/{eye-DorygWtP.js → eye-54QpT_B-.js} +1 -1
- package/static/assets/{folder-git-2-B8bjLoxc.js → folder-git-2-x65JY04J.js} +1 -1
- package/static/assets/index-BhlZ_D1Y.css +2 -0
- package/static/assets/index-VBSAUXJg.js +468 -0
- package/static/assets/{label-CTlQtJaU.js → label-C6P6J-NS.js} +1 -1
- package/static/assets/{markdown-editor-BOcltq2r.js → markdown-editor-CgzPMMiE.js} +1 -1
- package/static/assets/{pause-D33aM-oa.js → pause-CU8WFOyJ.js} +1 -1
- package/static/assets/{play-B6IdXHPj.js → play-nlXIUG-M.js} +1 -1
- package/static/assets/{plus-DhYjijTS.js → plus-nBUooJPr.js} +1 -1
- package/static/assets/{radio-group-B-Rc5x_L.js → radio-group-CQVEYWSk.js} +1 -1
- package/static/assets/{refresh-cw-BuuX9h4Z.js → refresh-cw-ChsHXM-C.js} +1 -1
- package/static/assets/{search-BiMN-o92.js → search-ygMlQfjH.js} +1 -1
- package/static/assets/{switch-vSV_roZ2.js → switch-BcjQDy93.js} +1 -1
- package/static/assets/{tabs-ChuwGq16.js → tabs-B2pmN66L.js} +1 -1
- package/static/assets/{tag-DERlGH35.js → tag-BEI3zSmE.js} +1 -1
- package/static/assets/terminal-preview-_bKoIC7R.js +1 -0
- package/static/assets/{use-terminal-qzkum-B5.js → use-terminal-DKszJuOd.js} +1 -1
- package/static/assets/{zap-DwFz_ltU.js → zap-w4hozPoR.js} +1 -1
- package/static/index.html +2 -2
- package/dist/lib/mcp-client.d.ts +0 -39
- package/dist/lib/mcp-client.js +0 -131
- package/static/assets/AgentEditPage-BiAoWU1z.js +0 -1
- package/static/assets/AgentsPage-D_HMA-40.js +0 -3
- package/static/assets/AgentsSettingsPage-C5ZsOVSL.js +0 -6
- package/static/assets/ArchitecturePage-CChIC6Qa.js +0 -1
- package/static/assets/CodePage-BtKkipWC.js +0 -2
- package/static/assets/DashboardPage-DdApq_B-.js +0 -11
- package/static/assets/IntegrationsSettingsPage-brFTXUBL.js +0 -1
- package/static/assets/KnowledgeDetailPage-e5OpRrZ2.js +0 -1
- package/static/assets/McpSettingsPage-KJBLTelP.js +0 -1
- package/static/assets/NewAgentPage-DLIvDpeZ.js +0 -1
- package/static/assets/NewProposalPage-BlocVyGv.js +0 -90
- package/static/assets/ProjectPage-Dj-tc-ZE.js +0 -1
- package/static/assets/ProposalDetailPage-_8Wn6NJt.js +0 -1
- package/static/assets/ProposalEditPage-BbbWkAuu.js +0 -1
- package/static/assets/ResourcesPage-B1uF-EA-.js +0 -71
- package/static/assets/SchedulePage-BAnM4Lu5.js +0 -4
- package/static/assets/SourceInput-7lTShZ6_.js +0 -1
- package/static/assets/TerminalPage-CRVEtFXr.js +0 -1
- package/static/assets/UserPreferencesPage-C5ueVUwG.js +0 -1
- package/static/assets/droid-C6RWH9f4.js +0 -4
- package/static/assets/index-B5SwW-PH.css +0 -2
- package/static/assets/index-BfJaT17z.js +0 -458
- package/static/assets/terminal-preview-BFedy4-J.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,
|
|
1
|
+
import{r as n,b9 as E,at as K,an as T,j as a,ao as N,ba as U,ar as x,as as g,bb as V,aq as w,bc as z,aw as H,av as $,e as I,bd as W}from"./index-VBSAUXJg.js";var C="Radio",[X,_]=N(C),[Y,J]=X(C),j=n.forwardRef((r,t)=>{const{__scopeRadio:e,name:d,checked:o=!1,required:s,disabled:i,value:p="on",onCheck:f,form:R,...v}=r,[l,m]=n.useState(null),c=g(t,y=>m(y)),u=n.useRef(!1),b=l?R||!!l.closest("form"):!0;return a.jsxs(Y,{scope:e,checked:o,disabled:i,children:[a.jsx(x.button,{type:"button",role:"radio","aria-checked":o,"data-state":S(o),"data-disabled":i?"":void 0,disabled:i,value:p,...v,ref:c,onClick:w(r.onClick,y=>{o||f?.(),b&&(u.current=y.isPropagationStopped(),u.current||y.stopPropagation())})}),b&&a.jsx(P,{control:l,bubbles:!u.current,name:d,value:p,checked:o,required:s,disabled:i,form:R,style:{transform:"translateX(-100%)"}})]})});j.displayName=C;var k="RadioIndicator",G=n.forwardRef((r,t)=>{const{__scopeRadio:e,forceMount:d,...o}=r,s=J(k,e);return a.jsx(z,{present:d||s.checked,children:a.jsx(x.span,{"data-state":S(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});G.displayName=k;var Q="RadioBubbleInput",P=n.forwardRef(({__scopeRadio:r,control:t,checked:e,bubbles:d=!0,...o},s)=>{const i=n.useRef(null),p=g(i,s),f=H(e),R=$(t);return n.useEffect(()=>{const v=i.current;if(!v)return;const l=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(l,"checked").set;if(f!==e&&c){const u=new Event("click",{bubbles:d});c.call(v,e),v.dispatchEvent(u)}},[f,e,d]),a.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:e,...o,tabIndex:-1,ref:p,style:{...o.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});P.displayName=Q;function S(r){return r?"checked":"unchecked"}var Z=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],h="RadioGroup",[ee,de]=N(h,[E,_]),A=E(),D=_(),[oe,re]=ee(h),M=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,name:d,defaultValue:o,value:s,required:i=!1,disabled:p=!1,orientation:f,dir:R,loop:v=!0,onValueChange:l,...m}=r,c=A(e),u=K(R),[b,y]=T({prop:s,defaultProp:o??null,onChange:l,caller:h});return a.jsx(oe,{scope:e,name:d,required:i,disabled:p,value:b,onValueChange:y,children:a.jsx(U,{asChild:!0,...c,orientation:f,dir:u,loop:v,children:a.jsx(x.div,{role:"radiogroup","aria-required":i,"aria-orientation":f,"data-disabled":p?"":void 0,dir:u,...m,ref:t})})})});M.displayName=h;var O="RadioGroupItem",q=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,disabled:d,...o}=r,s=re(O,e),i=s.disabled||d,p=A(e),f=D(e),R=n.useRef(null),v=g(t,R),l=s.value===o.value,m=n.useRef(!1);return n.useEffect(()=>{const c=b=>{Z.includes(b.key)&&(m.current=!0)},u=()=>m.current=!1;return document.addEventListener("keydown",c),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",u)}},[]),a.jsx(V,{asChild:!0,...p,focusable:!i,active:l,children:a.jsx(j,{disabled:i,required:s.required,checked:l,...f,...o,name:s.name,ref:v,onCheck:()=>s.onValueChange(o.value),onKeyDown:w(c=>{c.key==="Enter"&&c.preventDefault()}),onFocus:w(o.onFocus,()=>{m.current&&R.current?.click()})})})});q.displayName=O;var ae="RadioGroupIndicator",F=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,...d}=r,o=D(e);return a.jsx(G,{...o,...d,ref:t})});F.displayName=ae;var L=M,B=q,te=F;const se=n.forwardRef(({className:r,...t},e)=>a.jsx(L,{className:I("grid gap-2",r),...t,ref:e}));se.displayName=L.displayName;const ne=n.forwardRef(({className:r,...t},e)=>a.jsx(B,{ref:e,className:I("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),...t,children:a.jsx(te,{className:"flex items-center justify-center",children:a.jsx(W,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ne.displayName=B.displayName;export{se as R,ne as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,
|
|
1
|
+
import{r as c,j as e,e as i}from"./index-VBSAUXJg.js";const d=c.forwardRef(({className:s,onCheckedChange:r,onChange:t,...o},n)=>{const l=a=>{t?.(a),r?.(a.target.checked)};return e.jsxs("label",{className:i("relative inline-flex cursor-pointer",s),children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",onChange:l,ref:n,...o}),e.jsx("div",{className:"block bg-gray-300 w-9 h-5 rounded-full transition-colors duration-200 ease-in-out peer-checked:bg-blue-600"}),e.jsx("div",{className:"absolute left-0 top-0 bg-white w-4 h-4 rounded-full mt-0.5 ml-0.5 transition-transform duration-200 ease-in-out transform peer-checked:translate-x-4 shadow"})]})});d.displayName="Switch";export{d as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,
|
|
1
|
+
import{r as l,at as F,an as $,j as c,ao as D,b8 as V,ar as g,b9 as y,ba as k,bb as G,aq as m,bc as L,e as T}from"./index-VBSAUXJg.js";var p="Tabs",[K,Q]=D(p,[y]),h=y(),[q,x]=K(p),N=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,onValueChange:r,defaultValue:d,orientation:n="horizontal",dir:u,activationMode:f="automatic",...v}=e,i=F(u),[s,b]=$({prop:o,onChange:r,defaultProp:d??"",caller:p});return c.jsx(q,{scope:t,baseId:V(),value:s,onValueChange:b,orientation:n,dir:i,activationMode:f,children:c.jsx(g.div,{dir:i,"data-orientation":n,...v,ref:a})})});N.displayName=p;var C="TabsList",I=l.forwardRef((e,a)=>{const{__scopeTabs:t,loop:o=!0,...r}=e,d=x(C,t),n=h(t);return c.jsx(k,{asChild:!0,...n,orientation:d.orientation,dir:d.dir,loop:o,children:c.jsx(g.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:a})})});I.displayName=C;var R="TabsTrigger",j=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,disabled:r=!1,...d}=e,n=x(R,t),u=h(t),f=A(n.baseId,o),v=E(n.baseId,o),i=o===n.value;return c.jsx(G,{asChild:!0,...u,focusable:!r,active:i,children:c.jsx(g.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":v,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:f,...d,ref:a,onMouseDown:m(e.onMouseDown,s=>{!r&&s.button===0&&s.ctrlKey===!1?n.onValueChange(o):s.preventDefault()}),onKeyDown:m(e.onKeyDown,s=>{[" ","Enter"].includes(s.key)&&n.onValueChange(o)}),onFocus:m(e.onFocus,()=>{const s=n.activationMode!=="manual";!i&&!r&&s&&n.onValueChange(o)})})})});j.displayName=R;var w="TabsContent",_=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,forceMount:r,children:d,...n}=e,u=x(w,t),f=A(u.baseId,o),v=E(u.baseId,o),i=o===u.value,s=l.useRef(i);return l.useEffect(()=>{const b=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(b)},[]),c.jsx(L,{present:r||i,children:({present:b})=>c.jsx(g.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!b,id:v,tabIndex:0,...n,ref:a,style:{...e.style,animationDuration:s.current?"0s":void 0},children:b&&d})})});_.displayName=w;function A(e,a){return`${e}-trigger-${a}`}function E(e,a){return`${e}-content-${a}`}var B=N,S=I,M=j,P=_;const U=B,z=l.forwardRef(({className:e,...a},t)=>c.jsx(S,{ref:t,className:T("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));z.displayName=S.displayName;const H=l.forwardRef(({className:e,...a},t)=>c.jsx(M,{ref:t,className:T("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));H.displayName=M.displayName;const O=l.forwardRef(({className:e,...a},t)=>c.jsx(P,{ref:t,className:T("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));O.displayName=P.displayName;export{U as T,z as a,H as b,O as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,ag as j,j as u}from"./index-VBSAUXJg.js";import{x as k,a as B}from"./xterm-DTxiCjtJ.js";function A({sessionId:l,className:p,heightPx:d=160,maxScrollback:m=200}){const h=t.useRef(null),v=t.useRef(null),w=t.useRef(null),y=t.useRef(null),[x,R]=t.useState(!0),o=t.useRef([]),i=t.useRef(null);return t.useEffect(()=>{const a=h.current;if(!a||!l)return;const e=new k.Terminal({disableStdin:!0,cursorBlink:!1,convertEol:!0,scrollback:Math.max(50,Math.min(m,1e3)),fontSize:12,fontFamily:"'IBM Plex Mono', 'Source Code Pro', 'Fira Code', ui-monospace, Menlo, Monaco, monospace",lineHeight:1.25,letterSpacing:.3,theme:{background:"#1a1b26",foreground:"#c0caf5",cursor:"#c0caf5",selectionBackground:"#33467c",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}}),f=new B.FitAddon;e.loadAddon(f),e.open(a),a.style.height=`${d}px`,v.current=e,w.current=f;const s=()=>{try{const n=a.getBoundingClientRect();n.width>8&&n.height>8&&e.element&&f.fit()}catch{}},S=setTimeout(()=>s(),100),g=new ResizeObserver(()=>s());g.observe(a);const b=()=>{document.visibilityState==="visible"&&setTimeout(s,50)};document.addEventListener("visibilitychange",b);const c=new WebSocket(`${j}/ws/terminal-preview/${l}`);y.current=c,c.onopen=()=>R(!1);const E=()=>{i.current=null;const n=o.current;if(n.length){o.current=[];try{e.write(n.join(""))}catch{}}},F=()=>{i.current===null&&(i.current=requestAnimationFrame(E))};return c.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}if(r?.type==="snapshot"){if(e.reset(),o.current=[],r.data)try{e.write(r.data)}catch{}s()}else r?.type==="data"&&r.data&&(o.current.push(String(r.data)),F())},c.onclose=()=>{},c.onerror=()=>{},()=>{clearTimeout(S),g.disconnect(),document.removeEventListener("visibilitychange",b);try{c.close()}catch{}i.current!==null&&cancelAnimationFrame(i.current),i.current=null,o.current=[],e.dispose()}},[l,d,m]),u.jsxs("div",{className:`relative w-full ${p||""}`.trim(),children:[x&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/60 z-10",children:u.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading preview…"})}),u.jsx("div",{ref:h,className:"border border-muted rounded overflow-hidden"})]})}export{A as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,
|
|
1
|
+
import{r as i,ak as b,A as f}from"./index-VBSAUXJg.js";function j(){const[y,u]=i.useState([]),[m,c]=i.useState(!1),[g,o]=i.useState(null),{refresh:p}=b(),d=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=await fetch(`${f}/api/v1/terminal/${s}/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableLogging:n||!1,startupCommand:r})});if(!e.ok){const a=await e.json();throw new Error(a.error||"Failed to create terminal session")}const t=await e.json();return await p(),t.sessionId}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),null}finally{c(!1)}},[p]),S=i.useCallback(async s=>{try{c(!0),o(null);let n;if(s.startsWith("session-")){const e=s.split("-");n=`${e[0]}-${e[1]}`}else{const e=s.split("-");n=`${e[0]}-${e[1]}`}const r=await fetch(`${f}/api/v1/terminal/${n}/destroy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s})});if(!r.ok){const e=await r.json();throw new Error(e.error||"Failed to destroy terminal session")}return u(e=>e.filter(t=>t.id!==s)),await p(),!0}catch(n){const r=n instanceof Error?n.message:"Unknown error";return o(r),!1}finally{c(!1)}},[p]),$=i.useCallback(async(s,n,r)=>{try{o(null);let e;if(s.startsWith("session-")){const a=s.split("-");e=`${a[0]}-${a[1]}`}else{const a=s.split("-");e=`${a[0]}-${a[1]}`}const t=await fetch(`${f}/api/v1/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,cols:n,rows:r})});if(!t.ok){const a=await t.json();throw new Error(a.error||"Failed to resize terminal session")}return!0}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),!1}},[]),k=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=new URLSearchParams;s&&e.set("proposalId",s),n&&(e.set("withPreview","true"),r&&Number.isFinite(r)&&e.set("lines",String(r)));const t=`${f}/api/v1/terminal/sessions${e.toString()?`?${e.toString()}`:""}`,a=await fetch(t);if(!a.ok){const l=await a.json();throw new Error(l.error||"Failed to fetch terminal sessions")}const w=await a.json();u(w.sessions)}catch(e){const t=e instanceof Error?e.message:"Unknown error";o(t)}finally{c(!1)}},[]),E=i.useCallback(async(s,n=8)=>{try{o(null);const r=new URLSearchParams;r.set("sessionId",s),r.set("withPreview","true"),r.set("lines",String(n)),r.set("colorize","true");const e=`${f}/api/v1/terminal/sessions?${r.toString()}`,t=await fetch(e);if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to fetch preview")}const a=await t.json(),w=Array.isArray(a?.sessions)&&a.sessions[0]?.preview?a.sessions[0].preview:[];return u(l=>l.map(h=>h.id===s?{...h,preview:w}:h)),w}catch(r){const e=r instanceof Error?r.message:"Unknown error";return o(e),[]}},[]);return{sessions:y,loading:m,error:g,createSession:d,destroySession:S,resizeSession:$,refreshSessions:k,fetchPreview:E}}export{j as u};
|
package/static/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
|
|
10
10
|
<title>Coconut - Agentic Development Environment</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-VBSAUXJg.js"></script>
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BhlZ_D1Y.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body class="font-inter">
|
|
15
15
|
<div id="root"></div>
|
package/dist/lib/mcp-client.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Client helper for connecting to HTTP/SSE MCP servers
|
|
3
|
-
* Provides tool discovery and execution proxying
|
|
4
|
-
*/
|
|
5
|
-
export interface McpServerConfig {
|
|
6
|
-
name?: string;
|
|
7
|
-
type?: 'http' | 'sse' | 'stdio';
|
|
8
|
-
url?: string;
|
|
9
|
-
enabled?: boolean;
|
|
10
|
-
env?: Record<string, string>;
|
|
11
|
-
}
|
|
12
|
-
export interface DiscoveredTool {
|
|
13
|
-
name: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
inputSchema?: object;
|
|
16
|
-
serverName: string;
|
|
17
|
-
serverUrl: string;
|
|
18
|
-
}
|
|
19
|
-
export interface ToolCallResult {
|
|
20
|
-
content: Array<{
|
|
21
|
-
type: string;
|
|
22
|
-
text?: string;
|
|
23
|
-
[key: string]: unknown;
|
|
24
|
-
}>;
|
|
25
|
-
isError?: boolean;
|
|
26
|
-
structuredContent?: unknown;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Connect to an HTTP/SSE MCP server and discover its available tools
|
|
30
|
-
*/
|
|
31
|
-
export declare function discoverToolsFromServer(serverName: string, config: McpServerConfig): Promise<DiscoveredTool[]>;
|
|
32
|
-
/**
|
|
33
|
-
* Execute a tool on an HTTP/SSE MCP server
|
|
34
|
-
*/
|
|
35
|
-
export declare function executeToolOnServer(serverName: string, config: McpServerConfig, toolName: string, args: Record<string, unknown>): Promise<ToolCallResult>;
|
|
36
|
-
/**
|
|
37
|
-
* Close all cached client connections (for cleanup)
|
|
38
|
-
*/
|
|
39
|
-
export declare function closeAllConnections(): void;
|
package/dist/lib/mcp-client.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Client helper for connecting to HTTP/SSE MCP servers
|
|
3
|
-
* Provides tool discovery and execution proxying
|
|
4
|
-
*/
|
|
5
|
-
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
6
|
-
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
7
|
-
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
8
|
-
// Cache for active client connections
|
|
9
|
-
const clientCache = new Map();
|
|
10
|
-
// Clean up stale connections after 5 minutes
|
|
11
|
-
const CONNECTION_TTL_MS = 5 * 60 * 1000;
|
|
12
|
-
/**
|
|
13
|
-
* Get or create a client connection to an MCP server
|
|
14
|
-
*/
|
|
15
|
-
async function getOrCreateClient(serverName, config) {
|
|
16
|
-
const cacheKey = `${serverName}:${config.url}`;
|
|
17
|
-
const cached = clientCache.get(cacheKey);
|
|
18
|
-
if (cached) {
|
|
19
|
-
cached.lastUsed = Date.now();
|
|
20
|
-
return cached.client;
|
|
21
|
-
}
|
|
22
|
-
const client = new Client({
|
|
23
|
-
name: 'coconut-api',
|
|
24
|
-
version: '1.0.0'
|
|
25
|
-
});
|
|
26
|
-
const url = new URL(config.url);
|
|
27
|
-
// Try StreamableHTTP first (newer), fall back to SSE (legacy)
|
|
28
|
-
let transport;
|
|
29
|
-
if (config.type === 'sse') {
|
|
30
|
-
// Explicitly SSE
|
|
31
|
-
transport = new SSEClientTransport(url);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
// Default to StreamableHTTP for 'http' type or unspecified
|
|
35
|
-
transport = new StreamableHTTPClientTransport(url);
|
|
36
|
-
}
|
|
37
|
-
await client.connect(transport);
|
|
38
|
-
clientCache.set(cacheKey, { client, lastUsed: Date.now() });
|
|
39
|
-
// Schedule cleanup
|
|
40
|
-
scheduleCleanup();
|
|
41
|
-
return client;
|
|
42
|
-
}
|
|
43
|
-
let cleanupScheduled = false;
|
|
44
|
-
function scheduleCleanup() {
|
|
45
|
-
if (cleanupScheduled)
|
|
46
|
-
return;
|
|
47
|
-
cleanupScheduled = true;
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
cleanupScheduled = false;
|
|
50
|
-
const now = Date.now();
|
|
51
|
-
for (const [key, entry] of clientCache.entries()) {
|
|
52
|
-
if (now - entry.lastUsed > CONNECTION_TTL_MS) {
|
|
53
|
-
try {
|
|
54
|
-
entry.client.close();
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
// Ignore close errors
|
|
58
|
-
}
|
|
59
|
-
clientCache.delete(key);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
// Reschedule if there are still cached connections
|
|
63
|
-
if (clientCache.size > 0) {
|
|
64
|
-
scheduleCleanup();
|
|
65
|
-
}
|
|
66
|
-
}, CONNECTION_TTL_MS);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Connect to an HTTP/SSE MCP server and discover its available tools
|
|
70
|
-
*/
|
|
71
|
-
export async function discoverToolsFromServer(serverName, config) {
|
|
72
|
-
if (!config.url) {
|
|
73
|
-
throw new Error(`Server ${serverName} has no URL configured`);
|
|
74
|
-
}
|
|
75
|
-
if (config.enabled === false) {
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
const client = await getOrCreateClient(serverName, config);
|
|
80
|
-
const toolsResult = await client.listTools();
|
|
81
|
-
return toolsResult.tools.map(tool => ({
|
|
82
|
-
name: tool.name,
|
|
83
|
-
description: tool.description,
|
|
84
|
-
inputSchema: tool.inputSchema,
|
|
85
|
-
serverName,
|
|
86
|
-
serverUrl: config.url
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
console.error(`Failed to discover tools from ${serverName}:`, error);
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Execute a tool on an HTTP/SSE MCP server
|
|
96
|
-
*/
|
|
97
|
-
export async function executeToolOnServer(serverName, config, toolName, args) {
|
|
98
|
-
if (!config.url) {
|
|
99
|
-
throw new Error(`Server ${serverName} has no URL configured`);
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const client = await getOrCreateClient(serverName, config);
|
|
103
|
-
const result = await client.callTool({
|
|
104
|
-
name: toolName,
|
|
105
|
-
arguments: args
|
|
106
|
-
});
|
|
107
|
-
return {
|
|
108
|
-
content: result.content,
|
|
109
|
-
isError: result.isError,
|
|
110
|
-
structuredContent: result.structuredContent
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
console.error(`Failed to execute tool ${toolName} on ${serverName}:`, error);
|
|
115
|
-
throw error;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Close all cached client connections (for cleanup)
|
|
120
|
-
*/
|
|
121
|
-
export function closeAllConnections() {
|
|
122
|
-
for (const [key, entry] of clientCache.entries()) {
|
|
123
|
-
try {
|
|
124
|
-
entry.client.close();
|
|
125
|
-
}
|
|
126
|
-
catch (e) {
|
|
127
|
-
// Ignore close errors
|
|
128
|
-
}
|
|
129
|
-
clientCache.delete(key);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as X,u as Y,H as Z,r as n,j as e,B as m,L as v,i as O,I as D,a0 as ee,ac as te,A as y}from"./index-BfJaT17z.js";import{C as N,a as C,b as se,c as ae}from"./card-pzUJtmwJ.js";import{L as l}from"./label-CTlQtJaU.js";import{B as re}from"./badge-D7styiB7.js";import{c as ne}from"./clipboard-B9ndUJKl.js";import{A as z}from"./arrow-left-orDiJ2Pw.js";import{C as oe,a as ie}from"./clipboard-LaXihY2m.js";function xe(){const{id:i}=X(),U=Y(),{toast:w}=Z(),[q,S]=n.useState(!0),[o,A]=n.useState(!1),[d,c]=n.useState(null),[H,R]=n.useState(""),[u,E]=n.useState(""),[g,F]=n.useState(""),[f,P]=n.useState("blue"),[x,k]=n.useState([]),[h,$]=n.useState(""),[L,p]=n.useState([]),[_,M]=n.useState(!0),[J,T]=n.useState(!1),G=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],K={blue:{bg:"#3b82f6",border:"#1e40af",text:"#ffffff"},green:{bg:"#22c55e",border:"#15803d",text:"#ffffff"},red:{bg:"#ef4444",border:"#b91c1c",text:"#ffffff"},emerald:{bg:"#10b981",border:"#047857",text:"#ffffff"},purple:{bg:"#a855f7",border:"#7e22ce",text:"#ffffff"},orange:{bg:"#f97316",border:"#c2410c",text:"#ffffff"},yellow:{bg:"#eab308",border:"#a16207",text:"#ffffff"},teal:{bg:"#14b8a6",border:"#0f766e",text:"#ffffff"},indigo:{bg:"#6366f1",border:"#4338ca",text:"#ffffff"},pink:{bg:"#ec4899",border:"#be185d",text:"#ffffff"},cyan:{bg:"#06b6d4",border:"#0e7490",text:"#ffffff"},slate:{bg:"#64748b",border:"#475569",text:"#ffffff"},gray:{bg:"#6b7280",border:"#4b5563",text:"#ffffff"}},Q=t=>{if(!t)return[];if(Array.isArray(t)){const a=t.filter(s=>typeof s=="string").map(s=>s.trim()).filter(Boolean);return Array.from(new Set(a))}return typeof t=="string"?Array.from(new Set(t.split(",").map(a=>a.trim()).filter(Boolean))):[]};n.useEffect(()=>{async function t(){try{S(!0);const s=await(await fetch(`${y}/api/v1/agents/${i}`)).json();if(!s.success)throw new Error(s.error||"Failed to load agent");const r=s.document;R(r.filename),E(r.metadata.name||""),F(r.metadata.description||""),P(r.metadata.color||"blue"),$(r.content||""),k(Q(r.metadata.tools))}catch(a){const s=a instanceof Error?a.message:"Failed to load agent";c(s)}finally{S(!1)}}i&&t()},[i]),n.useEffect(()=>{let t=!0;return(async()=>{M(!0);try{const s=await fetch(`${y}/api/v1/mcp`);if(!s.ok)throw new Error("Failed to fetch MCP servers");const r=await s.json();if(!r?.success||!Array.isArray(r.servers)){t&&p([]);return}const B=r.mcpServers&&typeof r.mcpServers=="object"?r.mcpServers:{},b=r.servers.map(I=>{const j=B[I]??{};return{name:I,enabled:j?.enabled!==!1,description:typeof j?.description=="string"?j.description:void 0}});t&&p(b)}catch(s){console.error("Failed to load MCP servers",s),t&&p([])}finally{t&&M(!1)}})(),()=>{t=!1}},[]);const V=async()=>{const t=".nut/config.json";try{await ne(t),T(!0),w({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>T(!1),2e3)}catch(a){console.error("Failed to copy config path:",a),w({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},W=async t=>{if(t.preventDefault(),!u.trim()||!g.trim()||!h.trim()){c("Name, description, and agent instructions are required");return}try{A(!0),c(null);const a={name:u.trim(),description:g.trim(),content:h.trim(),metadata:{color:f,tools:x.length?x:void 0}},r=await(await fetch(`${y}/api/v1/agents/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.error||"Failed to update agent");const b=r.document.filename.replace(/\.md$/,"");U(`/agents/${b}`)}catch(a){const s=a instanceof Error?a.message:"Failed to update agent";c(s)}finally{A(!1)}};return q?e.jsx("div",{className:"space-y-6",children:e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:"Loading agent..."})})}):d?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Agent"}),e.jsx("p",{className:"text-muted-foreground",children:"Unable to load agent"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/agents/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(z,{className:"h-4 w-4"})})})})]}),e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:e.jsx("div",{className:"text-destructive",children:d})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Agent"}),e.jsxs("p",{className:"text-muted-foreground",children:["File: ",H]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/agents/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(z,{className:"h-4 w-4"})})})})]}),e.jsxs(N,{children:[e.jsx(se,{children:e.jsxs(ae,{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-5 w-5"}),"Agent Configuration"]})}),e.jsx(C,{children:e.jsxs("form",{onSubmit:W,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"name",children:"Name *"}),e.jsx(D,{id:"name",value:u,onChange:t=>E(t.target.value),disabled:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"description",children:"Description *"}),e.jsx(D,{id:"description",value:g,onChange:t=>F(t.target.value),disabled:o})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:G.map(t=>{const a=K[t];return e.jsx("button",{type:"button",onClick:()=>P(t),disabled:o,className:`w-10 h-10 rounded-md border-2 transition-all ${f===t?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:a.bg,borderColor:f===t?a.border:"hsl(var(--border))",...f===t&&{"--tw-ring-color":a.border}},title:t,children:e.jsx("span",{className:"sr-only",children:t})},t)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"content",children:"Agent Instructions *"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["System prompt or instructions for this agent's behavior."," ","Insert ",e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:".nut/config.json"})," ",e.jsx("button",{type:"button",onClick:V,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:J?e.jsx(oe,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(ie,{className:"h-3.5 w-3.5 ml-0.5"})})," ","if you want the agent to be able to access its name, role, or email address."]}),e.jsx(ee,{id:"content",value:h,onChange:t=>$(t.target.value),rows:8,disabled:o,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Tools (Optional)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this agent should be able to use. Leave empty to inherit all available servers."}),e.jsx("div",{className:"space-y-2",children:_?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers…"}):L.length===0?e.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):L.map(t=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[e.jsx(te,{checked:x.includes(t.name),onCheckedChange:a=>{k(s=>a===!0?s.includes(t.name)?s:[...s,t.name]:s.filter(r=>r!==t.name))},disabled:o||!t.enabled}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-medium",children:[t.name,!t.enabled&&e.jsx(re,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.enabled?t.description||"Enabled MCP server":"Enable this server in Settings to allow agents to use it"})]})]},t.name))})]}),d&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:d}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(m,{type:"button",variant:"outline",asChild:!0,disabled:o,children:e.jsx(v,{to:`/agents/${i}`,children:"Cancel"})}),e.jsx(m,{type:"submit",disabled:o,children:o?"Saving...":"Save Changes"})]})]})})]})]})}export{xe as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e,S as I,Y as L,r as x,H as O,A as S,n as M,B as b,L as v,i as E,ah as $,ai as _}from"./index-BfJaT17z.js";import{C as N,a as w,b as D,c as H}from"./card-pzUJtmwJ.js";import{B as y}from"./badge-D7styiB7.js";import{c as U}from"./clipboard-B9ndUJKl.js";import{R as Y,L as F}from"./browser-modal-n0MeSpgA.js";import{R as G,f as J}from"./registry-ANRa5WBi.js";import{P as T}from"./plus-DhYjijTS.js";import{T as K}from"./tag-DERlGH35.js";import"./search-BiMN-o92.js";const V=["color","tools","createdAt","updatedAt","version","focusAreas","contextPreferences","tags"];function P(t){if(t){if(Array.isArray(t)){const r=t.map(n=>{if(typeof n=="string")return n.trim();if(typeof n=="number")return`${n}`}).filter(n=>typeof n=="string"&&n.length>0);return r.length>0?r:void 0}if(typeof t=="string"){const r=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);return r.length>0?r:void 0}}}function q(t,r){const n=[];if(t.content&&typeof t.content=="object")for(const o of Object.values(t.content))typeof o=="string"&&o.trim().length>0&&n.push(o.trim());const i=[];return i.push(`# ${r}`),t.description?.trim()&&i.push(t.description.trim()),[...i,...n].join(`
|
|
2
|
-
|
|
3
|
-
`).trim()}function z(t,r){const n=t.name||r.name,i=r.description||t.description||"",a={registryId:t.id,registryEndpoint:t.endpoint,registrySource:G,author:t.author};for(const o of V){const d=r[o];if(d!==void 0)if(o==="tools"||o==="focusAreas"||o==="contextPreferences"||o==="tags"){const f=P(d);f&&(a[o]=f)}else a[o]=d}!a.version&&t.version&&(a.version=t.version),a.color||(a.color="blue"),!a.tags&&t.tags&&(a.tags=P(t.tags));for(const[o,d]of Object.entries(a))d==null&&delete a[o];return{name:n,description:i,content:q(r,n),metadata:Object.keys(a).length>0?a:void 0}}function B({open:t,onOpenChange:r,onImport:n}){return e.jsx(Y,{open:t,onOpenChange:r,categoryId:"agents",title:"Coconut Registry – Agents",confirmLabel:"Import Agent",getDetail:i=>J(i.endpoint),renderPreview:(i,a)=>{if(!a)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an agent to preview"});const o=z(i,a),d=o.metadata??{},f=typeof d.version=="string"?d.version:void 0,u=Array.isArray(i.tags)?i.tags:[],j=Array.isArray(d.tools)?d.tools.filter(l=>typeof l=="string"):[],p=Array.isArray(d.focusAreas)?d.focusAreas.filter(l=>typeof l=="string"):[];return e.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border",children:e.jsx(I,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:i.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),f&&e.jsxs(y,{variant:"outline",children:["v",f]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Registry ID: ",e.jsx("span",{className:"font-mono",children:i.id})]}),u.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(l=>e.jsx(y,{variant:"secondary",children:l},l))}),j.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:"Tools:"}),j.map(l=>e.jsx(y,{variant:"outline",children:l},l))]}),p.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-medium",children:"Focus Areas"}),e.jsx("ul",{className:"list-disc pl-5 text-sm text-muted-foreground",children:p.map(l=>e.jsx("li",{children:l},l))})]})]}),e.jsx(L,{className:"[&_.prose]:max-w-none",children:o.content})]})})})},onConfirm:async(i,a)=>{const o=z(i,a);await n({summary:i,detail:a,payload:o})}})}const Q=t=>t?Array.isArray(t)?t.filter(r=>typeof r=="string").map(r=>r.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(r=>r.trim()).filter(Boolean):[]:[],g={blue:{bg:"#dbeafe",border:"#2563eb",text:"#1e40af"},green:{bg:"#dcfce7",border:"#16a34a",text:"#166534"},red:{bg:"#fee2e2",border:"#dc2626",text:"#991b1b"},emerald:{bg:"#d1fae5",border:"#10b981",text:"#047857"},purple:{bg:"#f3e8ff",border:"#9333ea",text:"#6b21a8"},orange:{bg:"#fed7aa",border:"#ea580c",text:"#9a3412"},yellow:{bg:"#fef9c3",border:"#eab308",text:"#854d0e"},teal:{bg:"#ccfbf1",border:"#14b8a6",text:"#0f766e"},indigo:{bg:"#e0e7ff",border:"#6366f1",text:"#4338ca"},pink:{bg:"#fce7f3",border:"#ec4899",text:"#9f1239"},cyan:{bg:"#cffafe",border:"#06b6d4",text:"#155e75"},slate:{bg:"#f1f5f9",border:"#475569",text:"#334155"},gray:{bg:"#f3f4f6",border:"#6b7280",text:"#374151"}};function ie(){const[t,r]=x.useState([]),[n,i]=x.useState(!0),[a,o]=x.useState({}),[d,f]=x.useState(!1),[u,j]=x.useState(!1),{toast:p}=O(),l=x.useCallback(async()=>{i(!0);try{const s=await fetch(`${S}/api/v1/agents`);if(!s.ok)throw new Error("Failed to load agents");const m=await s.json();r(Array.isArray(m.documents)?m.documents:[])}catch(s){console.error("Failed to load agents:",s),r([])}finally{i(!1)}},[]);x.useEffect(()=>{l()},[l]);const A=async s=>{const m=`.nut/agents/${s}`;try{await U(m),o(c=>({...c,[s]:!0})),setTimeout(()=>{o(c=>({...c,[s]:!1}))},2e3),p({title:"Path copied!",description:`Copied ${m} to clipboard`})}catch(c){console.error("Failed to copy path:",c),p({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},C=x.useCallback(async({payload:s})=>{let m=!1;j(!0);try{const c=await fetch(`${S}/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s.name,description:s.description,content:s.content,metadata:s.metadata})});let h=null;try{h=await c.json()}catch(k){console.error("Failed to parse registry import response:",k)}if(!(c.ok&&h?.success)){const R=(typeof h?.error=="string"?h.error:h?.error?.message)||c.statusText||"Failed to import agent from registry";throw p({title:"Failed to import agent",description:R,variant:"destructive"}),m=!0,new Error(R)}p({title:"Agent imported",description:`${s.name} is now available in Coconut`}),await l()}catch(c){if(!m){const h=c instanceof Error&&c.message?c.message:"Failed to import agent from registry";p({title:"Failed to import agent",description:h,variant:"destructive"})}throw c}finally{j(!1)}},[l,p]);return n?e.jsx("div",{className:"space-y-6",children:e.jsx(N,{children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(M,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading agents..."})]})})})}):t.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage agents for your development workflows"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>f(!0),disabled:u,children:[e.jsx(F,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsx(b,{size:"sm",asChild:!0,children:e.jsxs(v,{to:"/agents/new",children:[e.jsx(T,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Create New"})]})})]})]}),e.jsx(N,{children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(E,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Agents Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Specialized agents help you automate your development and business workflows."})]})})})]}),e.jsx(B,{open:d,onOpenChange:f,onImport:C})]}):e.jsxs(e.Fragment,{children:[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("h2",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage agents for your development workflows"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>f(!0),disabled:u,children:[e.jsx(F,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsx(b,{size:"sm",asChild:!0,children:e.jsxs(v,{to:"/agents/new",children:[e.jsx(T,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Create New"})]})})]})]}),e.jsx("div",{className:"grid gap-4",children:t.map(s=>{const m=Q(s.metadata.tools);return e.jsx(v,{to:`/agents/${s.filename.replace(".md","")}`,className:"block",children:e.jsxs(N,{className:"group hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:[e.jsx(D,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"text-lg",children:s.title}),e.jsx(b,{variant:"ghost",size:"sm",onClick:c=>{c.preventDefault(),A(s.filename)},className:"h-6 w-6 p-0 hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy file path to clipboard",children:a[s.filename]?e.jsx($,{className:"w-3 h-3 text-green-600"}):e.jsx(_,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"text-xs text-muted-foreground font-mono bg-muted/50 px-2 py-1 rounded inline-block cursor-pointer hover:bg-muted/70 transition-colors",onClick:c=>{c.preventDefault(),A(s.filename)},title:"Click to copy file path to clipboard",children:[".nut/agents/",s.filename]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(K,{className:"w-3 h-3"}),s.metadata.color||"blue"]}),m.length>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(E,{className:"w-3 h-3"}),m.join(", ")]})]})]}),s.metadata.color&&e.jsx(y,{variant:"outline",className:"capitalize border-2",style:{backgroundColor:g[s.metadata.color]?.bg||g.blue.bg,color:g[s.metadata.color]?.text||g.blue.text,borderColor:g[s.metadata.color]?.border||g.blue.border},children:s.metadata.color})]})}),e.jsx(w,{children:e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:s.metadata.description})})})})]})},s.filename)})})]}),e.jsx(B,{open:d,onOpenChange:f,onImport:C})]})}export{ie as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{c as b,j as e,a1 as w,B as t,ad as C,T as A,I as r,v as l,w as c,x as d,y as o,z as i}from"./index-BfJaT17z.js";import{C as x,b as m,c as u,d as h,a as j}from"./card-pzUJtmwJ.js";import{L as a}from"./label-CTlQtJaU.js";import{B as n}from"./badge-D7styiB7.js";import{P as S}from"./plus-DhYjijTS.js";import{P as p}from"./pause-D33aM-oa.js";import{P as R}from"./play-B6IdXHPj.js";import{Z as T}from"./zap-DwFz_ltU.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 k=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],P=b("chart-column",k);function G(){const g=[{id:"1",name:"Code Review Agent",description:"Automatically reviews pull requests and provides feedback",type:"Code Review",status:"active",model:"claude-3.5-sonnet",lastRun:"5 minutes ago",runsToday:23,successRate:"94%"},{id:"2",name:"Documentation Agent",description:"Generates and updates code documentation automatically",type:"Documentation",status:"paused",model:"gpt-4",lastRun:"2 hours ago",runsToday:8,successRate:"98%"},{id:"3",name:"Bug Hunter Agent",description:"Scans code for potential bugs and security vulnerabilities",type:"Quality Assurance",status:"active",model:"gemini-pro",lastRun:"15 minutes ago",runsToday:12,successRate:"87%"},{id:"4",name:"Performance Monitor",description:"Monitors application performance and suggests optimizations",type:"Performance",status:"inactive",model:"claude-3-haiku",lastRun:"1 day ago",runsToday:0,successRate:"91%"}],v=["Code Review","Documentation","Quality Assurance","Performance","Security","Refactoring","Testing","Architecture"],f=["claude-3.5-sonnet","claude-3-haiku","gpt-4","gpt-3.5-turbo","gemini-pro","gemini-flash"],y=s=>{switch(s){case"active":return e.jsx(T,{className:"h-4 w-4 text-green-500"});case"paused":return e.jsx(p,{className:"h-4 w-4 text-yellow-500"});case"inactive":return e.jsx("div",{className:"h-4 w-4 rounded-full bg-gray-300"});default:return e.jsx("div",{className:"h-4 w-4 rounded-full bg-gray-300"})}},N=s=>{switch(s){case"active":return e.jsx(n,{className:"bg-green-100 text-green-800",children:"Active"});case"paused":return e.jsx(n,{className:"bg-yellow-100 text-yellow-800",children:"Paused"});case"inactive":return e.jsx(n,{variant:"secondary",children:"Inactive"});default:return e.jsx(n,{variant:"secondary",children:"Unknown"})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Agents Management"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure and manage AI agents that automate various development tasks."})]}),e.jsx(w,{}),e.jsxs(x,{children:[e.jsx(m,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{children:"Active Agents"}),e.jsx(h,{children:"Monitor and control your AI agents across different workflows."})]}),e.jsxs(t,{size:"sm",children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),"Create Agent"]})]})}),e.jsx(j,{children:e.jsx("div",{className:"space-y-4",children:g.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[y(s.status),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h4",{className:"font-medium",children:s.name}),N(s.status),e.jsx(n,{variant:"outline",children:s.type}),e.jsx(n,{variant:"outline",children:s.model})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.description}),e.jsxs("div",{className:"flex items-center space-x-4 mt-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last run: ",s.lastRun]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Runs today: ",s.runsToday]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Success rate: ",s.successRate]})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(P,{className:"h-4 w-4"})}),s.status==="active"?e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(p,{className:"h-4 w-4"})}):e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(C,{className:"h-4 w-4"})}),e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(A,{className:"h-4 w-4"})})]})]},s.id))})})]}),e.jsxs(x,{children:[e.jsxs(m,{children:[e.jsx(u,{children:"Create New Agent"}),e.jsx(h,{children:"Configure a new AI agent to automate specific development tasks."})]}),e.jsxs(j,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"agentName",children:"Agent Name"}),e.jsx(r,{id:"agentName",placeholder:"Enter agent name"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"agentType",children:"Agent Type"}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(d,{placeholder:"Select agent type"})}),e.jsx(o,{children:v.map(s=>e.jsx(i,{value:s.toLowerCase(),children:s},s))})]})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"agentDescription",children:"Description"}),e.jsx(r,{id:"agentDescription",placeholder:"What does this agent do?"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"aiModel",children:"AI Model"}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(d,{placeholder:"Select AI model"})}),e.jsx(o,{children:f.map(s=>e.jsx(i,{value:s,children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"systemPrompt",children:"System Prompt"}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(d,{placeholder:"Select system prompt"})}),e.jsxs(o,{children:[e.jsx(i,{value:"code-review",children:"Code Review Assistant"}),e.jsx(i,{value:"documentation",children:"Documentation Generator"}),e.jsx(i,{value:"bug-analysis",children:"Bug Analysis Expert"}),e.jsx(i,{value:"architecture",children:"Architecture Advisor"})]})]})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"triggers",children:"Triggers"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:["Pull Request","Commit","File Change","Schedule","Manual"].map(s=>e.jsxs("label",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",className:"rounded"}),e.jsx("span",{className:"text-sm",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"configuration",children:"Agent Configuration (JSON)"}),e.jsx("textarea",{id:"configuration",className:"w-full min-h-[120px] p-3 border rounded-md font-mono text-sm",placeholder:'{"maxTokens": 4000, "temperature": 0.3, "timeout": 30}'})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(t,{variant:"outline",children:"Test Configuration"}),e.jsx(t,{variant:"outline",children:"Save as Draft"}),e.jsx(t,{children:"Create & Activate"})]})]})]}),e.jsxs(x,{children:[e.jsxs(m,{children:[e.jsx(u,{children:"Global Agent Settings"}),e.jsx(h,{children:"Configure global settings that apply to all agents."})]}),e.jsxs(j,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"maxConcurrent",children:"Max Concurrent Agents"}),e.jsx(r,{id:"maxConcurrent",type:"number",placeholder:"5"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"defaultTimeout",children:"Default Timeout (seconds)"}),e.jsx(r,{id:"defaultTimeout",type:"number",placeholder:"30"})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"retryPolicy",children:"Retry Policy"}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(d,{placeholder:"Select retry policy"})}),e.jsxs(o,{children:[e.jsx(i,{value:"none",children:"No Retries"}),e.jsx(i,{value:"exponential",children:"Exponential Backoff"}),e.jsx(i,{value:"linear",children:"Linear Retry"}),e.jsx(i,{value:"custom",children:"Custom Policy"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"enableLogging",className:"rounded"}),e.jsx(a,{htmlFor:"enableLogging",children:"Enable detailed logging"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"enableMetrics",className:"rounded"}),e.jsx(a,{htmlFor:"enableMetrics",children:"Collect performance metrics"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"enableNotifications",className:"rounded"}),e.jsx(a,{htmlFor:"enableNotifications",children:"Send failure notifications"})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(t,{variant:"outline",children:"Reset to Defaults"}),e.jsx(t,{children:"Save Settings"})]})]})]})]})}export{G as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{H as g,r as n,A as v,j as e,n as y,g as k,B as l,az as b,ay as w,L as C,J as E,av as A}from"./index-BfJaT17z.js";import{C as a,a as c,b as o,c as m}from"./card-pzUJtmwJ.js";import{c as D}from"./clipboard-B9ndUJKl.js";function F(){const{toast:h}=g(),[r,x]=n.useState(null),[u,p]=n.useState(!0),[j,i]=n.useState(!1);n.useEffect(()=>{fetch(`${v}/api/v1/context/architecture`).then(t=>{if(t.ok)return t.json();throw new Error("Not found")}).then(t=>{t.success?(x(t.document),i(!0)):i(!1)}).catch(()=>{i(!1)}).finally(()=>{p(!1)})},[]);const N=async()=>{const t=".nut/context/architecture.md";try{await D(t),h({title:"Copied!",description:`Path ${t} copied to clipboard`})}catch(d){console.error("Failed to copy path:",d),h({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},f=()=>{const t=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"architecture-md",filename:"architecture.md",name:"architecture.md",path:".nut/context/architecture.md"}});window.dispatchEvent(t)};if(u)return e.jsx("div",{className:"space-y-6",children:e.jsx(a,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(y,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading architecture documentation..."})]})})})});if(!j||!r)return e.jsx("div",{className:"space-y-6",children:e.jsx(a,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(k,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Architecture Documentation Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Architecture documentation will appear here once created."})]})})})});const s=r.metadata;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:"Technical Architecture"}),e.jsx("p",{className:"text-muted-foreground",children:"System design, components, and technical patterns"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(l,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(b,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(l,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(l,{size:"sm",asChild:!0,children:e.jsxs(C,{to:"/context/architecture/edit",children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),s&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(a,{children:[e.jsx(o,{className:"pb-3",children:e.jsx(m,{className:"text-lg font-semibold",children:"Technology Stack"})}),e.jsx(c,{className:"space-y-3",children:s.stack&&e.jsxs("div",{className:"space-y-1 text-sm",children:[s.stack.runtime&&e.jsxs("div",{children:["Runtime: ",s.stack.runtime]}),s.stack.framework&&e.jsxs("div",{children:["Framework: ",s.stack.framework]}),s.stack.language&&e.jsxs("div",{children:["Language: ",s.stack.language]}),s.stack.database&&e.jsxs("div",{children:["Database: ",s.stack.database]}),s.stack.deployment&&e.jsxs("div",{children:["Deployment: ",s.stack.deployment]}),s.stack.repository&&e.jsxs("div",{children:["Repository:"," ",e.jsx("a",{href:s.stack.repository,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:s.stack.repository})]})]})})]}),e.jsxs(a,{children:[e.jsx(o,{className:"pb-3",children:e.jsx(m,{className:"text-lg font-semibold",children:"Quick Commands"})}),e.jsx(c,{className:"space-y-3",children:s.commands&&e.jsxs("div",{className:"space-y-1",children:[Object.entries(s.commands).slice(0,5).map(([t,d])=>e.jsxs("div",{className:"text-sm",children:[e.jsxs("span",{className:"font-medium capitalize",children:[t,": "]}),e.jsx("code",{className:"bg-muted px-2 py-1 rounded text-xs",children:d})]},t)),Object.entries(s.commands).length>5&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["+ ",Object.entries(s.commands).length-5," more commands"]})]})})]})]}),e.jsxs(a,{children:[e.jsx(o,{children:e.jsx(m,{className:"text-lg font-semibold",children:"Architecture Documentation"})}),e.jsx(c,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(A,{children:r.content||"No content available"})})})]})]})}export{F as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{u as ce,H as de,r as i,j as e,B as r,k as oe,a3 as me,q as xe,s as M,X as he,g as ue,J as fe,D as ge,a as je,b as pe,d as ve,v as Ne,w as ye,x as we,y as Ce,z as S,i as Se,a5 as R,a6 as B,a7 as H,a8 as L,a9 as O,ae as G,h as be,a0 as Ae,A as I}from"./index-BfJaT17z.js";import{C as p,b as ke,a as _,c as De}from"./card-pzUJtmwJ.js";import{B as U}from"./badge-D7styiB7.js";import{u as Me}from"./use-terminal-qzkum-B5.js";import{C as Ie,a as $e,T as Pe}from"./terminal-preview-BFedy4-J.js";import{b as Te,d as Ee,c as ze,a as Fe}from"./droid-C6RWH9f4.js";import{R as Re}from"./refresh-cw-BuuX9h4Z.js";import{P as Be}from"./play-B6IdXHPj.js";import"./xterm-DTxiCjtJ.js";const He=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 Xe(){const c=ce(),{sessions:x,loading:b,error:$,refreshSessions:w,createSession:V,destroySession:q}=Me(),{toast:v}=de(),[P,W]=i.useState([]),[J,X]=i.useState(!0),[g,A]=i.useState(()=>({})),[k,N]=i.useState(!1),[j,K]=i.useState("claude"),[T,Q]=i.useState(""),[D,E]=i.useState(!1),[h,Y]=i.useState([]),[f,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(`${I}/api/v1/proposals`);if(t.ok){const a=await t.json(),n=a.data||a;W(Array.isArray(n)?n:[])}}catch(t){console.error("Error loading proposals:",t)}finally{X(!1)}})()},[]),i.useEffect(()=>{w()},[w]),i.useEffect(()=>{if(!k)return;(async()=>{try{const t=await fetch(`${I}/api/v1/mcp`);if(t.ok){const a=await t.json();a?.success&&Array.isArray(a.servers)&&(Y(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(`${I}/api/v1/agents`);if(t.ok){const a=await t.json(),d=(Array.isArray(a?.documents)?a.documents:[]).map(l=>({id:l.filename,name:l?.metadata?.name||l.title||l.filename,tools:He(l?.metadata?.tools)}));se(d),C(l=>l.filter(F=>d.some(re=>re.id===F)))}}catch(t){console.error("Failed to load agents",t)}})()},[k]),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.tools.forEach(l=>{(!a||a.has(l))&&t.add(l)})}),Array.from(t)})},[o,u,h]);const m=i.useMemo(()=>x.filter(s=>s.proposalId?.startsWith("cp-")||s.proposalId?.startsWith("ag-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[x]);i.useEffect(()=>{A(s=>{const t={...s};return m.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[m]);const z=i.useMemo(()=>P.filter(s=>s.status==="draft"||s.status==="approved").sort((s,t)=>new Date(t.metadata.createdAt).getTime()-new Date(s.metadata.createdAt).getTime()).slice(0,3),[P]),ae=()=>{const s=m.every(a=>g[a.id]),t={};m.forEach(a=>{t[a.id]=!s}),A(t)},ie=m.length>0&&m.every(s=>g[s.id]),ne=async s=>{await q(s)?(v({title:"Session closed",description:s}),setTimeout(()=>w(),100)):v({title:"Failed to close session",description:s,variant:"destructive"})},le=async()=>{E(!0);try{const s=`cp-${Date.now()}`,t={proposalId:s,contextType:"change-proposal",cliAgent:j,mcpServersMap:Z,selectedMcpServers:f,agents:u,selectedAgentIds:o,automationEnabled:!1,customInstruction:T.trim(),includeDefaultInstructions:!1};let a="";j==="claude"?a=Te(t):j==="gemini"?a=Ee(t):j==="codex"?a=ze(t):j==="droid"&&(a=Fe(t)),await V(s,!1,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{E(!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:"Code"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Terminal sessions and coding agents"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>w(),disabled:b,children:[e.jsx(Re,{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(Ie,{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($e,{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"})]})]})]}),$&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:$})}),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(p,{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(p,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(oe,{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("/proposals"),className:"text-primary hover:underline font-medium",children:"Change Proposal"})]})]})]})}):e.jsx("div",{className:"space-y-2",children:m.slice(0,10).map(s=>e.jsxs(p,{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(me,{className:"h-4 w-4 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:s.proposalId}),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:()=>{A(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":g[s.id]?"Hide preview":"Show preview",title:g[s.id]?"Hide preview":"Show preview",children:g[s.id]?e.jsx(xe,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>c(`/terminal/${s.proposalId}`),children:"Open"}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>ne(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(he,{className:"h-4 w-4"})})]})]}),g[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>c(`/terminal/${s.proposalId}`),title:"Click to open full terminal session",children:e.jsx(Pe,{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:"Recent Proposals"}),J?e.jsx("div",{className:"space-y-3",children:[...Array(3)].map((s,t)=>e.jsx(p,{children:e.jsx(ke,{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(p,{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 proposals found"})})}):e.jsx("div",{className:"space-y-2",children:z.map(s=>e.jsx(p,{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(De,{className:"text-base leading-tight",children: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(`/proposals/${s.id}`),className:"h-7 px-2 text-xs",children:[e.jsx(ue,{className:"h-3 w-3 mr-1"})," View"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/proposals/${s.id}/edit`),className:"h-7 px-2 text-xs",children:[e.jsx(fe,{className:"h-3 w-3 mr-1"})," Edit"]})]})]})]})})})},s.id))})]}),e.jsx(ge,{open:k,onOpenChange:N,children:e.jsxs(je,{className:"max-w-lg",children:[e.jsxs(pe,{children:[e.jsx(ve,{children:"Start Coding Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Start an interactive coding 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:"Coding Agent"}),e.jsxs(Ne,{value:j,onValueChange:s=>K(s),children:[e.jsx(ye,{className:"w-full",children:e.jsx(we,{placeholder:"Select coding agent"})}),e.jsxs(Ce,{children:[e.jsx(S,{value:"claude",children:"Claude Code"}),e.jsx(S,{value:"gemini",children:"Google Gemini"}),e.jsx(S,{value:"codex",children:"OpenAI Codex"}),e.jsx(S,{value:"droid",children:"Factory Droid"})]})]})]}),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(Se,{className:"h-4 w-4"}),"Custom Agents"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[o.length," of ",u.length," selected"]})]}),e.jsxs(R,{children:[e.jsx(B,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[o.length===0?"Select agents...":o.length===u.length?"All agents selected":`${o.length} agent${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 Agents"}),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 agents 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.tools.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",s.tools.join(", ")]}),s.tools.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(be,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[f.length," of ",h.length," selected"]})]}),e.jsxs(R,{children:[e.jsx(B,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[f.length===0?"Select MCP servers...":f.length===h.length?"All servers selected":`${f.length} server${f.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:f.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(Ae,{value:T,onChange:s=>Q(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:le,disabled:D,children:D?"Starting...":"Start Session"})]})]})]})})]})}export{Xe as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{c as W,j as e,r as m,D as q,a as B,F as N,b as S,d as A,e as P,f as I,S as z,B as r,C as D,L as n,g as L,h as F,i as M,k as T,A as E}from"./index-BfJaT17z.js";import{C as c,a as l,b as f,c as j,d as R}from"./card-pzUJtmwJ.js";import{B as Y}from"./badge-D7styiB7.js";import{F as _}from"./folder-git-2-B8bjLoxc.js";import{C as H}from"./calendar-w3geg78-.js";import{C as G}from"./circle-check-HRharHjy.js";import{C as $}from"./chevron-left-B6nXpDLi.js";import{C as O}from"./clock-By2Dd4u0.js";import{C as V}from"./circle-check-big-B2CFEks4.js";import{P as U}from"./plus-DhYjijTS.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 J=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]],Q=W("file-chart-column-increasing",J);/**
|
|
7
|
-
* @license lucide-react v0.542.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Z=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],K=W("rocket",Z);function X({open:d,onOpenChange:g,workflows:y}){const[a,h]=m.useState(null),[o,u]=m.useState(0),C=t=>{h(t),u(0)},s=()=>{o>0?u(o-1):h(null)},v=()=>{a&&o<a.steps.length-1&&u(o+1)},p=()=>{h(null),u(0),g(!1)},x=()=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs(S,{children:[e.jsx(A,{className:"text-2xl",children:"Getting Started Wizard"}),e.jsx(P,{children:"Choose a workflow to get started with Coconut. We'll guide you through each step."})]}),e.jsx(z,{className:"h-[500px] pr-4",children:e.jsx("div",{className:"space-y-3",children:y.map(t=>e.jsx(c,{className:"cursor-pointer hover:bg-accent hover:border-accent-foreground/20 transition-colors",onClick:()=>C(t),children:e.jsx(l,{className:"p-6",children:e.jsxs("div",{className:"flex items-start space-x-4",children:[e.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:t.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold mb-1",children:t.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:t.description}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(Y,{variant:"secondary",className:"text-xs",children:[t.steps.length," steps"]}),e.jsx(D,{className:"h-4 w-4 text-muted-foreground"})]})]})]})})},t.id))})})]}),b=()=>{if(!a)return null;const t=a.steps[o],i=o===a.steps.length-1;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(S,{children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:a.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsx(A,{className:"text-xl",children:a.title}),e.jsxs(P,{children:["Step ",o+1," of ",a.steps.length]})]})]}),e.jsx("div",{className:"flex items-center space-x-2 pt-2",children:a.steps.map((k,w)=>e.jsx("div",{className:I("h-1.5 flex-1 rounded-full transition-colors",w<=o?"bg-primary":"bg-muted")},w))})]}),e.jsx(z,{className:"h-[450px] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]}),t.content&&e.jsxs("div",{className:"space-y-4",children:[t.content.text&&e.jsx(c,{children:e.jsx(l,{className:"p-4",children:e.jsx("p",{className:"text-sm leading-relaxed",children:t.content.text})})}),t.content.image&&e.jsx(c,{children:e.jsx(l,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("img",{src:t.content.image.src,alt:t.content.image.alt,className:"w-full rounded-md border"}),t.content.image.caption&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:t.content.image.caption})]})})}),t.content.video&&e.jsx(c,{children:e.jsx(l,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"relative rounded-md overflow-hidden border bg-muted",children:e.jsx("video",{src:t.content.video.src,poster:t.content.video.poster,controls:!0,className:"w-full",children:"Your browser does not support the video tag."})}),t.content.video.caption&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:t.content.video.caption})]})})})]}),i&&e.jsx(c,{className:"bg-primary/5 border-primary/20",children:e.jsxs(l,{className:"p-4 flex items-center space-x-3",children:[e.jsx(G,{className:"h-5 w-5 text-primary flex-shrink-0"}),e.jsx("p",{className:"text-sm font-medium",children:`You've completed this workflow! Click "Finish" to close this wizard.`})]})})]})}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs(r,{variant:"outline",onClick:s,children:[e.jsx($,{className:"mr-2 h-4 w-4"}),o===0?"Back to Workflows":"Previous"]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(r,{variant:"ghost",onClick:p,children:"Cancel"}),i?e.jsx(r,{onClick:p,children:"Finish"}):e.jsxs(r,{onClick:v,children:["Next",e.jsx(D,{className:"ml-2 h-4 w-4"})]})]})]})]})};return e.jsx(q,{open:d,onOpenChange:g,children:e.jsx(B,{className:"max-w-3xl max-h-[90vh]",children:a?b():x()})})}const ee=[{id:"new-project",title:"Start Developing a New Project",description:"Set up a brand new project with Coconut from scratch",icon:e.jsx(K,{className:"h-6 w-6"}),steps:[{title:"Welcome to Your New Project",description:"Let's set up your development environment and project structure",content:{text:"In this step, you'll learn how to initialize a new project with Coconut. We'll guide you through configuring your project settings, choosing your tech stack, and setting up your development environment."}},{title:"Configure Project Settings",description:"Customize your project configuration and preferences",content:{text:"Define your project name, description, and select the technologies you want to use. You can also configure advanced settings like build tools, testing frameworks, and deployment options."}},{title:"Initialize Your Workspace",description:"Create your project structure and install dependencies",content:{text:"Coconut will create the necessary files and folders for your project. This includes setting up version control, installing dependencies, and configuring your development tools."}}]},{id:"connect-project",title:"Connect an Existing Project",description:"Import and configure an existing codebase with Coconut",icon:e.jsx(_,{className:"h-6 w-6"}),steps:[{title:"Select Your Project",description:"Choose the project directory you want to connect",content:{text:"Navigate to your existing project folder or clone a repository. Coconut will analyze your project structure and detect the technologies you're using."}},{title:"Review Project Analysis",description:"Verify the detected technologies and configuration",content:{text:"Coconut has analyzed your project and detected the frameworks, libraries, and tools you're using. Review this information and make any necessary adjustments."}},{title:"Complete Integration",description:"Finalize the connection and sync your project",content:{text:"Coconut will create the necessary configuration files and integrate with your existing project. You'll be able to use all Coconut features with your codebase."}}]},{id:"analyze-code",title:"Analyze Code and Generate a Report",description:"Get insights, metrics, and recommendations for your codebase",icon:e.jsx(Q,{className:"h-6 w-6"}),steps:[{title:"Choose Analysis Scope",description:"Select what parts of your codebase to analyze",content:{text:"You can analyze your entire codebase or focus on specific directories, files, or modules. Choose the scope that best fits your needs."}},{title:"Configure Analysis Parameters",description:"Select the types of analysis you want to run",content:{text:"Choose from code quality checks, security scans, performance analysis, dependency reviews, and more. Customize the analysis to focus on what matters most to you."}},{title:"Review and Export Results",description:"View your analysis report and take action on findings",content:{text:"Coconut will generate a comprehensive report with actionable insights. You can export the report in various formats, share it with your team, or create change proposals to address issues."}}]},{id:"create-proposal",title:"Create a Change Proposal and Assign a Coding Agent",description:"Define a change and let AI agents help implement it",icon:e.jsx(N,{className:"h-6 w-6"}),steps:[{title:"Describe Your Change",description:"Define what you want to build or modify",content:{text:"Clearly describe the feature, bug fix, or refactoring you want to implement. Provide context, requirements, and any relevant technical details."}},{title:"Select an AI Agent",description:"Choose the right agent for your task",content:{text:"Pick from specialized agents based on your needs - frontend development, backend APIs, database changes, testing, documentation, and more. Each agent has unique capabilities and expertise."}},{title:"Review and Launch",description:"Confirm your proposal and start the implementation",content:{text:"Review your change proposal details and agent assignment. Once you're ready, launch the agent to start working on your change. You can monitor progress and provide feedback throughout."}}]},{id:"schedule-job",title:"Schedule an Agent Job",description:"Set up automated tasks and recurring agent workflows",icon:e.jsx(H,{className:"h-6 w-6"}),steps:[{title:"Define Your Job",description:"Specify what task the agent should perform",content:{text:"Describe the task you want to automate - code reviews, dependency updates, security scans, report generation, or custom workflows. Provide clear instructions for the agent."}},{title:"Set Schedule and Triggers",description:"Configure when and how often the job should run",content:{text:"Choose a schedule (daily, weekly, monthly, or custom cron expression) or set up event-based triggers like commits, pull requests, or deployments."}},{title:"Configure Notifications",description:"Decide how you want to be notified about job results",content:{text:"Set up notifications for job completion, failures, or important findings. Choose your preferred channels - email, Slack, GitHub, or in-app notifications."}}]}];function me(){const[d,g]=m.useState({total:0,inReview:0,approved:0}),[y,a]=m.useState([]),[h,o]=m.useState(!0),[u,C]=m.useState(!1);return m.useEffect(()=>{(async()=>{try{const p=await(await fetch(`${E}/api/v1/proposals`)).json();if(p.success&&p.data){const x=p.data,b={total:x.length,inReview:x.filter(i=>i.status==="in-review").length,approved:x.filter(i=>i.status==="approved"||i.status==="code-complete").length},t=x.sort((i,k)=>{const w=new Date(i.metadata?.updatedAt||i.metadata?.createdAt||0);return new Date(k.metadata?.updatedAt||k.metadata?.createdAt||0).getTime()-w.getTime()}).slice(0,5);g(b),a(t)}}catch(v){console.error("Failed to fetch proposal stats:",v)}finally{o(!1)}})()},[]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Home"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage change proposals, brainstorm, and take quick actions."})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(n,{to:"/proposals",children:e.jsxs(c,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(f,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(j,{className:"text-sm font-medium",children:"All Proposals"}),e.jsx(N,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(l,{children:[e.jsx("div",{className:"text-2xl font-bold",children:h?"...":d.total}),e.jsx("p",{className:"text-xs text-muted-foreground",children:d.total===0?"No proposals yet":`${d.total} proposal${d.total!==1?"s":""}`})]})]})}),e.jsx(n,{to:"/proposals?status=in-review",children:e.jsxs(c,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(f,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(j,{className:"text-sm font-medium",children:"In Review"}),e.jsx(O,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(l,{children:[e.jsx("div",{className:"text-2xl font-bold",children:h?"...":d.inReview}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting approval"})]})]})}),e.jsx(n,{to:"/proposals?status=approved",children:e.jsxs(c,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(f,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(j,{className:"text-sm font-medium",children:"Approved / Code Complete"}),e.jsx(V,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(l,{children:[e.jsx("div",{className:"text-2xl font-bold",children:h?"...":d.approved}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Ready to implement"})]})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(c,{children:[e.jsxs(f,{children:[e.jsx(j,{children:"Recent Proposals"}),e.jsx(R,{children:"Latest change proposals in your project"})]}),e.jsx(l,{children:h?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(s=>e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/2 mt-2"})]},s))}):y.length>0?e.jsxs("div",{className:"space-y-4 overflow-hidden",children:[y.map(s=>e.jsx(n,{to:`/proposals/${s.id}`,className:"block",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 p-3 rounded-lg border hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Y,{variant:s.status==="approved"||s.status==="code-complete"?"default":s.status==="in-review"?"secondary":s.status==="draft"?"outline":"destructive",children:s.status})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-sm font-medium line-clamp-2 sm:truncate",children:s.intent}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[s.author.name," • ",new Date(s.metadata?.updatedAt||s.metadata?.createdAt||"").toLocaleDateString()]})]})]})},s.id)),e.jsx("div",{className:"pt-2",children:e.jsx(r,{variant:"outline",size:"sm",asChild:!0,className:"w-full",children:e.jsx(n,{to:"/proposals",children:"View All Proposals"})})})]}):e.jsxs("div",{className:"text-center py-6",children:[e.jsx(N,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals yet"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first change proposal to get started."}),e.jsx(r,{asChild:!0,className:"mt-4",children:e.jsxs(n,{to:"/proposals/new",children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),"New Proposal"]})})]})})]}),e.jsxs(c,{className:"flex flex-col",children:[e.jsxs(f,{children:[e.jsx(j,{children:"Quick Actions"}),e.jsx(R,{children:"Common tasks and operations"})]}),e.jsx(l,{className:"flex flex-col flex-1",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{asChild:!0,variant:"default",className:"w-full justify-start",children:e.jsxs(n,{to:"/proposals/new",children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),"New Proposal"]})}),e.jsx(r,{asChild:!0,variant:"outline",className:"w-full justify-start",children:e.jsxs(n,{to:"/context/project/edit",children:[e.jsx(L,{className:"mr-2 h-4 w-4"}),"Update Project Overview"]})}),e.jsx(r,{asChild:!0,variant:"outline",className:"w-full justify-start",children:e.jsxs(n,{to:"/context/architecture/edit",children:[e.jsx(F,{className:"mr-2 h-4 w-4"}),"Update Technical Architecture"]})}),e.jsx(r,{asChild:!0,variant:"outline",className:"w-full justify-start",children:e.jsxs(n,{to:"/agents/new",children:[e.jsx(M,{className:"mr-2 h-4 w-4"}),"Create New Agent"]})}),e.jsx(r,{asChild:!0,variant:"outline",className:"w-full justify-start",children:e.jsxs(n,{to:"/code",children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),"Start Coding Agent"]})})]})})]})]}),e.jsx(X,{open:u,onOpenChange:C,workflows:ee})]})}export{me as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,b7 as T,b5 as I,t as n,j as e,a1 as E,f as j,s as y,C as N,ah as v,I as k,B as r,T as b,a2 as w,aj as q,v as Q,w as W,x as X,y as Z,z as ee}from"./index-BfJaT17z.js";import{C as U,b as Y,c as J,d as H,a as V}from"./card-pzUJtmwJ.js";import{L as m}from"./label-CTlQtJaU.js";function re(){const[t,F]=d.useState({}),[i,_]=d.useState(!0),[z,O]=d.useState(!1),[x,R]=d.useState({}),[C,G]=d.useState({}),[M,D]=d.useState(T()[0]?.id||"openai/gpt-4o"),[l,B]=d.useState({openrouter:!1,replicate:!1,anthropic:!1,openai:!1,gemini:!1,factorydroid:!1});d.useEffect(()=>{P()},[]);const P=async()=>{try{_(!0);const s=await I("/api/v1/config?type=global");if(s.success&&s.data){const a=s.data.apiKeys||{},c={},o={};for(const A of["openrouter","replicate","anthropic","openai","gemini","factorydroid"]){const K=a[A];K&&typeof K=="string"&&K.trim()!==""?(c[A]=!0,o[A]="***"):(c[A]=!1,o[A]="")}F(o);const S=s.data.defaults&&s.data.defaults.model?String(s.data.defaults.model):void 0;D(S||T()[0]?.id||"openai/gpt-4o")}}catch(s){console.error("Failed to load API keys:",s),n({title:"Error",description:"Failed to load API keys",variant:"destructive"})}finally{_(!1)}},h=(s,a)=>{F(c=>({...c,[s]:a}))},L=async s=>{try{G(S=>({...S,[s]:!0}));const a=t[s],c={provider:s};a&&a!=="***"&&(c.key=a);const o=await I("/api/v1/config/test",{method:"POST",body:JSON.stringify(c)});o.success&&o.message?n({title:"Test Result",description:o.message}):o.success?n({title:"Test Result",description:"Success"}):n({title:"Test Failed",description:o.message||"Unknown error",variant:"destructive"})}catch(a){n({title:"Test Failed",description:a instanceof Error?a.message:"Unknown error",variant:"destructive"})}finally{G(a=>({...a,[s]:!1}))}},p=s=>{B(a=>({...a,[s]:!a[s]}))},u=async s=>{try{const a={[s]:""};await I("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({apiKeys:a})}),n({title:"Success",description:`${s} API key cleared`}),await P()}catch(a){console.error("Failed to clear API key:",a),n({title:"Error",description:"Failed to clear API key",variant:"destructive"})}},f=async s=>{try{R(c=>({...c,[s]:!0}));const a={[s]:t[s]};await I("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({apiKeys:a})}),n({title:"Success",description:`${s} API key saved`}),await P()}catch(a){console.error("Failed to save API key:",a),n({title:"Error",description:"Failed to save API key",variant:"destructive"})}finally{R(a=>({...a,[s]:!1}))}},$=async()=>{try{O(!0),await I("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({defaults:{model:M}})}),n({title:"Success",description:"Default model saved successfully"})}catch(s){console.error("Failed to save default model:",s),n({title:"Error",description:"Failed to save default model",variant:"destructive"})}finally{O(!1)}},g={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(E,{}),e.jsxs(U,{children:[e.jsxs(Y,{children:[e.jsx(J,{children:"API Keys & Authentication"}),e.jsx(H,{children:"Manage API keys and authentication tokens for integrated services."})]}),e.jsxs(V,{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:()=>p("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:l.openrouter?e.jsx(y,{className:"h-4 w-4"}):e.jsx(N,{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:g.openrouter})]})]}),t.openrouter&&t.openrouter!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.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(k,{id:"openrouterKey",type:"password",placeholder:"sk-or-v1-...",className:"flex-1",value:t.openrouter||"",onChange:s=>h("openrouter",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("openrouter"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>L("openrouter"),disabled:!!C.openrouter,title:"Test API key",children:C.openrouter?"Testing...":"Test"}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>f("openrouter"),disabled:x.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(E,{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:()=>p("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:l.replicate?e.jsx(y,{className:"h-4 w-4"}):e.jsx(N,{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:g.replicate})]})]}),t.replicate&&t.replicate!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.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(k,{id:"replicateKey",type:"password",placeholder:"r8_...",className:"flex-1",value:t.replicate||"",onChange:s=>h("replicate",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("replicate"),title:"Clear API token",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>L("replicate"),disabled:!!C.replicate,title:"Test API token",children:C.replicate?"Testing...":"Test"}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>f("replicate"),disabled:x.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(E,{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:()=>p("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:l.anthropic?e.jsx(y,{className:"h-4 w-4"}):e.jsx(N,{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:g.anthropic})]})]}),t.anthropic&&t.anthropic!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.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(k,{id:"anthropicKey",type:"password",placeholder:"sk-ant-...",className:"flex-1",value:t.anthropic||"",onChange:s=>h("anthropic",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("anthropic"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>f("anthropic"),disabled:x.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:()=>p("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:l.openai?e.jsx(y,{className:"h-4 w-4"}):e.jsx(N,{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:g.openai})]})]}),t.openai&&t.openai!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.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(k,{id:"openaiKey",type:"password",placeholder:"sk-...",className:"flex-1",value:t.openai||"",onChange:s=>h("openai",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("openai"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>f("openai"),disabled:x.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:()=>p("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:l.gemini?e.jsx(y,{className:"h-4 w-4"}):e.jsx(N,{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:g.gemini})]})]}),t.gemini&&t.gemini!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.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(k,{id:"geminiKey",type:"password",placeholder:"AIza...",className:"flex-1",value:t.gemini||"",onChange:s=>h("gemini",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("gemini"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>f("gemini"),disabled:x.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:()=>p("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:l.factorydroid?e.jsx(y,{className:"h-4 w-4"}):e.jsx(N,{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:g.factorydroid})]})]}),t.factorydroid&&t.factorydroid!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.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(k,{id:"factorydroidKey",type:"password",placeholder:"fd-...",className:"flex-1",value:t.factorydroid||"",onChange:s=>h("factorydroid",s.target.value),disabled:i}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("factorydroid"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>f("factorydroid"),disabled:x.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(q,{className:"h-5 w-5"}),e.jsx(J,{children:"AI Assistant Settings"})]}),e.jsx(H,{children:"Configure default AI model and behavior for the AI assistant sidebar."})]}),e.jsxs(V,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"defaultModel",children:"Default AI Model"}),e.jsxs(Q,{value:M,onValueChange:D,children:[e.jsx(W,{children:e.jsx(X,{placeholder:"Select default AI model"})}),e.jsx(Z,{children:T().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:$,disabled:z||i,children:z?"Saving...":"Save"})})]})]})]})}export{re as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as A,u as T,H as F,r as i,A as p,j as e,n as g,B as o,L as x,az as L,J as S,M as $,N as P,T as z,O as B,P as K,Q as U,R as H,U as M,V as R,W,ah as _,ai as q,aA as I,Y as V}from"./index-BfJaT17z.js";import{C as d,a as m,b as J,c as O}from"./card-pzUJtmwJ.js";import{B as Q}from"./badge-D7styiB7.js";import{c as Y}from"./clipboard-B9ndUJKl.js";import{A as j}from"./arrow-left-orDiJ2Pw.js";import{C as G}from"./calendar-w3geg78-.js";import{T as X}from"./tag-DERlGH35.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,[t,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/context/knowledge/${l}`)).json();a.success?v(a.document):r({title:"Error",description:"Failed to load knowledge document",variant:"destructive"})}catch(s){console.error("Error fetching document:",s),r({title:"Error",description:"Failed to load knowledge document",variant:"destructive"})}finally{k(!1)}},D=async()=>{if(!t)return;const s=`.nut/context/knowledge/${t.filename}`;try{await Y(s),f(!0),setTimeout(()=>f(!1),2e3),r({title:"Copied!",description:`Path copied to clipboard: ${s}`})}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(!t)return;const s=new CustomEvent("discuss-in-chat",{detail:{type:"knowledge",id:`knowledge-${t.filename.replace(".md","")}`,filename:t.filename,name:t.filename,path:`.nut/context/knowledge/${t.filename}`}});window.dispatchEvent(s)},E=async()=>{if(t){u(!0);try{const a=await(await fetch(`${p}/api/v1/context/knowledge/${l}`,{method:"DELETE"})).json();a.success?(r({title:"Success",description:"Knowledge document deleted successfully"}),N("/context/knowledge")):r({title:"Error",description:a.error||"Failed to delete knowledge document",variant:"destructive"})}catch(s){console.error("Error deleting document:",s),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..."})]})})})}):t?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.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:"/context/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:`/context/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(P,{asChild:!0,children:e.jsxs(o,{variant:"destructive",size:"sm",children:[e.jsx(z,{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(H,{children:["Are you sure you want to delete “",t.title,"”? This action cannot be undone."]})]}),e.jsxs(M,{children:[e.jsx(R,{children:"Cancel"}),e.jsx(W,{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/context/knowledge/",t.filename]}),y?e.jsx(_,{className:"h-3.5 w-3.5 flex-shrink-0 text-green-600"}):e.jsx(q,{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(G,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Updated ",t.metadata.updated]})]}),t.metadata.tags&&t.metadata.tags.length>0&&e.jsxs("div",{className:"flex items-start gap-1.5 sm:items-center",children:[e.jsx(X,{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:t.metadata.tags.map((s,a)=>e.jsx(Q,{variant:"outline",className:"text-xs",children:s},a))})]})]}),t.metadata.sources&&t.metadata.sources.length>0&&e.jsxs(d,{children:[e.jsx(J,{children:e.jsx(O,{children:"Sources"})}),e.jsx(m,{children:e.jsx("ul",{className:"space-y-2",children:t.metadata.sources.map((s,a)=>{const c=Z(s);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(I,{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(V,{children:t.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:"/context/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};
|