@lovelybunch/api 1.0.71-alpha.2 → 1.0.71-alpha.3
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/file-validation.d.ts +65 -0
- package/dist/lib/file-validation.js +125 -0
- package/dist/middleware/auth.d.ts +1 -0
- package/dist/middleware/auth.js +13 -3
- package/dist/routes/api/v1/resources/route.js +10 -7
- package/package.json +5 -4
- package/static/assets/{AgentDetailPage-DwWIjGx1.js → AgentDetailPage-DVDnvYcy.js} +1 -1
- package/static/assets/{AgentEditPage-BvVPfYR3.js → AgentEditPage-DRLTkdIZ.js} +1 -1
- package/static/assets/{AgentsPage-D-Uy87Gh.js → AgentsPage-CVoYisFq.js} +1 -1
- package/static/assets/{AgentsSettingsPage-CDuAvFxu.js → AgentsSettingsPage-D9FDJHpC.js} +1 -1
- package/static/assets/{ApiKeysSettingsPage-Jug0kB7Z.js → ApiKeysSettingsPage-DGcz0E10.js} +1 -1
- package/static/assets/{ArchitectureEditPage-BmAgJAMV.js → ArchitectureEditPage-PXH0HtcY.js} +1 -1
- package/static/assets/{ArchitecturePage-ZjbdnDA7.js → ArchitecturePage-BiybPTif.js} +1 -1
- package/static/assets/{AuthSettingsPage-_pXoewOB.js → AuthSettingsPage-6TaOiZV7.js} +1 -1
- package/static/assets/{CallbackPage-CaAOpz4z.js → CallbackPage-BdZglBBj.js} +1 -1
- package/static/assets/{CodePage-DEbgr8C1.js → CodePage-B239DtM2.js} +1 -1
- package/static/assets/{CollapsibleSection-msxUBh1L.js → CollapsibleSection-DaqBpCe-.js} +1 -1
- package/static/assets/{DashboardPage-BXu-fikP.js → DashboardPage-B2FJcHVR.js} +1 -1
- package/static/assets/{GitPage-B7qFcP-K.js → GitPage-DaWE2Q-b.js} +1 -1
- package/static/assets/{GitSettingsPage-D7GjdOnE.js → GitSettingsPage-bTqUr0fn.js} +1 -1
- package/static/assets/{IdentityPage-BR48gNhN.js → IdentityPage-eXzMXYy2.js} +1 -1
- package/static/assets/{ImplementationStepsEditor-BdHMNVVd.js → ImplementationStepsEditor-CuDeossU.js} +1 -1
- package/static/assets/{IntegrationsSettingsPage-B1OHGlDC.js → IntegrationsSettingsPage-wAf_7nar.js} +1 -1
- package/static/assets/{KnowledgeDetailPage-DBOQQs3R.js → KnowledgeDetailPage-B5ieYIze.js} +1 -1
- package/static/assets/{KnowledgeEditPage-DHJxLPwi.js → KnowledgeEditPage-OMUREl1n.js} +1 -1
- package/static/assets/{KnowledgePage-CuuDTMa_.js → KnowledgePage-CKtcok1N.js} +1 -1
- package/static/assets/{LoginPage-IIU6NAG9.js → LoginPage-B70_aCBv.js} +1 -1
- package/static/assets/{McpSettingsPage-iz5gLGWt.js → McpSettingsPage-DcJIlHEi.js} +1 -1
- package/static/assets/{NewAgentPage-DolltGy5.js → NewAgentPage-DITLLDez.js} +1 -1
- package/static/assets/{NewKnowledgePage-_jbUZqBU.js → NewKnowledgePage-C7vEg4PR.js} +1 -1
- package/static/assets/{NewProposalPage-bFnfuuoA.js → NewProposalPage-z8wqyXIj.js} +1 -1
- package/static/assets/{ProjectEditPage-DTTjPnGj.js → ProjectEditPage-BDj8GlD_.js} +1 -1
- package/static/assets/{ProjectPage-DhwrnEq2.js → ProjectPage-CtoKV0l9.js} +1 -1
- package/static/assets/{PromptsSettingsPage-DLOVysbE.js → PromptsSettingsPage-CI-pWQVw.js} +1 -1
- package/static/assets/{ProposalDetailPage-KvjXUaaf.js → ProposalDetailPage-D6rhO9vm.js} +1 -1
- package/static/assets/{ProposalEditPage-BmzkHL9a.js → ProposalEditPage-DCy3_sbg.js} +1 -1
- package/static/assets/{ProposalsPage-DwQr1ycd.js → ProposalsPage-DQLqm83b.js} +1 -1
- package/static/assets/{ResourcesPage-B8Hm_j47.js → ResourcesPage-Bq9t872V.js} +1 -1
- package/static/assets/{RulesSettingsPage-CsGXFTFY.js → RulesSettingsPage-MgsP5qaA.js} +1 -1
- package/static/assets/{SchedulePage-CY8GdQlp.js → SchedulePage-C1vDSjyh.js} +1 -1
- package/static/assets/{TagInput-CbH9zq5n.js → TagInput-Cdfvhozb.js} +1 -1
- package/static/assets/{TerminalPage-DsjOLnyY.js → TerminalPage-NQzi2rzj.js} +1 -1
- package/static/assets/{TerminalSessionPage-DQ065WYU.js → TerminalSessionPage-DQgbm-LP.js} +1 -1
- package/static/assets/{UserPreferencesPage-55VTrzfQ.js → UserPreferencesPage-CCYsj_XY.js} +1 -1
- package/static/assets/{UserSettingsPage-BZwb93B4.js → UserSettingsPage-DdCnaoY_.js} +1 -1
- package/static/assets/{UtilitiesPage-BmEW7eJ_.js → UtilitiesPage-DGcmJSz6.js} +1 -1
- package/static/assets/{alert-CNSGDe1U.js → alert-BAeRxZ1d.js} +1 -1
- package/static/assets/{arrow-down-D1dapxzl.js → arrow-down-5CQhXptz.js} +1 -1
- package/static/assets/{arrow-left-CEZFPQje.js → arrow-left-DSqUNUH-.js} +1 -1
- package/static/assets/{arrow-up-D-lB4Ah6.js → arrow-up-CYoJSbWn.js} +1 -1
- package/static/assets/{badge-DO6e5hC1.js → badge-NJasrAx_.js} +1 -1
- package/static/assets/{browser-modal-BTxVvZIA.js → browser-modal-x3ise3M1.js} +1 -1
- package/static/assets/{calendar-DWaFMSXH.js → calendar-wiZSxCBM.js} +1 -1
- package/static/assets/{card-Cnz8b7Ou.js → card-CvaBJsG6.js} +1 -1
- package/static/assets/{chevron-left-CNgc28Tc.js → chevron-left-CaZHWPr-.js} +1 -1
- package/static/assets/{circle-alert-Dick-jNf.js → circle-alert-61156jM6.js} +1 -1
- package/static/assets/{circle-check-big-B70gdce7.js → circle-check-big-K_QMED_K.js} +1 -1
- package/static/assets/{circle-check-DDk43rYV.js → circle-check-z0By2KN8.js} +1 -1
- package/static/assets/{circle-play-TJEfmKde.js → circle-play-88lMuMRZ.js} +1 -1
- package/static/assets/{circle-x-BfR2YcXx.js → circle-x-DdTsJYO7.js} +1 -1
- package/static/assets/{clipboard-BTZru8wn.js → clipboard-BNXOfcye.js} +1 -1
- package/static/assets/{clock-DQXbrDkQ.js → clock-BTCBJF7v.js} +1 -1
- package/static/assets/{download-CW_rWwud.js → download-BaYIFjpj.js} +1 -1
- package/static/assets/{eye-Bv6mO2ld.js → eye-CuSCp49Y.js} +1 -1
- package/static/assets/{folder-git-2-Cv5NbBZZ.js → folder-git-2-CiVM8o0Y.js} +1 -1
- package/static/assets/{index-BSBM4i_g.js → index-B8vejVRZ.js} +3 -3
- package/static/assets/{label-vEgNxdb2.js → label-DtNTh--4.js} +1 -1
- package/static/assets/{markdown-editor-O6tGYa1a.js → markdown-editor-DvlGlqU9.js} +1 -1
- package/static/assets/{pause-6aQLhmG9.js → pause-COIsHZIp.js} +1 -1
- package/static/assets/{play-DsDsjO2V.js → play-a8BsF4gF.js} +1 -1
- package/static/assets/{plus-BfBtnncn.js → plus-Bon5P_OK.js} +1 -1
- package/static/assets/{radio-group-D_RD_9vY.js → radio-group-DpJuX02X.js} +1 -1
- package/static/assets/{refresh-cw-DvFNtws1.js → refresh-cw-CnHMzcH3.js} +1 -1
- package/static/assets/{search-kcgmZUqQ.js → search-BR37JgJ3.js} +1 -1
- package/static/assets/{switch-Bjq8cgQn.js → switch-D86f4WeD.js} +1 -1
- package/static/assets/{tabs-DDbBXbPg.js → tabs-BYrDWPwx.js} +1 -1
- package/static/assets/{tag-Czz-3rNY.js → tag--U3Nuedb.js} +1 -1
- package/static/assets/{terminal-preview-B7iP2vUT.js → terminal-preview-Be68j_3t.js} +1 -1
- package/static/assets/{use-terminal-CN3pheMp.js → use-terminal-2DGl8X5T.js} +1 -1
- package/static/assets/{zap-BMkP_c9R.js → zap-C0eIGEl_.js} +1 -1
- package/static/index.html +1 -1
- package/dist/lib/auth/auth-manager.d.ts.map +0 -1
- package/dist/lib/auth/auth-manager.js.map +0 -1
- package/dist/lib/gait-path.d.ts.map +0 -1
- package/dist/lib/gait-path.js.map +0 -1
- package/dist/lib/git-settings.d.ts.map +0 -1
- package/dist/lib/git-settings.js.map +0 -1
- package/dist/lib/git.d.ts.map +0 -1
- package/dist/lib/git.js.map +0 -1
- package/dist/lib/jobs/global-job-scheduler.d.ts.map +0 -1
- package/dist/lib/jobs/global-job-scheduler.js.map +0 -1
- package/dist/lib/jobs/job-runner.d.ts.map +0 -1
- package/dist/lib/jobs/job-runner.js.map +0 -1
- package/dist/lib/jobs/job-scheduler.d.ts.map +0 -1
- package/dist/lib/jobs/job-scheduler.js.map +0 -1
- package/dist/lib/jobs/job-store.d.ts.map +0 -1
- package/dist/lib/jobs/job-store.js.map +0 -1
- package/dist/lib/project-paths.d.ts.map +0 -1
- package/dist/lib/project-paths.js.map +0 -1
- package/dist/lib/storage/file-storage.d.ts.map +0 -1
- package/dist/lib/storage/file-storage.js.map +0 -1
- package/dist/lib/symlinks/symlink-manager.d.ts.map +0 -1
- package/dist/lib/symlinks/symlink-manager.js.map +0 -1
- package/dist/lib/symlinks/types.d.ts.map +0 -1
- package/dist/lib/symlinks/types.js.map +0 -1
- package/dist/lib/terminal/context-helper.d.ts.map +0 -1
- package/dist/lib/terminal/context-helper.js.map +0 -1
- package/dist/lib/terminal/global-manager.d.ts.map +0 -1
- package/dist/lib/terminal/global-manager.js.map +0 -1
- package/dist/lib/terminal/shell-utils.d.ts.map +0 -1
- package/dist/lib/terminal/shell-utils.js.map +0 -1
- package/dist/lib/terminal/terminal-manager.d.ts.map +0 -1
- package/dist/lib/terminal/terminal-manager.js.map +0 -1
- package/dist/lib/user-preferences.d.ts.map +0 -1
- package/dist/lib/user-preferences.js.map +0 -1
- package/dist/middleware/auth.d.ts.map +0 -1
- package/dist/middleware/auth.js.map +0 -1
- package/dist/routes/api/v1/agents/[id]/index.d.ts.map +0 -1
- package/dist/routes/api/v1/agents/[id]/index.js.map +0 -1
- package/dist/routes/api/v1/agents/[id]/route.d.ts.map +0 -1
- package/dist/routes/api/v1/agents/[id]/route.js.map +0 -1
- package/dist/routes/api/v1/agents/index.d.ts.map +0 -1
- package/dist/routes/api/v1/agents/index.js.map +0 -1
- package/dist/routes/api/v1/agents/route.d.ts.map +0 -1
- package/dist/routes/api/v1/agents/route.js.map +0 -1
- package/dist/routes/api/v1/ai/index.d.ts.map +0 -1
- package/dist/routes/api/v1/ai/index.js.map +0 -1
- package/dist/routes/api/v1/ai/route.d.ts.map +0 -1
- package/dist/routes/api/v1/ai/route.js.map +0 -1
- package/dist/routes/api/v1/api-keys/index.d.ts.map +0 -1
- package/dist/routes/api/v1/api-keys/index.js.map +0 -1
- package/dist/routes/api/v1/api-keys/route.d.ts.map +0 -1
- package/dist/routes/api/v1/api-keys/route.js.map +0 -1
- package/dist/routes/api/v1/auth/index.d.ts.map +0 -1
- package/dist/routes/api/v1/auth/index.js.map +0 -1
- package/dist/routes/api/v1/auth/route.d.ts.map +0 -1
- package/dist/routes/api/v1/auth/route.js.map +0 -1
- package/dist/routes/api/v1/auth-settings/index.d.ts.map +0 -1
- package/dist/routes/api/v1/auth-settings/index.js.map +0 -1
- package/dist/routes/api/v1/auth-settings/route.d.ts.map +0 -1
- package/dist/routes/api/v1/auth-settings/route.js.map +0 -1
- package/dist/routes/api/v1/chats/[id]/index.d.ts.map +0 -1
- package/dist/routes/api/v1/chats/[id]/index.js.map +0 -1
- package/dist/routes/api/v1/chats/[id]/route.d.ts.map +0 -1
- package/dist/routes/api/v1/chats/[id]/route.js.map +0 -1
- package/dist/routes/api/v1/chats/index.d.ts.map +0 -1
- package/dist/routes/api/v1/chats/index.js.map +0 -1
- package/dist/routes/api/v1/chats/route.d.ts.map +0 -1
- package/dist/routes/api/v1/chats/route.js.map +0 -1
- package/dist/routes/api/v1/config/index.d.ts.map +0 -1
- package/dist/routes/api/v1/config/index.js.map +0 -1
- package/dist/routes/api/v1/config/route.d.ts.map +0 -1
- package/dist/routes/api/v1/config/route.js.map +0 -1
- package/dist/routes/api/v1/context/architecture/route.d.ts.map +0 -1
- package/dist/routes/api/v1/context/architecture/route.js.map +0 -1
- package/dist/routes/api/v1/context/index.d.ts.map +0 -1
- package/dist/routes/api/v1/context/index.js.map +0 -1
- package/dist/routes/api/v1/context/knowledge/[filename]/index.d.ts.map +0 -1
- package/dist/routes/api/v1/context/knowledge/[filename]/index.js.map +0 -1
- package/dist/routes/api/v1/context/knowledge/[filename]/route.d.ts.map +0 -1
- package/dist/routes/api/v1/context/knowledge/[filename]/route.js.map +0 -1
- package/dist/routes/api/v1/context/knowledge/index.d.ts.map +0 -1
- package/dist/routes/api/v1/context/knowledge/index.js.map +0 -1
- package/dist/routes/api/v1/context/knowledge/route.d.ts.map +0 -1
- package/dist/routes/api/v1/context/knowledge/route.js.map +0 -1
- package/dist/routes/api/v1/context/project/route.d.ts.map +0 -1
- package/dist/routes/api/v1/context/project/route.js.map +0 -1
- package/dist/routes/api/v1/git/index.d.ts.map +0 -1
- package/dist/routes/api/v1/git/index.js.map +0 -1
- package/dist/routes/api/v1/jobs/[id]/route.d.ts.map +0 -1
- package/dist/routes/api/v1/jobs/[id]/route.js.map +0 -1
- package/dist/routes/api/v1/jobs/[id]/run/route.d.ts.map +0 -1
- package/dist/routes/api/v1/jobs/[id]/run/route.js.map +0 -1
- package/dist/routes/api/v1/jobs/index.d.ts.map +0 -1
- package/dist/routes/api/v1/jobs/index.js.map +0 -1
- package/dist/routes/api/v1/jobs/route.d.ts.map +0 -1
- package/dist/routes/api/v1/jobs/route.js.map +0 -1
- package/dist/routes/api/v1/jobs/status/route.d.ts.map +0 -1
- package/dist/routes/api/v1/jobs/status/route.js.map +0 -1
- package/dist/routes/api/v1/mcp/index.d.ts.map +0 -1
- package/dist/routes/api/v1/mcp/index.js.map +0 -1
- package/dist/routes/api/v1/mcp/route.d.ts.map +0 -1
- package/dist/routes/api/v1/mcp/route.js.map +0 -1
- package/dist/routes/api/v1/proposals/[id]/route.d.ts.map +0 -1
- package/dist/routes/api/v1/proposals/[id]/route.js.map +0 -1
- package/dist/routes/api/v1/proposals/index.d.ts.map +0 -1
- package/dist/routes/api/v1/proposals/index.js.map +0 -1
- package/dist/routes/api/v1/proposals/route.d.ts.map +0 -1
- package/dist/routes/api/v1/proposals/route.js.map +0 -1
- package/dist/routes/api/v1/resources/[id]/index.d.ts.map +0 -1
- package/dist/routes/api/v1/resources/[id]/index.js.map +0 -1
- package/dist/routes/api/v1/resources/[id]/route.js.map +0 -1
- package/dist/routes/api/v1/resources/[id]/thumbnail/index.d.ts.map +0 -1
- package/dist/routes/api/v1/resources/[id]/thumbnail/index.js.map +0 -1
- package/dist/routes/api/v1/resources/[id]/thumbnail/route.js.map +0 -1
- package/dist/routes/api/v1/resources/index.d.ts.map +0 -1
- package/dist/routes/api/v1/resources/index.js.map +0 -1
- package/dist/routes/api/v1/resources/route.d.ts.map +0 -1
- package/dist/routes/api/v1/resources/route.js.map +0 -1
- package/dist/routes/api/v1/symlinks/index.d.ts.map +0 -1
- package/dist/routes/api/v1/symlinks/index.js.map +0 -1
- package/dist/routes/api/v1/symlinks/route.d.ts.map +0 -1
- package/dist/routes/api/v1/symlinks/route.js.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/create/index.d.ts.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/create/index.js.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/create/route.d.ts.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/create/route.js.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.d.ts.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.js.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.d.ts.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.js.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/resize/index.d.ts.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/resize/index.js.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/resize/route.d.ts.map +0 -1
- package/dist/routes/api/v1/terminal/[proposalId]/resize/route.js.map +0 -1
- package/dist/routes/api/v1/terminal/sessions/index.d.ts.map +0 -1
- package/dist/routes/api/v1/terminal/sessions/index.js.map +0 -1
- package/dist/routes/api/v1/terminal/sessions/route.d.ts.map +0 -1
- package/dist/routes/api/v1/terminal/sessions/route.js.map +0 -1
- package/dist/routes/api/v1/user/index.d.ts.map +0 -1
- package/dist/routes/api/v1/user/index.js.map +0 -1
- package/dist/routes/api/v1/user/settings/index.d.ts.map +0 -1
- package/dist/routes/api/v1/user/settings/index.js.map +0 -1
- package/dist/routes/api/v1/user/settings/route.d.ts.map +0 -1
- package/dist/routes/api/v1/user/settings/route.js.map +0 -1
- package/dist/server-with-static.d.ts.map +0 -1
- package/dist/server-with-static.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-B8vejVRZ.js";import{C as c,a as l,b as f,c as j,d as R}from"./card-CvaBJsG6.js";import{B as Y}from"./badge-NJasrAx_.js";import{F as _}from"./folder-git-2-CiVM8o0Y.js";import{C as H}from"./calendar-wiZSxCBM.js";import{C as G}from"./circle-check-z0By2KN8.js";import{C as $}from"./chevron-left-CaZHWPr-.js";import{C as O}from"./clock-BTCBJF7v.js";import{C as V}from"./circle-check-big-K_QMED_K.js";import{P as U}from"./plus-Bon5P_OK.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as le,A as l,bd as ws,r as n,H as vs,ag as ys,j as e,L as ee,ad as Fe,B as o,G as D,ac as Ns,X as Cs,I as k,q as Me,s as Be,T as Oe,D as se,a as te,b as ae,d as re,e as ne,aY as ks,$ as Re}from"./index-
|
|
1
|
+
import{c as le,A as l,bd as ws,r as n,H as vs,ag as ys,j as e,L as ee,ad as Fe,B as o,G as D,ac as Ns,X as Cs,I as k,q as Me,s as Be,T as Oe,D as se,a as te,b as ae,d as re,e as ne,aY as ks,$ as Re}from"./index-B8vejVRZ.js";import{C as ie}from"./card-CvaBJsG6.js";import{L as Ge}from"./label-DtNTh--4.js";import{T as Ss,a as Ts,b as We,c as ze}from"./tabs-BYrDWPwx.js";import{C as Ps}from"./circle-check-z0By2KN8.js";import{C as As}from"./circle-x-DdTsJYO7.js";import{A as Ds}from"./arrow-down-5CQhXptz.js";import{A as $s}from"./arrow-up-CYoJSbWn.js";import{R as Ue}from"./refresh-cw-CnHMzcH3.js";import{C as ce}from"./circle-alert-61156jM6.js";import{F as oe}from"./folder-git-2-CiVM8o0Y.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ae,r,H as He,A as u,j as e,a1 as he,aq as xe,B as o,T as Fe,n as De,aY as ze,I as U,D as W,a as q,b as B,d as J,e as K,$ as Y}from"./index-
|
|
1
|
+
import{c as Ae,r,H as He,A as u,j as e,a1 as he,aq as xe,B as o,T as Fe,n as De,aY as ze,I as U,D as W,a as q,b as B,d as J,e as K,$ as Y}from"./index-B8vejVRZ.js";import{C as pe,b as ge,c as fe,d as be,a as je}from"./card-CvaBJsG6.js";import{L as f}from"./label-DtNTh--4.js";import{R as Me,a as ve}from"./radio-group-DpJuX02X.js";import{R as T}from"./refresh-cw-CnHMzcH3.js";import{C as Oe}from"./circle-check-z0By2KN8.js";import{C as Ie}from"./circle-x-DdTsJYO7.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as oe,H as ve,r as u,j as e,n as se,B as x,a2 as fe,Z as Ne,aV as Te,aW as Ce,I as c,a0 as O,ac as ae,a1 as ne,T as be,v as Se,w as we,x as Ae,y as ke,z as Ie,A as ie}from"./index-
|
|
1
|
+
import{c as oe,H as ve,r as u,j as e,n as se,B as x,a2 as fe,Z as Ne,aV as Te,aW as Ce,I as c,a0 as O,ac as ae,a1 as ne,T as be,v as Se,w as we,x as Ae,y as ke,z as Ie,A as ie}from"./index-B8vejVRZ.js";import{C as y,b as g,c as j,d as v,a as f,e as Oe}from"./card-CvaBJsG6.js";import{L as o}from"./label-DtNTh--4.js";import{B as re}from"./badge-NJasrAx_.js";import{A as Fe,a as Pe}from"./alert-BAeRxZ1d.js";import{T as Ee,a as Me,b,c as S}from"./tabs-BYrDWPwx.js";import{Z as Le}from"./zap-C0eIGEl_.js";import{E as De}from"./eye-CuSCp49Y.js";import{P as E}from"./plus-Bon5P_OK.js";import{C as _e,a as Ue}from"./clipboard-BNXOfcye.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as u,j as e,f as p,B as r,T as x,I as j,v,w as y,x as S,y as f,z as g}from"./index-
|
|
1
|
+
import{c as u,j as e,f as p,B as r,T as x,I as j,v,w as y,x as S,y as f,z as g}from"./index-B8vejVRZ.js";import{L as c}from"./label-DtNTh--4.js";import{P as b}from"./plus-Bon5P_OK.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/static/assets/{IntegrationsSettingsPage-B1OHGlDC.js → IntegrationsSettingsPage-wAf_7nar.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,aZ as T,aX 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 X,w as Z,x as Q,y as W,z as ee}from"./index-BSBM4i_g.js";import{C as U,b as Y,c as J,d as H,a as V}from"./card-Cnz8b7Ou.js";import{L as m}from"./label-vEgNxdb2.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(X,{value:M,onValueChange:D,children:[e.jsx(Z,{children:e.jsx(Q,{placeholder:"Select default AI model"})}),e.jsx(W,{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
|
+
import{r as d,aZ as T,aX 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 X,w as Z,x as Q,y as W,z as ee}from"./index-B8vejVRZ.js";import{C as U,b as Y,c as J,d as H,a as V}from"./card-CvaBJsG6.js";import{L as m}from"./label-DtNTh--4.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(X,{value:M,onValueChange:D,children:[e.jsx(Z,{children:e.jsx(Q,{placeholder:"Select default AI model"})}),e.jsx(W,{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 +1 @@
|
|
|
1
|
-
import{E,u as A,H as T,r,A as u,j as e,n as f,B as i,L as d,ap as F,J as L,M as $,N as P,T as S,O as z,P as B,Q as K,R as U,U as q,V as H,W as M,ah as R,ai as _,aq as I,Y as V}from"./index-
|
|
1
|
+
import{E,u as A,H as T,r,A as u,j as e,n as f,B as i,L as d,ap as F,J as L,M as $,N as P,T as S,O as z,P as B,Q as K,R as U,U as q,V as H,W as M,ah as R,ai as _,aq as I,Y as V}from"./index-B8vejVRZ.js";import{C as c,a as o,b as W,c as J}from"./card-CvaBJsG6.js";import{B as O}from"./badge-NJasrAx_.js";import{c as Q}from"./clipboard-B9ndUJKl.js";import{A as p}from"./arrow-left-DSqUNUH-.js";import{C as Y}from"./calendar-wiZSxCBM.js";import{T as G}from"./tag--U3Nuedb.js";function le(){const g=E(),j=A(),{toast:n}=T(),l=g.filename,[s,w]=r.useState(null),[N,v]=r.useState(!0),[m,x]=r.useState(!1),[k,h]=r.useState(!1);r.useEffect(()=>{l&&C()},[l]);const C=async()=>{try{const a=await(await fetch(`${u}/api/v1/context/knowledge/${l}`)).json();a.success?w(a.document):n({title:"Error",description:"Failed to load knowledge document",variant:"destructive"})}catch(t){console.error("Error fetching document:",t),n({title:"Error",description:"Failed to load knowledge document",variant:"destructive"})}finally{v(!1)}},y=async()=>{if(!s)return;const t=`.nut/context/knowledge/${s.filename}`;try{await Q(t),h(!0),setTimeout(()=>h(!1),2e3),n({title:"Copied!",description:`Path copied to clipboard: ${t}`})}catch(a){console.error("Failed to copy path:",a),n({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},D=()=>{if(!s)return;const t=new CustomEvent("discuss-in-chat",{detail:{type:"knowledge",id:`knowledge-${s.filename.replace(".md","")}`,filename:s.filename,name:s.filename,path:`.nut/context/knowledge/${s.filename}`}});window.dispatchEvent(t)},b=async()=>{if(s){x(!0);try{const a=await(await fetch(`${u}/api/v1/context/knowledge/${l}`,{method:"DELETE"})).json();a.success?(n({title:"Success",description:"Knowledge document deleted successfully"}),j("/context/knowledge")):n({title:"Error",description:a.error||"Failed to delete knowledge document",variant:"destructive"})}catch(t){console.error("Error deleting document:",t),n({title:"Error",description:"Failed to delete knowledge document",variant:"destructive"})}finally{x(!1)}}};return N?e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(o,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(f,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading knowledge document..."})]})})})}):s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(i,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(d,{to:"/context/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})}),e.jsxs(i,{variant:"outline",size:"sm",onClick:D,children:[e.jsx(F,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsx(i,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(d,{to:`/context/knowledge/${l}/edit`,children:[e.jsx(L,{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(i,{variant:"destructive",size:"sm",children:[e.jsx(S,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Delete"})]})}),e.jsxs(z,{children:[e.jsxs(B,{children:[e.jsx(K,{children:"Delete Knowledge Document"}),e.jsxs(U,{children:["Are you sure you want to delete “",s.title,"”? This action cannot be undone."]})]}),e.jsxs(q,{children:[e.jsx(H,{children:"Cancel"}),e.jsx(M,{onClick:b,disabled:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:m?e.jsx(f,{className:"w-4 h-4 animate-spin"}):"Delete"})]})]})]})]})]}),e.jsx("div",{className:"text-left",children:e.jsxs("button",{type:"button",onClick:y,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/",s.filename]}),k?e.jsx(R,{className:"h-3.5 w-3.5 flex-shrink-0 text-green-600"}):e.jsx(_,{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(Y,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Updated ",s.metadata.updated]})]}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{className:"flex items-start gap-1.5 sm:items-center",children:[e.jsx(G,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5 sm:mt-0"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.metadata.tags.map((t,a)=>e.jsx(O,{variant:"outline",className:"text-xs",children:t},a))})]})]}),s.metadata.sources&&s.metadata.sources.length>0&&e.jsxs(c,{children:[e.jsx(W,{children:e.jsxs(J,{className:"flex items-center gap-2",children:[e.jsx(I,{className:"w-4 h-4"}),"Sources"]})}),e.jsx(o,{children:e.jsx("ul",{className:"space-y-2",children:s.metadata.sources.map((t,a)=>e.jsx("li",{children:t.startsWith("http")?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:t}):e.jsx("span",{children:t})},a))})})]}),e.jsx(c,{children:e.jsx(o,{className:"pt-6",children:e.jsx(V,{children:s.content})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold",children:"Knowledge Document Not Found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(i,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(d,{to:"/context/knowledge",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})})})]}),e.jsx(c,{children:e.jsx(o,{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{le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as B,u as M,H as z,r as n,A as C,j as e,n as S,B as x,L as D,a2 as K,X as R,I as U}from"./index-
|
|
1
|
+
import{E as B,u as M,H as z,r as n,A as C,j as e,n as S,B as x,L as D,a2 as K,X as R,I as U}from"./index-B8vejVRZ.js";import{C as d,a as l,b as h,c as g}from"./card-CvaBJsG6.js";import{L as p}from"./label-DtNTh--4.js";import{M as H}from"./markdown-editor-DvlGlqU9.js";import{T as y}from"./TagInput-Cdfvhozb.js";import{A as _}from"./arrow-left-DSqUNUH-.js";import"./badge-NJasrAx_.js";function W(){const T=B(),i=M(),{toast:a}=z(),r=T.filename,[m,L]=n.useState(null),[A,b]=n.useState(!0),[u,f]=n.useState(!1),[o,j]=n.useState(""),[c,v]=n.useState(""),[w,N]=n.useState([]),[k,E]=n.useState([]);n.useEffect(()=>{r&&F()},[r]);const F=async()=>{try{const t=await(await fetch(`${C}/api/v1/context/knowledge/${r}`)).json();t.success?(L(t.document),j(t.document.title),v(t.document.content),N(t.document.metadata.tags||[]),E(t.document.metadata.sources||[])):(a({title:"Error",description:"Failed to load knowledge document",variant:"destructive"}),i("/context/knowledge"))}catch(s){console.error("Error fetching document:",s),a({title:"Error",description:"Failed to load knowledge document",variant:"destructive"}),i("/context/knowledge")}finally{b(!1)}},P=async()=>{if(m){if(!o.trim()){a({title:"Error",description:"Please provide a title for the knowledge document",variant:"destructive"});return}if(!c.trim()){a({title:"Error",description:"Please provide content for the knowledge document",variant:"destructive"});return}f(!0);try{const t=await(await fetch(`${C}/api/v1/context/knowledge/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.trim(),content:c.trim(),metadata:{tags:w,sources:k}})})).json();if(t.success){a({title:"Success",description:"Knowledge document updated successfully"});const I=t.document.filename.replace(".md","");i(`/context/knowledge/${I}`,{replace:!0})}else a({title:"Error",description:t.error||"Failed to update knowledge document",variant:"destructive"})}catch(s){console.error("Error updating document:",s),a({title:"Error",description:"Failed to update knowledge document",variant:"destructive"})}finally{f(!1)}}},$=()=>{i(`/context/knowledge/${r}`)};return A?e.jsx("div",{className:"space-y-6",children:e.jsx(d,{children:e.jsx(l,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(S,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading knowledge document..."})]})})})}):m?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Knowledge Document"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:m.filename})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(x,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(D,{to:"/context/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(_,{className:"h-4 w-4"})})}),e.jsxs(x,{onClick:P,disabled:u||!o.trim()||!c.trim(),size:"sm",children:[u?e.jsx(S,{className:"w-4 h-4 animate-spin sm:mr-2"}):e.jsx(K,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:u?"Saving...":"Save"})]}),e.jsxs(x,{onClick:$,variant:"outline",size:"sm",children:[e.jsx(R,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Cancel"})]})]})]}),e.jsxs(d,{children:[e.jsx(h,{children:e.jsx(g,{children:"Basic Information"})}),e.jsx(l,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(p,{htmlFor:"title",children:"Title *"}),e.jsx(U,{id:"title",value:o,onChange:s=>j(s.target.value),placeholder:"Enter document title...",className:"text-lg"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing the title will rename the file"})]})})]}),e.jsxs(d,{children:[e.jsx(h,{children:e.jsx(g,{children:"Metadata"})}),e.jsxs(l,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Tags"}),e.jsx(y,{tags:w,onChange:N,placeholder:"Add a tag"})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Sources"}),e.jsx(y,{tags:k,onChange:E,placeholder:"Add a source (URL or name)"})]})]})]}),e.jsxs(d,{children:[e.jsx(h,{children:e.jsx(g,{children:"Content *"})}),e.jsx(l,{children:e.jsx(H,{value:c,onChange:s=>v(s||""),placeholder:"Enter your knowledge content in Markdown..."})})]})]}):null}export{W as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as q,j as e,S as G,Y as Q,u as W,r as p,H as X,A as P,n as Z,B as h,L as R,g as C,ap as z,ah as I,ai as K}from"./index-
|
|
1
|
+
import{c as q,j as e,S as G,Y as Q,u as W,r as p,H as X,A as P,n as Z,B as h,L as R,g as C,ap as z,ah as I,ai as K}from"./index-B8vejVRZ.js";import{C as M,a as L}from"./card-CvaBJsG6.js";import{B as j}from"./badge-NJasrAx_.js";import{c as ee}from"./clipboard-B9ndUJKl.js";import{R as te,a as se,f as ne,L as B}from"./browser-modal-x3ise3M1.js";import{P as O}from"./plus-Bon5P_OK.js";import{A as ae}from"./arrow-up-CYoJSbWn.js";import{A as re}from"./arrow-down-5CQhXptz.js";import"./search-BR37JgJ3.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as I,l as z,m as B,r as t,j as e,n as g,I as l,B as y,t as n}from"./index-
|
|
1
|
+
import{u as I,l as z,m as B,r as t,j as e,n as g,I as l,B as y,t as n}from"./index-B8vejVRZ.js";import{L as c}from"./label-DtNTh--4.js";import{C as D,b as k,c as H,d as M,a as O}from"./card-CvaBJsG6.js";import{T as V,a as W,b as w,c as N}from"./tabs-BYrDWPwx.js";function Q(){const i=I(),o=z(),{login:b,register:C,isAuthenticated:h,authEnabled:x,isLoading:m}=B(),[a,d]=t.useState(!1),[L,S]=t.useState("login"),[p,E]=t.useState(""),[f,T]=t.useState(""),[j,F]=t.useState(""),[u,P]=t.useState(""),[v,R]=t.useState("");t.useEffect(()=>{if(!m){if(!x)i("/");else if(h){const s=o.state?.from?.pathname||"/";i(s,{replace:!0})}}},[x,h,m,i,o]);const A=async s=>{s.preventDefault(),d(!0);try{await b(p,f),n({title:"Success",description:"Logged in successfully"});const r=o.state?.from?.pathname||"/";i(r,{replace:!0})}catch(r){n({title:"Login failed",description:r.message||"Invalid email or password",variant:"destructive"})}finally{d(!1)}},q=async s=>{if(s.preventDefault(),u.length<8){n({title:"Invalid password",description:"Password must be at least 8 characters",variant:"destructive"});return}d(!0);try{await C(j,u,v),n({title:"Success",description:"Account created successfully"});const r=o.state?.from?.pathname||"/";i(r,{replace:!0})}catch(r){n({title:"Registration failed",description:r.message||"Failed to create account",variant:"destructive"})}finally{d(!1)}};return m?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(g,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-background to-muted p-4",children:e.jsxs(D,{className:"w-full max-w-md",children:[e.jsxs(k,{className:"space-y-1 text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("svg",{className:"h-12 w-12 text-green-600",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"})})}),e.jsx(H,{className:"text-2xl font-bold",children:"Welcome to Coconut"}),e.jsx(M,{children:"Sign in to your account or create a new one"})]}),e.jsx(O,{children:e.jsxs(V,{value:L,onValueChange:s=>S(s),children:[e.jsxs(W,{className:"grid w-full grid-cols-2",children:[e.jsx(w,{value:"login",children:"Login"}),e.jsx(w,{value:"register",children:"Register"})]}),e.jsx(N,{value:"login",className:"space-y-4",children:e.jsxs("form",{onSubmit:A,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"login-email",children:"Email"}),e.jsx(l,{id:"login-email",type:"email",placeholder:"you@example.com",value:p,onChange:s=>E(s.target.value),required:!0,disabled:a})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"login-password",children:"Password"}),e.jsx(l,{id:"login-password",type:"password",value:f,onChange:s=>T(s.target.value),required:!0,disabled:a})]}),e.jsx(y,{type:"submit",className:"w-full",disabled:a,children:a?e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"mr-2 h-4 w-4 animate-spin"}),"Logging in..."]}):"Login"})]})}),e.jsx(N,{value:"register",className:"space-y-4",children:e.jsxs("form",{onSubmit:q,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"register-email",children:"Email"}),e.jsx(l,{id:"register-email",type:"email",placeholder:"you@example.com",value:j,onChange:s=>F(s.target.value),required:!0,disabled:a}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Only whitelisted emails can register"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"register-name",children:"Name"}),e.jsx(l,{id:"register-name",type:"text",placeholder:"Your name",value:v,onChange:s=>R(s.target.value),required:!0,disabled:a})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"register-password",children:"Password"}),e.jsx(l,{id:"register-password",type:"password",value:u,onChange:s=>P(s.target.value),required:!0,disabled:a,minLength:8}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"At least 8 characters"})]}),e.jsx(y,{type:"submit",className:"w-full",disabled:a,children:a?e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating account..."]}):"Create Account"})]})})]})})]})})}export{Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,S as ne,Y as E,r as f,aX as B,t as C,a1 as te,aV as ie,B as j,I as g,a0 as M,J as ae,T as oe,g as ce,ad as le}from"./index-BSBM4i_g.js";import{C as P,b as F,c as O,d as R,a as $}from"./card-Cnz8b7Ou.js";import{L as m}from"./label-vEgNxdb2.js";import{B as J}from"./badge-DO6e5hC1.js";import{S as I}from"./switch-Bjq8cgQn.js";import{A as q,a as z}from"./alert-CNSGDe1U.js";import{R as de,a as me,L as he}from"./browser-modal-BTxVvZIA.js";import{C as L}from"./circle-alert-Dick-jNf.js";import{P as Y}from"./plus-BfBtnncn.js";import{C as xe}from"./circle-check-big-B70gdce7.js";import"./search-kcgmZUqQ.js";function U(r){if(r){if(Array.isArray(r)){const t=r.map(o=>{if(typeof o=="string")return o.trim();if(typeof o=="number")return`${o}`}).filter(o=>typeof o=="string"&&o.length>0);return t.length>0?t:void 0}if(typeof r=="string"){const t=r.split(",").map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?t:void 0}}}function K(r,t){const o=r.name||t.name,h=t.description||r.description||"",i={registryId:r.id,registryEndpoint:r.endpoint,registrySource:de,author:r.author||t.author};(t.version||r.version)&&(i.version=t.version||r.version);const d=U(t.tags)||U(r.tags);d&&(i.tags=d),t.capabilities&&Array.isArray(t.capabilities)&&(i.capabilities=t.capabilities),t.requirements&&typeof t.requirements=="object"&&(i.requirements=t.requirements),t.links&&typeof t.links=="object"&&(i.links=t.links),t.metadata&&typeof t.metadata=="object"&&(i.mcpMetadata=t.metadata);for(const[a,v]of Object.entries(i))v==null&&delete i[a];return{name:o,command:t.configuration.command,args:t.configuration.args,env:t.configuration.env,enabled:!0,description:h,metadata:Object.keys(i).length>0?i:void 0}}async function ve(r){const t=r.startsWith("http")?r:`https://registry.coconut.dev${r}`,o=await fetch(t,{headers:{Accept:"application/json","User-Agent":"coconut-frontend"}});if(!o.ok)throw new Error(`Failed to fetch MCP server detail: ${o.status}`);return o.json()}function ge({open:r,onOpenChange:t,onImport:o}){return e.jsx(me,{open:r,onOpenChange:t,categoryId:"mcp-servers",title:"Coconut Registry – MCP Servers",confirmLabel:"Add Server",getDetail:h=>ve(h.endpoint),renderPreview:(h,i)=>{if(!i)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an MCP server to preview"});const d=K(h,i),a=d.metadata??{},v=typeof a.version=="string"?a.version:void 0,N=Array.isArray(h.tags)?h.tags:[],S=Array.isArray(a.capabilities)?a.capabilities.filter(p=>typeof p=="string"):[];return e.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border",children:e.jsx(ne,{className:"h-full",children:e.jsx("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:h.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.description})]}),v&&e.jsxs(J,{variant:"outline",children:["v",v]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Registry ID: ",e.jsx("span",{className:"font-mono",children:h.id})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:N.map(p=>e.jsx(J,{variant:"secondary",children:p},p))}),e.jsxs("div",{className:"space-y-2 rounded-md border p-3 bg-muted/50",children:[e.jsx("div",{className:"text-sm font-medium",children:"Configuration"}),e.jsxs("div",{className:"space-y-1 text-sm font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Command:"})," ",e.jsx("span",{className:"text-foreground",children:d.command})]}),d.args&&d.args.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Args:"})," ",e.jsx("span",{className:"text-foreground",children:d.args.join(" ")})]}),d.env&&Object.keys(d.env).length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Env:"})," ",e.jsx("span",{className:"text-foreground",children:JSON.stringify(d.env)})]})]})]}),S.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Capabilities"}),e.jsx("ul",{className:"list-disc pl-5 text-sm text-muted-foreground space-y-1",children:S.map(p=>e.jsx("li",{children:p},p))})]}),i.documentation&&e.jsxs("div",{className:"space-y-3",children:[i.documentation.overview&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Overview"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.overview})]}),i.documentation.installation&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Installation"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.installation})]}),i.documentation.usage&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Usage"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.usage})]}),i.documentation.examples&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Examples"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.examples})]})]})]})})})})},onConfirm:async(h,i)=>{const d=K(h,i);await o({summary:h,detail:i,payload:d})}})}function Ae(){const[r,t]=f.useState({}),[o,h]=f.useState(!0),[i,d]=f.useState(!1),[a,v]=f.useState({name:"",command:"",args:"",env:"",description:"",enabled:!0}),[N,S]=f.useState(!1),[p,A]=f.useState(null),[c,b]=f.useState({name:"",command:"",args:"",env:"",description:"",enabled:!0}),[V,T]=f.useState(!1);f.useEffect(()=>{_()},[]);const _=async()=>{try{h(!0);const s=await B("/api/v1/mcp/raw-config");t(s||{})}catch(s){console.error("Failed to load MCP config:",s),C({title:"Error",description:"Failed to load MCP configuration",variant:"destructive"})}finally{h(!1)}},w=async s=>{try{d(!0),await B("/api/v1/mcp/raw-config",{method:"PUT",body:JSON.stringify(s)}),t(s),C({title:"Success",description:"MCP configuration saved successfully"})}catch(n){console.error("Failed to save MCP config:",n),C({title:"Error",description:"Failed to save MCP configuration",variant:"destructive"})}finally{d(!1)}},G=()=>{if(!a.name||!a.command){C({title:"Error",description:"Server name and command are required",variant:"destructive"});return}const s={name:a.name,command:a.command,enabled:a.enabled,description:a.description||void 0};if(a.args.trim()&&(s.args=a.args.split(" ").filter(x=>x.trim())),a.env.trim())try{s.env=JSON.parse(a.env)}catch{C({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const n={...r,mcpServers:{...r.mcpServers,[a.name]:s}};w(n),v({name:"",command:"",args:"",env:"",description:"",enabled:!0}),S(!1)},H=(s,n)=>{const x={...r,mcpServers:{...r.mcpServers,[s]:{...r.mcpServers[s],enabled:n}}};w(x)},W=s=>{const{[s]:n,...x}=r.mcpServers||{},y={...r,mcpServers:x};w(y)},X=s=>{const n=r.mcpServers?.[s];n&&(b({name:n.name||s,command:n.command,args:n.args?.join(" ")||"",env:n.env?JSON.stringify(n.env,null,2):"",description:n.description||"",enabled:n.enabled!==!1}),A(s))},Q=s=>{if(!c.command){C({title:"Error",description:"Command is required",variant:"destructive"});return}const n={name:c.name,command:c.command,enabled:c.enabled,description:c.description||void 0};if(c.args.trim()&&(n.args=c.args.split(" ").filter(l=>l.trim())),c.env.trim())try{n.env=JSON.parse(c.env)}catch{C({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const{[s]:x,...y}=r.mcpServers||{},u={...r,mcpServers:{...y,[s]:n}};w(u),A(null)},Z=()=>{A(null),b({name:"",command:"",args:"",env:"",description:"",enabled:!0})},k=s=>{const n={...r,globalSettings:{...r.globalSettings,...s}};w(n)},ee=async s=>{const{payload:n}=s;let x=n.name.toLowerCase().replace(/\s+/g,"-");const y=r.mcpServers||{};let u=x,l=1;for(;y[u];)u=`${x}-${l}`,l++;const se={name:u,command:n.command,args:n.args,env:n.env,enabled:n.enabled!==!1,description:n.description},re={...r,mcpServers:{...r.mcpServers,[u]:se}};await w(re),C({title:"Success",description:`MCP server "${u}" added from registry`})};if(o)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading configuration..."})]})});const D=r.mcpServers||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Model Context Protocol servers and settings."})]}),e.jsx(te,{}),Object.keys(D).length===0&&!N&&e.jsxs(q,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(z,{children:"No MCP servers configured yet. Add your first server to get started."})]}),e.jsxs(P,{children:[e.jsx(F,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-5 w-5"}),"MCP Servers"]}),e.jsx(R,{className:"hidden sm:block",children:"Configure and manage Model Context Protocol servers for enhanced AI capabilities."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{size:"sm",variant:"outline",onClick:()=>T(!0),children:[e.jsx(he,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsxs(j,{size:"sm",onClick:()=>S(!N),variant:N?"outline":"default",children:[e.jsx(Y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:N?"Cancel":"Add Server"})]})]})]})}),e.jsxs($,{children:[N&&e.jsxs("div",{className:"space-y-4 p-3 sm:p-4 border rounded-lg mb-4",children:[e.jsx("h4",{className:"font-medium",children:"Add MCP Server"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverName",children:"Server Name"}),e.jsx(g,{id:"serverName",value:a.name,onChange:s=>v({...a,name:s.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverCommand",children:"Command"}),e.jsx(g,{id:"serverCommand",value:a.command,onChange:s=>v({...a,command:s.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverArgs",children:"Arguments (space-separated)"}),e.jsx(g,{id:"serverArgs",value:a.args,onChange:s=>v({...a,args:s.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverEnv",children:"Environment Variables (JSON format)"}),e.jsx(M,{id:"serverEnv",value:a.env,onChange:s=>v({...a,env:s.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverDescription",children:"Description (optional)"}),e.jsx(g,{id:"serverDescription",value:a.description,onChange:s=>v({...a,description:s.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:"serverEnabled",checked:a.enabled,onCheckedChange:s=>v({...a,enabled:s})}),e.jsx(m,{htmlFor:"serverEnabled",children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs(j,{onClick:G,disabled:i,children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),"Add Server"]}),e.jsx(j,{variant:"outline",onClick:()=>S(!1),children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-4",children:Object.entries(D).map(([s,n])=>{const x=n.enabled!==!1,y=n.name||s,u=p===s;return e.jsx("div",{className:"border rounded-lg",children:u?e.jsxs("div",{className:"space-y-4 p-3 sm:p-4",children:[e.jsx("h4",{className:"font-medium",children:"Edit MCP Server"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-name-${s}`,children:"Server Name"}),e.jsx(g,{id:`edit-name-${s}`,value:c.name,onChange:l=>b({...c,name:l.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-command-${s}`,children:"Command"}),e.jsx(g,{id:`edit-command-${s}`,value:c.command,onChange:l=>b({...c,command:l.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-args-${s}`,children:"Arguments (space-separated)"}),e.jsx(g,{id:`edit-args-${s}`,value:c.args,onChange:l=>b({...c,args:l.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-env-${s}`,children:"Environment Variables (JSON format)"}),e.jsx(M,{id:`edit-env-${s}`,value:c.env,onChange:l=>b({...c,env:l.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-description-${s}`,children:"Description (optional)"}),e.jsx(g,{id:`edit-description-${s}`,value:c.description,onChange:l=>b({...c,description:l.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:`edit-enabled-${s}`,checked:c.enabled,onCheckedChange:l=>b({...c,enabled:l})}),e.jsx(m,{htmlFor:`edit-enabled-${s}`,children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(j,{onClick:()=>Q(s),disabled:i,children:"Save Changes"}),e.jsx(j,{variant:"outline",onClick:Z,children:"Cancel"})]})]}):e.jsx("div",{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[x?e.jsx(xe,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"}):e.jsx(L,{className:"h-4 w-4 text-gray-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:y}),e.jsx(J,{variant:x?"default":"secondary",className:"text-xs",children:x?"Enabled":"Disabled"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:n.description||n.command}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:[e.jsx("span",{className:"font-medium",children:"Command:"})," ",n.command," ",n.args?.join(" ")]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 shrink-0",children:[e.jsx(I,{checked:x,onCheckedChange:l=>H(s,l),disabled:i}),e.jsx(j,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>X(s),children:e.jsx(ae,{className:"h-4 w-4"})}),e.jsx(j,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>W(s),disabled:i,children:e.jsx(oe,{className:"h-4 w-4"})})]})]})})},s)})})]})]}),e.jsxs(P,{children:[e.jsxs(F,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"Configuration File"]}),e.jsxs(R,{children:["The MCP configuration is stored in ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:".nut/mcp/config.json"})]})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"configJson",children:"Current Configuration (JSON)"}),e.jsx(M,{id:"configJson",value:JSON.stringify(r,null,2),readOnly:!0,rows:12,className:"font-mono text-sm",placeholder:"Loading configuration..."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This is a read-only view of the current configuration. Use the forms above to make changes."})]}),e.jsxs(q,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(z,{children:"Configuration changes are automatically saved to the MCP config file. This file can also be edited manually if you prefer working with JSON directly."})]})]})]}),e.jsxs(P,{children:[e.jsxs(F,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5"}),"Global Settings"]}),e.jsx(R,{children:"Configure global MCP behavior and connection settings."})]}),e.jsx($,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"timeout",children:"Connection Timeout (ms)"}),e.jsx(g,{id:"timeout",type:"number",value:r.globalSettings?.timeout||3e4,onChange:s=>k({timeout:parseInt(s.target.value)}),placeholder:"30000"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"retryAttempts",children:"Retry Attempts"}),e.jsx(g,{id:"retryAttempts",type:"number",value:r.globalSettings?.retryAttempts||3,onChange:s=>k({retryAttempts:parseInt(s.target.value)}),placeholder:"3"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"logLevel",children:"Log Level"}),e.jsxs("select",{id:"logLevel",className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",value:r.globalSettings?.logLevel||"info",onChange:s=>k({logLevel:s.target.value}),children:[e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warning"}),e.jsx("option",{value:"error",children:"Error"})]})]})]})})]}),e.jsx("div",{className:"flex justify-end space-x-2",children:e.jsx(j,{variant:"outline",onClick:_,disabled:o,children:"Reload Configuration"})}),e.jsx(ge,{open:V,onOpenChange:T,onImport:ee})]})}export{Ae as default};
|
|
1
|
+
import{j as e,S as ne,Y as E,r as f,aX as B,t as C,a1 as te,aV as ie,B as j,I as g,a0 as M,J as ae,T as oe,g as ce,ad as le}from"./index-B8vejVRZ.js";import{C as P,b as F,c as O,d as R,a as $}from"./card-CvaBJsG6.js";import{L as m}from"./label-DtNTh--4.js";import{B as J}from"./badge-NJasrAx_.js";import{S as I}from"./switch-D86f4WeD.js";import{A as q,a as z}from"./alert-BAeRxZ1d.js";import{R as de,a as me,L as he}from"./browser-modal-x3ise3M1.js";import{C as L}from"./circle-alert-61156jM6.js";import{P as Y}from"./plus-Bon5P_OK.js";import{C as xe}from"./circle-check-big-K_QMED_K.js";import"./search-BR37JgJ3.js";function U(r){if(r){if(Array.isArray(r)){const t=r.map(o=>{if(typeof o=="string")return o.trim();if(typeof o=="number")return`${o}`}).filter(o=>typeof o=="string"&&o.length>0);return t.length>0?t:void 0}if(typeof r=="string"){const t=r.split(",").map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?t:void 0}}}function K(r,t){const o=r.name||t.name,h=t.description||r.description||"",i={registryId:r.id,registryEndpoint:r.endpoint,registrySource:de,author:r.author||t.author};(t.version||r.version)&&(i.version=t.version||r.version);const d=U(t.tags)||U(r.tags);d&&(i.tags=d),t.capabilities&&Array.isArray(t.capabilities)&&(i.capabilities=t.capabilities),t.requirements&&typeof t.requirements=="object"&&(i.requirements=t.requirements),t.links&&typeof t.links=="object"&&(i.links=t.links),t.metadata&&typeof t.metadata=="object"&&(i.mcpMetadata=t.metadata);for(const[a,v]of Object.entries(i))v==null&&delete i[a];return{name:o,command:t.configuration.command,args:t.configuration.args,env:t.configuration.env,enabled:!0,description:h,metadata:Object.keys(i).length>0?i:void 0}}async function ve(r){const t=r.startsWith("http")?r:`https://registry.coconut.dev${r}`,o=await fetch(t,{headers:{Accept:"application/json","User-Agent":"coconut-frontend"}});if(!o.ok)throw new Error(`Failed to fetch MCP server detail: ${o.status}`);return o.json()}function ge({open:r,onOpenChange:t,onImport:o}){return e.jsx(me,{open:r,onOpenChange:t,categoryId:"mcp-servers",title:"Coconut Registry – MCP Servers",confirmLabel:"Add Server",getDetail:h=>ve(h.endpoint),renderPreview:(h,i)=>{if(!i)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an MCP server to preview"});const d=K(h,i),a=d.metadata??{},v=typeof a.version=="string"?a.version:void 0,N=Array.isArray(h.tags)?h.tags:[],S=Array.isArray(a.capabilities)?a.capabilities.filter(p=>typeof p=="string"):[];return e.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border",children:e.jsx(ne,{className:"h-full",children:e.jsx("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:h.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.description})]}),v&&e.jsxs(J,{variant:"outline",children:["v",v]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Registry ID: ",e.jsx("span",{className:"font-mono",children:h.id})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:N.map(p=>e.jsx(J,{variant:"secondary",children:p},p))}),e.jsxs("div",{className:"space-y-2 rounded-md border p-3 bg-muted/50",children:[e.jsx("div",{className:"text-sm font-medium",children:"Configuration"}),e.jsxs("div",{className:"space-y-1 text-sm font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Command:"})," ",e.jsx("span",{className:"text-foreground",children:d.command})]}),d.args&&d.args.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Args:"})," ",e.jsx("span",{className:"text-foreground",children:d.args.join(" ")})]}),d.env&&Object.keys(d.env).length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Env:"})," ",e.jsx("span",{className:"text-foreground",children:JSON.stringify(d.env)})]})]})]}),S.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Capabilities"}),e.jsx("ul",{className:"list-disc pl-5 text-sm text-muted-foreground space-y-1",children:S.map(p=>e.jsx("li",{children:p},p))})]}),i.documentation&&e.jsxs("div",{className:"space-y-3",children:[i.documentation.overview&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Overview"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.overview})]}),i.documentation.installation&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Installation"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.installation})]}),i.documentation.usage&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Usage"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.usage})]}),i.documentation.examples&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Examples"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.examples})]})]})]})})})})},onConfirm:async(h,i)=>{const d=K(h,i);await o({summary:h,detail:i,payload:d})}})}function Ae(){const[r,t]=f.useState({}),[o,h]=f.useState(!0),[i,d]=f.useState(!1),[a,v]=f.useState({name:"",command:"",args:"",env:"",description:"",enabled:!0}),[N,S]=f.useState(!1),[p,A]=f.useState(null),[c,b]=f.useState({name:"",command:"",args:"",env:"",description:"",enabled:!0}),[V,T]=f.useState(!1);f.useEffect(()=>{_()},[]);const _=async()=>{try{h(!0);const s=await B("/api/v1/mcp/raw-config");t(s||{})}catch(s){console.error("Failed to load MCP config:",s),C({title:"Error",description:"Failed to load MCP configuration",variant:"destructive"})}finally{h(!1)}},w=async s=>{try{d(!0),await B("/api/v1/mcp/raw-config",{method:"PUT",body:JSON.stringify(s)}),t(s),C({title:"Success",description:"MCP configuration saved successfully"})}catch(n){console.error("Failed to save MCP config:",n),C({title:"Error",description:"Failed to save MCP configuration",variant:"destructive"})}finally{d(!1)}},G=()=>{if(!a.name||!a.command){C({title:"Error",description:"Server name and command are required",variant:"destructive"});return}const s={name:a.name,command:a.command,enabled:a.enabled,description:a.description||void 0};if(a.args.trim()&&(s.args=a.args.split(" ").filter(x=>x.trim())),a.env.trim())try{s.env=JSON.parse(a.env)}catch{C({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const n={...r,mcpServers:{...r.mcpServers,[a.name]:s}};w(n),v({name:"",command:"",args:"",env:"",description:"",enabled:!0}),S(!1)},H=(s,n)=>{const x={...r,mcpServers:{...r.mcpServers,[s]:{...r.mcpServers[s],enabled:n}}};w(x)},W=s=>{const{[s]:n,...x}=r.mcpServers||{},y={...r,mcpServers:x};w(y)},X=s=>{const n=r.mcpServers?.[s];n&&(b({name:n.name||s,command:n.command,args:n.args?.join(" ")||"",env:n.env?JSON.stringify(n.env,null,2):"",description:n.description||"",enabled:n.enabled!==!1}),A(s))},Q=s=>{if(!c.command){C({title:"Error",description:"Command is required",variant:"destructive"});return}const n={name:c.name,command:c.command,enabled:c.enabled,description:c.description||void 0};if(c.args.trim()&&(n.args=c.args.split(" ").filter(l=>l.trim())),c.env.trim())try{n.env=JSON.parse(c.env)}catch{C({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const{[s]:x,...y}=r.mcpServers||{},u={...r,mcpServers:{...y,[s]:n}};w(u),A(null)},Z=()=>{A(null),b({name:"",command:"",args:"",env:"",description:"",enabled:!0})},k=s=>{const n={...r,globalSettings:{...r.globalSettings,...s}};w(n)},ee=async s=>{const{payload:n}=s;let x=n.name.toLowerCase().replace(/\s+/g,"-");const y=r.mcpServers||{};let u=x,l=1;for(;y[u];)u=`${x}-${l}`,l++;const se={name:u,command:n.command,args:n.args,env:n.env,enabled:n.enabled!==!1,description:n.description},re={...r,mcpServers:{...r.mcpServers,[u]:se}};await w(re),C({title:"Success",description:`MCP server "${u}" added from registry`})};if(o)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading configuration..."})]})});const D=r.mcpServers||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Model Context Protocol servers and settings."})]}),e.jsx(te,{}),Object.keys(D).length===0&&!N&&e.jsxs(q,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(z,{children:"No MCP servers configured yet. Add your first server to get started."})]}),e.jsxs(P,{children:[e.jsx(F,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-5 w-5"}),"MCP Servers"]}),e.jsx(R,{className:"hidden sm:block",children:"Configure and manage Model Context Protocol servers for enhanced AI capabilities."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{size:"sm",variant:"outline",onClick:()=>T(!0),children:[e.jsx(he,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsxs(j,{size:"sm",onClick:()=>S(!N),variant:N?"outline":"default",children:[e.jsx(Y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:N?"Cancel":"Add Server"})]})]})]})}),e.jsxs($,{children:[N&&e.jsxs("div",{className:"space-y-4 p-3 sm:p-4 border rounded-lg mb-4",children:[e.jsx("h4",{className:"font-medium",children:"Add MCP Server"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverName",children:"Server Name"}),e.jsx(g,{id:"serverName",value:a.name,onChange:s=>v({...a,name:s.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverCommand",children:"Command"}),e.jsx(g,{id:"serverCommand",value:a.command,onChange:s=>v({...a,command:s.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverArgs",children:"Arguments (space-separated)"}),e.jsx(g,{id:"serverArgs",value:a.args,onChange:s=>v({...a,args:s.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverEnv",children:"Environment Variables (JSON format)"}),e.jsx(M,{id:"serverEnv",value:a.env,onChange:s=>v({...a,env:s.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverDescription",children:"Description (optional)"}),e.jsx(g,{id:"serverDescription",value:a.description,onChange:s=>v({...a,description:s.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:"serverEnabled",checked:a.enabled,onCheckedChange:s=>v({...a,enabled:s})}),e.jsx(m,{htmlFor:"serverEnabled",children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs(j,{onClick:G,disabled:i,children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),"Add Server"]}),e.jsx(j,{variant:"outline",onClick:()=>S(!1),children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-4",children:Object.entries(D).map(([s,n])=>{const x=n.enabled!==!1,y=n.name||s,u=p===s;return e.jsx("div",{className:"border rounded-lg",children:u?e.jsxs("div",{className:"space-y-4 p-3 sm:p-4",children:[e.jsx("h4",{className:"font-medium",children:"Edit MCP Server"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-name-${s}`,children:"Server Name"}),e.jsx(g,{id:`edit-name-${s}`,value:c.name,onChange:l=>b({...c,name:l.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-command-${s}`,children:"Command"}),e.jsx(g,{id:`edit-command-${s}`,value:c.command,onChange:l=>b({...c,command:l.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-args-${s}`,children:"Arguments (space-separated)"}),e.jsx(g,{id:`edit-args-${s}`,value:c.args,onChange:l=>b({...c,args:l.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-env-${s}`,children:"Environment Variables (JSON format)"}),e.jsx(M,{id:`edit-env-${s}`,value:c.env,onChange:l=>b({...c,env:l.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-description-${s}`,children:"Description (optional)"}),e.jsx(g,{id:`edit-description-${s}`,value:c.description,onChange:l=>b({...c,description:l.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:`edit-enabled-${s}`,checked:c.enabled,onCheckedChange:l=>b({...c,enabled:l})}),e.jsx(m,{htmlFor:`edit-enabled-${s}`,children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(j,{onClick:()=>Q(s),disabled:i,children:"Save Changes"}),e.jsx(j,{variant:"outline",onClick:Z,children:"Cancel"})]})]}):e.jsx("div",{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[x?e.jsx(xe,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"}):e.jsx(L,{className:"h-4 w-4 text-gray-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:y}),e.jsx(J,{variant:x?"default":"secondary",className:"text-xs",children:x?"Enabled":"Disabled"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:n.description||n.command}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:[e.jsx("span",{className:"font-medium",children:"Command:"})," ",n.command," ",n.args?.join(" ")]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 shrink-0",children:[e.jsx(I,{checked:x,onCheckedChange:l=>H(s,l),disabled:i}),e.jsx(j,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>X(s),children:e.jsx(ae,{className:"h-4 w-4"})}),e.jsx(j,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>W(s),disabled:i,children:e.jsx(oe,{className:"h-4 w-4"})})]})]})})},s)})})]})]}),e.jsxs(P,{children:[e.jsxs(F,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"Configuration File"]}),e.jsxs(R,{children:["The MCP configuration is stored in ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:".nut/mcp/config.json"})]})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"configJson",children:"Current Configuration (JSON)"}),e.jsx(M,{id:"configJson",value:JSON.stringify(r,null,2),readOnly:!0,rows:12,className:"font-mono text-sm",placeholder:"Loading configuration..."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This is a read-only view of the current configuration. Use the forms above to make changes."})]}),e.jsxs(q,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(z,{children:"Configuration changes are automatically saved to the MCP config file. This file can also be edited manually if you prefer working with JSON directly."})]})]})]}),e.jsxs(P,{children:[e.jsxs(F,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5"}),"Global Settings"]}),e.jsx(R,{children:"Configure global MCP behavior and connection settings."})]}),e.jsx($,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"timeout",children:"Connection Timeout (ms)"}),e.jsx(g,{id:"timeout",type:"number",value:r.globalSettings?.timeout||3e4,onChange:s=>k({timeout:parseInt(s.target.value)}),placeholder:"30000"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"retryAttempts",children:"Retry Attempts"}),e.jsx(g,{id:"retryAttempts",type:"number",value:r.globalSettings?.retryAttempts||3,onChange:s=>k({retryAttempts:parseInt(s.target.value)}),placeholder:"3"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"logLevel",children:"Log Level"}),e.jsxs("select",{id:"logLevel",className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",value:r.globalSettings?.logLevel||"info",onChange:s=>k({logLevel:s.target.value}),children:[e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warning"}),e.jsx("option",{value:"error",children:"Error"})]})]})]})})]}),e.jsx("div",{className:"flex justify-end space-x-2",children:e.jsx(j,{variant:"outline",onClick:_,disabled:o,children:"Reload Configuration"})}),e.jsx(ge,{open:V,onOpenChange:T,onImport:ee})]})}export{Ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as _,H as z,r as a,j as e,B as b,L as k,i as J,I as A,a0 as W,ac as Y,A as P}from"./index-
|
|
1
|
+
import{u as _,H as z,r as a,j as e,B as b,L as k,i as J,I as A,a0 as W,ac as Y,A as P}from"./index-B8vejVRZ.js";import{C as G,b as K,c as Q,a as V}from"./card-CvaBJsG6.js";import{L as d}from"./label-DtNTh--4.js";import{B as X}from"./badge-NJasrAx_.js";import{c as Z}from"./clipboard-B9ndUJKl.js";import{A as O}from"./arrow-left-DSqUNUH-.js";import{C as ee,a as te}from"./clipboard-BNXOfcye.js";function le(){const M=_(),{toast:p}=z(),[o,j]=a.useState(!1),[v,l]=a.useState(null),[m,E]=a.useState(""),[u,L]=a.useState(""),[c,T]=a.useState("blue"),[g,C]=a.useState([]),[h,F]=a.useState(""),[y,x]=a.useState([]),[B,N]=a.useState(!0),[I,w]=a.useState(!1),D=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],$={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"}};a.useEffect(()=>{let t=!0;return(async()=>{N(!0);try{const n=await fetch(`${P}/api/v1/mcp`);if(!n.ok)throw new Error("Failed to fetch MCP servers");const r=await n.json();if(!r?.success||!Array.isArray(r.servers)){t&&x([]);return}const R=r.mcpServers&&typeof r.mcpServers=="object"?r.mcpServers:{},S=r.servers.map(f=>{const i=R[f]??{};return{name:f,enabled:i?.enabled!==!1,description:typeof i?.description=="string"?i.description:void 0}});t&&(x(S),C(f=>f.filter(i=>S.some(U=>U.name===i))))}catch(n){console.error("Failed to load MCP servers",n),t&&x([])}finally{t&&N(!1)}})(),()=>{t=!1}},[]);const q=async()=>{const t=".nut/config.json";try{await Z(t),w(!0),p({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>w(!1),2e3)}catch(s){console.error("Failed to copy config path:",s),p({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},H=async t=>{if(t.preventDefault(),!m.trim()||!u.trim()||!h.trim()){l("Name, description, and agent instructions are required");return}try{j(!0),l(null);const s={name:m.trim(),description:u.trim(),content:h.trim(),metadata:{color:c,tools:g.length>0?g:void 0}},r=await(await fetch(`${P}/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();r.success?M("/agents"):l(r.error?.message||"Failed to create agent")}catch(s){l(s instanceof Error?s.message:"Unknown error")}finally{j(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Create New Agent"}),e.jsx("p",{className:"text-muted-foreground",children:"Define an AI agent for automated development workflows"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(b,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(k,{to:"/agents",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(O,{className:"h-4 w-4"})})})})]}),e.jsxs(G,{children:[e.jsx(K,{children:e.jsxs(Q,{className:"flex items-center gap-2",children:[e.jsx(J,{className:"h-5 w-5"}),"Agent Configuration"]})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:H,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(d,{htmlFor:"name",children:"Name *"}),e.jsx(A,{id:"name",placeholder:"e.g., code-reviewer",value:m,onChange:t=>E(t.target.value),disabled:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"description",children:"Description *"}),e.jsx(A,{id:"description",placeholder:"When should this agent be invoked?",value:u,onChange:t=>L(t.target.value),disabled:o})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(t=>{const s=$[t];return e.jsx("button",{type:"button",onClick:()=>T(t),disabled:o,className:`w-10 h-10 rounded-md border-2 transition-all ${c===t?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:s.bg,borderColor:c===t?s.border:"hsl(var(--border))",...c===t&&{"--tw-ring-color":s.border}},title:t,children:e.jsx("span",{className:"sr-only",children:t})},t)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{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:q,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:I?e.jsx(ee,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(te,{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(W,{id:"content",placeholder:"You are a code review agent that focuses on...",value:h,onChange:t=>F(t.target.value),rows:8,disabled:o,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{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:B?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers…"}):y.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."}):y.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(Y,{checked:g.includes(t.name),onCheckedChange:s=>{C(n=>s===!0?n.includes(t.name)?n:[...n,t.name]:n.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(X,{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))})]}),v&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:v}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(b,{type:"button",variant:"outline",asChild:!0,disabled:o,children:e.jsx(k,{to:"/agents",children:"Cancel"})}),e.jsx(b,{type:"submit",disabled:o,children:o?"Creating...":"Create Agent"})]})]})})]})]})}export{le as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as S,H as E,r as a,j as e,B as p,n as L,a2 as T,L as b,I as A,A as I}from"./index-
|
|
1
|
+
import{u as S,H as E,r as a,j as e,B as p,n as L,a2 as T,L as b,I as A,A as I}from"./index-B8vejVRZ.js";import{C as i,b as c,c as l,a as d}from"./card-CvaBJsG6.js";import{L as m}from"./label-DtNTh--4.js";import{M as B}from"./markdown-editor-DvlGlqU9.js";import{T as g}from"./TagInput-Cdfvhozb.js";import{A as P}from"./arrow-left-DSqUNUH-.js";import"./badge-NJasrAx_.js";function O(){const f=S(),{toast:s}=E(),[u,x]=a.useState(!1),[r,v]=a.useState(""),[n,w]=a.useState(""),[h,C]=a.useState([]),[j,k]=a.useState([]),N=async()=>{if(!r.trim()){s({title:"Error",description:"Please provide a title for the knowledge document",variant:"destructive"});return}if(!n.trim()){s({title:"Error",description:"Please provide content for the knowledge document",variant:"destructive"});return}x(!0);try{const o=await(await fetch(`${I}/api/v1/context/knowledge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:r.trim(),content:n.trim(),metadata:{tags:h,sources:j}})})).json();if(o.success){s({title:"Success",description:"Knowledge document created successfully"});const y=o.document.filename.replace(".md","");f(`/context/knowledge/${y}`)}else s({title:"Error",description:o.error||"Failed to create knowledge document",variant:"destructive"})}catch(t){console.error("Error creating document:",t),s({title:"Error",description:"Failed to create knowledge document",variant:"destructive"})}finally{x(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-3xl font-bold",children:"Create Knowledge Document"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(p,{onClick:N,disabled:u||!r.trim()||!n.trim(),size:"sm",children:[u?e.jsx(L,{className:"w-4 h-4 animate-spin"}):e.jsx(T,{className:"w-4 h-4"}),"Create Document"]}),e.jsx(p,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(b,{to:"/context/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(P,{className:"h-4 w-4"})})})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Basic Information"})}),e.jsx(d,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(m,{htmlFor:"title",children:"Title *"}),e.jsx(A,{id:"title",value:r,onChange:t=>v(t.target.value),placeholder:"Enter document title...",className:"text-lg"})]})})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Metadata"})}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{children:"Tags"}),e.jsx(g,{tags:h,onChange:C,placeholder:"Add a tag"})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Sources"}),e.jsx(g,{tags:j,onChange:k,placeholder:"Add a source (URL or name)"})]})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Content *"})}),e.jsx(d,{children:e.jsx(B,{value:n,onChange:t=>w(t||""),placeholder:`Enter your knowledge content in Markdown...
|
|
2
2
|
|
|
3
3
|
You can use:
|
|
4
4
|
- **Bold text**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Q,H as G,m as Y,r as n,A as E,j as e,B as j,L as F,v as P,w as k,x as L,y as I,z as r,I as y,a2 as J,M as X,O as Z,P as ee,Q as te,R as se,U as ae,V as ie,W as ne}from"./index-
|
|
1
|
+
import{u as Q,H as G,m as Y,r as n,A as E,j as e,B as j,L as F,v as P,w as k,x as L,y as I,z as r,I as y,a2 as J,M as X,O as Z,P as ee,Q as te,R as se,U as ae,V as ie,W as ne}from"./index-B8vejVRZ.js";import{C as re,b as oe,c as le,a as ce}from"./card-CvaBJsG6.js";import{L as h}from"./label-DtNTh--4.js";import{M as de}from"./markdown-editor-DvlGlqU9.js";import{C as he}from"./CollapsibleSection-DaqBpCe-.js";import{I as ue,L as me}from"./ImplementationStepsEditor-CuDeossU.js";import{T as pe}from"./TagInput-Cdfvhozb.js";import{A as ge}from"./arrow-left-DSqUNUH-.js";import"./plus-Bon5P_OK.js";import"./badge-NJasrAx_.js";const v={feature:{name:"New Feature",content:`## Problem Statement
|
|
2
2
|
Describe the problem this new feature addresses.
|
|
3
3
|
|
|
4
4
|
## Proposed Solution
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as L,H as I,r as i,A as S,j as e,B as C,L as M,a2 as A,I as p,v as B,w as D,x as T,y as O,z as j}from"./index-
|
|
1
|
+
import{u as L,H as I,r as i,A as S,j as e,B as C,L as M,a2 as A,I as p,v as B,w as D,x as T,y as O,z as j}from"./index-B8vejVRZ.js";import{C as m,a as x,b,c as P}from"./card-CvaBJsG6.js";import{L as l}from"./label-DtNTh--4.js";import{M as V}from"./markdown-editor-DvlGlqU9.js";import{A as W}from"./arrow-left-DSqUNUH-.js";import{C as z}from"./circle-check-big-K_QMED_K.js";function K(){const E=L(),{toast:d}=I(),[a,v]=i.useState({project:{name:"",description:"",website:"",version:"1.0.0",stage:"development"}}),[u,g]=i.useState(""),[F,f]=i.useState(!0),[y,w]=i.useState(!1);i.useEffect(()=>{fetch(`${S}/api/v1/context/project`).then(t=>t.json()).then(t=>{if(t.success){const s=t.document;v({project:{name:s.metadata.project?.name||"",description:s.metadata.project?.description||"",website:s.metadata.project?.website||s.metadata.project?.repository||"",version:s.metadata.project?.version||"1.0.0",stage:s.metadata.project?.stage||"development"}}),g(s.content.trim())}f(!1)}).catch(t=>{console.error("Failed to load context:",t),d({title:"Error",description:"Failed to load project context",variant:"destructive"}),f(!1)})},[d]);const k=async()=>{w(!0);try{const s={project:Object.fromEntries(Object.entries(a.project).map(([o,r])=>[o,typeof r=="string"?r.trim():r]))},n=await(await fetch(`${S}/api/v1/context/project`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u,metadata:s})})).json();if(n.success)d({title:"Success",description:"Project context saved successfully",action:e.jsx(z,{className:"h-4 w-4"})}),E("/context/project");else throw new Error(n.error||"Failed to save context")}catch(t){console.error("Save error:",t),d({title:"Error",description:"Failed to save project context",variant:"destructive"})}finally{w(!1)}},c=(t,s)=>{v(N=>{const n={...N},o=t.split(".");let r=n;for(let h=0;h<o.length-1;h++)r=r[o[h]];return r[o[o.length-1]]=s,n})};return F?e.jsx("div",{className:"space-y-6",children:e.jsx(m,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Edit project information and documentation"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(M,{to:"/context/project",children:[e.jsx(W,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Back"})]})}),e.jsxs(C,{size:"sm",onClick:k,disabled:y,children:[e.jsx(A,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Saving...":"Save"})]})]})]}),e.jsxs(m,{children:[e.jsx(b,{children:e.jsx(P,{children:"Project Information"})}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-name",children:"Project Name"}),e.jsx(p,{id:"project-name",value:a.project.name,onChange:t=>c("project.name",t.target.value),placeholder:"My Awesome Project"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-version",children:"Version"}),e.jsx(p,{id:"project-version",value:a.project.version,onChange:t=>c("project.version",t.target.value),placeholder:"1.0.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-description",children:"Description"}),e.jsx(p,{id:"project-description",value:a.project.description,onChange:t=>c("project.description",t.target.value),placeholder:"Brief description of what this project does"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-website",children:"Website"}),e.jsx(p,{id:"project-website",value:a.project.website,onChange:t=>c("project.website",t.target.value),placeholder:"https://yourproject.com"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-stage",children:"Development Stage"}),e.jsxs(B,{value:a.project.stage,onValueChange:t=>c("project.stage",t),children:[e.jsx(D,{children:e.jsx(T,{placeholder:"Select stage"})}),e.jsxs(O,{children:[e.jsx(j,{value:"prototype",children:"Prototype"}),e.jsx(j,{value:"development",children:"Development"}),e.jsx(j,{value:"mvp",children:"MVP"}),e.jsx(j,{value:"production",children:"Production"})]})]})]})]})]})]}),e.jsxs(m,{children:[e.jsx(b,{children:e.jsx(P,{children:"Documentation"})}),e.jsx(x,{children:e.jsx(V,{value:u,onChange:t=>g(t||""),placeholder:`Write your project documentation in markdown...
|
|
2
2
|
|
|
3
3
|
## What is this project?
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as w,r,A as y,j as e,n as C,g as b,B as n,ap as P,ao as k,L as E,J as L,aq as z,al as B}from"./index-
|
|
1
|
+
import{H as w,r,A as y,j as e,n as C,g as b,B as n,ap as P,ao as k,L as E,J as L,aq as z,al as B}from"./index-B8vejVRZ.js";import{C as c,a as i,b as p,c as D}from"./card-CvaBJsG6.js";import{B as x}from"./badge-NJasrAx_.js";import{c as F}from"./clipboard-B9ndUJKl.js";function A(){const{toast:d}=w(),[o,h]=r.useState(null),[j,u]=r.useState(!0),[f,l]=r.useState(!1);r.useEffect(()=>{fetch(`${y}/api/v1/context/project`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(h(s.document),l(!0)):l(!1)}).catch(()=>{l(!1)}).finally(()=>{u(!1)})},[]);const v=async()=>{const s=".nut/context/project.md";try{await F(s),d({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(m){console.error("Failed to copy path:",m),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},N=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"project-md",filename:"project.md",name:"project.md",path:".nut/context/project.md"}});window.dispatchEvent(s)};if(j)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading Project Overview..."})]})})})});if(!f||!o)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(b,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Project Overview Found"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Run ",e.jsx("code",{className:"bg-muted px-2 py-1 rounded",children:"coconut init"})," to create the project overview."]})]})})})});const t=o.metadata,a=t.project?.website||t.project?.repository,g=a?(s=>{try{return new URL(s.startsWith("http")?s:`https://${s}`).host.replace(/^www\./,"")}catch{return s.replace(/^https?:\/\//,"")}})(a):null;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Core project information and configuration"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(P,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(n,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(k,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(n,{size:"sm",asChild:!0,children:e.jsxs(E,{to:"/context/project/edit",children:[e.jsx(L,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),t&&e.jsx("div",{className:"grid grid-cols-1 gap-4",children:e.jsxs(c,{children:[e.jsx(p,{className:"pb-3",children:e.jsx(D,{className:"text-lg font-semibold",children:"Project Info"})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.project?.name||"Unnamed Project"}),t.project?.description&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t.project.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(z,{className:"w-3 h-3 mr-2"}),g||"Website"]})}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[t.project?.version&&e.jsxs(x,{variant:"secondary",children:["v",t.project.version]}),t.project?.stage&&e.jsx(x,{variant:t.project.stage==="mvp"?"default":"secondary",children:t.project.stage})]})]})]})]})}),e.jsxs(c,{children:[e.jsx(p,{}),e.jsx(i,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(B,{children:o.content||"No content available"})})})]})]})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a1 as p,B as r,J as h,ai as j,T as u,I as l,v as g,w as f,x as v,y as N,z as y}from"./index-
|
|
1
|
+
import{j as e,a1 as p,B as r,J as h,ai as j,T as u,I as l,v as g,w as f,x as v,y as N,z as y}from"./index-B8vejVRZ.js";import{C as t,b as i,c as n,d as c,a as d}from"./card-CvaBJsG6.js";import{L as a}from"./label-DtNTh--4.js";import{B as o}from"./badge-NJasrAx_.js";import{P as w}from"./plus-Bon5P_OK.js";import{E as b}from"./eye-CuSCp49Y.js";import{D as C}from"./download-BaYIFjpj.js";function E(){const m=[{id:"1",name:"Code Review Assistant",description:"Prompt for AI agents to perform thorough code reviews",category:"Code Review",usage:"cursor-cli, claude-code",lastUpdated:"2 days ago",active:!0},{id:"2",name:"Architecture Advisor",description:"System prompt for architectural decision guidance",category:"Architecture",usage:"gemini-cli, claude-code",lastUpdated:"1 week ago",active:!0},{id:"3",name:"Bug Analysis Expert",description:"Specialized prompt for debugging and error analysis",category:"Debugging",usage:"cursor-cli",lastUpdated:"3 days ago",active:!1},{id:"4",name:"Documentation Generator",description:"Prompt for generating comprehensive code documentation",category:"Documentation",usage:"github-copilot, claude-code",lastUpdated:"5 days ago",active:!0}],x=["Code Review","Architecture","Debugging","Documentation","Testing","Refactoring","Security","Performance"];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"System Prompts"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage system prompts used by AI agents and integrations for consistent behavior."})]}),e.jsx(p,{}),e.jsxs(t,{children:[e.jsx(i,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Prompt Library"}),e.jsx(c,{children:"Pre-configured prompts for different AI agents and use cases."})]}),e.jsxs(r,{size:"sm",children:[e.jsx(w,{className:"h-4 w-4 mr-2"}),"New Prompt"]})]})}),e.jsx(d,{children:e.jsx("div",{className:"space-y-4",children:m.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[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}),e.jsx(o,{variant:s.active?"default":"secondary",children:s.active?"Active":"Inactive"}),e.jsx(o,{variant:"outline",children:s.category})]}),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:["Used by: ",s.usage]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Updated: ",s.lastUpdated]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(h,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(j,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(u,{className:"h-4 w-4"})})]})]},s.id))})})]}),e.jsxs(t,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Create New Prompt"}),e.jsx(c,{children:"Design a new system prompt for your AI agents and integrations."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptName",children:"Prompt Name"}),e.jsx(l,{id:"promptName",placeholder:"Enter prompt name"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptCategory",children:"Category"}),e.jsxs(g,{children:[e.jsx(f,{children:e.jsx(v,{placeholder:"Select category"})}),e.jsx(N,{children:x.map(s=>e.jsx(y,{value:s.toLowerCase(),children:s},s))})]})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptDescription",children:"Description"}),e.jsx(l,{id:"promptDescription",placeholder:"Brief description of the prompt's purpose"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"targetIntegrations",children:"Target Integrations"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:["cursor-cli","claude-code","gemini-cli","github-copilot"].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:"promptContent",children:"Prompt Content"}),e.jsx("textarea",{id:"promptContent",className:"w-full min-h-[200px] p-3 border rounded-md font-mono text-sm",placeholder:"You are an expert code reviewer. Your task is to..."})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptVariables",children:"Variables (JSON format)"}),e.jsx("textarea",{id:"promptVariables",className:"w-full min-h-[100px] p-3 border rounded-md font-mono text-sm",placeholder:'{"language": "typescript", "framework": "react", "style": "functional"}'})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(r,{variant:"outline",children:"Preview"}),e.jsx(r,{variant:"outline",children:"Save as Draft"}),e.jsx(r,{children:"Save & Activate"})]})]})]}),e.jsxs(t,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Prompt Templates"}),e.jsx(c,{children:"Import and export prompt templates for sharing across teams."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(r,{variant:"outline",size:"sm",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Import Template"]}),e.jsx(r,{variant:"outline",size:"sm",children:"Export All Prompts"}),e.jsx(r,{variant:"outline",size:"sm",children:"Export Selected"})]}),e.jsx("div",{className:"p-4 border-2 border-dashed rounded-lg text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag and drop prompt template files here, or click to browse"})})]})]})]})}export{E as default};
|