titan-agent 6.4.0 → 6.4.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/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/package.json +10 -2
- package/ui/dist/assets/AuditPanel-BOIeotPE.js +1 -0
- package/ui/dist/assets/{AutonomyPanel-E6arcbAb.js → AutonomyPanel-Dv8ClpL9.js} +1 -1
- package/ui/dist/assets/{AutopilotPanel-AhNEPP_2.js → AutopilotPanel-Dv3-_6fZ.js} +1 -1
- package/ui/dist/assets/AutoresearchPanel-DdLmfGpC.js +6 -0
- package/ui/dist/assets/{BackupPanel-CGQAxeWf.js → BackupPanel-DYr6APwV.js} +1 -1
- package/ui/dist/assets/{BrowserPanel-BylOyNpQ.js → BrowserPanel-DMZf6mNn.js} +2 -2
- package/ui/dist/assets/{CPActivity-7zS0dXGf.js → CPActivity-B2kmaYR9.js} +1 -1
- package/ui/dist/assets/{CPAgentDetail-DUi0ygHI.js → CPAgentDetail--ploJZFv.js} +1 -1
- package/ui/dist/assets/{CPAgents-BZYynbga.js → CPAgents-ctC99jCR.js} +1 -1
- package/ui/dist/assets/{CPApprovals-CwNTmqzq.js → CPApprovals-BZHaJ6d_.js} +1 -1
- package/ui/dist/assets/{CPCosts-5hylxGvH.js → CPCosts--xJmtfEi.js} +1 -1
- package/ui/dist/assets/{CPDashboard-5f8qcBKy.js → CPDashboard-rThYnRLi.js} +1 -1
- package/ui/dist/assets/CPFiles-IRzbOaxo.js +1 -0
- package/ui/dist/assets/{CPGoals-CVSxXk1i.js → CPGoals-BQ4Kasli.js} +1 -1
- package/ui/dist/assets/{CPInbox-DD4RYSpf.js → CPInbox-DYvoAJdg.js} +1 -1
- package/ui/dist/assets/{CPIssueDetail-Dpuc_wTi.js → CPIssueDetail-D4JUVm7B.js} +1 -1
- package/ui/dist/assets/{CPIssues-DsPZLTGm.js → CPIssues-C_K0zuiB.js} +1 -1
- package/ui/dist/assets/CPLayout-B3Lr8puc.js +2 -0
- package/ui/dist/assets/{CPOrg-C121ZFWy.js → CPOrg-CAKwV8Kr.js} +1 -1
- package/ui/dist/assets/{CPRuns-BUdKn-uk.js → CPRuns-COUYpSBB.js} +1 -1
- package/ui/dist/assets/{CPSocial-CriG1P45.js → CPSocial-BCTgcO3V.js} +1 -1
- package/ui/dist/assets/{CPVoice-BNhgXUE1.js → CPVoice-D-wxXUGf.js} +1 -1
- package/ui/dist/assets/{ChannelsPanel-9SjAkSHg.js → ChannelsPanel-Cx3dxaP9.js} +1 -1
- package/ui/dist/assets/{CheckpointsPanel-D2sCPz2u.js → CheckpointsPanel-D2ATiPXs.js} +1 -1
- package/ui/dist/assets/{CommandPostHub-DHTVn2_E.js → CommandPostHub-DTs1EGm8.js} +4 -4
- package/ui/dist/assets/{CronPanel-CLQ0_Z_9.js → CronPanel-D0j9zDVW.js} +1 -1
- package/ui/dist/assets/{DataTable-CrBYCT2O.js → DataTable-CgeOprjv.js} +1 -1
- package/ui/dist/assets/{DreamPanel-BAkiDqQc.js → DreamPanel-CJAI6Aka.js} +3 -3
- package/ui/dist/assets/{EmptyState-DSuZC-Tg.js → EmptyState-NMpt-ODJ.js} +1 -1
- package/ui/dist/assets/{EvalHarnessPanel-BykaelQd.js → EvalHarnessPanel-ZPXlKHaK.js} +2 -2
- package/ui/dist/assets/{EvalPanel-BlFByCOv.js → EvalPanel-DpmEQQXh.js} +1 -1
- package/ui/dist/assets/{FileViewer-B0WedL9k.js → FileViewer-B7Mm4cJL.js} +1 -1
- package/ui/dist/assets/{FilesPanel-DwUzP4Hv.js → FilesPanel-CvrGQwh3.js} +2 -2
- package/ui/dist/assets/{FleetPanel-JW9Pk1FM.js → FleetPanel-BDf9E7dQ.js} +1 -1
- package/ui/dist/assets/{HomelabPanel-DigWCjaM.js → HomelabPanel-CKGR1kGN.js} +1 -1
- package/ui/dist/assets/InfraView-CreCQSNl.js +2 -0
- package/ui/dist/assets/{InlineEditableField-Car7F635.js → InlineEditableField-JxqorUFO.js} +1 -1
- package/ui/dist/assets/{Input-BGGQDAyP.js → Input-rfmX8eLw.js} +1 -1
- package/ui/dist/assets/IntegrationsPanel-Ds5KCGUi.js +1 -0
- package/ui/dist/assets/IntelligenceView-YcrYQTVO.js +2 -0
- package/ui/dist/assets/{LearningPanel-CGENRFnq.js → LearningPanel-CZUd4UsW.js} +1 -1
- package/ui/dist/assets/LogsPanel-CmUBA-jG.js +1 -0
- package/ui/dist/assets/McpPanel-CVyjQ6H6.js +1 -0
- package/ui/dist/assets/{MemoryGraphPanel-FQxiv5x5.js → MemoryGraphPanel-BK-AbsbF.js} +1 -1
- package/ui/dist/assets/{MemoryWikiPanel-C1w7xDNl.js → MemoryWikiPanel-DkfHLaje.js} +1 -1
- package/ui/dist/assets/MeshPanel-BCDzhBRO.js +11 -0
- package/ui/dist/assets/{MissionCanvas-BvbSfN_4.js → MissionCanvas-GvSYEkjz.js} +1 -1
- package/ui/dist/assets/{MissionChat-Do8j0nvp.js → MissionChat-DpyGbBhk.js} +1 -1
- package/ui/dist/assets/{MissionLibrary-CTzkJFJ7.js → MissionLibrary-Dwn2vP2g.js} +1 -1
- package/ui/dist/assets/{MissionStart-_-qlVcRK.js → MissionStart-DIYEotqX.js} +1 -1
- package/ui/dist/assets/{Modal-CNnSfYJm.js → Modal-BFii_RIq.js} +1 -1
- package/ui/dist/assets/NvidiaPanel-BCmLv4bY.js +1 -0
- package/ui/dist/assets/{OrganismPanel-DBy9J7Vl.js → OrganismPanel-CDMC8-yf.js} +1 -1
- package/ui/dist/assets/{OverviewPanel-B7JFNH2w.js → OverviewPanel-C9ErRTB1.js} +1 -1
- package/ui/dist/assets/{PageHeader-CwcMp_4A.js → PageHeader-CawSrb9E.js} +1 -1
- package/ui/dist/assets/{PersonaProfilesPanel-CmZhQC8H.js → PersonaProfilesPanel-B_hx3sLQ.js} +1 -1
- package/ui/dist/assets/{PersonasPanel-DSP0tTKz.js → PersonasPanel-BhfAKQWd.js} +1 -1
- package/ui/dist/assets/{PhoneDeskPanel-DZSs7aPr.js → PhoneDeskPanel-Cew4jv5F.js} +1 -1
- package/ui/dist/assets/{RecipesPanel-BW0hW2sW.js → RecipesPanel-KSNQil0R.js} +1 -1
- package/ui/dist/assets/{SecurityPanel-_Saqrvw7.js → SecurityPanel-ojbdvuZR.js} +1 -1
- package/ui/dist/assets/SelfImprovePanel-D743Dh0z.js +1 -0
- package/ui/dist/assets/{SelfProposalsPanel-D24kB0uM.js → SelfProposalsPanel-DHPrgGsJ.js} +1 -1
- package/ui/dist/assets/{SessionsPanel-BCxsCKwr.js → SessionsPanel-Bd8dAJQa.js} +1 -1
- package/ui/dist/assets/{SessionsTab-C5fvnjtl.js → SessionsTab-BjyOfaQ9.js} +1 -1
- package/ui/dist/assets/SettingsPanel-CWvFc8MJ.js +1 -0
- package/ui/dist/assets/SettingsView-Chh-hdRF.js +2 -0
- package/ui/dist/assets/{SkeletonLoader-C42HbL9c.js → SkeletonLoader-sjDa7Y96.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-DYG8avbV.js → SkillsPanel-B0UwrZGA.js} +1 -1
- package/ui/dist/assets/{SomaView-8Rwvw2sJ.js → SomaView-CXfqpdNP.js} +1 -1
- package/ui/dist/assets/{StatCard-vp0doZoE.js → StatCard-B4qf3WOB.js} +1 -1
- package/ui/dist/assets/{StatusBadge-C4dl4Z7r.js → StatusBadge-BtDtyL5L.js} +1 -1
- package/ui/dist/assets/{Tabs-B3hK5PRj.js → Tabs-CeY7i2tk.js} +1 -1
- package/ui/dist/assets/{TeamsPanel-Bgc-EYSL.js → TeamsPanel-BxFpHD58.js} +1 -1
- package/ui/dist/assets/{TelemetryPanel-DexYjpd5.js → TelemetryPanel-D2L98GwC.js} +1 -1
- package/ui/dist/assets/{TitanCanvas-Da6TxxdJ.js → TitanCanvas-D7TL368k.js} +4 -4
- package/ui/dist/assets/ToolsView-BiW0mds2.js +2 -0
- package/ui/dist/assets/{Tooltip-Chg08x7x.js → Tooltip-C3exOcZa.js} +1 -1
- package/ui/dist/assets/{TraceViewer-CojtXASo.js → TraceViewer-z42wYVdE.js} +1 -1
- package/ui/dist/assets/{TrainingPanel-tgn1BmiH.js → TrainingPanel-BPVftaSt.js} +1 -1
- package/ui/dist/assets/{VoiceOverlay-D_jfyVe9.js → VoiceOverlay-DNzDqitY.js} +1 -1
- package/ui/dist/assets/{VramPanel-DXrdQK3J.js → VramPanel-CF4l5fe_.js} +1 -1
- package/ui/dist/assets/{WatchView-BitQHsCy.js → WatchView-CewHUoxK.js} +1 -1
- package/ui/dist/assets/{WorkTab-6hdXBR7d.js → WorkTab-ByC4niLi.js} +1 -1
- package/ui/dist/assets/{WorkflowsPanel-BlB2iBik.js → WorkflowsPanel-Bsyhjv87.js} +1 -1
- package/ui/dist/assets/{archive-aaQ0bgj_.js → archive-Cz-kvWW5.js} +1 -1
- package/ui/dist/assets/{arrow-left-xxx_FceU.js → arrow-left-CGVxTClf.js} +1 -1
- package/ui/dist/assets/{book-open-B00IpKZA.js → book-open-CrOs3smB.js} +1 -1
- package/ui/dist/assets/{bot-C4CRICZX.js → bot-C0wiWyCT.js} +1 -1
- package/ui/dist/assets/{chart-column-lnilxGq2.js → chart-column-Dcc3a8m5.js} +1 -1
- package/ui/dist/assets/{check-BJMHM0tu.js → check-BhmlTEFk.js} +1 -1
- package/ui/dist/assets/{chevron-right-CA8HOEP4.js → chevron-right-DJCsUSwz.js} +1 -1
- package/ui/dist/assets/{chevron-up-n_3KVmjQ.js → chevron-up-cs3cBR4O.js} +1 -1
- package/ui/dist/assets/{circle-check-big-hiNdH5H3.js → circle-check-big-De2k5qVr.js} +1 -1
- package/ui/dist/assets/{circle-stop-BlIwj_3n.js → circle-stop-u0L9iQ69.js} +1 -1
- package/ui/dist/assets/{clipboard-list-BnOtwHQm.js → clipboard-list-DF1F3Vjf.js} +1 -1
- package/ui/dist/assets/{clock-BFgCJnqQ.js → clock-Bc6IrFv8.js} +1 -1
- package/ui/dist/assets/{dollar-sign-CBBudQd7.js → dollar-sign-BStL62ws.js} +1 -1
- package/ui/dist/assets/{download-C-DdF4cx.js → download-VXqww0Iy.js} +1 -1
- package/ui/dist/assets/{external-link-CPAx2HBG.js → external-link-BjN0VrNb.js} +1 -1
- package/ui/dist/assets/{file-text-CyC_OxlA.js → file-text-SIULFbzy.js} +1 -1
- package/ui/dist/assets/{flask-conical-BKbKUYhz.js → flask-conical-CsShOfpS.js} +1 -1
- package/ui/dist/assets/{folder-7bWz46dM.js → folder-DwOkgBGj.js} +1 -1
- package/ui/dist/assets/{funnel-C_bR-Dz5.js → funnel-CDnA2Enn.js} +1 -1
- package/ui/dist/assets/{git-branch-DGWdkudk.js → git-branch-BAFSlxgi.js} +1 -1
- package/ui/dist/assets/{index-CgHHe41p.js → index-BlFxPvdg.js} +5 -5
- package/ui/dist/assets/{index-CtD9JOx2.css → index-Dm6zcSTS.css} +1 -1
- package/ui/dist/assets/{layers-3BMDaZuk.js → layers-DKKOtsYx.js} +1 -1
- package/ui/dist/assets/{legacy-VWR8oDEy.js → legacy-YQ03_WIq.js} +1 -1
- package/ui/dist/assets/{lightbulb-CPhcUxli.js → lightbulb-D4Syh7fA.js} +1 -1
- package/ui/dist/assets/{link-CfLpUR24.js → link-C_6ueq0o.js} +1 -1
- package/ui/dist/assets/{list-todo-DgAmn8ot.js → list-todo-3Me4V-34.js} +1 -1
- package/ui/dist/assets/{message-square-WJp1dTaM.js → message-square-Dv6Q3VRO.js} +1 -1
- package/ui/dist/assets/{mic-DjXDp1Js.js → mic-BInf3BDE.js} +1 -1
- package/ui/dist/assets/{missions-CwDL2FHE.js → missions-BUTRB5Lq.js} +1 -1
- package/ui/dist/assets/{network-C_MOo5My.js → network-BsSfc5IE.js} +1 -1
- package/ui/dist/assets/{pause-CovS6Xwq.js → pause-CXCmPcHk.js} +1 -1
- package/ui/dist/assets/{pencil-C6SVDEUL.js → pencil-DAvceqn3.js} +1 -1
- package/ui/dist/assets/{play-D3Nbm1Cz.js → play-MuD1S1C5.js} +1 -1
- package/ui/dist/assets/{plug-Dpu9RRBi.js → plug-Chv5y4No.js} +1 -1
- package/ui/dist/assets/{plus-CJKkM9fM.js → plus-SBD6A3Qb.js} +1 -1
- package/ui/dist/assets/{proxy-CaK_YXZW.js → proxy-C5UuKDtU.js} +1 -1
- package/ui/dist/assets/{radio-BTFO9FV9.js → radio-BySzBvYH.js} +1 -1
- package/ui/dist/assets/{refresh-cw-_C-4Cd_3.js → refresh-cw-BdcqinTm.js} +1 -1
- package/ui/dist/assets/{rotate-ccw-DWyVAH19.js → rotate-ccw-CRA_s5tz.js} +1 -1
- package/ui/dist/assets/{save-B02XWwgN.js → save-BWhXC8Tv.js} +1 -1
- package/ui/dist/assets/{search-CHteSk-9.js → search-DF7UnWEk.js} +1 -1
- package/ui/dist/assets/{send-DkMQeZAz.js → send-CmvPtbvy.js} +1 -1
- package/ui/dist/assets/{server-CvEvPDpX.js → server-1PubNLgw.js} +1 -1
- package/ui/dist/assets/{shield-check-DQeYCvwF.js → shield-check-BjuAv28a.js} +1 -1
- package/ui/dist/assets/{terminal-BVErXh5C.js → terminal-BvDfNOXl.js} +1 -1
- package/ui/dist/assets/{test-tube-JSgqEqJs.js → test-tube-CrzRsKdm.js} +1 -1
- package/ui/dist/assets/{toggle-right-B3Qz7cQt.js → toggle-right-BRJ_dULZ.js} +1 -1
- package/ui/dist/assets/{trash-2-kiHv5iAF.js → trash-2-Dtxmn6GE.js} +1 -1
- package/ui/dist/assets/{trending-up-xhvUQXWt.js → trending-up-C7pfwW1S.js} +1 -1
- package/ui/dist/assets/{trophy-G3zNxlQS.js → trophy-Dknrgn8P.js} +1 -1
- package/ui/dist/assets/{volume-2-CELMZXsT.js → volume-2-ahkfEwxT.js} +1 -1
- package/ui/dist/assets/{wifi-off-DKKYhVWL.js → wifi-off-wACQ7wec.js} +1 -1
- package/ui/dist/index.html +2 -2
- package/ui/dist/sw.js +1 -1
- package/ui/dist/assets/AuditPanel-CLc6IVvA.js +0 -1
- package/ui/dist/assets/AutoresearchPanel-BJRXdUNa.js +0 -6
- package/ui/dist/assets/CPFiles-CR9Nn3_p.js +0 -1
- package/ui/dist/assets/CPLayout-CDkrYE-H.js +0 -2
- package/ui/dist/assets/InfraView-0iQPmcD1.js +0 -2
- package/ui/dist/assets/IntegrationsPanel-BGEkU649.js +0 -1
- package/ui/dist/assets/IntelligenceView-wm2Pw46I.js +0 -2
- package/ui/dist/assets/LogsPanel-DZ_K2xOL.js +0 -1
- package/ui/dist/assets/McpPanel-CNB1BMz-.js +0 -1
- package/ui/dist/assets/MeshPanel-DjYZh3P3.js +0 -11
- package/ui/dist/assets/NvidiaPanel-CLoX_gD2.js +0 -1
- package/ui/dist/assets/SelfImprovePanel-D5s-1XCU.js +0 -1
- package/ui/dist/assets/SettingsPanel-B7jrFmeR.js +0 -1
- package/ui/dist/assets/SettingsView-CQMHjpN8.js +0 -2
- package/ui/dist/assets/ToolsView-DkP9NfCj.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as E,r as a,
|
|
1
|
+
import{c as E,r as a,bk as me,bl as pe,j as e,X as O,H as ue,S as he,bm as ve,bn as fe,bo as I,bp as be,bq as ge}from"./index-BlFxPvdg.js";import{P as je}from"./plus-SBD6A3Qb.js";import{R as Ne}from"./refresh-cw-BdcqinTm.js";import{C as U}from"./chevron-right-DJCsUSwz.js";import{A as ye}from"./arrow-left-CGVxTClf.js";import{C as we}from"./clock-Bc6IrFv8.js";import{P as J}from"./pencil-DAvceqn3.js";import{T as Z}from"./trash-2-Dtxmn6GE.js";import{S as ke}from"./save-BWhXC8Tv.js";import{D as Ce}from"./download-VXqww0Iy.js";import{C as X}from"./check-BhmlTEFk.js";import{D as G}from"./TitanCanvas-D7TL368k.js";import{F as Q}from"./file-text-SIULFbzy.js";import"./chevron-up-cs3cBR4O.js";import"./server-1PubNLgw.js";import"./network-BsSfc5IE.js";import"./terminal-BvDfNOXl.js";import"./book-open-CrOs3smB.js";import"./rotate-ccw-CRA_s5tz.js";import"./search-DF7UnWEk.js";import"./send-CmvPtbvy.js";import"./message-square-Dv6Q3VRO.js";import"./mic-BInf3BDE.js";import"./flask-conical-CsShOfpS.js";import"./archive-Cz-kvWW5.js";import"./radio-BySzBvYH.js";import"./test-tube-CrzRsKdm.js";import"./VoiceOverlay-DNzDqitY.js";import"./volume-2-ahkfEwxT.js";import"./folder-DwOkgBGj.js";import"./shield-check-BjuAv28a.js";import"./external-link-BjN0VrNb.js";import"./bot-C0wiWyCT.js";import"./wifi-off-wACQ7wec.js";import"./chart-column-Dcc3a8m5.js";import"./link-C_6ueq0o.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ import{c as E,r as a,bj as me,bk as pe,j as e,X as q,H as ue,S as he,bl as ve,bm
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Ee=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],De=E("folder-plus",Ee);function pt(){var O;const[w,Y]=a.useState([]),[n,D]=a.useState(""),[o,P]=a.useState(""),[R,ee]=a.useState([]),[s,d]=a.useState(null),[te,$]=a.useState(!0),[re,L]=a.useState(!1),[k,x]=a.useState(!1),[b,C]=a.useState(""),[W,B]=a.useState(!1),[se,g]=a.useState(!1),[ae,j]=a.useState(!1),[l,m]=a.useState(""),[p,N]=a.useState(null),[v,T]=a.useState(""),z=a.useRef(null),[u,f]=a.useState(null),[M,i]=a.useState("");a.useEffect(()=>{me().then(t=>{Y(t.roots),t.roots.length>0&&!n&&D(t.roots[0].path)}).catch(()=>{})},[]);const h=a.useCallback(async t=>{$(!0);try{const r=await pe(t??o,n||void 0);ee(r.entries)}catch{}$(!1)},[o,n]);a.useEffect(()=>{n&&h(o)},[o,n]);const y=t=>{P(t),d(null),x(!1)},ne=()=>{const t=o.split("/").filter(Boolean);t.pop(),y(t.join("/"))},oe=async t=>{if(t.type==="directory"){y(t.path);return}L(!0),x(!1);try{const r=await fe(t.path,n||void 0);d(r)}catch{}L(!1)},ie=async()=>{if(s){B(!0),i("");try{await I(s.path,b,n||void 0),d({...s,content:b,size:new Blob([b]).size}),x(!1)}catch(t){i(t.message)}B(!1)}},A=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await I(t,"",n||void 0),g(!1),m(""),h()}catch(t){i(t.message)}}},H=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await be(t,n||void 0),j(!1),m(""),h()}catch(t){i(t.message)}}},_=async t=>{if(!v.trim()||v===t.name){N(null);return}i("");try{const r=t.path.split("/").slice(0,-1).join("/"),c=r?`${r}/${v.trim()}`:v.trim();await ve(t.path,c,n||void 0),N(null),h()}catch(r){i(r.message)}},le=async()=>{if(u){i("");try{await ge(u.path,n||void 0),f(null),(s==null?void 0:s.path)===u.path&&d(null),h()}catch(t){i(t.message),f(null)}}};a.useEffect(()=>{p&&z.current&&z.current.focus()},[p]);const V=t=>t===0?"0 B":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`,ce=t=>{if(!t)return"";try{const r=new Date(t),c=Date.now()-r.getTime();return c<36e5?`${Math.round(c/6e4)}m ago`:c<864e5?`${Math.round(c/36e5)}h ago`:c<6048e5?`${Math.round(c/864e5)}d ago`:r.toLocaleDateString()}catch{return""}},K=t=>t.endsWith(".json")||t.endsWith(".jsonl")?e.jsx(G,{size:14,className:"text-yellow-400"}):t.endsWith(".md")?e.jsx(Q,{size:14,className:"text-blue-400"}):t.endsWith(".db")?e.jsx(G,{size:14,className:"text-purple-400"}):t.endsWith(".log")?e.jsx(Q,{size:14,className:"text-[var(--text-muted)]"}):t==="titan.json"?e.jsx(he,{size:14,className:"text-[var(--accent)]"}):e.jsx(Fe,{size:14,className:"text-[var(--text-muted)]"}),de=t=>t.endsWith(".json")||t.endsWith(".jsonl")?"json":t.endsWith(".md")?"markdown":t.endsWith(".ts")||t.endsWith(".tsx")?"typescript":t.endsWith(".js")?"javascript":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":"text",F=o?o.split("/").filter(Boolean):[],xe=((O=w.find(t=>t.path===n))==null?void 0:O.label)||"~/.titan";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"File Manager"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Browse, edit, and manage TITAN files"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{g(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New File",children:[e.jsx(je,{size:12})," File"]}),e.jsxs("button",{onClick:()=>{j(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New Folder",children:[e.jsx(De,{size:12})," Folder"]}),e.jsx("button",{onClick:()=>h(),className:"p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(Ne,{size:14})})]})]}),M&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-lg text-sm text-red-400",children:[e.jsx("span",{children:M}),e.jsx("button",{onClick:()=>i(""),children:e.jsx(q,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[w.length>1&&e.jsx("select",{value:n,onChange:t=>{D(t.target.value),P(""),d(null)},className:"px-2 py-1.5 rounded-md border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text)] text-xs",children:w.map(t=>e.jsx("option",{value:t.path,children:t.label},t.path))}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg px-3 py-2 overflow-x-auto",children:[e.jsxs("button",{onClick:()=>y(""),className:"flex items-center gap-1 text-[var(--accent)] hover:underline flex-shrink-0",children:[e.jsx(ue,{size:14})," ",xe]}),F.map((t,r)=>e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(U,{size:12,className:"text-[var(--text-muted)]"}),e.jsx("button",{onClick:()=>y(F.slice(0,r+1).join("/")),className:r===F.length-1?"text-[var(--text)] font-medium":"text-[var(--accent)] hover:underline",children:t})]},r))]})]}),e.jsxs("div",{className:"flex gap-4",style:{height:"calc(100vh - 280px)"},children:[e.jsxs("div",{className:`${s?"w-1/3":"w-full"} bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col transition-all`,children:[o&&e.jsxs("button",{onClick:ne,className:"flex items-center gap-2 px-4 py-2 text-sm text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)] transition-colors",children:[e.jsx(ye,{size:14})," Back"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:te?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading..."}):R.length===0?e.jsxs("div",{className:"p-8 text-center text-[var(--text-muted)]",children:[e.jsx(S,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"Empty directory"})]}):R.map(t=>e.jsxs("div",{className:`group w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)]/30 transition-colors cursor-pointer ${(s==null?void 0:s.path)===t.path?"bg-[var(--accent)]/10 border-l-2 border-l-[var(--accent)]":""}`,onClick:()=>p!==t.path&&oe(t),children:[t.type==="directory"?e.jsx(S,{size:14,className:"text-[var(--accent)] flex-shrink-0"}):K(t.name),e.jsx("div",{className:"flex-1 min-w-0",children:p===t.path?e.jsx("input",{ref:z,value:v,onChange:r=>T(r.target.value),onKeyDown:r=>{r.key==="Enter"&&_(t),r.key==="Escape"&&N(null)},onBlur:()=>_(t),className:"text-sm bg-[var(--bg-tertiary)] border border-[var(--accent)] rounded px-1.5 py-0.5 text-[var(--text)] w-full outline-none",onClick:r=>r.stopPropagation()}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`text-sm truncate ${t.type==="directory"?"text-[var(--accent)] font-medium":"text-[var(--text)]"}`,children:t.name}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[t.type==="file"&&e.jsx("span",{children:V(t.size)}),t.modified&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{size:10})," ",ce(t.modified)]})]})]})}),p!==t.path&&e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[e.jsx("button",{onClick:r=>{r.stopPropagation(),N(t.path),T(t.name)},className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)]",title:"Rename",children:e.jsx(J,{size:12})}),e.jsx("button",{onClick:r=>{r.stopPropagation(),f(t)},className:"p-1 rounded text-[var(--text-muted)] hover:text-red-400 hover:bg-red-500/10",title:"Delete",children:e.jsx(Z,{size:12})})]}),t.type==="directory"&&p!==t.path&&e.jsx(U,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"})]},t.path))})]}),s&&e.jsxs("div",{className:"flex-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] bg-[var(--bg-tertiary)]",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[K(s.path),e.jsx("span",{className:"text-sm font-medium text-[var(--text)] truncate",children:s.path.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:V(s.size)}),s.truncated&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--warning)]/15 text-[var(--warning)] border border-[var(--warning)]/20 flex-shrink-0",children:"Truncated (1MB limit)"}),k&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--accent)]/15 text-[var(--accent)] border border-[var(--accent)]/20 flex-shrink-0",children:"Editing"})]}),e.jsx("div",{className:"flex gap-1.5",children:k?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ie,disabled:W,className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-[var(--accent)] text-white hover:opacity-90 disabled:opacity-50",children:[e.jsx(ke,{size:12})," ",W?"Saving...":"Save"]}),e.jsxs("button",{onClick:()=>{x(!1),C("")},className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)]",children:[e.jsx(q,{size:12})," Cancel"]})]}):e.jsxs(e.Fragment,{children:[!s.truncated&&e.jsx("button",{onClick:()=>{x(!0),C(s.content)},className:"flex items-center gap-1 p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Edit",children:e.jsx(J,{size:14})}),e.jsx("button",{onClick:()=>{const t=new Blob([s.content],{type:"text/plain"}),r=document.createElement("a");r.href=URL.createObjectURL(t),r.download=s.path.split("/").pop()||"file.txt",r.click()},className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Download",children:e.jsx(Ce,{size:14})}),e.jsx("button",{onClick:()=>{d(null),x(!1)},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text)] px-1",children:"Close"})]})})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:re?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading file..."}):k?e.jsx("textarea",{value:b,onChange:t=>C(t.target.value),className:"w-full h-full p-4 text-xs font-mono text-[var(--text-secondary)] bg-transparent resize-none outline-none leading-relaxed",spellCheck:!1}):de(s.path)==="json"?e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:(()=>{try{return JSON.stringify(JSON.parse(s.content),null,2)}catch{return s.content}})()}):e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:s.content})})]})]}),se&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>g(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New File"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&A(),placeholder:"filename.txt",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>g(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:A,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(X,{size:12})," Create"]})]})]})}),ae&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>j(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New Folder"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&H(),placeholder:"folder-name",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:H,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(X,{size:12})," Create"]})]})]})}),u&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>f(null),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsxs("h3",{className:"text-sm font-semibold text-[var(--text)]",children:["Delete ",u.type==="directory"?"Folder":"File","?"]}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Are you sure you want to delete ",e.jsx("span",{className:"font-mono text-[var(--text)]",children:u.name}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>f(null),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:le,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-500 text-white rounded-md hover:opacity-90",children:[e.jsx(Z,{size:12})," Delete"]})]})]})})]})}export{pt as default};
|
|
16
|
+
*/const Ee=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],De=E("folder-plus",Ee);function pt(){var K;const[w,Y]=a.useState([]),[n,D]=a.useState(""),[o,P]=a.useState(""),[R,ee]=a.useState([]),[s,d]=a.useState(null),[te,$]=a.useState(!0),[re,L]=a.useState(!1),[k,x]=a.useState(!1),[b,C]=a.useState(""),[W,B]=a.useState(!1),[se,g]=a.useState(!1),[ae,j]=a.useState(!1),[l,m]=a.useState(""),[p,N]=a.useState(null),[v,T]=a.useState(""),z=a.useRef(null),[u,f]=a.useState(null),[M,i]=a.useState("");a.useEffect(()=>{me().then(t=>{Y(t.roots),t.roots.length>0&&!n&&D(t.roots[0].path)}).catch(()=>{})},[]);const h=a.useCallback(async t=>{$(!0);try{const r=await pe(t??o,n||void 0);ee(r.entries)}catch{}$(!1)},[o,n]);a.useEffect(()=>{n&&h(o)},[o,n]);const y=t=>{P(t),d(null),x(!1)},ne=()=>{const t=o.split("/").filter(Boolean);t.pop(),y(t.join("/"))},oe=async t=>{if(t.type==="directory"){y(t.path);return}L(!0),x(!1);try{const r=await fe(t.path,n||void 0);d(r)}catch{}L(!1)},ie=async()=>{if(s){B(!0),i("");try{await I(s.path,b,n||void 0),d({...s,content:b,size:new Blob([b]).size}),x(!1)}catch(t){i(t.message)}B(!1)}},A=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await I(t,"",n||void 0),g(!1),m(""),h()}catch(t){i(t.message)}}},H=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await be(t,n||void 0),j(!1),m(""),h()}catch(t){i(t.message)}}},_=async t=>{if(!v.trim()||v===t.name){N(null);return}i("");try{const r=t.path.split("/").slice(0,-1).join("/"),c=r?`${r}/${v.trim()}`:v.trim();await ve(t.path,c,n||void 0),N(null),h()}catch(r){i(r.message)}},le=async()=>{if(u){i("");try{await ge(u.path,n||void 0),f(null),(s==null?void 0:s.path)===u.path&&d(null),h()}catch(t){i(t.message),f(null)}}};a.useEffect(()=>{p&&z.current&&z.current.focus()},[p]);const V=t=>t===0?"0 B":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`,ce=t=>{if(!t)return"";try{const r=new Date(t),c=Date.now()-r.getTime();return c<36e5?`${Math.round(c/6e4)}m ago`:c<864e5?`${Math.round(c/36e5)}h ago`:c<6048e5?`${Math.round(c/864e5)}d ago`:r.toLocaleDateString()}catch{return""}},q=t=>t.endsWith(".json")||t.endsWith(".jsonl")?e.jsx(G,{size:14,className:"text-yellow-400"}):t.endsWith(".md")?e.jsx(Q,{size:14,className:"text-blue-400"}):t.endsWith(".db")?e.jsx(G,{size:14,className:"text-purple-400"}):t.endsWith(".log")?e.jsx(Q,{size:14,className:"text-[var(--text-muted)]"}):t==="titan.json"?e.jsx(he,{size:14,className:"text-[var(--accent)]"}):e.jsx(Fe,{size:14,className:"text-[var(--text-muted)]"}),de=t=>t.endsWith(".json")||t.endsWith(".jsonl")?"json":t.endsWith(".md")?"markdown":t.endsWith(".ts")||t.endsWith(".tsx")?"typescript":t.endsWith(".js")?"javascript":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":"text",F=o?o.split("/").filter(Boolean):[],xe=((K=w.find(t=>t.path===n))==null?void 0:K.label)||"~/.titan";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"File Manager"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Browse, edit, and manage TITAN files"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{g(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New File",children:[e.jsx(je,{size:12})," File"]}),e.jsxs("button",{onClick:()=>{j(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New Folder",children:[e.jsx(De,{size:12})," Folder"]}),e.jsx("button",{onClick:()=>h(),className:"p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(Ne,{size:14})})]})]}),M&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-lg text-sm text-red-400",children:[e.jsx("span",{children:M}),e.jsx("button",{onClick:()=>i(""),children:e.jsx(O,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[w.length>1&&e.jsx("select",{value:n,onChange:t=>{D(t.target.value),P(""),d(null)},className:"px-2 py-1.5 rounded-md border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text)] text-xs",children:w.map(t=>e.jsx("option",{value:t.path,children:t.label},t.path))}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg px-3 py-2 overflow-x-auto",children:[e.jsxs("button",{onClick:()=>y(""),className:"flex items-center gap-1 text-[var(--accent)] hover:underline flex-shrink-0",children:[e.jsx(ue,{size:14})," ",xe]}),F.map((t,r)=>e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(U,{size:12,className:"text-[var(--text-muted)]"}),e.jsx("button",{onClick:()=>y(F.slice(0,r+1).join("/")),className:r===F.length-1?"text-[var(--text)] font-medium":"text-[var(--accent)] hover:underline",children:t})]},r))]})]}),e.jsxs("div",{className:"flex gap-4",style:{height:"calc(100vh - 280px)"},children:[e.jsxs("div",{className:`${s?"w-1/3":"w-full"} bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col transition-all`,children:[o&&e.jsxs("button",{onClick:ne,className:"flex items-center gap-2 px-4 py-2 text-sm text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)] transition-colors",children:[e.jsx(ye,{size:14})," Back"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:te?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading..."}):R.length===0?e.jsxs("div",{className:"p-8 text-center text-[var(--text-muted)]",children:[e.jsx(S,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"Empty directory"})]}):R.map(t=>e.jsxs("div",{className:`group w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)]/30 transition-colors cursor-pointer ${(s==null?void 0:s.path)===t.path?"bg-[var(--accent)]/10 border-l-2 border-l-[var(--accent)]":""}`,onClick:()=>p!==t.path&&oe(t),children:[t.type==="directory"?e.jsx(S,{size:14,className:"text-[var(--accent)] flex-shrink-0"}):q(t.name),e.jsx("div",{className:"flex-1 min-w-0",children:p===t.path?e.jsx("input",{ref:z,value:v,onChange:r=>T(r.target.value),onKeyDown:r=>{r.key==="Enter"&&_(t),r.key==="Escape"&&N(null)},onBlur:()=>_(t),className:"text-sm bg-[var(--bg-tertiary)] border border-[var(--accent)] rounded px-1.5 py-0.5 text-[var(--text)] w-full outline-none",onClick:r=>r.stopPropagation()}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`text-sm truncate ${t.type==="directory"?"text-[var(--accent)] font-medium":"text-[var(--text)]"}`,children:t.name}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[t.type==="file"&&e.jsx("span",{children:V(t.size)}),t.modified&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{size:10})," ",ce(t.modified)]})]})]})}),p!==t.path&&e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[e.jsx("button",{onClick:r=>{r.stopPropagation(),N(t.path),T(t.name)},className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)]",title:"Rename",children:e.jsx(J,{size:12})}),e.jsx("button",{onClick:r=>{r.stopPropagation(),f(t)},className:"p-1 rounded text-[var(--text-muted)] hover:text-red-400 hover:bg-red-500/10",title:"Delete",children:e.jsx(Z,{size:12})})]}),t.type==="directory"&&p!==t.path&&e.jsx(U,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"})]},t.path))})]}),s&&e.jsxs("div",{className:"flex-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] bg-[var(--bg-tertiary)]",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[q(s.path),e.jsx("span",{className:"text-sm font-medium text-[var(--text)] truncate",children:s.path.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:V(s.size)}),s.truncated&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--warning)]/15 text-[var(--warning)] border border-[var(--warning)]/20 flex-shrink-0",children:"Truncated (1MB limit)"}),k&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--accent)]/15 text-[var(--accent)] border border-[var(--accent)]/20 flex-shrink-0",children:"Editing"})]}),e.jsx("div",{className:"flex gap-1.5",children:k?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ie,disabled:W,className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-[var(--accent)] text-white hover:opacity-90 disabled:opacity-50",children:[e.jsx(ke,{size:12})," ",W?"Saving...":"Save"]}),e.jsxs("button",{onClick:()=>{x(!1),C("")},className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)]",children:[e.jsx(O,{size:12})," Cancel"]})]}):e.jsxs(e.Fragment,{children:[!s.truncated&&e.jsx("button",{onClick:()=>{x(!0),C(s.content)},className:"flex items-center gap-1 p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Edit",children:e.jsx(J,{size:14})}),e.jsx("button",{onClick:()=>{const t=new Blob([s.content],{type:"text/plain"}),r=document.createElement("a");r.href=URL.createObjectURL(t),r.download=s.path.split("/").pop()||"file.txt",r.click()},className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Download",children:e.jsx(Ce,{size:14})}),e.jsx("button",{onClick:()=>{d(null),x(!1)},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text)] px-1",children:"Close"})]})})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:re?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading file..."}):k?e.jsx("textarea",{value:b,onChange:t=>C(t.target.value),className:"w-full h-full p-4 text-xs font-mono text-[var(--text-secondary)] bg-transparent resize-none outline-none leading-relaxed",spellCheck:!1}):de(s.path)==="json"?e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:(()=>{try{return JSON.stringify(JSON.parse(s.content),null,2)}catch{return s.content}})()}):e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:s.content})})]})]}),se&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>g(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New File"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&A(),placeholder:"filename.txt",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>g(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:A,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(X,{size:12})," Create"]})]})]})}),ae&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>j(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New Folder"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&H(),placeholder:"folder-name",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:H,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(X,{size:12})," Create"]})]})]})}),u&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>f(null),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsxs("h3",{className:"text-sm font-semibold text-[var(--text)]",children:["Delete ",u.type==="directory"?"Folder":"File","?"]}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Are you sure you want to delete ",e.jsx("span",{className:"font-mono text-[var(--text)]",children:u.name}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>f(null),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:le,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-500 text-white rounded-md hover:opacity-90",children:[e.jsx(Z,{size:12})," Delete"]})]})]})})]})}export{pt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,
|
|
1
|
+
import{r as a,aT as c,j as e}from"./index-BlFxPvdg.js";import{P as o}from"./PageHeader-CawSrb9E.js";import{R as m}from"./refresh-cw-BdcqinTm.js";import{R as x}from"./radio-BySzBvYH.js";import"./chevron-right-DJCsUSwz.js";function h(){const[l,d]=a.useState([]),[r,i]=a.useState(!0),t=a.useCallback(async()=>{i(!0);try{const s=await c();d(s.nodes||[])}catch{}i(!1)},[]);return a.useEffect(()=>{t()},[t]),e.jsxs("div",{className:"space-y-4",children:[e.jsx(o,{title:"Fleet Router",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Mesh"},{label:"Fleet"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:t,disabled:r,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(m,{className:`w-4 h-4 ${r?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:l.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x,{className:`w-4 h-4 ${s.status==="online"?"text-emerald-400":s.status==="busy"?"text-amber-400":"text-red-400"}`}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:s.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[s.address," • ",s.capabilities.join(", ")]})]})]}),e.jsx("div",{className:"text-xs text-[#52525b]",children:s.status})]},s.id))})]})}export{h as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ee,r as d,b as m,j as e,Z as I,C as se,n as te,A as w,m as ae,U as ne,l as le,K as re}from"./index-
|
|
1
|
+
import{c as ee,r as d,b as m,j as e,Z as I,C as se,n as te,A as w,m as ae,U as ne,l as le,K as re}from"./index-BlFxPvdg.js";import{P as B}from"./PageHeader-CawSrb9E.js";import{S as h}from"./StatCard-B4qf3WOB.js";import{S as ie}from"./SkeletonLoader-sjDa7Y96.js";import{R as ce}from"./refresh-cw-BdcqinTm.js";import{C as de}from"./clock-Bc6IrFv8.js";import{M as oe}from"./message-square-Dv6Q3VRO.js";import{S as xe}from"./server-1PubNLgw.js";import{C as me}from"./chart-column-Dcc3a8m5.js";import{N as D}from"./network-BsSfc5IE.js";import{C as A}from"./circle-check-big-De2k5qVr.js";import{W as he}from"./wifi-off-wACQ7wec.js";import{D as ue}from"./dollar-sign-BStL62ws.js";import"./chevron-right-DJCsUSwz.js";import"./clsx-B-dksMZM.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomelabPanel-CKGR1kGN.js","assets/index-BlFxPvdg.js","assets/index-Dm6zcSTS.css","assets/PageHeader-CawSrb9E.js","assets/chevron-right-DJCsUSwz.js","assets/StatCard-B4qf3WOB.js","assets/SkeletonLoader-sjDa7Y96.js","assets/clsx-B-dksMZM.js","assets/refresh-cw-BdcqinTm.js","assets/clock-Bc6IrFv8.js","assets/message-square-Dv6Q3VRO.js","assets/server-1PubNLgw.js","assets/chart-column-Dcc3a8m5.js","assets/network-BsSfc5IE.js","assets/circle-check-big-De2k5qVr.js","assets/wifi-off-wACQ7wec.js","assets/dollar-sign-BStL62ws.js","assets/NvidiaPanel-BCmLv4bY.js","assets/save-BWhXC8Tv.js","assets/external-link-BjN0VrNb.js","assets/search-DF7UnWEk.js","assets/FilesPanel-CvrGQwh3.js","assets/plus-SBD6A3Qb.js","assets/arrow-left-CGVxTClf.js","assets/pencil-DAvceqn3.js","assets/trash-2-Dtxmn6GE.js","assets/download-VXqww0Iy.js","assets/check-BhmlTEFk.js","assets/TitanCanvas-D7TL368k.js","assets/chevron-up-cs3cBR4O.js","assets/file-text-SIULFbzy.js","assets/terminal-BvDfNOXl.js","assets/book-open-CrOs3smB.js","assets/rotate-ccw-CRA_s5tz.js","assets/send-CmvPtbvy.js","assets/mic-BInf3BDE.js","assets/flask-conical-CsShOfpS.js","assets/archive-Cz-kvWW5.js","assets/radio-BySzBvYH.js","assets/test-tube-CrzRsKdm.js","assets/VoiceOverlay-DNzDqitY.js","assets/volume-2-ahkfEwxT.js","assets/folder-DwOkgBGj.js","assets/shield-check-BjuAv28a.js","assets/bot-C0wiWyCT.js","assets/link-C_6ueq0o.js","assets/TitanCanvas-BfitWg9R.css","assets/LogsPanel-CmUBA-jG.js","assets/TelemetryPanel-D2L98GwC.js","assets/git-branch-BAFSlxgi.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as t,j as e,_ as a}from"./index-BlFxPvdg.js";import{c as i}from"./clsx-B-dksMZM.js";const r=t.lazy(()=>a(()=>import("./HomelabPanel-CKGR1kGN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))),d=t.lazy(()=>a(()=>import("./NvidiaPanel-BCmLv4bY.js"),__vite__mapDeps([17,1,2,3,4,8,18,14,19,20]))),n=t.lazy(()=>a(()=>import("./FilesPanel-CvrGQwh3.js"),__vite__mapDeps([21,1,2,22,8,4,23,9,24,25,18,26,27,28,29,30,11,13,31,32,33,20,34,10,35,36,37,38,39,40,41,42,43,19,44,15,12,45,46]))),c=t.lazy(()=>a(()=>import("./LogsPanel-CmUBA-jG.js"),__vite__mapDeps([47,1,2,3,4,8]))),m=t.lazy(()=>a(()=>import("./TelemetryPanel-D2L98GwC.js"),__vite__mapDeps([48,1,2,5,9,49,12,11]))),x=[{id:"homelab",label:"Homelab"},{id:"gpu",label:"GPU / NVIDIA"},{id:"files",label:"Files"},{id:"logs",label:"Logs"},{id:"telemetry",label:"Telemetry"}];function p(){const[l,o]=t.useState("homelab");return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-0",children:[e.jsx("h1",{className:"text-sm font-semibold text-text mb-3",children:"Infrastructure"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:x.map(s=>e.jsxs("button",{onClick:()=>o(s.id),className:i("px-3 py-2 text-xs font-medium transition-colors relative",l===s.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[s.label,l===s.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},s.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(t.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[l==="homelab"&&e.jsx(r,{}),l==="gpu"&&e.jsx(d,{}),l==="files"&&e.jsx(n,{}),l==="logs"&&e.jsx(c,{}),l==="telemetry"&&e.jsx(m,{})]})})]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as t,X as N}from"./index-
|
|
1
|
+
import{r,j as t,X as N}from"./index-BlFxPvdg.js";import{c as g}from"./clsx-B-dksMZM.js";import{C as w}from"./check-BhmlTEFk.js";import{P as S}from"./pencil-DAvceqn3.js";function P({value:s,onSave:h,placeholder:p,multiline:a=!1,className:k,displayValue:E,emptyLabel:j="—",hidePencil:C=!1,maxLength:x,title:v}){const[i,o]=r.useState(!1),[c,l]=r.useState(s),[f,y]=r.useState(!1),n=r.useRef(null);r.useEffect(()=>{i&&n.current&&(n.current.focus(),"select"in n.current&&n.current.select())},[i]),r.useEffect(()=>{i||l(s)},[s,i]);const u=async()=>{if(c===s){o(!1);return}y(!0);try{await h(c),o(!1)}catch{}finally{y(!1)}},m=()=>{l(s),o(!1)},b=e=>{e.key==="Enter"&&!a||e.key==="Enter"&&a&&e.metaKey?(e.preventDefault(),u()):e.key==="Escape"&&(e.preventDefault(),m())};if(i){const e=g("bg-bg-tertiary border border-accent/60 rounded px-2 py-1 text-sm text-text","focus:outline-none focus:border-accent","w-full",a&&"resize-none min-h-[60px]");return t.jsxs("span",{className:"inline-flex items-start gap-1 w-full",children:[a?t.jsx("textarea",{ref:n,value:c,onChange:d=>l(d.target.value),onKeyDown:b,placeholder:p,maxLength:x,className:e,disabled:f}):t.jsx("input",{ref:n,type:"text",value:c,onChange:d=>l(d.target.value),onKeyDown:b,placeholder:p,maxLength:x,className:e,disabled:f}),t.jsx("button",{onClick:u,disabled:f,className:"text-success hover:bg-success/10 rounded p-1 shrink-0",title:a?"Save (Cmd+Enter)":"Save (Enter)",type:"button",children:t.jsx(w,{size:14})}),t.jsx("button",{onClick:m,disabled:f,className:"text-text-muted hover:bg-bg-tertiary rounded p-1 shrink-0",title:"Cancel (Esc)",type:"button",children:t.jsx(N,{size:14})})]})}const D=E??(s&&s.length>0?s:j);return t.jsxs("span",{className:g("inline-flex items-center gap-1 cursor-pointer group","hover:bg-bg-tertiary rounded px-1 -mx-1",k),onClick:()=>o(!0),title:v??"Click to edit",role:"button",tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),o(!0))},children:[t.jsx("span",{children:D}),!C&&t.jsx(S,{size:10,className:"text-text-muted opacity-0 group-hover:opacity-60 transition-opacity shrink-0"})]})}export{P as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e,L as b}from"./index-
|
|
1
|
+
import{r as n,j as e,L as b}from"./index-BlFxPvdg.js";import{c as d}from"./clsx-B-dksMZM.js";const m={primary:"text-white shadow-sm glow-accent-hover bg-[image:var(--gradient-accent)] hover:brightness-110",secondary:"bg-bg-tertiary text-text border border-border hover:border-border-light hover:bg-bg-secondary",ghost:"text-text-secondary hover:text-text hover:bg-bg-tertiary",danger:"bg-error/10 text-error border border-error/20 hover:bg-error/20"},p={sm:"px-2.5 py-1 text-xs gap-1.5 rounded-md",md:"px-3.5 py-2 text-sm gap-2 rounded-lg",lg:"px-5 py-2.5 text-sm gap-2 rounded-lg"},g=n.forwardRef(({variant:r="primary",size:t="md",icon:o,loading:s,disabled:a,children:i,className:l,...c},x)=>e.jsxs("button",{ref:x,disabled:a||s,className:d("inline-flex items-center justify-center font-medium transition-all","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50","disabled:opacity-50 disabled:pointer-events-none",m[r],p[t],l),...c,children:[s?e.jsx(b,{size:t==="sm"?14:16,className:"animate-spin"}):o,i]}));g.displayName="Button";const u=n.forwardRef(({icon:r,error:t,className:o,...s},a)=>e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"relative",children:[r&&e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted pointer-events-none",children:r}),e.jsx("input",{ref:a,className:d("w-full rounded-lg border bg-bg py-2 text-sm text-text outline-none transition-colors","placeholder:text-text-muted",r?"pl-10 pr-3":"px-3",t?"border-error focus:border-error":"border-border focus:border-accent",o),...s})]}),t&&e.jsx("p",{className:"mt-1 text-xs text-error",children:t})]}));u.displayName="Input";export{g as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,j as e,i as B,ao as A,E as T,a8 as w,b as C,V as F,a9 as K}from"./index-BlFxPvdg.js";import{P as U}from"./PageHeader-CawSrb9E.js";import{C as R}from"./circle-check-big-De2k5qVr.js";import{P as q}from"./plug-Chv5y4No.js";import{S as I}from"./save-BWhXC8Tv.js";import{C as M}from"./chevron-right-DJCsUSwz.js";const k=[{id:"anthropic",label:"Anthropic",fieldKey:"anthropicKey",fieldType:"key",placeholder:"sk-ant-..."},{id:"openai",label:"OpenAI",fieldKey:"openaiKey",fieldType:"key",placeholder:"sk-..."},{id:"google",label:"Google AI",fieldKey:"googleKey",fieldType:"key",placeholder:"AIza..."},{id:"groq",label:"Groq",fieldKey:"groqKey",fieldType:"key",placeholder:"gsk_..."},{id:"mistral",label:"Mistral",fieldKey:"mistralKey",fieldType:"key",placeholder:"API key"},{id:"openrouter",label:"OpenRouter",fieldKey:"openrouterKey",fieldType:"key",placeholder:"sk-or-..."},{id:"fireworks",label:"Fireworks AI",fieldKey:"fireworksKey",fieldType:"key",placeholder:"API key"},{id:"xai",label:"xAI (Grok)",fieldKey:"xaiKey",fieldType:"key",placeholder:"xai-..."},{id:"together",label:"Together AI",fieldKey:"togetherKey",fieldType:"key",placeholder:"API key"},{id:"deepseek",label:"DeepSeek",fieldKey:"deepseekKey",fieldType:"key",placeholder:"sk-..."},{id:"perplexity",label:"Perplexity",fieldKey:"perplexityKey",fieldType:"key",placeholder:"pplx-..."},{id:"ollama",label:"Ollama",fieldKey:"ollamaUrl",fieldType:"url",placeholder:"http://localhost:11434"}];function O({configured:a}){return e.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${a?"bg-success/10 text-success":"bg-border-light/20 text-text-muted"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${a?"bg-success":"bg-border-light"}`}),a?"Configured":"Not configured"]})}function V({provider:a,configured:b,currentUrl:o,onSave:p,saving:v}){const[y,f]=l.useState(!1),[i,d]=l.useState(a.fieldType==="url"&&o||""),[x,u]=l.useState(!1),g=a.fieldType==="key",c=v===a.id;return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary",children:[e.jsxs("button",{onClick:()=>f(!y),className:"flex w-full items-center justify-between px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y?e.jsx(F,{className:"h-4 w-4 text-text-muted"}):e.jsx(M,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-text",children:a.label})]}),e.jsx(O,{configured:b})]}),y&&e.jsxs("div",{className:"border-t border-bg-tertiary px-4 py-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:g?"API Key":"Base URL"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`integration-${a.id}`,name:`integration-${a.id}`,type:g&&!x?"password":"text",value:i,onChange:j=>d(j.target.value),placeholder:a.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),g&&e.jsx("button",{type:"button",onClick:()=>u(!x),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:x?e.jsx(A,{className:"h-4 w-4"}):e.jsx(T,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:()=>p(a.fieldKey,i),disabled:c||!i,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(I,{className:"h-3.5 w-3.5"}),c?"Saving...":"Save"]})})]})]})}function W(){const[a,b]=l.useState({}),[o,p]=l.useState({clientIdSet:!1,clientSecretSet:!1}),[v,y]=l.useState(!0),[f,i]=l.useState(null),[d,x]=l.useState(null),[u,g]=l.useState(""),[c,j]=l.useState(""),[N,P]=l.useState(!1);l.useEffect(()=>{(async()=>{var t;try{const r=await w();if(r.providers&&b(r.providers),(t=r.oauth)!=null&&t.google){const m=r.oauth.google;try{const n=await(await C("/api/auth/google/status")).json();m.connected=n.connected,m.email=n.email}catch{}p(m)}}catch{}finally{y(!1)}})()},[]);const G=()=>{window.location.href="/api/auth/google/start"},E=async()=>{try{await C("/api/auth/google/disconnect",{method:"POST"}),p(s=>({...s,connected:!1,email:void 0})),h("success","Google account disconnected")}catch{h("error","Failed to disconnect")}},h=(s,t)=>{x({type:s,message:t}),setTimeout(()=>x(null),3e3)},D=async(s,t)=>{var m,S;const r=((m=k.find(n=>n.fieldKey===s))==null?void 0:m.id)||s;i(r);try{await K({[s]:t});const n=await w();n.providers&&b(n.providers),h("success",`${((S=k.find(L=>L.fieldKey===s))==null?void 0:S.label)||"Provider"} saved`)}catch(n){h("error",n instanceof Error?n.message:"Failed to save")}finally{i(null)}},$=async()=>{var s;i("oauth");try{const t={};u&&(t.googleOAuthClientId=u),c&&(t.googleOAuthClientSecret=c),await K(t);const r=await w();(s=r.oauth)!=null&&s.google&&p(r.oauth.google),h("success","Google OAuth settings saved"),g(""),j("")}catch(t){h("error",t instanceof Error?t.message:"Failed to save")}finally{i(null)}};return v?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((s,t)=>e.jsx("div",{className:"h-14 animate-pulse rounded-xl border border-border bg-bg-secondary"},t))}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(U,{title:"Integrations",subtitle:"Configure LLM providers and external service connections",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Integrations"}]}),d&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${d.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[d.type==="success"?e.jsx(R,{className:"h-4 w-4"}):e.jsx(B,{className:"h-4 w-4"}),d.message]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"LLM Providers"}),e.jsx("div",{className:"space-y-2",children:k.map(s=>{const t=a[s.id],r=s.id==="ollama"?!!(t!=null&&t.baseUrl):!!(t!=null&&t.configured);return e.jsx(V,{provider:s,configured:r,currentUrl:s.fieldType==="url"?(t==null?void 0:t.baseUrl)||"":void 0,onSave:D,saving:f},s.id)})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Google Services (OAuth)"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"Google OAuth 2.0"}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:o.connected&&o.email?`Connected as ${o.email}`:"Gmail, Drive, Calendar, Docs, Sheets, Tasks"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{configured:!!o.connected}),o.clientIdSet&&!o.connected&&e.jsxs("button",{onClick:G,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white hover:bg-accent/80 transition-colors",children:[e.jsx(q,{className:"h-3.5 w-3.5"}),"Connect Google"]}),o.connected&&e.jsx("button",{onClick:E,className:"flex items-center gap-1.5 rounded-lg border border-red-500/30 px-3 py-1.5 text-xs font-medium text-red-400 hover:bg-red-500/10 transition-colors",children:"Disconnect"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Client ID"}),e.jsx("input",{id:"integration-google-client-id",name:"integration-google-client-id",type:"text",value:u,onChange:s=>g(s.target.value),placeholder:o.clientIdSet?"(configured)":"your-client-id.apps.googleusercontent.com",className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Client Secret"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"integration-google-client-secret",name:"integration-google-client-secret",type:N?"text":"password",value:c,onChange:s=>j(s.target.value),placeholder:o.clientSecretSet?"(configured)":"GOCSPX-...",className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>P(!N),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:N?e.jsx(A,{className:"h-4 w-4"}):e.jsx(T,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:$,disabled:f==="oauth"||!u&&!c,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(I,{className:"h-3.5 w-3.5"}),f==="oauth"?"Saving...":"Save OAuth Settings"]})})]})]})]})}export{W as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AutopilotPanel-Dv3-_6fZ.js","assets/index-BlFxPvdg.js","assets/index-Dm6zcSTS.css","assets/PageHeader-CawSrb9E.js","assets/chevron-right-DJCsUSwz.js","assets/WorkflowsPanel-Bsyhjv87.js","assets/Input-rfmX8eLw.js","assets/clsx-B-dksMZM.js","assets/InlineEditableField-JxqorUFO.js","assets/check-BhmlTEFk.js","assets/pencil-DAvceqn3.js","assets/refresh-cw-BdcqinTm.js","assets/plus-SBD6A3Qb.js","assets/play-MuD1S1C5.js","assets/pause-CXCmPcHk.js","assets/trash-2-Dtxmn6GE.js","assets/clock-Bc6IrFv8.js","assets/toggle-right-BRJ_dULZ.js","assets/book-open-CrOs3smB.js","assets/LearningPanel-CZUd4UsW.js","assets/lightbulb-D4Syh7fA.js","assets/TitanCanvas-D7TL368k.js","assets/chevron-up-cs3cBR4O.js","assets/file-text-SIULFbzy.js","assets/server-1PubNLgw.js","assets/network-BsSfc5IE.js","assets/terminal-BvDfNOXl.js","assets/save-BWhXC8Tv.js","assets/rotate-ccw-CRA_s5tz.js","assets/search-DF7UnWEk.js","assets/send-CmvPtbvy.js","assets/message-square-Dv6Q3VRO.js","assets/mic-BInf3BDE.js","assets/flask-conical-CsShOfpS.js","assets/archive-Cz-kvWW5.js","assets/radio-BySzBvYH.js","assets/test-tube-CrzRsKdm.js","assets/VoiceOverlay-DNzDqitY.js","assets/volume-2-ahkfEwxT.js","assets/folder-DwOkgBGj.js","assets/shield-check-BjuAv28a.js","assets/external-link-BjN0VrNb.js","assets/bot-C0wiWyCT.js","assets/wifi-off-wACQ7wec.js","assets/chart-column-Dcc3a8m5.js","assets/link-C_6ueq0o.js","assets/TitanCanvas-BfitWg9R.css","assets/trending-up-C7pfwW1S.js","assets/MemoryGraphPanel-BK-AbsbF.js","assets/SelfImprovePanel-D743Dh0z.js","assets/circle-check-big-De2k5qVr.js","assets/trophy-Dknrgn8P.js","assets/PersonasPanel-BhfAKQWd.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as o,j as e,_ as t}from"./index-BlFxPvdg.js";import{c as a}from"./clsx-B-dksMZM.js";const i=o.lazy(()=>t(()=>import("./AutopilotPanel-Dv3-_6fZ.js"),__vite__mapDeps([0,1,2,3,4]))),n=o.lazy(()=>t(()=>import("./WorkflowsPanel-Bsyhjv87.js"),__vite__mapDeps([5,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18]))),d=o.lazy(()=>t(()=>import("./LearningPanel-CZUd4UsW.js"),__vite__mapDeps([19,1,2,3,4,11,18,20,21,22,12,23,24,25,26,27,10,28,29,30,31,32,33,16,34,35,36,37,38,39,9,40,41,42,43,44,45,15,46,47]))),c=o.lazy(()=>t(()=>import("./MemoryGraphPanel-BK-AbsbF.js"),__vite__mapDeps([48,1,2,25,11,15,29]))),m=o.lazy(()=>t(()=>import("./SelfImprovePanel-D743Dh0z.js"),__vite__mapDeps([49,1,2,3,4,11,50,16,51,47,42,13,26,35,15]))),x=o.lazy(()=>t(()=>import("./PersonasPanel-BhfAKQWd.js"),__vite__mapDeps([52,1,2]))),p=[{id:"autopilot",label:"Autopilot"},{id:"workflows",label:"Workflows"},{id:"learning",label:"Learning"},{id:"memory",label:"Memory & Graph"},{id:"self-improve",label:"Self-Improve"},{id:"personas",label:"Personas"}];function f(){const[l,r]=o.useState("autopilot");return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-0",children:[e.jsx("h1",{className:"text-sm font-semibold text-text mb-3",children:"Intelligence"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:p.map(s=>e.jsxs("button",{onClick:()=>r(s.id),className:a("px-3 py-2 text-xs font-medium transition-colors relative",l===s.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[s.label,l===s.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},s.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(o.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[l==="autopilot"&&e.jsx(i,{}),l==="workflows"&&e.jsx(n,{}),l==="learning"&&e.jsx(d,{}),l==="memory"&&e.jsx(c,{}),l==="self-improve"&&e.jsx(m,{}),l==="personas"&&e.jsx(x,{})]})})]})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,W as g,K as j,b as m}from"./index-
|
|
1
|
+
import{r as i,j as e,W as g,K as j,b as m}from"./index-BlFxPvdg.js";import{P as f}from"./PageHeader-CawSrb9E.js";import{R as N}from"./refresh-cw-BdcqinTm.js";import{B as u}from"./book-open-CrOs3smB.js";import{L as v}from"./lightbulb-D4Syh7fA.js";import{D as y}from"./TitanCanvas-D7TL368k.js";import{T as C}from"./trending-up-C7pfwW1S.js";import"./chevron-right-DJCsUSwz.js";import"./chevron-up-cs3cBR4O.js";import"./plus-SBD6A3Qb.js";import"./file-text-SIULFbzy.js";import"./server-1PubNLgw.js";import"./network-BsSfc5IE.js";import"./terminal-BvDfNOXl.js";import"./save-BWhXC8Tv.js";import"./pencil-DAvceqn3.js";import"./rotate-ccw-CRA_s5tz.js";import"./search-DF7UnWEk.js";import"./send-CmvPtbvy.js";import"./message-square-Dv6Q3VRO.js";import"./mic-BInf3BDE.js";import"./flask-conical-CsShOfpS.js";import"./clock-Bc6IrFv8.js";import"./archive-Cz-kvWW5.js";import"./radio-BySzBvYH.js";import"./test-tube-CrzRsKdm.js";import"./VoiceOverlay-DNzDqitY.js";import"./volume-2-ahkfEwxT.js";import"./folder-DwOkgBGj.js";import"./check-BhmlTEFk.js";import"./shield-check-BjuAv28a.js";import"./external-link-BjN0VrNb.js";import"./bot-C0wiWyCT.js";import"./wifi-off-wACQ7wec.js";import"./chart-column-Dcc3a8m5.js";import"./link-C_6ueq0o.js";import"./trash-2-Dtxmn6GE.js";function w(t){return t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}function k(t){return t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}K`:`${(t/1e6).toFixed(2)}M`}function a({icon:t,label:d,value:s,color:l,sub:o}){return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md",style:{backgroundColor:l+"15"},children:e.jsx(t,{className:"h-3.5 w-3.5",style:{color:l}})}),e.jsx("p",{className:"text-xs text-text-muted",children:d})]}),e.jsx("p",{className:"text-2xl font-bold text-text",children:s}),o&&e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:o})]})}function de(){const[t,d]=i.useState(null),[s,l]=i.useState(null),[o,b]=i.useState(null),[h,x]=i.useState(!0),p=()=>{x(!0),Promise.all([m("/api/learning").then(r=>r.ok?r.json():null).catch(()=>null),m("/api/stats").then(r=>r.ok?r.json():null).catch(()=>null),m("/api/graphiti").then(r=>r.ok?r.json():null).catch(()=>null)]).then(([r,c,n])=>{d(r),l(c),b(n?{nodeCount:n.nodeCount||0,edgeCount:n.edgeCount||0,episodeCount:n.episodeCount||0}:null)}).finally(()=>x(!1))};return i.useEffect(()=>{p()},[]),h?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 animate-pulse rounded-xl bg-bg-secondary"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Array.from({length:8}).map((r,c)=>e.jsx("div",{className:"h-24 animate-pulse rounded-xl bg-bg-secondary"},c))})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(f,{title:"Learning",subtitle:"Knowledge base, tool mastery, and memory systems",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Memory"},{label:"Learning"}],actions:e.jsxs("button",{onClick:p,className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-xs text-text-secondary hover:bg-border hover:text-text transition-colors",children:[e.jsx(N,{className:"h-3.5 w-3.5"})," Refresh"]})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Knowledge Base"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(a,{icon:u,label:"Knowledge Entries",value:(t==null?void 0:t.knowledgeEntries)??0,color:"#6366f1",sub:"Facts, patterns, corrections"}),e.jsx(a,{icon:g,label:"Tools Tracked",value:(t==null?void 0:t.toolsTracked)??0,color:"#22d3ee",sub:"Success rates learned"}),e.jsx(a,{icon:j,label:"Error Patterns",value:(t==null?void 0:t.errorPatterns)??0,color:"#f59e0b",sub:"Known failure modes"}),e.jsx(a,{icon:v,label:"Corrections",value:(t==null?void 0:t.corrections)??0,color:"#34d399",sub:"User-taught improvements"})]})]}),o&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Memory Graph"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(a,{icon:y,label:"Entities",value:o.nodeCount,color:"#818cf8",sub:"People, topics, projects"}),e.jsx(a,{icon:C,label:"Relationships",value:o.edgeCount,color:"#22d3ee",sub:"Connections between entities"}),e.jsx(a,{icon:u,label:"Episodes",value:o.episodeCount,color:"#34d399",sub:"Conversation memories"})]})]}),s&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"System"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Tokens Used"}),e.jsx("p",{className:"text-xl font-bold text-text",children:k(s.totalTokens)})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Requests"}),e.jsx("p",{className:"text-xl font-bold text-text",children:s.totalRequests})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Uptime"}),e.jsx("p",{className:"text-xl font-bold text-text",children:w(s.uptime)})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Memory"}),e.jsxs("p",{className:"text-xl font-bold text-text",children:[s.memoryMB,"MB"]})]})]})]})]})}export{de as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,aR as v,j as e}from"./index-BlFxPvdg.js";import{P as j}from"./PageHeader-CawSrb9E.js";import{R as y}from"./refresh-cw-BdcqinTm.js";import"./chevron-right-DJCsUSwz.js";const x={debug:"bg-text-muted/20 text-text-secondary",info:"bg-info/20 text-info",warn:"bg-warning/20 text-warning",warning:"bg-warning/20 text-warning",error:"bg-error/20 text-error"};function k(){const[c,u]=r.useState([]),[g,m]=r.useState(!0),[i,d]=r.useState(null),[n,b]=r.useState(""),[o,h]=r.useState(100),[l,p]=r.useState(!1),s=r.useRef(null),a=r.useCallback(async()=>{try{const t=await v(n||void 0,o);u(t),d(null)}catch(t){d(t instanceof Error?t.message:"Failed to fetch logs")}finally{m(!1)}},[n,o]);return r.useEffect(()=>{a()},[a]),r.useEffect(()=>(l?s.current=setInterval(a,5e3):s.current&&(clearInterval(s.current),s.current=null),()=>{s.current&&clearInterval(s.current)}),[l,a]),g?e.jsx("div",{className:"h-96 animate-pulse rounded-xl border border-border bg-bg-secondary"}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{title:"Logs",subtitle:"Recent gateway and skill activity",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Logs"}]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:n,onChange:t=>b(t.target.value),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:"",children:"All levels"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]}),e.jsxs("select",{value:o,onChange:t=>h(Number(t.target.value)),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:50,children:"50 entries"}),e.jsx("option",{value:100,children:"100 entries"}),e.jsx("option",{value:200,children:"200 entries"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:t=>p(t.target.checked),className:"h-4 w-4 rounded border-border accent-accent"}),"Auto-refresh (5s)"]}),e.jsx("button",{onClick:a,className:"ml-auto rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(y,{className:"h-4 w-4"})})]}),i&&e.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:i}),e.jsx("div",{className:"max-h-[600px] overflow-y-auto rounded-xl border border-border bg-bg-secondary",children:c.length===0?e.jsx("p",{className:"px-4 py-12 text-center text-text-muted",children:"No logs found"}):e.jsx("div",{className:"divide-y divide-border",children:c.map((t,f)=>e.jsxs("div",{className:"flex items-start gap-3 px-4 py-2.5",children:[e.jsx("span",{className:"shrink-0 font-mono text-xs text-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),e.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium uppercase ${x[t.level]??x.debug}`,children:t.level}),e.jsx("span",{className:"min-w-0 break-all text-sm text-text",children:t.message})]},f))})})]})}export{k as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,j as e,G as A,ai as k,aj as z,ak as u,al as $,am as R,an as I}from"./index-BlFxPvdg.js";import{P as E}from"./PageHeader-CawSrb9E.js";import{R as D}from"./refresh-cw-BdcqinTm.js";import{P as L}from"./plus-SBD6A3Qb.js";import{S as g}from"./server-1PubNLgw.js";import{P as F}from"./plug-Chv5y4No.js";import{T as G,P as H}from"./test-tube-CrzRsKdm.js";import{T as B}from"./trash-2-Dtxmn6GE.js";import"./chevron-right-DJCsUSwz.js";function Y(){const[l,h]=d.useState([]),[j,N]=d.useState([]),[y,x]=d.useState(!0),[m,c]=d.useState(!1),[v,p]=d.useState(null),[o,i]=d.useState(null),[r,a]=d.useState({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),n=async()=>{x(!0);try{const[t,s]=await Promise.all([k(),z()]);h(t),N(s)}catch{}x(!1)};d.useEffect(()=>{n()},[]);const f=async()=>{try{await u({id:r.id,name:r.name,description:r.description,type:r.type,...r.type==="stdio"?{command:r.command,args:r.args.split(/\s+/).filter(Boolean)}:{url:r.url}}),c(!1),a({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),n()}catch(t){alert(t.message)}},C=async t=>{try{await u({presetId:t}),n()}catch(s){alert(s.message)}},P=async t=>{confirm(`Remove MCP server "${t}"?`)&&(await I(t),n())},w=async(t,s)=>{await R(t,s),n()},M=async t=>{p(t),i(null);try{const s=await $(t);i({id:t,...s})}catch(s){i({id:t,ok:!1,tools:0,error:s.message})}p(null)},T=t=>t==="connected"?"text-[var(--success)]":t==="error"?"text-[var(--error)]":"text-[var(--text-muted)]",S=t=>t==="connected"?"bg-[var(--success)]":t==="error"?"bg-[var(--error)]":"bg-[var(--text-muted)]",b=j.filter(t=>!l.some(s=>s.id===t.id));return e.jsxs("div",{className:"space-y-6",children:[e.jsx(E,{title:"MCP Connections",subtitle:"Connect to external tools via Model Context Protocol",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"MCP"}],actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:n,className:"px-3 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(D,{size:14})}),e.jsxs("button",{onClick:()=>c(!m),className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] transition-colors",children:[e.jsx(L,{size:14})," Add Server"]})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Configured Servers"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--text)]",children:l.length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Connected"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--success)]",children:l.filter(t=>t.status==="connected").length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"External Tools"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--accent)]",children:l.reduce((t,s)=>t+s.toolCount,0)})]})]}),m&&e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Add MCP Server"}),b.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)] mb-2",children:"Quick Add Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map(t=>e.jsxs("button",{onClick:()=>C(t.id),className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:[e.jsx(g,{size:12})," ",t.name]},t.id))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"ID"}),e.jsx("input",{id:"mcp-server-id",name:"mcp-server-id",value:r.id,onChange:t=>a({...r,id:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"my-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Name"}),e.jsx("input",{id:"mcp-server-name",name:"mcp-server-name",value:r.name,onChange:t=>a({...r,name:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"My MCP Server"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Description"}),e.jsx("input",{id:"mcp-server-description",name:"mcp-server-description",value:r.description,onChange:t=>a({...r,description:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"What does this server do?"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Type"}),e.jsxs("select",{id:"mcp-server-type",name:"mcp-server-type",value:r.type,onChange:t=>a({...r,type:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",children:[e.jsx("option",{value:"stdio",children:"stdio (local process)"}),e.jsx("option",{value:"http",children:"HTTP (remote server)"})]})]}),r.type==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Command"}),e.jsx("input",{id:"mcp-server-command",name:"mcp-server-command",value:r.command,onChange:t=>a({...r,command:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"npx @modelcontextprotocol/server-xxx"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Arguments (space-separated)"}),e.jsx("input",{id:"mcp-server-args",name:"mcp-server-args",value:r.args,onChange:t=>a({...r,args:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"--port 3000"})]})]}):e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Server URL"}),e.jsx("input",{id:"mcp-server-url",name:"mcp-server-url",value:r.url,onChange:t=>a({...r,url:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"http://localhost:3000/mcp"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:f,disabled:!r.id||!r.name,className:"px-4 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] disabled:opacity-40 transition-colors",children:"Add Server"}),e.jsx("button",{onClick:()=>c(!1),className:"px-4 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:"Cancel"})]})]}),y?e.jsx("div",{className:"text-[var(--text-muted)] text-sm",children:"Loading MCP servers..."}):l.length===0?e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-8 text-center",children:[e.jsx(F,{className:"w-10 h-10 text-[var(--text-muted)] mx-auto mb-3"}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:"No MCP servers configured"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Add an MCP server to connect TITAN to external tools like databases, APIs, and services."})]}):e.jsx("div",{className:"space-y-3",children:l.map(t=>e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:t.type==="stdio"?e.jsx(g,{size:18,className:"text-[var(--text-muted)]"}):e.jsx(A,{size:18,className:"text-[var(--text-muted)]"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-[var(--text)]",children:t.name}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${S(t.status)}`}),e.jsx("span",{className:T(t.status),children:t.status})]}),t.toolCount>0&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--accent)]/10 text-[var(--accent)]",children:[t.toolCount," tools"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:t.description}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-1 font-mono",children:t.type==="stdio"?`${t.command} ${(t.args||[]).join(" ")}`:t.url})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>M(t.id),disabled:v===t.id,title:"Test connection",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-tertiary)] transition-colors disabled:opacity-40",children:e.jsx(G,{size:14,className:v===t.id?"animate-pulse":""})}),e.jsx("button",{onClick:()=>w(t.id,!t.enabled),title:t.enabled?"Disable":"Enable",className:`p-1.5 rounded-md transition-colors hover:bg-[var(--bg-tertiary)] ${t.enabled?"text-[var(--success)]":"text-[var(--text-muted)]"}`,children:e.jsx(H,{size:14})}),e.jsx("button",{onClick:()=>P(t.id),title:"Remove",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--error)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(B,{size:14})})]})]}),(o==null?void 0:o.id)===t.id&&e.jsx("div",{className:`mt-3 px-3 py-2 rounded-md text-xs ${o.ok?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:o.ok?`Connected successfully — ${o.tools} tools discovered`:`Connection failed: ${o.error}`})]},t.id))}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-2",children:"About MCP"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)] leading-relaxed",children:["Model Context Protocol (MCP) is the universal standard for connecting AI agents to external tools. TITAN acts as both an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"server"})," (exposing its tools to other agents) and an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"client"})," (connecting to external MCP servers). Add any MCP-compatible server and its tools automatically become available in TITAN."]})]})]})}export{Y as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ve,r as j,b as je,j as o,X as $e}from"./index-
|
|
1
|
+
import{c as ve,r as j,b as je,j as o,X as $e}from"./index-BlFxPvdg.js";import{N as Ne}from"./network-BsSfc5IE.js";import{R as ze}from"./refresh-cw-BdcqinTm.js";import{T as Le}from"./trash-2-Dtxmn6GE.js";import{S as Re}from"./search-DF7UnWEk.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as N,r as n,b as h,j as e}from"./index-
|
|
1
|
+
import{c as N,r as n,b as h,j as e}from"./index-BlFxPvdg.js";import{P as u}from"./PageHeader-CawSrb9E.js";import{A as v}from"./arrow-left-CGVxTClf.js";import{L as w}from"./link-C_6ueq0o.js";import{C as k}from"./clock-Bc6IrFv8.js";import{S}from"./search-DF7UnWEk.js";import{B as C}from"./book-open-CrOs3smB.js";import"./chevron-right-DJCsUSwz.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c as l,r as n,j as e,as as y,at as j,au as N,av as f,aw as v}from"./index-BlFxPvdg.js";import{D as k}from"./DataTable-CgeOprjv.js";import{P as w}from"./PageHeader-CawSrb9E.js";import{R as P}from"./refresh-cw-BdcqinTm.js";import{S as C}from"./shield-check-BjuAv28a.js";import"./chevron-right-DJCsUSwz.js";/**
|
|
2
|
+
* @license lucide-react v0.513.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const R=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],M=l("shield-x",R);/**
|
|
7
|
+
* @license lucide-react v0.513.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const S=[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]],A=l("unplug",S);function q(){const[d,i]=n.useState([]),[o,m]=n.useState([]),[x,h]=n.useState(!0),[c,a]=n.useState(null),r=async()=>{try{const[s,t]=await Promise.all([y(),j()]);i(s),m(t),a(null)}catch(s){a(s instanceof Error?s.message:"Failed to fetch mesh data")}finally{h(!1)}};n.useEffect(()=>{r()},[]);const p=async s=>{try{await N(s),await r()}catch(t){a(t instanceof Error?t.message:"Failed to approve peer")}},g=async s=>{try{await f(s),await r()}catch(t){a(t instanceof Error?t.message:"Failed to reject peer")}},u=async s=>{try{await v(s),await r()}catch(t){a(t instanceof Error?t.message:"Failed to revoke peer")}},b=[{key:"nodeId",header:"Node ID",render:s=>e.jsx("span",{className:"font-mono text-xs",children:s.nodeId})},{key:"url",header:"URL"},{key:"status",header:"Status",render:s=>e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-success"}),e.jsx("span",{className:"capitalize",children:s.status})]})},{key:"connectedAt",header:"Connected At",render:s=>s.connectedAt?e.jsx("span",{children:new Date(s.connectedAt).toLocaleString()}):e.jsx("span",{className:"text-text-muted",children:"-"})},{key:"_actions",header:"",className:"w-16",render:s=>e.jsx("button",{onClick:t=>{t.stopPropagation(),u(s.id)},className:"rounded-md p-1.5 text-error transition-colors hover:bg-bg-tertiary",title:"Revoke peer",children:e.jsx(A,{className:"h-4 w-4"})})}];return x?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"}),e.jsx("div",{className:"h-48 animate-pulse rounded-xl border border-border bg-bg-secondary"})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(w,{title:"Mesh Network",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Mesh"}],actions:e.jsx("button",{onClick:r,className:"rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(P,{className:"h-4 w-4"})})}),c&&e.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:c}),e.jsxs("div",{children:[e.jsxs("h3",{className:"mb-3 text-sm font-medium text-text-secondary",children:["Pending Requests (",o.length,")"]}),o.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-6 text-center text-text-muted",children:"No pending requests"}):e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:o.map(s=>e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsx("p",{className:"font-mono text-sm text-text",children:s.nodeId}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:s.url}),s.name&&e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:s.name}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsxs("button",{onClick:()=>p(s.id),className:"flex items-center gap-1.5 rounded-lg bg-success px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-success/80",children:[e.jsx(C,{className:"h-3.5 w-3.5"}),"Approve"]}),e.jsxs("button",{onClick:()=>g(s.id),className:"flex items-center gap-1.5 rounded-lg bg-error px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-error/80",children:[e.jsx(M,{className:"h-3.5 w-3.5"}),"Reject"]})]})]},s.id))})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"mb-3 text-sm font-medium text-text-secondary",children:["Connected Peers (",d.length,")"]}),e.jsx(k,{columns:b,data:d,emptyMessage:"No connected peers"})]})]})}export{q as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,j as e,p as Ne,u as Se,aB as Ce}from"./index-CgHHe41p.js";import{p as ee,f as Me,h as $e,i as De,g as Te,a as de,s as Ae,b as ze,d as Oe,e as Fe}from"./missions-CwDL2FHE.js";import{F as Le}from"./FileViewer-B0WedL9k.js";function Ee({member:t,room:a,anchor:r,availableModels:s,onClose:d,onTalkInChat:u}){const p=o.useRef(null),[l,v]=o.useState("main"),[y,h]=o.useState(""),[b,c]=o.useState(!1),[m,f]=o.useState(!1),[w,j]=o.useState(null);o.useEffect(()=>{const g=E=>{E.key==="Escape"&&d()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[d]);const A=320,T=360,C=Re(r,A,T);async function S(){f(!0),j(null);try{await ee(a.id,`@${t.name} quick check-in — how's it going? Anything I can clear for you?`),d()}catch(g){j(g.message)}finally{f(!1)}}async function L(g){const E=y.trim();if(!(!E||b)){c(!0),j(null);try{await ee(a.id,`@${t.name} ${g}${E}`),h(""),d()}catch(W){j(W.message)}finally{c(!1)}}}async function z(g){f(!0),j(null);try{await De(a.id,t.agentId,g),v("main")}catch(E){j(E.message)}finally{f(!1)}}async function k(){f(!0),j(null);try{await Me(a.id,t.agentId,!t.paused)}catch(g){j(g.message)}finally{f(!1)}}async function R(){f(!0),j(null);try{await $e(a.id,!a.longRunningMode)}catch(g){j(g.message)}finally{f(!1)}}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[60]",onClick:d,"aria-hidden":!0}),e.jsxs("div",{ref:p,className:"absolute z-[61] flex flex-col titan-modal-surface overflow-hidden",style:{left:C.x,top:C.y,width:A,maxHeight:T,borderRadius:12},onClick:g=>g.stopPropagation(),children:[e.jsx("div",{className:"h-1.5",style:{background:`linear-gradient(90deg, ${t.color}, ${ue(t.color,-25)})`}}),e.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-md flex items-center justify-center text-white font-bold text-[14px]",style:{background:`linear-gradient(135deg, ${t.color}, ${ue(t.color,-25)})`},children:t.name[0]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-sm",children:t.name}),e.jsxs("div",{className:"text-[11px] text-text-muted",children:[t.role," · ",Pe(t)]})]}),e.jsx("button",{onClick:d,"aria-label":"Close",className:"titan-close-btn w-7 h-7 rounded-full flex items-center justify-center text-sm",style:{border:"1px solid var(--theme-menu-border)"},children:"✕"})]}),t.currentActivity&&e.jsxs("div",{className:"px-4 pb-2 text-[11px] text-text-secondary italic leading-snug border-b border-border/60",children:['"',t.currentActivity,'"']}),w&&e.jsx("div",{className:"px-4 py-2 text-[11px] text-error bg-error/10 border-b border-error/30",children:w}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l==="main"&&e.jsxs("div",{className:"p-2 grid grid-cols-2 gap-2",children:[e.jsx(H,{icon:"👋",label:"Nudge",hint:"A friendly check-in",onClick:S,disabled:m}),e.jsx(H,{icon:"💬",label:"Talk to them",hint:"Send a message just to them",onClick:()=>{u?(u(t.agentId,`@${t.name} `),d()):v("talk")},disabled:m}),e.jsx(H,{icon:"🧭",label:"Steer",hint:"Redirect them mid-task",onClick:()=>v("steer"),disabled:m}),e.jsx(H,{icon:"🧠",label:"Model",hint:t.modelOverride?Ie(t.modelOverride):"default",onClick:()=>v("model"),disabled:m}),e.jsx(H,{icon:t.paused?"▶":"⏸",label:t.paused?"Resume agent":"Pause agent",hint:t.paused?"Bring them back":"Skip them for now",onClick:k,disabled:m,wide:!1}),e.jsx(H,{icon:"🏃",label:a.longRunningMode?"Marathon ON":"Marathon mode",hint:a.longRunningMode?"running 72h goal":"72h auto-run",onClick:R,disabled:m,active:!!a.longRunningMode})]}),(l==="talk"||l==="steer")&&e.jsxs("div",{className:"p-3 flex flex-col gap-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-text-muted",children:l==="talk"?`Message ${t.name}`:`Steer ${t.name}`}),e.jsx("textarea",{autoFocus:!0,value:y,onChange:g=>h(g.target.value),rows:4,onKeyDown:g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),L(l==="steer"?"steer: ":""))},placeholder:l==="steer"?'e.g. "skip the chart, focus on cost comparison"':"Type a private note to them…",className:"bg-bg-tertiary border border-border rounded-lg p-2 text-sm text-text outline-none focus:border-accent resize-none"}),l==="steer"&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["Slow down","Be thorough","Wrap it up","Skip the chart"].map(g=>e.jsx("button",{onClick:()=>h(g.toLowerCase()),className:"px-2 py-0.5 text-[11px] bg-bg-tertiary border border-border rounded-full text-text-muted hover:text-text",children:g},g))}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("button",{onClick:()=>v("main"),className:"text-xs text-text-muted hover:text-text",children:"← Back"}),e.jsx("button",{onClick:()=>L(l==="steer"?"steer: ":""),disabled:!y.trim()||b,className:"px-3 py-1.5 rounded-lg font-bold text-bg-deep bg-gradient-to-br from-accent to-accent2 disabled:opacity-50 text-xs",children:b?"Sending…":"Send ⌘↵"})]})]}),l==="model"&&e.jsxs("div",{className:"p-3 flex flex-col gap-2",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-widest text-text-muted",children:[t.name,"'s brain"]}),e.jsx("div",{className:"text-[11px] text-text-secondary leading-snug",children:"Pick a specific model for this agent on this mission. Empty = the role's default."}),t.modelOverride&&e.jsxs("div",{className:"px-2.5 py-1.5 rounded-lg bg-accent/10 border border-accent/40 text-[12px] text-text flex items-center justify-between",children:[e.jsxs("span",{className:"truncate",children:["Now: ",e.jsx("b",{children:t.modelOverride})]}),e.jsx("button",{onClick:()=>z(null),className:"text-[11px] text-text-muted hover:text-text shrink-0",children:"clear"})]}),e.jsx("div",{className:"flex flex-col gap-1 max-h-48 overflow-y-auto",children:s.length===0?e.jsx("div",{className:"text-[11px] text-text-muted italic",children:"No models discovered. /api/models returned empty."}):s.map(g=>{const E=t.modelOverride===g.id;return e.jsxs("button",{onClick:()=>z(g.id),disabled:m,className:`flex items-center justify-between px-2.5 py-1.5 rounded-lg text-[12px] border text-left ${E?"bg-accent/10 border-accent/60 text-text":"bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light"}`,children:[e.jsx("span",{className:"truncate",children:g.id}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2 shrink-0",children:g.provider})]},g.id)})}),e.jsx("button",{onClick:()=>v("main"),className:"text-xs text-text-muted hover:text-text self-start mt-1",children:"← Back"})]})]})]})]})}function H({icon:t,label:a,hint:r,onClick:s,disabled:d,wide:u,active:p}){return e.jsxs("button",{onClick:s,disabled:d,className:`text-left p-2.5 rounded-xl border transition-colors ${p?"bg-accent/15 border-accent/50 text-text":"bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light"} ${u?"col-span-2":""} disabled:opacity-50`,children:[e.jsx("div",{className:"text-lg leading-none mb-1",children:t}),e.jsx("div",{className:"text-[12px] font-semibold leading-tight",children:a}),r&&e.jsx("div",{className:"text-[10px] text-text-muted leading-snug mt-0.5 truncate",children:r})]})}function Re({x:t,y:a},r,s){const d=window.innerWidth,u=window.innerHeight;return{x:Math.max(8,Math.min(t,d-r-8)),y:Math.max(8,Math.min(a,u-s-8))}}function Pe(t){return t.paused?"paused (by you)":t.state==="working"?"working":t.state==="editing"?"editing":t.state==="blocked"?"needs you":t.state==="done"?"done":"idle"}function Ie(t){return t.length<=24?t:t.slice(0,22)+"…"}function ue(t,a){const r=t.replace("#","");if(r.length!==6)return t;const s=parseInt(r,16);let d=s>>16&255,u=s>>8&255,p=s&255;const l=Math.round(255*(a/100));return d=Math.max(0,Math.min(255,d+l)),u=Math.max(0,Math.min(255,u+l)),p=Math.max(0,Math.min(255,p+l)),"#"+(d<<16|u<<8|p).toString(16).padStart(6,"0")}const Be=12;function Ye(t){const a=new Map;for(const s of t){const d=s.activityLog??[];for(const u of d){const p=`${s.agentId}::${u.activity}`,l=a.get(p);if(!l){a.set(p,{id:p,agentId:s.agentId,agentName:s.name,agentColor:s.color,icon:u.icon,activity:u.activity,detail:u.detail,at:u.at,count:1,recentDetails:u.detail?[u.detail]:[]});continue}l.count+=1,u.at>l.at&&(l.at=u.at,l.icon=u.icon,u.detail&&(l.detail=u.detail)),u.detail&&(l.recentDetails=[u.detail,...l.recentDetails.filter(v=>v!==u.detail)].slice(0,3))}}return Array.from(a.values()).sort((s,d)=>s.at<d.at?1:-1).slice(0,Be)}const We=[{cmd:"/slow down",label:"Slow down",hint:"be more careful"},{cmd:"/be thorough",label:"Be thorough",hint:"dig deeper"},{cmd:"/wrap it up",label:"Wrap it up",hint:"finish what you have"},{cmd:"/pause",label:"Pause",hint:"pause the team"}];function He(t){try{const a=localStorage.getItem(he(t));return a?JSON.parse(a):{}}catch{return{}}}function Ge(t,a){try{localStorage.setItem(he(t),JSON.stringify(a))}catch{}}function he(t){return`titan-desk:${t}`}function fe(t){return`titan-desk-furniture:${t}`}function Ke(t){const a={cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1};try{const r=localStorage.getItem(fe(t));if(!r)return a;const s=JSON.parse(r);return{cabinet:Array.isArray(s.cabinet)?s.cabinet:[],trash:Array.isArray(s.trash)?s.trash:[],permanentlyHidden:Array.isArray(s.permanentlyHidden)?s.permanentlyHidden:[],cabinetOpen:!!s.cabinetOpen,trashOpen:!!s.trashOpen}}catch{return a}}function _e(t,a){try{localStorage.setItem(fe(t),JSON.stringify(a))}catch{}}function $t(){const{id:t}=Ne(),a=Se(),[r,s]=o.useState(null),[d,u]=o.useState(!0),[p,l]=o.useState(null),[v,y]=o.useState(""),[h,b]=o.useState(!1),[c,m]=o.useState(!1),f=o.useRef(null),[w,j]=o.useState(()=>({width:typeof window>"u"?1400:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}));o.useLayoutEffect(()=>{const n=f.current;if(!n)return;const i=()=>{const M=n.getBoundingClientRect();j($=>{const P=Math.max(320,Math.round(M.width)),N=Math.max(320,Math.round(M.height));return $.width===P&&$.height===N?$:{width:P,height:N}})};i();const x=typeof ResizeObserver<"u"?new ResizeObserver(i):null;return x==null||x.observe(n),window.addEventListener("resize",i),()=>{x==null||x.disconnect(),window.removeEventListener("resize",i)}},[d,r==null?void 0:r.id]);const A=o.useCallback(()=>{var i;const n=(i=f.current)==null?void 0:i.getBoundingClientRect();return n||{left:0,top:0,width:typeof window>"u"?1400:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}},[]),T=o.useCallback((n,i)=>{const x=A();return{x:n-x.left,y:i-x.top}},[A]),C=o.useCallback((n,i)=>{const x=T(n,i);return{x:Math.max(8,Math.min(x.x,w.width-328)),y:Math.max(8,Math.min(x.y,w.height-368))}},[w,T]),[S,L]=o.useState({});o.useEffect(()=>{t&&L(He(t))},[t]);const z=o.useCallback(n=>{L(n),t&&Ge(t,n)},[t]),[k,R]=o.useState({cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1});o.useEffect(()=>{t&&R(Ke(t))},[t]);const g=o.useCallback(n=>{R(n),t&&_e(t,n)},[t]),[E,W]=o.useState([]);o.useEffect(()=>{Ce().then(W).catch(()=>W([]))},[]);const[B,G]=o.useState(null),[J,V]=o.useState(null),te=o.useCallback(async n=>{if(t){V({ref:n,loading:!0});try{const i=await Te(t,n);V({ref:n,loading:!1,file:i})}catch(i){V({ref:n,loading:!1,error:i.message})}}},[t]);o.useEffect(()=>{if(!t)return;let n=!0;return u(!0),de(t).then(({mission:i})=>{n&&(s(i),u(!1))}).catch(i=>{n&&(l(i.message),u(!1))}),()=>{n=!1}},[t]),o.useEffect(()=>t?Ae(t,i=>{if(i.kind==="mission_deleted"){a("/mission");return}i.kind!=="hello"&&de(t).then(({mission:x})=>s(x)).catch(()=>{})}):void 0,[t,a]);const ae=o.useCallback(async n=>{if(!(!r||!n.trim()||h)){b(!0);try{await ee(r.id,n.trim()),y("")}catch(i){l(i.message)}finally{b(!1)}}},[r,h]),me=o.useCallback(async(n,i)=>{if(r)try{await ze(r.id,n,i)}catch(x){l(x.message)}},[r]),ge=o.useCallback(async()=>{if(!r)return;const n=r.status==="paused"?"working":"paused";try{await Oe(r.id,n)}catch(i){l(i.message)}},[r]),be=o.useCallback(async()=>{if(!(!r||!window.confirm(`Delete this mission?
|
|
1
|
+
import{r as o,j as e,p as Ne,u as Se,aC as Ce}from"./index-BlFxPvdg.js";import{p as ee,f as Me,h as $e,i as De,g as Te,a as de,s as Ae,b as ze,d as Oe,e as Fe}from"./missions-BUTRB5Lq.js";import{F as Le}from"./FileViewer-B7Mm4cJL.js";function Ee({member:t,room:a,anchor:r,availableModels:s,onClose:d,onTalkInChat:u}){const p=o.useRef(null),[l,v]=o.useState("main"),[y,h]=o.useState(""),[b,c]=o.useState(!1),[m,f]=o.useState(!1),[w,j]=o.useState(null);o.useEffect(()=>{const g=E=>{E.key==="Escape"&&d()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[d]);const A=320,T=360,C=Re(r,A,T);async function S(){f(!0),j(null);try{await ee(a.id,`@${t.name} quick check-in — how's it going? Anything I can clear for you?`),d()}catch(g){j(g.message)}finally{f(!1)}}async function L(g){const E=y.trim();if(!(!E||b)){c(!0),j(null);try{await ee(a.id,`@${t.name} ${g}${E}`),h(""),d()}catch(W){j(W.message)}finally{c(!1)}}}async function z(g){f(!0),j(null);try{await De(a.id,t.agentId,g),v("main")}catch(E){j(E.message)}finally{f(!1)}}async function k(){f(!0),j(null);try{await Me(a.id,t.agentId,!t.paused)}catch(g){j(g.message)}finally{f(!1)}}async function R(){f(!0),j(null);try{await $e(a.id,!a.longRunningMode)}catch(g){j(g.message)}finally{f(!1)}}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[60]",onClick:d,"aria-hidden":!0}),e.jsxs("div",{ref:p,className:"absolute z-[61] flex flex-col titan-modal-surface overflow-hidden",style:{left:C.x,top:C.y,width:A,maxHeight:T,borderRadius:12},onClick:g=>g.stopPropagation(),children:[e.jsx("div",{className:"h-1.5",style:{background:`linear-gradient(90deg, ${t.color}, ${ue(t.color,-25)})`}}),e.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-md flex items-center justify-center text-white font-bold text-[14px]",style:{background:`linear-gradient(135deg, ${t.color}, ${ue(t.color,-25)})`},children:t.name[0]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-sm",children:t.name}),e.jsxs("div",{className:"text-[11px] text-text-muted",children:[t.role," · ",Pe(t)]})]}),e.jsx("button",{onClick:d,"aria-label":"Close",className:"titan-close-btn w-7 h-7 rounded-full flex items-center justify-center text-sm",style:{border:"1px solid var(--theme-menu-border)"},children:"✕"})]}),t.currentActivity&&e.jsxs("div",{className:"px-4 pb-2 text-[11px] text-text-secondary italic leading-snug border-b border-border/60",children:['"',t.currentActivity,'"']}),w&&e.jsx("div",{className:"px-4 py-2 text-[11px] text-error bg-error/10 border-b border-error/30",children:w}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l==="main"&&e.jsxs("div",{className:"p-2 grid grid-cols-2 gap-2",children:[e.jsx(H,{icon:"👋",label:"Nudge",hint:"A friendly check-in",onClick:S,disabled:m}),e.jsx(H,{icon:"💬",label:"Talk to them",hint:"Send a message just to them",onClick:()=>{u?(u(t.agentId,`@${t.name} `),d()):v("talk")},disabled:m}),e.jsx(H,{icon:"🧭",label:"Steer",hint:"Redirect them mid-task",onClick:()=>v("steer"),disabled:m}),e.jsx(H,{icon:"🧠",label:"Model",hint:t.modelOverride?Ie(t.modelOverride):"default",onClick:()=>v("model"),disabled:m}),e.jsx(H,{icon:t.paused?"▶":"⏸",label:t.paused?"Resume agent":"Pause agent",hint:t.paused?"Bring them back":"Skip them for now",onClick:k,disabled:m,wide:!1}),e.jsx(H,{icon:"🏃",label:a.longRunningMode?"Marathon ON":"Marathon mode",hint:a.longRunningMode?"running 72h goal":"72h auto-run",onClick:R,disabled:m,active:!!a.longRunningMode})]}),(l==="talk"||l==="steer")&&e.jsxs("div",{className:"p-3 flex flex-col gap-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-text-muted",children:l==="talk"?`Message ${t.name}`:`Steer ${t.name}`}),e.jsx("textarea",{autoFocus:!0,value:y,onChange:g=>h(g.target.value),rows:4,onKeyDown:g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),L(l==="steer"?"steer: ":""))},placeholder:l==="steer"?'e.g. "skip the chart, focus on cost comparison"':"Type a private note to them…",className:"bg-bg-tertiary border border-border rounded-lg p-2 text-sm text-text outline-none focus:border-accent resize-none"}),l==="steer"&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["Slow down","Be thorough","Wrap it up","Skip the chart"].map(g=>e.jsx("button",{onClick:()=>h(g.toLowerCase()),className:"px-2 py-0.5 text-[11px] bg-bg-tertiary border border-border rounded-full text-text-muted hover:text-text",children:g},g))}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("button",{onClick:()=>v("main"),className:"text-xs text-text-muted hover:text-text",children:"← Back"}),e.jsx("button",{onClick:()=>L(l==="steer"?"steer: ":""),disabled:!y.trim()||b,className:"px-3 py-1.5 rounded-lg font-bold text-bg-deep bg-gradient-to-br from-accent to-accent2 disabled:opacity-50 text-xs",children:b?"Sending…":"Send ⌘↵"})]})]}),l==="model"&&e.jsxs("div",{className:"p-3 flex flex-col gap-2",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-widest text-text-muted",children:[t.name,"'s brain"]}),e.jsx("div",{className:"text-[11px] text-text-secondary leading-snug",children:"Pick a specific model for this agent on this mission. Empty = the role's default."}),t.modelOverride&&e.jsxs("div",{className:"px-2.5 py-1.5 rounded-lg bg-accent/10 border border-accent/40 text-[12px] text-text flex items-center justify-between",children:[e.jsxs("span",{className:"truncate",children:["Now: ",e.jsx("b",{children:t.modelOverride})]}),e.jsx("button",{onClick:()=>z(null),className:"text-[11px] text-text-muted hover:text-text shrink-0",children:"clear"})]}),e.jsx("div",{className:"flex flex-col gap-1 max-h-48 overflow-y-auto",children:s.length===0?e.jsx("div",{className:"text-[11px] text-text-muted italic",children:"No models discovered. /api/models returned empty."}):s.map(g=>{const E=t.modelOverride===g.id;return e.jsxs("button",{onClick:()=>z(g.id),disabled:m,className:`flex items-center justify-between px-2.5 py-1.5 rounded-lg text-[12px] border text-left ${E?"bg-accent/10 border-accent/60 text-text":"bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light"}`,children:[e.jsx("span",{className:"truncate",children:g.id}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2 shrink-0",children:g.provider})]},g.id)})}),e.jsx("button",{onClick:()=>v("main"),className:"text-xs text-text-muted hover:text-text self-start mt-1",children:"← Back"})]})]})]})]})}function H({icon:t,label:a,hint:r,onClick:s,disabled:d,wide:u,active:p}){return e.jsxs("button",{onClick:s,disabled:d,className:`text-left p-2.5 rounded-xl border transition-colors ${p?"bg-accent/15 border-accent/50 text-text":"bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light"} ${u?"col-span-2":""} disabled:opacity-50`,children:[e.jsx("div",{className:"text-lg leading-none mb-1",children:t}),e.jsx("div",{className:"text-[12px] font-semibold leading-tight",children:a}),r&&e.jsx("div",{className:"text-[10px] text-text-muted leading-snug mt-0.5 truncate",children:r})]})}function Re({x:t,y:a},r,s){const d=window.innerWidth,u=window.innerHeight;return{x:Math.max(8,Math.min(t,d-r-8)),y:Math.max(8,Math.min(a,u-s-8))}}function Pe(t){return t.paused?"paused (by you)":t.state==="working"?"working":t.state==="editing"?"editing":t.state==="blocked"?"needs you":t.state==="done"?"done":"idle"}function Ie(t){return t.length<=24?t:t.slice(0,22)+"…"}function ue(t,a){const r=t.replace("#","");if(r.length!==6)return t;const s=parseInt(r,16);let d=s>>16&255,u=s>>8&255,p=s&255;const l=Math.round(255*(a/100));return d=Math.max(0,Math.min(255,d+l)),u=Math.max(0,Math.min(255,u+l)),p=Math.max(0,Math.min(255,p+l)),"#"+(d<<16|u<<8|p).toString(16).padStart(6,"0")}const Be=12;function Ye(t){const a=new Map;for(const s of t){const d=s.activityLog??[];for(const u of d){const p=`${s.agentId}::${u.activity}`,l=a.get(p);if(!l){a.set(p,{id:p,agentId:s.agentId,agentName:s.name,agentColor:s.color,icon:u.icon,activity:u.activity,detail:u.detail,at:u.at,count:1,recentDetails:u.detail?[u.detail]:[]});continue}l.count+=1,u.at>l.at&&(l.at=u.at,l.icon=u.icon,u.detail&&(l.detail=u.detail)),u.detail&&(l.recentDetails=[u.detail,...l.recentDetails.filter(v=>v!==u.detail)].slice(0,3))}}return Array.from(a.values()).sort((s,d)=>s.at<d.at?1:-1).slice(0,Be)}const We=[{cmd:"/slow down",label:"Slow down",hint:"be more careful"},{cmd:"/be thorough",label:"Be thorough",hint:"dig deeper"},{cmd:"/wrap it up",label:"Wrap it up",hint:"finish what you have"},{cmd:"/pause",label:"Pause",hint:"pause the team"}];function He(t){try{const a=localStorage.getItem(he(t));return a?JSON.parse(a):{}}catch{return{}}}function Ge(t,a){try{localStorage.setItem(he(t),JSON.stringify(a))}catch{}}function he(t){return`titan-desk:${t}`}function fe(t){return`titan-desk-furniture:${t}`}function Ke(t){const a={cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1};try{const r=localStorage.getItem(fe(t));if(!r)return a;const s=JSON.parse(r);return{cabinet:Array.isArray(s.cabinet)?s.cabinet:[],trash:Array.isArray(s.trash)?s.trash:[],permanentlyHidden:Array.isArray(s.permanentlyHidden)?s.permanentlyHidden:[],cabinetOpen:!!s.cabinetOpen,trashOpen:!!s.trashOpen}}catch{return a}}function _e(t,a){try{localStorage.setItem(fe(t),JSON.stringify(a))}catch{}}function $t(){const{id:t}=Ne(),a=Se(),[r,s]=o.useState(null),[d,u]=o.useState(!0),[p,l]=o.useState(null),[v,y]=o.useState(""),[h,b]=o.useState(!1),[c,m]=o.useState(!1),f=o.useRef(null),[w,j]=o.useState(()=>({width:typeof window>"u"?1400:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}));o.useLayoutEffect(()=>{const n=f.current;if(!n)return;const i=()=>{const M=n.getBoundingClientRect();j($=>{const P=Math.max(320,Math.round(M.width)),N=Math.max(320,Math.round(M.height));return $.width===P&&$.height===N?$:{width:P,height:N}})};i();const x=typeof ResizeObserver<"u"?new ResizeObserver(i):null;return x==null||x.observe(n),window.addEventListener("resize",i),()=>{x==null||x.disconnect(),window.removeEventListener("resize",i)}},[d,r==null?void 0:r.id]);const A=o.useCallback(()=>{var i;const n=(i=f.current)==null?void 0:i.getBoundingClientRect();return n||{left:0,top:0,width:typeof window>"u"?1400:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}},[]),T=o.useCallback((n,i)=>{const x=A();return{x:n-x.left,y:i-x.top}},[A]),C=o.useCallback((n,i)=>{const x=T(n,i);return{x:Math.max(8,Math.min(x.x,w.width-328)),y:Math.max(8,Math.min(x.y,w.height-368))}},[w,T]),[S,L]=o.useState({});o.useEffect(()=>{t&&L(He(t))},[t]);const z=o.useCallback(n=>{L(n),t&&Ge(t,n)},[t]),[k,R]=o.useState({cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1});o.useEffect(()=>{t&&R(Ke(t))},[t]);const g=o.useCallback(n=>{R(n),t&&_e(t,n)},[t]),[E,W]=o.useState([]);o.useEffect(()=>{Ce().then(W).catch(()=>W([]))},[]);const[B,G]=o.useState(null),[J,V]=o.useState(null),te=o.useCallback(async n=>{if(t){V({ref:n,loading:!0});try{const i=await Te(t,n);V({ref:n,loading:!1,file:i})}catch(i){V({ref:n,loading:!1,error:i.message})}}},[t]);o.useEffect(()=>{if(!t)return;let n=!0;return u(!0),de(t).then(({mission:i})=>{n&&(s(i),u(!1))}).catch(i=>{n&&(l(i.message),u(!1))}),()=>{n=!1}},[t]),o.useEffect(()=>t?Ae(t,i=>{if(i.kind==="mission_deleted"){a("/mission");return}i.kind!=="hello"&&de(t).then(({mission:x})=>s(x)).catch(()=>{})}):void 0,[t,a]);const ae=o.useCallback(async n=>{if(!(!r||!n.trim()||h)){b(!0);try{await ee(r.id,n.trim()),y("")}catch(i){l(i.message)}finally{b(!1)}}},[r,h]),me=o.useCallback(async(n,i)=>{if(r)try{await ze(r.id,n,i)}catch(x){l(x.message)}},[r]),ge=o.useCallback(async()=>{if(!r)return;const n=r.status==="paused"?"working":"paused";try{await Oe(r.id,n)}catch(i){l(i.message)}},[r]),be=o.useCallback(async()=>{if(!(!r||!window.confirm(`Delete this mission?
|
|
2
2
|
|
|
3
3
|
"${r.goal.slice(0,120)}${r.goal.length>120?"…":""}"
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,j as e,R as E,p as q,u as W}from"./index-
|
|
1
|
+
import{r as o,j as e,R as E,p as q,u as W}from"./index-BlFxPvdg.js";import{g as G,a as R,s as K,p as V,b as Y,d as Q,e as X}from"./missions-BUTRB5Lq.js";import{F as J}from"./FileViewer-B7Mm4cJL.js";const Z=/\bhttps?:\/\/[^\s<>()[\]"']+[^\s<>()[\]"',.!?;:]/gi;function ee(t){if(!t)return[];const a=[];let r=0;for(const s of t.matchAll(Z))s.index!==void 0&&(s.index>r&&a.push(t.slice(r,s.index)),a.push({url:s[0]}),r=s.index+s[0].length);return r<t.length&&a.push(t.slice(r)),a}function v(t){try{const a=new URL(t),r=a.host.replace(/^www\./,""),s=(a.pathname+a.search+a.hash).replace(/^\//,"");if(s.length===0)return r;const i=`${r}/${s}`;return i.length<=60?i:i.slice(0,57)+"…"}catch{return t.length<=60?t:t.slice(0,57)+"…"}}function te({text:t,sources:a,onOpenFile:r}){const s=o.useMemo(()=>ee(t),[t]),i=o.useMemo(()=>(a??[]).filter(n=>n.type==="url"),[a]),u=o.useMemo(()=>(a??[]).filter(n=>n.type!=="url"),[a]),d=o.useMemo(()=>{const n=new Set;for(const c of s)typeof c!="string"&&n.add(c.url);return n},[s]),m=o.useMemo(()=>i.filter(n=>!d.has(n.ref)),[i,d]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"whitespace-pre-wrap",children:s.map((n,c)=>typeof n=="string"?e.jsx(E.Fragment,{children:n},c):e.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),className:"text-accent hover:text-accent2 underline underline-offset-2 break-all",children:v(n.url)},c))}),(m.length>0||u.length>0)&&e.jsxs("div",{className:"mt-3 pt-2.5 border-t border-border/50",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-text-muted mb-1.5",children:"Sources"}),m.length>0&&e.jsx("ul",{className:"space-y-1 mb-1.5",children:m.map((n,c)=>e.jsxs("li",{className:"text-[12px] leading-snug",children:[e.jsx("span",{className:"mr-1.5",children:"🔗"}),e.jsx("a",{href:n.ref,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),className:"text-accent hover:text-accent2 underline underline-offset-2 break-all",title:n.ref,children:n.description??v(n.ref)}),n.description&&e.jsxs("span",{className:"text-text-muted ml-2 text-[11px]",children:["(",v(n.ref),")"]})]},`u-${c}`))}),u.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map((n,c)=>{const p=n.type==="file"?"📄":n.type==="fact"?"💡":"📊",f=n.ref.length>50?n.ref.slice(0,47)+"…":n.ref;return(n.type==="file"||n.type==="report")&&!!r?e.jsxs("button",{type:"button",onClick:j=>{j.stopPropagation(),r(n.ref,n.type)},className:"inline-flex items-center gap-1.5 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-secondary hover:bg-accent/15 hover:text-text hover:border-accent/40 transition-colors cursor-pointer",title:`Open ${n.ref}${n.description?" — "+n.description:""}`,children:[p," ",e.jsx("b",{className:"text-text font-medium",children:f}),e.jsx("span",{className:"text-text-muted text-[10px]",children:"↗"})]},`o-${c}`):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-secondary",title:n.description??n.ref,children:[p," ",e.jsx("b",{className:"text-text font-medium",children:f})]},`o-${c}`)})})]})]})}function ge(){const{id:t}=q(),a=W(),[r,s]=o.useState(null),[i,u]=o.useState(!0),[d,m]=o.useState(null),[n,c]=o.useState(""),[p,f]=o.useState(!1),[k,j]=o.useState(!1),[I,S]=o.useState(!1),[A,L]=o.useState(new Set),U=o.useCallback(l=>{L(x=>{const h=new Set(x);return h.has(l)?h.delete(l):h.add(l),h})},[]),C=o.useRef(null),$=o.useRef(null),F=o.useRef(!0),[T,b]=o.useState(null),B=o.useCallback(async l=>{if(t){b({ref:l,loading:!0});try{const x=await G(t,l);b({ref:l,loading:!1,file:x})}catch(x){b({ref:l,loading:!1,error:x.message})}}},[t]),O=o.useCallback(()=>b(null),[]);o.useEffect(()=>{if(!t)return;let l=!0;return u(!0),R(t).then(({mission:x})=>{l&&(s(x),u(!1))}).catch(x=>{l&&(m(x.message),u(!1))}),()=>{l=!1}},[t]),o.useEffect(()=>t?K(t,x=>{if(x.kind==="mission_deleted"){a("/mission");return}x.kind!=="hello"&&R(t).then(({mission:h})=>s(h)).catch(()=>{})}):void 0,[t,a]),o.useEffect(()=>{const l=C.current;if(!l)return;const x=()=>{F.current=l.scrollHeight-l.scrollTop-l.clientHeight<100};return x(),l.addEventListener("scroll",x,{passive:!0}),()=>{l.removeEventListener("scroll",x)}},[r==null?void 0:r.id]),o.useEffect(()=>{if(!F.current)return;const l=$.current;l&&l.scrollIntoView({behavior:"smooth",block:"end"})},[r==null?void 0:r.messages.length]);const P=o.useCallback(async()=>{if(!(!r||!n.trim()||p)){f(!0);try{await V(r.id,n.trim()),c("")}catch(l){m(l.message)}finally{f(!1)}}},[r,n,p]),_=o.useCallback(async(l,x)=>{if(r)try{await Y(r.id,l,x)}catch(h){m(h.message)}},[r]),z=o.useCallback(async()=>{if(!r)return;const l=r.status==="paused"?"working":"paused";try{await Q(r.id,l)}catch(x){m(x.message)}},[r]),H=o.useCallback(async()=>{if(!(!r||!window.confirm(`Delete this mission?
|
|
2
2
|
|
|
3
3
|
"${r.goal.slice(0,120)}${r.goal.length>120?"…":""}"
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as M,r as m,j as e}from"./index-
|
|
1
|
+
import{u as M,r as m,j as e}from"./index-BlFxPvdg.js";import{l as j,e as D}from"./missions-BUTRB5Lq.js";const T=258;function z(){const a=M(),[r,s]=m.useState(null),[o,i]=m.useState(null),[l,c]=m.useState("all"),[d,F]=m.useState("");m.useEffect(()=>{let t=!0;return j().then(({missions:n})=>{t&&s(n)}).catch(n=>{t&&i(n.message)}),()=>{t=!1}},[]);const S=m.useCallback(()=>{s(null),j().then(({missions:t})=>s(t)).catch(t=>i(t.message))},[]),p=m.useCallback(async(t,n)=>{if(window.confirm(`Delete this mission?
|
|
2
2
|
|
|
3
3
|
"${n.slice(0,120)}${n.length>120?"…":""}"
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as b,u as W,j as e}from"./index-CgHHe41p.js";import{c as _}from"./missions-CwDL2FHE.js";const G={id:"hourly",label:"Every hour",cron:"0 * * * *",cadence:"24 runs/day"},L={id:"every4h",label:"Every 4 hours",cron:"0 */4 * * *",cadence:"6 runs/day"},A={id:"every6h",label:"Every 6 hours",cron:"0 */6 * * *",cadence:"4 runs/day"},I={id:"daily7",label:"Daily at 7am",cron:"0 7 * * *",cadence:"once/day"},M={id:"weekly",label:"Weekly (Mon 9am)",cron:"0 9 * * 1",cadence:"once/week"},H={id:"nightly",label:"Nightly at 11pm",cron:"0 23 * * *",cadence:"once/day"},D={id:"twice",label:"Twice daily (7am + 7pm)",cron:"0 7,19 * * *",cadence:"2 runs/day"},V=[{id:"research-digest",icon:"📰",title:"Daily research digest",blurb:"Scout researches your topic and writes a fresh briefing for the first run.",goalTemplate:'Research the latest developments on "{{topic}}" and produce a clear HTML briefing (write_file with a .html extension) with 5 highlights, an inline SVG chart of the most important trend, and clickable source links throughout.',suggestedPlayId:"research",fields:[{key:"topic",label:"Your topic",hint:"What you want a fresh briefing on each morning",defaultValue:"AI agents in business",placeholder:"AI agents in business"}],schedules:[I,D,M],whatItDoes:"Scout searches the web for fresh developments on your topic, reads the top 5 sources end-to-end, and writes a one-page briefing. The briefing lands on your desk as a paper sheet, and the chat thread captures every URL Scout looked at so you can dig in further if anything catches your eye.",accent:{from:"#6366f1",to:"#8b5cf6"}},{id:"inbox-triage",icon:"📬",title:"Inbox triage",blurb:"Sage sorts and summarizes incoming email so important threads stay visible.",goalTemplate:'Read my inbox and produce a triaged summary: "needs reply within 24h", "informational", "newsletters", and "junk". Cap at 30 messages per run.',suggestedPlayId:"inbox",fields:[],schedules:[L,A,I],whatItDoes:"Sage opens your inbox, classifies up to 30 recent threads into four buckets (urgent / informational / newsletters / junk), and pins the urgent ones to the desk as sticky notes. The full triage lands as a paper sheet you can scan in under a minute.",accent:{from:"#06b6d4",to:"#0ea5e9"}},{id:"code-review",icon:"🔍",title:"Code review",blurb:"Builder reviews your repo changes and reports only meaningful findings.",goalTemplate:"Review the diff in {{repoPath}} since the last review. Flag bugs, regressions, and obvious improvements. Don't nitpick formatting.",suggestedPlayId:"code-review",fields:[{key:"repoPath",label:"Repo path or URL",hint:"Local path on the host, or a GitHub repo URL",defaultValue:"~/Desktop/MyProject",placeholder:"~/projects/repo"}],schedules:[H,D],whatItDoes:"Builder pulls the latest changes from your repo and writes a concise review focused on real defects (logic bugs, regressions, security smells). Formatting nits are skipped. Findings land as a paper sheet; if there's nothing to report, Builder closes silently.",accent:{from:"#22c55e",to:"#10b981"}},{id:"lead-scout",icon:"🎯",title:"Lead scout",blurb:"Scout scans freelance + opportunity boards and surfaces matches for your skills.",goalTemplate:'Scan Upwork, Indeed, and HackerNews "who is hiring" for new postings matching: {{skills}}. Filter to budget >= ${{minBudget}} and remote OK.',suggestedPlayId:"lead-scout",fields:[{key:"skills",label:"Skills to match",hint:"Comma-separated keywords. Scout fuzzy-matches.",defaultValue:"TypeScript, Node.js, AI agents",placeholder:"React, Python, design"},{key:"minBudget",label:"Minimum budget (USD)",hint:"Skip postings paying less.",defaultValue:"500"}],schedules:[L,A,I],whatItDoes:"Scout sweeps the boards you care about for postings that match your skill keywords and budget floor. New matches land as sticky notes; the running log of every posting seen sits as a paper sheet you can browse anytime.",accent:{from:"#f59e0b",to:"#eab308"}},{id:"market-watch",icon:"📈",title:"Market watch",blurb:"Analyst tracks tickers + crypto and writes a brief if anything moves >3%.",goalTemplate:"Check the latest price + 24h move for: {{tickers}}. If any moved more than 3% (up or down) since the last run, produce an HTML brief (write_file with a .html extension) with a sparkline SVG per ticker and a one-paragraph explanation with 2 source links.",suggestedPlayId:"analyst",fields:[{key:"tickers",label:"Tickers / coins",hint:"Comma-separated. Stocks or crypto.",defaultValue:"BTC, ETH, NVDA, AAPL",placeholder:"TSLA, SPY, BTC"}],schedules:[G,L,A],whatItDoes:"Each cycle, Analyst pulls the latest price and 24-hour move for every ticker you listed. If anything jumped or dropped more than 3%, it writes a one-paragraph explanation with 2 source links. Quiet runs close silently — your desk only fills up when something actually moved.",accent:{from:"#ef4444",to:"#f97316"}},{id:"creative-prompts",icon:"🎨",title:"Daily creative prompt",blurb:"Writer creates a fresh writing, sketching, or music prompt for the first run.",goalTemplate:"Generate a fresh {{discipline}} prompt for me today. Make it specific enough to start in 5 minutes but open enough to take in any direction. Include a 1-line warm-up exercise.",fields:[{key:"discipline",label:"Discipline",hint:"What kind of prompt you want.",defaultValue:"songwriting",placeholder:"short fiction · songwriting · sketching"}],schedules:[I,M],whatItDoes:"Writer creates one fresh creative prompt tailored to the discipline you chose, with a quick warm-up exercise to get started. The prompt lands as a sticky note on the desk so you can grab it when you need it.",accent:{from:"#ec4899",to:"#8b5cf6"}}];function Y(s,n){return s.goalTemplate.replace(/\{\{(\w+)\}\}/g,(i,r)=>{const u=n[r];return u&&u.trim().length>0?u.trim():r})}const z=["Plan my mom's 70th birthday party","Write a thank-you note to my landlord","Summarize this long email I got","Draft the Q1 investor update","Review a code change"],x="var(--theme-font-display, 'Iowan Old Style', 'Charter', Georgia, serif)",d="var(--theme-font-mono, 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace)",c="var(--theme-paper, #f3e9d0)",o="var(--theme-ink-soft, #a0a8d0)",t="var(--theme-metal, #c4a35a)",g="var(--theme-metal-bright, #f3d27a)",m="var(--theme-metal-dark, #8a6a3a)",F="var(--theme-bolt, #2a1808)",E="var(--theme-leather, #4a2818)",v="var(--theme-leather-edge, #2a1408)",U="var(--theme-leather-stitch, #d4a060)",h="var(--theme-bg-base, #1a1235)",R="var(--theme-bg-grain, #0e0820)",K="var(--theme-bg-vignette, rgba(0,0,0,0.6))",j="var(--theme-shadow, rgba(0,0,0,0.55))",Q="var(--theme-accent, #c45a30)";function ee(){const[s,n]=b.useState(""),[i,r]=b.useState(!1),[u,N]=b.useState(null),[$,k]=b.useState(null),S=W();async function y(a,p){const f=a.trim();if(!(!f||i)){r(!0),N(null);try{const{mission:w}=await _(f,p);S(`/mission/${w.id}`)}catch(w){N(w.message),r(!1)}}}return e.jsxs("div",{className:"min-h-full w-full flex flex-col items-center",style:{color:c,fontFamily:x,background:`radial-gradient(120% 80% at 50% -10%, ${R} 0%, ${h} 60%, ${h} 100%)`},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:`radial-gradient(circle at 50% 12%, ${Q}22 0%, transparent 55%)`}}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{boxShadow:`inset 0 0 240px 60px ${K}`}}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-8 w-full max-w-5xl px-6 pt-10 pb-28 md:py-14",children:[e.jsxs("div",{className:"w-full flex items-center",style:{paddingRight:260},children:[e.jsxs("div",{className:"flex items-center gap-3 text-[11px] uppercase tracking-[0.3em]",style:{color:o,fontFamily:d},children:[e.jsx("span",{style:{color:g,fontWeight:700},children:"TITAN"}),e.jsx("span",{style:{opacity:.6},children:"·"}),e.jsx("span",{children:"MISSION CONTROL"})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsx(P,{onClick:()=>S("/mission/library"),title:"See your past missions",children:"Past missions →"}),e.jsx(P,{onClick:()=>S("/space/home"),title:"Back to the canvas spaces",children:"🌌 Canvas"})]})]}),e.jsxs("section",{className:"relative w-full max-w-3xl rounded-3xl overflow-hidden",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${v}`,boxShadow:`0 30px 80px ${j}, inset 0 1px 0 ${t}33`,padding:"36px 36px 28px"},children:[e.jsx(C,{position:"tl"}),e.jsx(C,{position:"tr"}),e.jsx(C,{position:"bl"}),e.jsx(C,{position:"br"}),e.jsx("div",{className:"text-[10px] uppercase tracking-[0.4em] mb-3",style:{color:t,fontFamily:d,fontWeight:600},children:"◆ New Mission"}),e.jsx("h1",{className:"text-4xl md:text-5xl tracking-tight",style:{color:c,fontFamily:x,fontWeight:600,letterSpacing:0,textShadow:`0 2px 12px ${j}`},children:"What's the mission?"}),e.jsx("p",{className:"mt-3 text-[15px] leading-relaxed max-w-xl",style:{color:o},children:"Tell me anything — a thank-you note, a birthday plan, a Q1 report. I’ll assemble a small team of AI specialists and we’ll work it out together."}),e.jsxs("form",{onSubmit:a=>{a.preventDefault(),y(s)},className:"mt-6 flex flex-col gap-3",children:[e.jsx("textarea",{autoFocus:!0,value:s,onChange:a=>n(a.target.value),placeholder:"Try: Help me write a birthday speech for my mom",rows:3,disabled:i,className:"w-full resize-none outline-none rounded-2xl px-5 py-4 text-base leading-relaxed",style:{background:`${h}80`,color:c,border:`1px solid ${t}44`,fontFamily:x,boxShadow:`inset 0 2px 8px ${j}`},onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&a.key==="Enter"&&(a.preventDefault(),y(s))}}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-[11px] tracking-wide",style:{color:o,fontFamily:d},children:"⌘↵ to dispatch · voice coming soon"}),e.jsxs("div",{className:"flex w-full items-center gap-2 sm:w-auto",children:[e.jsx("button",{type:"button",disabled:!0,title:"Voice is coming next release",className:"w-11 h-11 rounded-full flex items-center justify-center cursor-not-allowed",style:{background:`${h}66`,border:`1px solid ${t}33`,color:o,opacity:.55},children:"🎤"}),e.jsx("button",{type:"submit",disabled:!s.trim()||i,className:"h-11 flex-1 rounded-xl px-5 text-sm font-bold tracking-wide transition-transform sm:flex-none",style:{background:s.trim()&&!i?`linear-gradient(180deg, ${g} 0%, ${t} 60%, ${m} 100%)`:`${m}66`,color:s.trim()&&!i?F:o,border:`1px solid ${m}`,boxShadow:s.trim()&&!i?`0 6px 18px ${j}, inset 0 1px 0 ${g}`:"none",cursor:s.trim()&&!i?"pointer":"not-allowed",fontFamily:x,letterSpacing:"0.04em"},onMouseDown:a=>{s.trim()&&!i&&(a.currentTarget.style.transform="translateY(1px)")},onMouseUp:a=>{a.currentTarget.style.transform=""},onMouseLeave:a=>{a.currentTarget.style.transform=""},children:i?"Dispatching…":"Start mission →"})]})]})]}),u&&e.jsx("div",{className:"mt-4 text-sm rounded-lg px-3 py-2",style:{color:"#ffb4a8",background:"#5a1a1a55",border:"1px solid #8a3a3a"},children:u})]}),e.jsxs("div",{className:"w-full max-w-3xl flex flex-col items-center gap-3",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.35em]",style:{color:o,fontFamily:d},children:"— or try a one-shot —"}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:z.map(a=>e.jsx("button",{type:"button",onClick:()=>y(a),disabled:i,className:"px-3 py-1.5 text-xs rounded-full transition-colors disabled:opacity-50",style:{background:`${v}99`,color:c,border:`1px solid ${t}33`,fontFamily:x},onMouseEnter:p=>{p.currentTarget.style.borderColor=`${t}88`,p.currentTarget.style.background=`${E}`},onMouseLeave:p=>{p.currentTarget.style.borderColor=`${t}33`,p.currentTarget.style.background=`${v}99`},children:a},a))})]}),e.jsxs("section",{className:"w-full mt-4 flex flex-col gap-4",children:[e.jsxs("header",{className:"flex items-baseline justify-between pb-3",style:{borderBottom:`1px solid ${t}33`},children:[e.jsxs("h2",{className:"text-xl tracking-tight",style:{color:c,fontFamily:x,fontWeight:600},children:["Mission starters",e.jsx("span",{className:"ml-3 text-[10px] uppercase tracking-[0.3em]",style:{color:o,fontFamily:d},children:"saved cadence"})]}),e.jsx("span",{className:"text-[11px] tracking-wide",style:{color:o,fontFamily:d},children:"click → 3 steps → launch"})]}),e.jsx("p",{className:"text-sm leading-relaxed max-w-2xl",style:{color:o},children:"Pick a starter recipe, customize it, and launch the first run. TITAN saves the cadence with the mission request."}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3 mt-2",children:V.map(a=>e.jsx(J,{template:a,onClick:()=>k(a)},a.id))})]}),e.jsx("div",{className:"h-20"})]}),$&&e.jsx(q,{template:$,onClose:()=>k(null),onLaunch:async(a,p,f)=>{try{const w=JSON.parse(localStorage.getItem("titan-pending-schedules")??"[]");w.push({at:new Date().toISOString(),templateId:$.id,goal:a,scheduleId:p}),localStorage.setItem("titan-pending-schedules",JSON.stringify(w))}catch{}k(null),await y(a,f)}})]})}function P({onClick:s,title:n,children:i}){return e.jsx("button",{onClick:s,title:n,className:"px-3 py-1 text-[10px] uppercase tracking-[0.2em] rounded-full transition-colors",style:{color:o,border:`1px solid ${t}33`,background:"transparent",fontFamily:d},onMouseEnter:r=>{r.currentTarget.style.color=c,r.currentTarget.style.borderColor=`${t}99`},onMouseLeave:r=>{r.currentTarget.style.color=o,r.currentTarget.style.borderColor=`${t}33`},children:i})}function C({position:s}){const n={position:"absolute"};return s==="tl"&&(n.top=10,n.left=10),s==="tr"&&(n.top=10,n.right=10),s==="bl"&&(n.bottom=10,n.left=10),s==="br"&&(n.bottom=10,n.right=10),e.jsx("div",{style:{...n,width:6,height:6,borderRadius:"50%",background:t,boxShadow:`0 0 6px ${g}, inset 0 1px 0 ${g}`,opacity:.7,pointerEvents:"none"}})}function J({template:s,onClick:n}){const[i,r]=b.useState(!1);return e.jsxs("button",{type:"button",onClick:n,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),className:"text-left rounded-2xl relative overflow-hidden transition-all",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${i?t:v}`,boxShadow:i?`0 14px 36px ${j}, inset 0 1px 0 ${t}55`:`0 6px 18px ${j}, inset 0 1px 0 ${t}22`,transform:i?"translateY(-2px)":"translateY(0)",padding:"14px 16px 14px"},children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-md mb-3",style:{background:`linear-gradient(180deg, ${g} 0%, ${t} 55%, ${m} 100%)`,border:`1px solid ${m}`,boxShadow:`inset 0 1px 0 ${g}aa, 0 1px 3px ${j}`,color:F},children:[e.jsx("span",{className:"text-base leading-none",children:s.icon}),e.jsx("span",{className:"text-xs uppercase tracking-[0.16em] truncate",style:{fontFamily:x,fontWeight:700,letterSpacing:"0.12em"},children:s.title})]}),e.jsx("p",{className:"text-[13px] leading-snug mb-3",style:{color:c,opacity:.88},children:s.blurb}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.schedules.slice(0,2).map(u=>e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full",style:{background:`${v}cc`,color:c,border:`1px solid ${U}55`,fontFamily:d,opacity:.85},children:u.label},u.id)),e.jsx("span",{className:"ml-auto text-[10px] uppercase tracking-[0.2em] transition-opacity",style:{color:g,fontFamily:d,opacity:i?1:0},children:"Set up →"})]})]})}function q({template:s,onClose:n,onLaunch:i}){const[r,u]=b.useState(1),[N,$]=b.useState(()=>Object.fromEntries(s.fields.map(l=>[l.key,l.defaultValue]))),[k,S]=b.useState(s.schedules[0]),[y,a]=b.useState(!1),p=Y(s,N),f=r!==1||s.fields.every(l=>(N[l.key]??"").trim().length>0);async function w(){if(!y){a(!0);try{await i(p,k.id,s.suggestedPlayId)}finally{a(!1)}}}const B={background:`${h}aa`,color:c,border:`1px solid ${t}33`,fontFamily:x};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm p-4 md:p-8",style:{background:`${R}cc`},onClick:n,children:e.jsxs("div",{className:"relative w-full max-w-2xl rounded-2xl overflow-hidden flex flex-col",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${t}55`,boxShadow:`0 40px 100px ${j}, inset 0 1px 0 ${t}55`,color:c,fontFamily:x},onClick:l=>l.stopPropagation(),children:[e.jsx("div",{style:{height:4,background:`linear-gradient(90deg, ${m}, ${g}, ${m})`}}),e.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",style:{borderBottom:`1px solid ${t}22`},children:[e.jsx("span",{className:"text-2xl leading-none",children:s.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-sm truncate",style:{color:c},children:s.title}),e.jsxs("div",{className:"text-[11px]",style:{color:o,fontFamily:d},children:["Step ",r," of 3 · ",r===1?"Customize":r===2?"Cadence":"Launch"]})]}),e.jsx("button",{onClick:n,className:"w-8 h-8 rounded-full flex items-center justify-center text-sm",style:{background:`${h}66`,border:`1px solid ${t}33`,color:o},title:"Close",children:"✕"})]}),e.jsx("div",{className:"px-5 py-2 flex items-center gap-2",style:{borderBottom:`1px solid ${t}11`},children:[1,2,3].map(l=>e.jsx("div",{className:"h-1 flex-1 rounded-full transition-colors",style:{background:l<=r?`linear-gradient(90deg, ${t}, ${g})`:`${h}66`}},l))}),e.jsxs("div",{className:"p-5 max-h-[60vh] overflow-y-auto",children:[r===1&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:s.blurb}),s.fields.length===0&&e.jsxs("div",{className:"text-sm italic",style:{color:o},children:["This template runs as-is — no setup needed. Click ",e.jsx("b",{style:{color:c},children:"Next"})," to pick a cadence."]}),s.fields.map(l=>e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-[0.2em]",style:{color:t,fontFamily:d,fontWeight:600},children:l.label}),e.jsx("input",{value:N[l.key]??"",onChange:T=>$(O=>({...O,[l.key]:T.target.value})),placeholder:l.placeholder??l.defaultValue,className:"px-3 py-2 rounded-lg text-sm outline-none",style:B}),l.hint&&e.jsx("span",{className:"text-[11px]",style:{color:o},children:l.hint})]},l.key)),e.jsxs("div",{className:"mt-2 px-3 py-2.5 rounded-lg",style:{background:`${h}66`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Preview goal"}),e.jsx("div",{className:"text-sm leading-snug",style:{color:c},children:p})]})]}),r===2&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:"Which cadence should TITAN remember?"}),s.schedules.map(l=>{const T=l.id===k.id;return e.jsxs("button",{onClick:()=>S(l),className:"flex items-center justify-between p-3 rounded-xl text-left transition-colors",style:{background:T?`${t}1f`:`${h}55`,border:`1px solid ${T?t:`${t}22`}`,color:T?c:o},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:c},children:l.label}),e.jsx("span",{className:"text-[11px]",style:{color:o,fontFamily:d},children:l.cadence})]}),e.jsx("code",{className:"text-[10px]",style:{color:o,fontFamily:d},children:l.cron})]},l.id)}),e.jsx("div",{className:"text-[11px] italic px-1 pt-1",style:{color:o},children:"This starts the first run immediately and saves the cadence selection for recurring mission support."})]}),r===3&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:"Quick recap before we kick off."}),e.jsxs("div",{className:"rounded-xl p-4",style:{background:`${h}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"What I'll do"}),e.jsx("div",{className:"text-sm leading-relaxed",style:{color:c},children:s.whatItDoes})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[12px]",children:[e.jsxs("div",{className:"rounded-lg p-3",style:{background:`${h}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Goal"}),e.jsx("div",{className:"leading-snug",style:{color:c},children:p})]}),e.jsxs("div",{className:"rounded-lg p-3",style:{background:`${h}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Cadence"}),e.jsx("div",{className:"font-semibold",style:{color:c},children:k.label}),e.jsx("div",{className:"text-[11px] mt-0.5",style:{color:o,fontFamily:d},children:k.cadence})]})]})]})]}),e.jsxs("div",{className:"px-5 py-3 flex items-center justify-between",style:{borderTop:`1px solid ${t}22`,background:`${v}66`},children:[e.jsx("button",{onClick:()=>r>1?u(l=>l-1):n(),className:"px-4 py-2 text-sm",style:{color:o,background:"transparent",fontFamily:x},children:r>1?"← Back":"Cancel"}),r<3?e.jsx("button",{onClick:()=>u(l=>l+1),disabled:!f,className:"px-5 py-2 rounded-lg text-sm font-bold",style:{background:f?`linear-gradient(180deg, ${g} 0%, ${t} 60%, ${m} 100%)`:`${m}55`,color:F,border:`1px solid ${m}`,opacity:f?1:.5,cursor:f?"pointer":"not-allowed",fontFamily:x,letterSpacing:"0.04em"},children:"Next →"}):e.jsx("button",{onClick:w,disabled:y,className:"px-5 py-2 rounded-lg text-sm font-bold",style:{background:y?`${m}55`:`linear-gradient(180deg, ${g} 0%, ${t} 60%, ${m} 100%)`,color:F,border:`1px solid ${m}`,opacity:y?.6:1,cursor:y?"wait":"pointer",fontFamily:x,letterSpacing:"0.04em"},children:y?"Launching…":"Launch first run 🚀"})]})]})})}export{ee as default};
|
|
1
|
+
import{r as b,u as W,j as e}from"./index-BlFxPvdg.js";import{c as _}from"./missions-BUTRB5Lq.js";const G={id:"hourly",label:"Every hour",cron:"0 * * * *",cadence:"24 runs/day"},L={id:"every4h",label:"Every 4 hours",cron:"0 */4 * * *",cadence:"6 runs/day"},A={id:"every6h",label:"Every 6 hours",cron:"0 */6 * * *",cadence:"4 runs/day"},I={id:"daily7",label:"Daily at 7am",cron:"0 7 * * *",cadence:"once/day"},M={id:"weekly",label:"Weekly (Mon 9am)",cron:"0 9 * * 1",cadence:"once/week"},H={id:"nightly",label:"Nightly at 11pm",cron:"0 23 * * *",cadence:"once/day"},D={id:"twice",label:"Twice daily (7am + 7pm)",cron:"0 7,19 * * *",cadence:"2 runs/day"},V=[{id:"research-digest",icon:"📰",title:"Daily research digest",blurb:"Scout researches your topic and writes a fresh briefing for the first run.",goalTemplate:'Research the latest developments on "{{topic}}" and produce a clear HTML briefing (write_file with a .html extension) with 5 highlights, an inline SVG chart of the most important trend, and clickable source links throughout.',suggestedPlayId:"research",fields:[{key:"topic",label:"Your topic",hint:"What you want a fresh briefing on each morning",defaultValue:"AI agents in business",placeholder:"AI agents in business"}],schedules:[I,D,M],whatItDoes:"Scout searches the web for fresh developments on your topic, reads the top 5 sources end-to-end, and writes a one-page briefing. The briefing lands on your desk as a paper sheet, and the chat thread captures every URL Scout looked at so you can dig in further if anything catches your eye.",accent:{from:"#6366f1",to:"#8b5cf6"}},{id:"inbox-triage",icon:"📬",title:"Inbox triage",blurb:"Sage sorts and summarizes incoming email so important threads stay visible.",goalTemplate:'Read my inbox and produce a triaged summary: "needs reply within 24h", "informational", "newsletters", and "junk". Cap at 30 messages per run.',suggestedPlayId:"inbox",fields:[],schedules:[L,A,I],whatItDoes:"Sage opens your inbox, classifies up to 30 recent threads into four buckets (urgent / informational / newsletters / junk), and pins the urgent ones to the desk as sticky notes. The full triage lands as a paper sheet you can scan in under a minute.",accent:{from:"#06b6d4",to:"#0ea5e9"}},{id:"code-review",icon:"🔍",title:"Code review",blurb:"Builder reviews your repo changes and reports only meaningful findings.",goalTemplate:"Review the diff in {{repoPath}} since the last review. Flag bugs, regressions, and obvious improvements. Don't nitpick formatting.",suggestedPlayId:"code-review",fields:[{key:"repoPath",label:"Repo path or URL",hint:"Local path on the host, or a GitHub repo URL",defaultValue:"~/Desktop/MyProject",placeholder:"~/projects/repo"}],schedules:[H,D],whatItDoes:"Builder pulls the latest changes from your repo and writes a concise review focused on real defects (logic bugs, regressions, security smells). Formatting nits are skipped. Findings land as a paper sheet; if there's nothing to report, Builder closes silently.",accent:{from:"#22c55e",to:"#10b981"}},{id:"lead-scout",icon:"🎯",title:"Lead scout",blurb:"Scout scans freelance + opportunity boards and surfaces matches for your skills.",goalTemplate:'Scan Upwork, Indeed, and HackerNews "who is hiring" for new postings matching: {{skills}}. Filter to budget >= ${{minBudget}} and remote OK.',suggestedPlayId:"lead-scout",fields:[{key:"skills",label:"Skills to match",hint:"Comma-separated keywords. Scout fuzzy-matches.",defaultValue:"TypeScript, Node.js, AI agents",placeholder:"React, Python, design"},{key:"minBudget",label:"Minimum budget (USD)",hint:"Skip postings paying less.",defaultValue:"500"}],schedules:[L,A,I],whatItDoes:"Scout sweeps the boards you care about for postings that match your skill keywords and budget floor. New matches land as sticky notes; the running log of every posting seen sits as a paper sheet you can browse anytime.",accent:{from:"#f59e0b",to:"#eab308"}},{id:"market-watch",icon:"📈",title:"Market watch",blurb:"Analyst tracks tickers + crypto and writes a brief if anything moves >3%.",goalTemplate:"Check the latest price + 24h move for: {{tickers}}. If any moved more than 3% (up or down) since the last run, produce an HTML brief (write_file with a .html extension) with a sparkline SVG per ticker and a one-paragraph explanation with 2 source links.",suggestedPlayId:"analyst",fields:[{key:"tickers",label:"Tickers / coins",hint:"Comma-separated. Stocks or crypto.",defaultValue:"BTC, ETH, NVDA, AAPL",placeholder:"TSLA, SPY, BTC"}],schedules:[G,L,A],whatItDoes:"Each cycle, Analyst pulls the latest price and 24-hour move for every ticker you listed. If anything jumped or dropped more than 3%, it writes a one-paragraph explanation with 2 source links. Quiet runs close silently — your desk only fills up when something actually moved.",accent:{from:"#ef4444",to:"#f97316"}},{id:"creative-prompts",icon:"🎨",title:"Daily creative prompt",blurb:"Writer creates a fresh writing, sketching, or music prompt for the first run.",goalTemplate:"Generate a fresh {{discipline}} prompt for me today. Make it specific enough to start in 5 minutes but open enough to take in any direction. Include a 1-line warm-up exercise.",fields:[{key:"discipline",label:"Discipline",hint:"What kind of prompt you want.",defaultValue:"songwriting",placeholder:"short fiction · songwriting · sketching"}],schedules:[I,M],whatItDoes:"Writer creates one fresh creative prompt tailored to the discipline you chose, with a quick warm-up exercise to get started. The prompt lands as a sticky note on the desk so you can grab it when you need it.",accent:{from:"#ec4899",to:"#8b5cf6"}}];function Y(s,n){return s.goalTemplate.replace(/\{\{(\w+)\}\}/g,(i,r)=>{const u=n[r];return u&&u.trim().length>0?u.trim():r})}const z=["Plan my mom's 70th birthday party","Write a thank-you note to my landlord","Summarize this long email I got","Draft the Q1 investor update","Review a code change"],x="var(--theme-font-display, 'Iowan Old Style', 'Charter', Georgia, serif)",d="var(--theme-font-mono, 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace)",c="var(--theme-paper, #f3e9d0)",o="var(--theme-ink-soft, #a0a8d0)",t="var(--theme-metal, #c4a35a)",g="var(--theme-metal-bright, #f3d27a)",m="var(--theme-metal-dark, #8a6a3a)",F="var(--theme-bolt, #2a1808)",E="var(--theme-leather, #4a2818)",v="var(--theme-leather-edge, #2a1408)",U="var(--theme-leather-stitch, #d4a060)",h="var(--theme-bg-base, #1a1235)",R="var(--theme-bg-grain, #0e0820)",K="var(--theme-bg-vignette, rgba(0,0,0,0.6))",j="var(--theme-shadow, rgba(0,0,0,0.55))",Q="var(--theme-accent, #c45a30)";function ee(){const[s,n]=b.useState(""),[i,r]=b.useState(!1),[u,N]=b.useState(null),[$,k]=b.useState(null),S=W();async function y(a,p){const f=a.trim();if(!(!f||i)){r(!0),N(null);try{const{mission:w}=await _(f,p);S(`/mission/${w.id}`)}catch(w){N(w.message),r(!1)}}}return e.jsxs("div",{className:"min-h-full w-full flex flex-col items-center",style:{color:c,fontFamily:x,background:`radial-gradient(120% 80% at 50% -10%, ${R} 0%, ${h} 60%, ${h} 100%)`},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:`radial-gradient(circle at 50% 12%, ${Q}22 0%, transparent 55%)`}}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{boxShadow:`inset 0 0 240px 60px ${K}`}}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-8 w-full max-w-5xl px-6 pt-10 pb-28 md:py-14",children:[e.jsxs("div",{className:"w-full flex items-center",style:{paddingRight:260},children:[e.jsxs("div",{className:"flex items-center gap-3 text-[11px] uppercase tracking-[0.3em]",style:{color:o,fontFamily:d},children:[e.jsx("span",{style:{color:g,fontWeight:700},children:"TITAN"}),e.jsx("span",{style:{opacity:.6},children:"·"}),e.jsx("span",{children:"MISSION CONTROL"})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsx(P,{onClick:()=>S("/mission/library"),title:"See your past missions",children:"Past missions →"}),e.jsx(P,{onClick:()=>S("/space/home"),title:"Back to the canvas spaces",children:"🌌 Canvas"})]})]}),e.jsxs("section",{className:"relative w-full max-w-3xl rounded-3xl overflow-hidden",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${v}`,boxShadow:`0 30px 80px ${j}, inset 0 1px 0 ${t}33`,padding:"36px 36px 28px"},children:[e.jsx(C,{position:"tl"}),e.jsx(C,{position:"tr"}),e.jsx(C,{position:"bl"}),e.jsx(C,{position:"br"}),e.jsx("div",{className:"text-[10px] uppercase tracking-[0.4em] mb-3",style:{color:t,fontFamily:d,fontWeight:600},children:"◆ New Mission"}),e.jsx("h1",{className:"text-4xl md:text-5xl tracking-tight",style:{color:c,fontFamily:x,fontWeight:600,letterSpacing:0,textShadow:`0 2px 12px ${j}`},children:"What's the mission?"}),e.jsx("p",{className:"mt-3 text-[15px] leading-relaxed max-w-xl",style:{color:o},children:"Tell me anything — a thank-you note, a birthday plan, a Q1 report. I’ll assemble a small team of AI specialists and we’ll work it out together."}),e.jsxs("form",{onSubmit:a=>{a.preventDefault(),y(s)},className:"mt-6 flex flex-col gap-3",children:[e.jsx("textarea",{autoFocus:!0,value:s,onChange:a=>n(a.target.value),placeholder:"Try: Help me write a birthday speech for my mom",rows:3,disabled:i,className:"w-full resize-none outline-none rounded-2xl px-5 py-4 text-base leading-relaxed",style:{background:`${h}80`,color:c,border:`1px solid ${t}44`,fontFamily:x,boxShadow:`inset 0 2px 8px ${j}`},onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&a.key==="Enter"&&(a.preventDefault(),y(s))}}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-[11px] tracking-wide",style:{color:o,fontFamily:d},children:"⌘↵ to dispatch · voice coming soon"}),e.jsxs("div",{className:"flex w-full items-center gap-2 sm:w-auto",children:[e.jsx("button",{type:"button",disabled:!0,title:"Voice is coming next release",className:"w-11 h-11 rounded-full flex items-center justify-center cursor-not-allowed",style:{background:`${h}66`,border:`1px solid ${t}33`,color:o,opacity:.55},children:"🎤"}),e.jsx("button",{type:"submit",disabled:!s.trim()||i,className:"h-11 flex-1 rounded-xl px-5 text-sm font-bold tracking-wide transition-transform sm:flex-none",style:{background:s.trim()&&!i?`linear-gradient(180deg, ${g} 0%, ${t} 60%, ${m} 100%)`:`${m}66`,color:s.trim()&&!i?F:o,border:`1px solid ${m}`,boxShadow:s.trim()&&!i?`0 6px 18px ${j}, inset 0 1px 0 ${g}`:"none",cursor:s.trim()&&!i?"pointer":"not-allowed",fontFamily:x,letterSpacing:"0.04em"},onMouseDown:a=>{s.trim()&&!i&&(a.currentTarget.style.transform="translateY(1px)")},onMouseUp:a=>{a.currentTarget.style.transform=""},onMouseLeave:a=>{a.currentTarget.style.transform=""},children:i?"Dispatching…":"Start mission →"})]})]})]}),u&&e.jsx("div",{className:"mt-4 text-sm rounded-lg px-3 py-2",style:{color:"#ffb4a8",background:"#5a1a1a55",border:"1px solid #8a3a3a"},children:u})]}),e.jsxs("div",{className:"w-full max-w-3xl flex flex-col items-center gap-3",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.35em]",style:{color:o,fontFamily:d},children:"— or try a one-shot —"}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:z.map(a=>e.jsx("button",{type:"button",onClick:()=>y(a),disabled:i,className:"px-3 py-1.5 text-xs rounded-full transition-colors disabled:opacity-50",style:{background:`${v}99`,color:c,border:`1px solid ${t}33`,fontFamily:x},onMouseEnter:p=>{p.currentTarget.style.borderColor=`${t}88`,p.currentTarget.style.background=`${E}`},onMouseLeave:p=>{p.currentTarget.style.borderColor=`${t}33`,p.currentTarget.style.background=`${v}99`},children:a},a))})]}),e.jsxs("section",{className:"w-full mt-4 flex flex-col gap-4",children:[e.jsxs("header",{className:"flex items-baseline justify-between pb-3",style:{borderBottom:`1px solid ${t}33`},children:[e.jsxs("h2",{className:"text-xl tracking-tight",style:{color:c,fontFamily:x,fontWeight:600},children:["Mission starters",e.jsx("span",{className:"ml-3 text-[10px] uppercase tracking-[0.3em]",style:{color:o,fontFamily:d},children:"saved cadence"})]}),e.jsx("span",{className:"text-[11px] tracking-wide",style:{color:o,fontFamily:d},children:"click → 3 steps → launch"})]}),e.jsx("p",{className:"text-sm leading-relaxed max-w-2xl",style:{color:o},children:"Pick a starter recipe, customize it, and launch the first run. TITAN saves the cadence with the mission request."}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3 mt-2",children:V.map(a=>e.jsx(J,{template:a,onClick:()=>k(a)},a.id))})]}),e.jsx("div",{className:"h-20"})]}),$&&e.jsx(q,{template:$,onClose:()=>k(null),onLaunch:async(a,p,f)=>{try{const w=JSON.parse(localStorage.getItem("titan-pending-schedules")??"[]");w.push({at:new Date().toISOString(),templateId:$.id,goal:a,scheduleId:p}),localStorage.setItem("titan-pending-schedules",JSON.stringify(w))}catch{}k(null),await y(a,f)}})]})}function P({onClick:s,title:n,children:i}){return e.jsx("button",{onClick:s,title:n,className:"px-3 py-1 text-[10px] uppercase tracking-[0.2em] rounded-full transition-colors",style:{color:o,border:`1px solid ${t}33`,background:"transparent",fontFamily:d},onMouseEnter:r=>{r.currentTarget.style.color=c,r.currentTarget.style.borderColor=`${t}99`},onMouseLeave:r=>{r.currentTarget.style.color=o,r.currentTarget.style.borderColor=`${t}33`},children:i})}function C({position:s}){const n={position:"absolute"};return s==="tl"&&(n.top=10,n.left=10),s==="tr"&&(n.top=10,n.right=10),s==="bl"&&(n.bottom=10,n.left=10),s==="br"&&(n.bottom=10,n.right=10),e.jsx("div",{style:{...n,width:6,height:6,borderRadius:"50%",background:t,boxShadow:`0 0 6px ${g}, inset 0 1px 0 ${g}`,opacity:.7,pointerEvents:"none"}})}function J({template:s,onClick:n}){const[i,r]=b.useState(!1);return e.jsxs("button",{type:"button",onClick:n,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),className:"text-left rounded-2xl relative overflow-hidden transition-all",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${i?t:v}`,boxShadow:i?`0 14px 36px ${j}, inset 0 1px 0 ${t}55`:`0 6px 18px ${j}, inset 0 1px 0 ${t}22`,transform:i?"translateY(-2px)":"translateY(0)",padding:"14px 16px 14px"},children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-md mb-3",style:{background:`linear-gradient(180deg, ${g} 0%, ${t} 55%, ${m} 100%)`,border:`1px solid ${m}`,boxShadow:`inset 0 1px 0 ${g}aa, 0 1px 3px ${j}`,color:F},children:[e.jsx("span",{className:"text-base leading-none",children:s.icon}),e.jsx("span",{className:"text-xs uppercase tracking-[0.16em] truncate",style:{fontFamily:x,fontWeight:700,letterSpacing:"0.12em"},children:s.title})]}),e.jsx("p",{className:"text-[13px] leading-snug mb-3",style:{color:c,opacity:.88},children:s.blurb}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.schedules.slice(0,2).map(u=>e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full",style:{background:`${v}cc`,color:c,border:`1px solid ${U}55`,fontFamily:d,opacity:.85},children:u.label},u.id)),e.jsx("span",{className:"ml-auto text-[10px] uppercase tracking-[0.2em] transition-opacity",style:{color:g,fontFamily:d,opacity:i?1:0},children:"Set up →"})]})]})}function q({template:s,onClose:n,onLaunch:i}){const[r,u]=b.useState(1),[N,$]=b.useState(()=>Object.fromEntries(s.fields.map(l=>[l.key,l.defaultValue]))),[k,S]=b.useState(s.schedules[0]),[y,a]=b.useState(!1),p=Y(s,N),f=r!==1||s.fields.every(l=>(N[l.key]??"").trim().length>0);async function w(){if(!y){a(!0);try{await i(p,k.id,s.suggestedPlayId)}finally{a(!1)}}}const B={background:`${h}aa`,color:c,border:`1px solid ${t}33`,fontFamily:x};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm p-4 md:p-8",style:{background:`${R}cc`},onClick:n,children:e.jsxs("div",{className:"relative w-full max-w-2xl rounded-2xl overflow-hidden flex flex-col",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${t}55`,boxShadow:`0 40px 100px ${j}, inset 0 1px 0 ${t}55`,color:c,fontFamily:x},onClick:l=>l.stopPropagation(),children:[e.jsx("div",{style:{height:4,background:`linear-gradient(90deg, ${m}, ${g}, ${m})`}}),e.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",style:{borderBottom:`1px solid ${t}22`},children:[e.jsx("span",{className:"text-2xl leading-none",children:s.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-sm truncate",style:{color:c},children:s.title}),e.jsxs("div",{className:"text-[11px]",style:{color:o,fontFamily:d},children:["Step ",r," of 3 · ",r===1?"Customize":r===2?"Cadence":"Launch"]})]}),e.jsx("button",{onClick:n,className:"w-8 h-8 rounded-full flex items-center justify-center text-sm",style:{background:`${h}66`,border:`1px solid ${t}33`,color:o},title:"Close",children:"✕"})]}),e.jsx("div",{className:"px-5 py-2 flex items-center gap-2",style:{borderBottom:`1px solid ${t}11`},children:[1,2,3].map(l=>e.jsx("div",{className:"h-1 flex-1 rounded-full transition-colors",style:{background:l<=r?`linear-gradient(90deg, ${t}, ${g})`:`${h}66`}},l))}),e.jsxs("div",{className:"p-5 max-h-[60vh] overflow-y-auto",children:[r===1&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:s.blurb}),s.fields.length===0&&e.jsxs("div",{className:"text-sm italic",style:{color:o},children:["This template runs as-is — no setup needed. Click ",e.jsx("b",{style:{color:c},children:"Next"})," to pick a cadence."]}),s.fields.map(l=>e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-[0.2em]",style:{color:t,fontFamily:d,fontWeight:600},children:l.label}),e.jsx("input",{value:N[l.key]??"",onChange:T=>$(O=>({...O,[l.key]:T.target.value})),placeholder:l.placeholder??l.defaultValue,className:"px-3 py-2 rounded-lg text-sm outline-none",style:B}),l.hint&&e.jsx("span",{className:"text-[11px]",style:{color:o},children:l.hint})]},l.key)),e.jsxs("div",{className:"mt-2 px-3 py-2.5 rounded-lg",style:{background:`${h}66`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Preview goal"}),e.jsx("div",{className:"text-sm leading-snug",style:{color:c},children:p})]})]}),r===2&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:"Which cadence should TITAN remember?"}),s.schedules.map(l=>{const T=l.id===k.id;return e.jsxs("button",{onClick:()=>S(l),className:"flex items-center justify-between p-3 rounded-xl text-left transition-colors",style:{background:T?`${t}1f`:`${h}55`,border:`1px solid ${T?t:`${t}22`}`,color:T?c:o},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:c},children:l.label}),e.jsx("span",{className:"text-[11px]",style:{color:o,fontFamily:d},children:l.cadence})]}),e.jsx("code",{className:"text-[10px]",style:{color:o,fontFamily:d},children:l.cron})]},l.id)}),e.jsx("div",{className:"text-[11px] italic px-1 pt-1",style:{color:o},children:"This starts the first run immediately and saves the cadence selection for recurring mission support."})]}),r===3&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:"Quick recap before we kick off."}),e.jsxs("div",{className:"rounded-xl p-4",style:{background:`${h}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"What I'll do"}),e.jsx("div",{className:"text-sm leading-relaxed",style:{color:c},children:s.whatItDoes})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[12px]",children:[e.jsxs("div",{className:"rounded-lg p-3",style:{background:`${h}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Goal"}),e.jsx("div",{className:"leading-snug",style:{color:c},children:p})]}),e.jsxs("div",{className:"rounded-lg p-3",style:{background:`${h}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Cadence"}),e.jsx("div",{className:"font-semibold",style:{color:c},children:k.label}),e.jsx("div",{className:"text-[11px] mt-0.5",style:{color:o,fontFamily:d},children:k.cadence})]})]})]})]}),e.jsxs("div",{className:"px-5 py-3 flex items-center justify-between",style:{borderTop:`1px solid ${t}22`,background:`${v}66`},children:[e.jsx("button",{onClick:()=>r>1?u(l=>l-1):n(),className:"px-4 py-2 text-sm",style:{color:o,background:"transparent",fontFamily:x},children:r>1?"← Back":"Cancel"}),r<3?e.jsx("button",{onClick:()=>u(l=>l+1),disabled:!f,className:"px-5 py-2 rounded-lg text-sm font-bold",style:{background:f?`linear-gradient(180deg, ${g} 0%, ${t} 60%, ${m} 100%)`:`${m}55`,color:F,border:`1px solid ${m}`,opacity:f?1:.5,cursor:f?"pointer":"not-allowed",fontFamily:x,letterSpacing:"0.04em"},children:"Next →"}):e.jsx("button",{onClick:w,disabled:y,className:"px-5 py-2 rounded-lg text-sm font-bold",style:{background:y?`${m}55`:`linear-gradient(180deg, ${g} 0%, ${t} 60%, ${m} 100%)`,color:F,border:`1px solid ${m}`,opacity:y?.6:1,cursor:y?"wait":"pointer",fontFamily:x,letterSpacing:"0.04em"},children:y?"Launching…":"Launch first run 🚀"})]})]})})}export{ee as default};
|