titan-agent 6.1.0-beta.2 → 6.1.0-beta.21
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/LICENSE +1 -29
- package/README.md +1 -1
- package/dist/agent/agentLessons.js +2 -2
- package/dist/agent/agentLessons.js.map +1 -1
- package/dist/agent/autoModeClassifier.js +95 -0
- package/dist/agent/autoModeClassifier.js.map +1 -0
- package/dist/agent/durableJournal.js +2 -2
- package/dist/agent/durableJournal.js.map +1 -1
- package/dist/agent/goalDriver.js +67 -0
- package/dist/agent/goalDriver.js.map +1 -1
- package/dist/agent/goalPlanFile.js +3 -3
- package/dist/agent/goalPlanFile.js.map +1 -1
- package/dist/agent/missionLifecycle.js +2 -2
- package/dist/agent/missionLifecycle.js.map +1 -1
- package/dist/agent/subAgent.js +41 -0
- package/dist/agent/subAgent.js.map +1 -1
- package/dist/agent/toolContract.js +49 -0
- package/dist/agent/toolContract.js.map +1 -0
- package/dist/agent/toolRunner.js +72 -11
- package/dist/agent/toolRunner.js.map +1 -1
- package/dist/agent/trajectoryRecorder.js +185 -0
- package/dist/agent/trajectoryRecorder.js.map +1 -0
- package/dist/agent/verification.js +164 -0
- package/dist/agent/verification.js.map +1 -0
- package/dist/agent/worktreeExecutor.js +207 -0
- package/dist/agent/worktreeExecutor.js.map +1 -0
- package/dist/config/schema.js +28 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/gateway/server.js +54 -0
- package/dist/gateway/server.js.map +1 -1
- package/dist/memory/facade.js +137 -0
- package/dist/memory/facade.js.map +1 -0
- package/dist/migrations/003-soma-profile-default.js +2 -2
- package/dist/migrations/003-soma-profile-default.js.map +1 -1
- package/dist/migrations/005-route-redirects.js +3 -1
- package/dist/migrations/005-route-redirects.js.map +1 -1
- package/dist/migrations/runner.js +2 -2
- package/dist/migrations/runner.js.map +1 -1
- package/dist/providers/defaultModel.js +14 -0
- package/dist/providers/defaultModel.js.map +1 -1
- package/dist/providers/router.js +4 -0
- package/dist/providers/router.js.map +1 -1
- package/dist/providers/stub.js +185 -0
- package/dist/providers/stub.js.map +1 -0
- package/dist/skills/builtin/backup.js +1 -2
- package/dist/skills/builtin/backup.js.map +1 -1
- package/dist/skills/builtin/contracts.js +254 -0
- package/dist/skills/builtin/contracts.js.map +1 -0
- package/dist/skills/builtin/download_image.js +9 -0
- package/dist/skills/builtin/download_image.js.map +1 -1
- package/dist/skills/builtin/filesystem.js +70 -20
- package/dist/skills/builtin/filesystem.js.map +1 -1
- package/dist/skills/registry.js +7 -0
- package/dist/skills/registry.js.map +1 -1
- package/dist/storage/patterns.js +2 -2
- package/dist/storage/patterns.js.map +1 -1
- package/dist/storage/personalGallery.js +2 -2
- package/dist/storage/personalGallery.js.map +1 -1
- package/dist/storage/somaProfile.js +2 -2
- package/dist/storage/somaProfile.js.map +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/package.json +2 -2
- package/ui/dist/assets/{AuditPanel-DrDvXZ9u.js → AuditPanel-RNrvKmfX.js} +1 -1
- package/ui/dist/assets/{AutonomyPanel-BfhW-PRX.js → AutonomyPanel-D0nmt79R.js} +2 -2
- package/ui/dist/assets/{AutopilotPanel-C3yQBxAp.js → AutopilotPanel-DlcdfRRy.js} +1 -1
- package/ui/dist/assets/{AutoresearchPanel-BgpR3EcK.js → AutoresearchPanel-CXeO6kGK.js} +2 -2
- package/ui/dist/assets/BackupPanel-CKb-cDsk.js +1 -0
- package/ui/dist/assets/{BrowserPanel-BNaKZOnn.js → BrowserPanel-CDaoF6n5.js} +1 -1
- package/ui/dist/assets/CPActivity-BZbeztg1.js +1 -0
- package/ui/dist/assets/CPAgentDetail-C9fvLxKi.js +1 -0
- package/ui/dist/assets/CPAgents-BsBA9kb2.js +1 -0
- package/ui/dist/assets/CPApprovals-Di5itVIK.js +1 -0
- package/ui/dist/assets/CPCosts-DmgckHli.js +1 -0
- package/ui/dist/assets/CPDashboard-CmSb7woK.js +1 -0
- package/ui/dist/assets/{CPFiles-CUpP5I82.js → CPFiles-Dd0NGcpX.js} +1 -1
- package/ui/dist/assets/CPGoals-DeILFq0A.js +1 -0
- package/ui/dist/assets/{CPInbox-DUW_hntB.js → CPInbox-DAtidZez.js} +2 -2
- package/ui/dist/assets/CPIssueDetail-BvwoGI57.js +1 -0
- package/ui/dist/assets/CPIssues-CZ1hIKDP.js +1 -0
- package/ui/dist/assets/{CPLayout-J0fa-it4.js → CPLayout-luPwhNpA.js} +3 -3
- package/ui/dist/assets/CPOrg-BlYp_KP6.js +8 -0
- package/ui/dist/assets/CPRuns-D0HMCjIo.js +1 -0
- package/ui/dist/assets/{CPSocial-By_FStZ4.js → CPSocial-CZaGi14s.js} +2 -2
- package/ui/dist/assets/ChannelsPanel-khiBHwx3.js +1 -0
- package/ui/dist/assets/{CheckpointsPanel-DvKUd2VF.js → CheckpointsPanel-n2y3jzzT.js} +1 -1
- package/ui/dist/assets/{CommandPostHub-CQqRYBjf.js → CommandPostHub-iWf-zt5p.js} +4 -4
- package/ui/dist/assets/{CronPanel-Brmnnu8_.js → CronPanel-BkRJl8u6.js} +1 -1
- package/ui/dist/assets/{DataTable-seaktPzB.js → DataTable-DZ2cG3Cv.js} +1 -1
- package/ui/dist/assets/{DreamPanel-CO7iSdjn.js → DreamPanel-DF6l0WB-.js} +1 -1
- package/ui/dist/assets/{EmptyState-CmK9fywh.js → EmptyState-D7xwm8hA.js} +1 -1
- package/ui/dist/assets/{EvalHarnessPanel-2RVBKbym.js → EvalHarnessPanel-BHabu49z.js} +2 -2
- package/ui/dist/assets/{EvalPanel-CqAwhFQ5.js → EvalPanel-yAesMLSP.js} +1 -1
- package/ui/dist/assets/{FileViewer-D98m-vF5.js → FileViewer-DOWUQccc.js} +52 -14
- package/ui/dist/assets/{FilesPanel-dRQM0apb.js → FilesPanel-BjuDhqaX.js} +2 -2
- package/ui/dist/assets/FleetPanel-B0ZhS2XX.js +1 -0
- package/ui/dist/assets/{HomelabPanel-DjMUrO2B.js → HomelabPanel-D373ddvj.js} +1 -1
- package/ui/dist/assets/InfraView-CI99NZbI.js +2 -0
- package/ui/dist/assets/InlineEditableField-fDk3eGVo.js +1 -0
- package/ui/dist/assets/Input-j10hONMY.js +1 -0
- package/ui/dist/assets/IntegrationsPanel-kPa5Qq-f.js +1 -0
- package/ui/dist/assets/IntelligenceView-DeKBaAlY.js +2 -0
- package/ui/dist/assets/LearningPanel-B8tqHeEZ.js +1 -0
- package/ui/dist/assets/{LogsPanel-Bs9IsTCH.js → LogsPanel-sXc__trb.js} +1 -1
- package/ui/dist/assets/McpPanel-DEr8pZwB.js +1 -0
- package/ui/dist/assets/{MemoryGraphPanel-F1P9COyY.js → MemoryGraphPanel-DZl7USJ6.js} +1 -1
- package/ui/dist/assets/MemoryWikiPanel-DTNVWvVT.js +11 -0
- package/ui/dist/assets/{MeshPanel-CgIAh5ZX.js → MeshPanel-b77zyQx4.js} +1 -1
- package/ui/dist/assets/MissionCanvas-D_quSl5F.js +69 -0
- package/ui/dist/assets/MissionChat-rQ5rUPAt.js +7 -0
- package/ui/dist/assets/MissionLibrary-Cxw7sLxv.js +5 -0
- package/ui/dist/assets/MissionStart-ChMWO1rr.js +1 -0
- package/ui/dist/assets/Modal-Dl5b6Yaj.js +1 -0
- package/ui/dist/assets/NvidiaPanel-D7qFbbeJ.js +1 -0
- package/ui/dist/assets/{OrganismPanel-CNZM3eof.js → OrganismPanel-EiQ9Gfqx.js} +1 -1
- package/ui/dist/assets/OverviewPanel-Bectj1Z5.js +1 -0
- package/ui/dist/assets/{PageHeader-llOXO43Z.js → PageHeader-CiuoyvDR.js} +1 -1
- package/ui/dist/assets/{PersonaProfilesPanel-CfsQTMra.js → PersonaProfilesPanel-BO87DSVG.js} +1 -1
- package/ui/dist/assets/{PersonasPanel-DIac_kZ3.js → PersonasPanel-BNogLwM0.js} +1 -1
- package/ui/dist/assets/RecipesPanel-DyqfWlaY.js +1 -0
- package/ui/dist/assets/{SecurityPanel-_gqMk8hJ.js → SecurityPanel-OMC-Tvbz.js} +1 -1
- package/ui/dist/assets/SelfImprovePanel-DXIfG_df.js +1 -0
- package/ui/dist/assets/{SelfProposalsPanel-DuA0zsGH.js → SelfProposalsPanel-CmgEz1TQ.js} +2 -2
- package/ui/dist/assets/SessionsPanel-gJXosEGf.js +1 -0
- package/ui/dist/assets/{SessionsTab-bFYaFvTZ.js → SessionsTab-BOVzzjTO.js} +1 -1
- package/ui/dist/assets/SettingsPanel-DifFGEvi.js +1 -0
- package/ui/dist/assets/SettingsView-BNpj0iym.js +2 -0
- package/ui/dist/assets/SkeletonLoader-CNSsfH3f.js +1 -0
- package/ui/dist/assets/{SkillsPanel-D08WcRGp.js → SkillsPanel-6fbRov-m.js} +1 -1
- package/ui/dist/assets/{SomaView-CYukE7Fp.js → SomaView-D3boPl5D.js} +1 -1
- package/ui/dist/assets/{StatCard-DT4Bx1mY.js → StatCard-2BmOlamJ.js} +1 -1
- package/ui/dist/assets/StatusBadge-CdVHF1nG.js +1 -0
- package/ui/dist/assets/Tabs-DW9ytf9H.js +1 -0
- package/ui/dist/assets/{TeamsPanel-DOBe72TK.js → TeamsPanel-CNaQ8Dbw.js} +1 -1
- package/ui/dist/assets/TelemetryPanel-DL81QlAW.js +1 -0
- package/ui/dist/assets/TitanCanvas-DLIN_wV3.js +1152 -0
- package/ui/dist/assets/ToolsView-BlChEE4n.js +2 -0
- package/ui/dist/assets/Tooltip-oR5JnwoN.js +6 -0
- package/ui/dist/assets/{TraceViewer-0bCz0x_a.js → TraceViewer-DtJXjCXV.js} +1 -1
- package/ui/dist/assets/TrainingPanel-4XMGaRN_.js +1 -0
- package/ui/dist/assets/{VoiceOverlay-B08Sw918.js → VoiceOverlay-B3fXJ-EC.js} +1 -1
- package/ui/dist/assets/{VramPanel-CJiic8y4.js → VramPanel-HisAYiqI.js} +1 -1
- package/ui/dist/assets/{WatchView-CaQMDEAy.js → WatchView-C92y0hU7.js} +1 -1
- package/ui/dist/assets/{WorkTab-D5bi2WRi.js → WorkTab-BYAWcvA1.js} +1 -1
- package/ui/dist/assets/{WorkflowsPanel-DdY6E93C.js → WorkflowsPanel-D2DiOBLA.js} +1 -1
- package/ui/dist/assets/{arrow-left-CHJyrO8S.js → arrow-left-thXQMJQ6.js} +1 -1
- package/ui/dist/assets/{briefcase-ROIEmiah.js → briefcase-ByMhDqlL.js} +1 -1
- package/ui/dist/assets/{chart-column-wFkjV3Ni.js → chart-column-CYHJVuxN.js} +1 -1
- package/ui/dist/assets/{check-BcOm5jPO.js → check-ChWLFWCx.js} +1 -1
- package/ui/dist/assets/{chevron-down-CM11GPpR.js → chevron-down-CU_O_5h3.js} +1 -1
- package/ui/dist/assets/{chevron-right-aFDDgFsL.js → chevron-right-DAiXsK24.js} +1 -1
- package/ui/dist/assets/{chevron-up-D6g7FB6i.js → chevron-up-BudRYwvy.js} +1 -1
- package/ui/dist/assets/{circle-check-big-DPz64kZW.js → circle-check-big-gkA-V2JW.js} +1 -1
- package/ui/dist/assets/{clock-BbCCaukN.js → clock-qO5kIED9.js} +1 -1
- package/ui/dist/assets/clsx-B-dksMZM.js +1 -0
- package/ui/dist/assets/{dollar-sign-Dy5-qkg3.js → dollar-sign-1gQNJK3V.js} +1 -1
- package/ui/dist/assets/{download-DjheLEns.js → download-DMD1m87c.js} +1 -1
- package/ui/dist/assets/{external-link-BgxGF7ZQ.js → external-link-ByafQkZ7.js} +1 -1
- package/ui/dist/assets/{folder-DY4eeMdo.js → folder-DeG4RuOD.js} +1 -1
- package/ui/dist/assets/{funnel-LWmcwhj-.js → funnel-wE8i5V9Y.js} +1 -1
- package/ui/dist/assets/{git-branch-CPZciK10.js → git-branch-BWSuK1LU.js} +1 -1
- package/ui/dist/assets/index-B8YEFBRH.js +277 -0
- package/ui/dist/assets/index-Cb5bSxRB.css +1 -0
- package/ui/dist/assets/{layers-Bn7bgu2Z.js → layers-tN-wIpE0.js} +1 -1
- package/ui/dist/assets/{legacy-BVPeht6t.js → legacy-BSZBdyop.js} +2 -2
- package/ui/dist/assets/{lightbulb-tzuCyEQk.js → lightbulb-TUHKCda3.js} +1 -1
- package/ui/dist/assets/{list-todo-say4NbSw.js → list-todo-DtxcUGz2.js} +1 -1
- package/ui/dist/assets/{missions-DbC8UmMc.js → missions-C3EC4uKT.js} +1 -1
- package/ui/dist/assets/{network-v9O7MmZT.js → network-ephW7nah.js} +1 -1
- package/ui/dist/assets/{pause-CZo33QlA.js → pause-DeggUVZc.js} +1 -1
- package/ui/dist/assets/{play-DbCJhc5H.js → play-Dfc0ia6v.js} +1 -1
- package/ui/dist/assets/{plug-CtpCZg2z.js → plug-Bl_6i_9u.js} +1 -1
- package/ui/dist/assets/{plus-O61rB_YF.js → plus-CQwCh7WY.js} +1 -1
- package/ui/dist/assets/{proxy-BAUTNyg6.js → proxy-BjQ4lsww.js} +1 -1
- package/ui/dist/assets/{rotate-ccw-n5WkWR51.js → rotate-ccw-CUuN2ebi.js} +1 -1
- package/ui/dist/assets/{save-D2Qh8KyN.js → save-PlTUvsN5.js} +1 -1
- package/ui/dist/assets/{search-C9SdcZJq.js → search-BHgLDT-j.js} +1 -1
- package/ui/dist/assets/{send-DZ_5M5QQ.js → send-pflQNBoT.js} +1 -1
- package/ui/dist/assets/{shield-check-DyP5PmaY.js → shield-check-CrD-s89i.js} +1 -1
- package/ui/dist/assets/{target-CWfn705s.js → target-D4oh8GME.js} +1 -1
- package/ui/dist/assets/{terminal-CdhfA0Kr.js → terminal-BvJZ1R3x.js} +1 -1
- package/ui/dist/assets/{toggle-right-CmYQLQRS.js → toggle-right-Dl7x_ed7.js} +1 -1
- package/ui/dist/assets/{trash-2-TQcEJEv4.js → trash-2-lPcFwnW5.js} +1 -1
- package/ui/dist/assets/{trending-up-Cw22bM4J.js → trending-up-DqUbZfDe.js} +1 -1
- package/ui/dist/assets/{trophy-DUF8Bcas.js → trophy-Dv6zFfKM.js} +1 -1
- package/ui/dist/assets/{users-BX_ZaByZ.js → users-NPyAWbs5.js} +1 -1
- package/ui/dist/assets/{wrench-Cfp7nYhG.js → wrench-BCKgeHj3.js} +1 -1
- package/ui/dist/index.html +2 -2
- package/ui/dist/sw.js +1 -1
- package/ui/dist/assets/BackupPanel-BNxMlNIP.js +0 -1
- package/ui/dist/assets/CPActivity-CjIgehOq.js +0 -1
- package/ui/dist/assets/CPAgentDetail-oaymYRNI.js +0 -1
- package/ui/dist/assets/CPAgents-CWQ6iJfO.js +0 -1
- package/ui/dist/assets/CPApprovals-DzATBhtM.js +0 -1
- package/ui/dist/assets/CPCosts-xVQR148_.js +0 -1
- package/ui/dist/assets/CPDashboard-Dt6Jr7Zw.js +0 -1
- package/ui/dist/assets/CPGoals-Bt1a3C9T.js +0 -1
- package/ui/dist/assets/CPIssueDetail-DHxqtiuh.js +0 -1
- package/ui/dist/assets/CPIssues-D0l3fgUs.js +0 -1
- package/ui/dist/assets/CPOrg-DQ3tbYld.js +0 -8
- package/ui/dist/assets/CPRuns-0vncicUW.js +0 -1
- package/ui/dist/assets/ChannelsPanel-CiJs4gyw.js +0 -1
- package/ui/dist/assets/FleetPanel-Bg-f3_ip.js +0 -1
- package/ui/dist/assets/InfraView-CHYaZqMK.js +0 -2
- package/ui/dist/assets/InlineEditableField-BOLRKQq1.js +0 -1
- package/ui/dist/assets/Input-4pNffAw-.js +0 -1
- package/ui/dist/assets/IntegrationsPanel-CFucvr-Q.js +0 -1
- package/ui/dist/assets/IntelligenceView-Dh-Wuf13.js +0 -2
- package/ui/dist/assets/LearningPanel-CtlougkF.js +0 -1
- package/ui/dist/assets/McpPanel-BobqpLsh.js +0 -1
- package/ui/dist/assets/MemoryWikiPanel-BfYksjoI.js +0 -11
- package/ui/dist/assets/MissionCanvas-0V_vtqiu.js +0 -50
- package/ui/dist/assets/MissionChat-9hGhc9Zw.js +0 -7
- package/ui/dist/assets/MissionLibrary-dFkT8pGp.js +0 -5
- package/ui/dist/assets/MissionStart-CZSEie0Q.js +0 -1
- package/ui/dist/assets/Modal-V2yNnkKk.js +0 -1
- package/ui/dist/assets/NvidiaPanel-qLJysI9M.js +0 -1
- package/ui/dist/assets/OverviewPanel-Be6LukJ_.js +0 -1
- package/ui/dist/assets/RecipesPanel-DDYOCx3w.js +0 -1
- package/ui/dist/assets/SelfImprovePanel-B8o_fO30.js +0 -1
- package/ui/dist/assets/SessionsPanel-DeCBkSgY.js +0 -1
- package/ui/dist/assets/SettingsPanel-BlsRDAt7.js +0 -1
- package/ui/dist/assets/SettingsView-Dsa7Zr4e.js +0 -2
- package/ui/dist/assets/SkeletonLoader-BkQoZllJ.js +0 -1
- package/ui/dist/assets/StatusBadge-BFEHCdgi.js +0 -1
- package/ui/dist/assets/Tabs-g2Gs9sK0.js +0 -1
- package/ui/dist/assets/TelemetryPanel-DXAGuV0R.js +0 -1
- package/ui/dist/assets/TitanCanvas-DCl3gxSl.js +0 -1072
- package/ui/dist/assets/ToolsView-CnUjq0Js.js +0 -2
- package/ui/dist/assets/Tooltip-DJ99YlFF.js +0 -6
- package/ui/dist/assets/TrainingPanel-BLf_KMaE.js +0 -1
- package/ui/dist/assets/eye-off-CYR4nH5I.js +0 -6
- package/ui/dist/assets/index-PwwKjgT3.css +0 -1
- package/ui/dist/assets/index-slWylU2o.js +0 -244
- package/ui/dist/assets/loader-circle-E8aLxmMz.js +0 -6
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as o,j as e,R as E,l as q,u as W}from"./index-B8YEFBRH.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-C3EC4uKT.js";import{F as J}from"./FileViewer-DOWUQccc.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
|
+
|
|
3
|
+
"${r.goal.slice(0,120)}${r.goal.length>120?"…":""}"
|
|
4
|
+
|
|
5
|
+
The file is renamed on disk (recoverable manually), but the mission disappears from the UI immediately.`)))try{await X(r.id),a("/mission")}catch(x){m(x.message)}},[r,a]);if(i)return e.jsx("div",{className:"flex items-center justify-center h-full text-sm",style:{fontFamily:"var(--theme-font-display, 'Georgia', serif)",color:"var(--theme-ink-soft, #a89070)"},children:"Loading mission…"});if(d||!r)return e.jsxs("div",{className:"flex items-center justify-center h-full flex-col gap-3",style:{fontFamily:"var(--theme-font-display, 'Georgia', serif)",color:"var(--theme-paper-fg, #f3e9d0)"},children:[e.jsx("div",{className:"text-sm",style:{color:"var(--theme-accent, #c45050)"},children:d??"Mission not found."}),e.jsx("button",{onClick:()=>a("/mission"),className:"text-sm hover:underline",style:{color:"var(--theme-metal, #c4a35a)"},children:"← Start a new mission"})]});const{working:M,blocked:g}=de(r);return e.jsxs("div",{className:"h-full w-full flex flex-col overflow-hidden",style:{fontFamily:"var(--theme-font-display, 'Georgia', serif)",color:"var(--theme-paper-fg, #f3e9d0)",minHeight:0},children:[e.jsxs("header",{className:"relative z-20 flex items-center gap-4 px-5 py-3 shrink-0",style:{background:"linear-gradient(180deg, var(--theme-leather, rgba(42,26,10,0.92)), var(--theme-leather-edge, rgba(56,36,16,0.88)))",borderBottom:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.5))",boxShadow:"0 2px 12px rgba(0,0,0,0.3)"},children:[e.jsx("button",{onClick:()=>a("/mission"),className:"text-text-muted hover:text-text text-sm shrink-0",title:"Start a new mission",children:"←"}),e.jsx("button",{onClick:()=>a("/mission/library"),className:"text-[10px] uppercase tracking-widest text-text-muted hover:text-text border border-border rounded-full px-2 py-0.5 shrink-0",title:"Browse past missions",children:"Library"}),e.jsx("button",{onClick:()=>a("/space/home"),className:"text-[10px] uppercase tracking-widest text-text-muted hover:text-text border border-border rounded-full px-2 py-0.5 shrink-0 inline-flex items-center gap-1",title:"Back to the canvas spaces",children:"🌌 Canvas"}),e.jsxs("div",{className:"font-semibold tracking-tight shrink-0",children:[e.jsx("span",{className:"bg-gradient-to-r from-accent to-accent2 bg-clip-text text-transparent",children:"TITAN"}),e.jsx("span",{className:"text-text-muted font-normal",children:" › "}),"Mission"]}),e.jsx(se,{room:r}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("div",{title:"Team health",className:"inline-flex items-center gap-2 px-3 py-1.5 bg-bg-secondary/60 border border-border rounded-full text-xs text-text-muted",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${g>0?"bg-error animate-pulse":M>0?"bg-accent animate-pulse":"bg-success"}`}),xe(r.status,M,g)]}),g>0&&e.jsxs("div",{className:"inline-flex items-center gap-1 px-2.5 py-1.5 bg-error/15 border border-error/30 rounded-full text-xs text-error",title:"Decisions waiting on you",children:["🔔 ",g]}),e.jsxs("div",{title:"Effort so far",className:"inline-flex items-center gap-2 px-3 py-1.5 bg-bg-secondary/60 border border-border rounded-full text-xs",children:[e.jsx("span",{className:"inline-block w-3 h-4 bg-gradient-radial-flame"}),e.jsxs("span",{className:"text-text font-medium",children:["$",r.cost.usd.toFixed(2)]})]}),e.jsx("button",{onClick:()=>a(`/mission/${r.id}/canvas`),className:"px-3 py-1.5 text-xs bg-bg-secondary/60 border border-border rounded-full text-text-secondary hover:text-text",title:"Switch to the canvas (spatial) view of the same mission",children:"Canvas view"}),e.jsx("button",{onClick:z,className:"px-3 py-1.5 text-xs bg-bg-secondary/60 border border-border rounded-full text-text-secondary hover:text-text",children:r.status==="paused"?"Resume":"Pause"}),e.jsx("button",{onClick:H,className:"px-3 py-1.5 text-xs bg-bg-secondary/60 border border-border rounded-full text-text-muted hover:text-error hover:bg-error/15 hover:border-error/40 transition-colors",title:"Delete this mission",children:"🗑 Delete"}),e.jsx("button",{onClick:()=>S(l=>!l),className:"w-8 h-8 rounded-full bg-bg-secondary/60 border border-border text-text-muted hover:text-text flex items-center justify-center font-semibold text-sm",title:"What's this?",children:"?"})]})]}),e.jsx("main",{ref:C,className:"relative z-10 flex-1 overflow-y-auto",style:{minHeight:0},children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 md:px-6 py-6 flex flex-col gap-3",children:[r.messages.length===0?e.jsx(re,{}):r.messages.map(l=>e.jsx(ae,{msg:l,artifact:r.artifact,artifactExpanded:k,onToggleArtifact:()=>j(x=>!x),onAnswer:_,onOpenFile:B,expanded:A.has(l.id),onToggleExpand:()=>U(l.id)},l.id)),e.jsx(ce,{room:r}),e.jsx("div",{ref:$,"aria-hidden":"true"})]})}),e.jsx("footer",{className:"relative z-20 bg-bg/80 backdrop-blur-md border-t border-border shrink-0",style:{paddingBottom:40},children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 md:px-6 py-3",children:[e.jsxs("form",{onSubmit:l=>{l.preventDefault(),P()},className:"flex items-center gap-2 bg-bg-secondary/70 border border-border rounded-2xl px-3 py-2",children:[e.jsx("button",{type:"button",title:"Add a teammate (coming soon)",className:"w-9 h-9 rounded-xl bg-bg-tertiary border border-border text-text-muted hover:text-text flex items-center justify-center text-lg font-semibold",disabled:!0,children:"+"}),e.jsx("input",{value:n,onChange:l=>c(l.target.value),placeholder:"Type to the team — or @Sage to talk to one helper",className:"flex-1 bg-transparent outline-none text-text placeholder:text-text-muted/60 text-sm py-2 px-1"}),e.jsxs("button",{type:"button",title:"Voice coming next release",disabled:!0,"aria-disabled":"true",className:"relative w-9 h-9 rounded-full flex items-center justify-center cursor-not-allowed transition-colors",style:{background:"color-mix(in srgb, var(--theme-leather-edge) 60%, transparent)",border:"1px solid var(--theme-metal-dark)",color:"var(--theme-metal)",boxShadow:"inset 0 0 0 1px color-mix(in srgb, var(--theme-metal) 25%, transparent)",opacity:.7},children:[e.jsx("span",{"aria-hidden":"true",children:"🎤"}),e.jsx("span",{className:"absolute -bottom-3.5 left-1/2 -translate-x-1/2 text-[8px] uppercase tracking-widest",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-mono)",letterSpacing:"0.15em"},children:"soon"})]}),e.jsx("button",{type:"submit",disabled:!n.trim()||p,className:"w-9 h-9 rounded-xl bg-gradient-to-br from-accent to-accent2 text-bg-deep font-bold shadow-[0_0_16px_rgba(99,102,241,0.5)] disabled:opacity-50 disabled:cursor-not-allowed",title:"Send",children:"↑"})]}),e.jsxs("div",{className:"mt-2 flex justify-between items-center text-[11px] text-text-muted",children:[e.jsxs("span",{children:[r.team.map(l=>e.jsx("span",{className:"mr-2",children:e.jsxs("b",{className:"text-text-secondary",children:["@",l.name]})},l.agentId)),"to address one helper"]}),e.jsxs("span",{children:["Press ",e.jsx("b",{className:"text-text-secondary",children:"↵"})," to send"]})]})]})}),T&&e.jsx(J,{state:T,onClose:O}),I&&e.jsxs("div",{className:"fixed top-16 right-5 w-80 bg-bg-secondary/95 border border-border rounded-xl p-4 backdrop-blur-xl shadow-2xl z-30",children:[e.jsx("button",{onClick:()=>S(!1),className:"absolute top-3 right-3 text-text-muted hover:text-text text-sm",children:"✕"}),e.jsx("h3",{className:"font-semibold text-sm mb-2",children:"What you're looking at"}),e.jsxs("p",{className:"text-xs text-text-secondary leading-relaxed mb-3",children:["It's a group chat with your ",e.jsx("b",{className:"text-text",children:"AI helpers"}),". Each one has a job. You stay in charge."]}),e.jsxs("ul",{className:"space-y-2 text-xs text-text-secondary",children:[e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"💬"}),e.jsxs("span",{children:["Helpers ",e.jsx("b",{className:"text-text",children:"talk in the thread"})," as they work."]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"📄"}),e.jsxs("span",{children:["The ",e.jsx("b",{className:"text-text",children:"document card"})," shows what they're building."]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"❓"}),e.jsxs("span",{children:["Decisions appear as ",e.jsx("b",{className:"text-text",children:"pink messages with buttons"}),"."]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"@"}),e.jsxs("span",{children:["Type ",e.jsx("b",{className:"text-text",children:"@Scout"})," (or any name) to message one helper."]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"🎤"}),e.jsx("span",{children:e.jsx("b",{className:"text-text",children:"Voice comes next release."})})]})]})]})]})}function N({name:t,role:a,at:r,align:s,color:i,colorOverride:u,hint:d}){const m=t[0]??"?",n=i?`linear-gradient(135deg, ${i}, ${w(i,-25)})`:u??"var(--theme-metal-bright)";return e.jsxs("div",{className:`flex items-center gap-2 mb-1 ${s==="right"?"flex-row-reverse":""}`,style:{fontFamily:"var(--theme-font-display)"},children:[e.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center font-bold text-[11px]",style:{background:n,color:"var(--theme-leather-edge)"},children:m}),e.jsx("span",{className:"text-[12px] font-semibold tracking-tight",style:{color:"var(--theme-paper-fg)"},children:t}),a&&e.jsx("span",{className:"text-[10px] uppercase tracking-widest",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-mono)"},children:a}),e.jsx("span",{className:s==="right"?"text-[10px] mr-auto":"text-[10px] ml-auto",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-mono)"},children:ue(r)}),d&&e.jsx("span",{className:"text-[10px]",style:{color:"var(--theme-ink-soft)",opacity:.6,fontFamily:"var(--theme-font-mono)"},children:d})]})}function re(){return e.jsxs("div",{className:"self-center my-12 max-w-md text-center flex flex-col items-center gap-3",children:[e.jsxs("span",{className:"inline-flex gap-1","aria-hidden":"true",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-bounce",style:{background:"var(--theme-metal)",animationDelay:"0ms"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-bounce",style:{background:"var(--theme-metal)",animationDelay:"150ms"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-bounce",style:{background:"var(--theme-metal)",animationDelay:"300ms"}})]}),e.jsx("p",{className:"italic text-sm leading-relaxed",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-display)"},children:"Your team will start replying any moment now…"})]})}function se({room:t}){return e.jsxs("div",{className:"flex-1 flex items-center gap-2 overflow-x-auto min-w-0",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-widest text-text-muted shrink-0",children:"your team"}),t.team.map(a=>e.jsxs("div",{title:`${a.name} · ${a.role}${a.currentActivity?" · "+a.currentActivity:""}`,className:"inline-flex items-center gap-2 px-2.5 py-1 bg-bg-secondary/60 border border-border rounded-full text-xs shrink-0",children:[e.jsx("span",{className:"w-5 h-5 rounded-md flex items-center justify-center text-[10px] font-bold text-bg-deep",style:{background:`linear-gradient(135deg, ${a.color}, ${w(a.color,-25)})`},children:a.name[0]}),e.jsx("span",{className:"text-text-secondary",children:a.name}),e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${me(a.state)}`,style:{boxShadow:`0 0 6px ${pe(a.state)}`}})]},a.agentId))]})}function ae({msg:t,artifact:a,artifactExpanded:r,onToggleArtifact:s,onAnswer:i,onOpenFile:u,expanded:d,onToggleExpand:m}){const n=(c,p)=>e.jsx("button",{type:"button",onClick:m,className:"text-left w-full",title:d?"Click to hide details":"Click to see details",children:c},p);if(t.kind==="user")return e.jsxs("div",{className:"self-end max-w-[88%] flex flex-col items-end",children:[e.jsx(N,{name:"You",role:"",at:t.at,align:"right",colorOverride:"var(--theme-metal-bright)"}),n(e.jsx("div",{className:"px-3.5 py-2.5 rounded-2xl rounded-br-md text-sm leading-relaxed cursor-pointer",style:{background:"color-mix(in srgb, var(--theme-metal-dark) 30%, transparent)",color:"var(--theme-paper-fg)",border:"1px solid color-mix(in srgb, var(--theme-metal) 40%, transparent)",boxShadow:"0 2px 6px var(--theme-shadow)",fontFamily:"var(--theme-font-display)"},children:t.content})),d&&e.jsx(y,{msg:t})]});if(t.kind==="system"){const c=t.tag==="team_formed"?"Team formed":t.tag==="team_expanded"?"Team change":t.tag??"note";return e.jsxs("div",{className:"self-center flex flex-col items-center max-w-[88%] my-1",children:[n(e.jsxs("div",{className:"italic text-center text-[12px] leading-relaxed cursor-pointer px-3 py-1",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-display)"},children:[e.jsx("span",{className:"not-italic",style:{fontFamily:"var(--theme-font-mono)",letterSpacing:"0.08em",fontSize:"10px",textTransform:"uppercase"},children:c}),e.jsx("span",{className:"mx-2 opacity-50",children:"·"}),t.content.replace(/^Team formed —\s*/,"").replace(/\.$/,"")]})),d&&e.jsx(y,{msg:t})]})}return t.kind==="artifact_update"?e.jsx(ie,{artifact:a,expanded:r,onToggle:s,latestSummary:t.summary,latestBy:t.by.name,wordCount:t.wordCount}):t.kind==="question"?e.jsxs("div",{className:"max-w-[88%] flex flex-col",children:[e.jsx(N,{name:t.from.name,role:t.from.role,at:t.at,align:"left",color:t.from.color}),e.jsxs("span",{className:"self-start inline-flex items-center gap-1 px-2 py-0.5 mb-1.5 bg-error text-white text-[10px] uppercase tracking-widest font-bold rounded-full",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-pulse"}),"Needs you"]}),e.jsxs("div",{className:"px-3.5 py-2.5 rounded-2xl rounded-bl-md border-l-[3px] text-sm leading-relaxed cursor-pointer",onClick:m,title:d?"Click to hide details":"Click to see details",style:{background:"linear-gradient(180deg, rgba(239,68,68,0.18), rgba(239,68,68,0.06))",borderLeftColor:t.from.color,border:"1px solid rgba(239,68,68,0.35)",borderLeft:`3px solid ${t.from.color}`,color:"var(--theme-paper-fg)",fontFamily:"var(--theme-font-display)",boxShadow:"0 2px 6px var(--theme-shadow)"},children:[t.content,!t.answer&&e.jsxs(e.Fragment,{children:[t.quickReplies.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:t.quickReplies.map((c,p)=>e.jsx("button",{onClick:f=>{f.stopPropagation(),i(t.approvalId,c)},className:`px-3 py-1.5 rounded-lg text-xs font-semibold border ${p===t.quickReplies.length-1?"bg-gradient-to-br from-accent to-accent2 text-bg-deep border-transparent":"bg-bg-secondary/60 border-error/40 text-text hover:bg-error/15"}`,children:c},c))}),e.jsx(ne,{approvalId:t.approvalId,onSubmit:c=>i(t.approvalId,c)})]}),t.answer&&e.jsxs("div",{className:"mt-3 text-[12px] text-text-muted border-t border-border pt-2",children:["You answered: ",e.jsx("span",{className:"text-text",children:t.answer.content})]})]}),d&&e.jsx(y,{msg:t})]}):e.jsxs("div",{className:"max-w-[88%] flex flex-col",children:[e.jsx(N,{name:t.from.name,role:t.from.role,at:t.at,align:"left",color:t.from.color,hint:d?"click to hide":"click for details"}),n(e.jsxs("div",{className:"px-3.5 py-2.5 rounded-2xl rounded-bl-md text-sm leading-relaxed backdrop-blur-sm cursor-pointer transition-colors",style:{background:"color-mix(in srgb, var(--theme-paper) 6%, transparent)",color:"var(--theme-paper-fg)",border:"1px solid color-mix(in srgb, var(--theme-metal-dark) 35%, transparent)",borderLeft:`3px solid ${t.from.color}`,boxShadow:"0 2px 6px var(--theme-shadow)",fontFamily:"var(--theme-font-display)"},children:[e.jsx(te,{text:t.content,sources:t.sources,onOpenFile:u}),t.actions&&t.actions.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.actions.map((c,p)=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-muted",children:[e.jsx("span",{children:c.name}),c.detail&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted",children:"·"}),e.jsx("b",{className:"text-text font-medium",children:c.detail})]})]},p))})]})),d&&e.jsx(y,{msg:t})]})}function y({msg:t}){const a=D(t.at),r=[];if(r.push({label:"When",value:a}),r.push({label:"Message id",value:e.jsx("code",{className:"text-text-secondary text-[11px]",children:t.id})}),t.kind==="agent"){r.push({label:"From",value:e.jsxs("span",{children:[e.jsx("b",{children:t.from.name})," · ",t.from.role," ",e.jsxs("span",{className:"text-text-muted",children:["(",t.from.agentId,")"]})]})});const s=t.meta;s!=null&&s.subtaskTitle&&r.push({label:"Working on",value:e.jsxs("i",{children:['"',s.subtaskTitle,'"']})}),s!=null&&s.status&&r.push({label:"Outcome",value:e.jsx(le,{status:s.status})}),s!=null&&s.model&&r.push({label:"Brain",value:e.jsx("code",{className:"text-text-secondary text-[11px]",children:s.model})}),typeof(s==null?void 0:s.durationMs)=="number"&&r.push({label:"Took",value:oe(s.durationMs)}),typeof(s==null?void 0:s.tokensUsed)=="number"&&s.tokensUsed>0&&r.push({label:"Tokens",value:s.tokensUsed.toLocaleString()}),typeof(s==null?void 0:s.costUsd)=="number"&&s.costUsd>0&&r.push({label:"Cost",value:"$"+s.costUsd.toFixed(4)}),t.actions&&t.actions.length>0&&r.push({label:"Used",value:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.actions.map((i,u)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-muted",children:[i.name,i.detail&&e.jsxs("span",{children:[e.jsx("span",{className:"text-text-muted/60",children:" · "}),e.jsx("b",{className:"text-text",children:i.detail})]})]},u))})}),s!=null&&s.failureDetail&&r.push({label:"Error detail",value:e.jsxs("code",{className:"block whitespace-pre-wrap bg-bg-tertiary/80 border border-border rounded p-2 text-[11px] text-text-secondary font-mono leading-relaxed max-h-40 overflow-y-auto",children:[s.failureDetail.slice(0,800),s.failureDetail.length>800?`
|
|
6
|
+
…`:""]})})}else t.kind==="question"?(r.push({label:"From",value:e.jsxs("span",{children:[e.jsx("b",{children:t.from.name})," · ",t.from.role]})}),r.push({label:"Approval id",value:e.jsx("code",{className:"text-text-secondary text-[11px]",children:t.approvalId})}),t.answer?r.push({label:"Answered",value:e.jsxs("span",{children:[D(t.answer.at),' — "',t.answer.content,'"']})}):r.push({label:"Status",value:e.jsx("span",{className:"text-warning",children:"Waiting for your reply"})}),t.quickReplies.length>0&&r.push({label:"Options",value:t.quickReplies.join(" · ")})):t.kind==="user"?r.push({label:"Length",value:t.content.length+" chars"}):t.kind==="system"&&t.tag&&r.push({label:"Kind",value:e.jsx("code",{className:"text-text-secondary text-[11px]",children:t.tag})});return e.jsxs("div",{className:"mt-2 self-stretch bg-bg-secondary/40 border border-border rounded-lg px-3 py-2.5 backdrop-blur-sm",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-text-muted mb-1.5",children:"Details"}),e.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1.5 text-[12px]",children:r.map((s,i)=>e.jsxs(E.Fragment,{children:[e.jsx("dt",{className:"text-text-muted",children:s.label}),e.jsx("dd",{className:"text-text-secondary",children:s.value})]},i))})]})}function ne({approvalId:t,onSubmit:a}){const[r,s]=o.useState(!1),[i,u]=o.useState(""),d=o.useRef(null);o.useEffect(()=>{r&&d.current&&d.current.focus()},[r]);const m=()=>{const n=i.trim();n&&(a(n),u(""),s(!1))};return r?e.jsxs("div",{className:"mt-3",onClick:n=>n.stopPropagation(),children:[e.jsx("textarea",{ref:d,value:i,onChange:n=>u(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.metaKey||n.ctrlKey)?(n.preventDefault(),m()):n.key==="Escape"&&(n.preventDefault(),s(!1))},placeholder:`Tell ${t.slice(0,6)}… anything you want.`,rows:3,className:"w-full bg-bg-secondary/80 border border-border rounded-lg p-2 text-sm text-text placeholder:text-text-muted/60 outline-none focus:border-accent/60 resize-y"}),e.jsxs("div",{className:"flex items-center justify-end gap-2 mt-1.5",children:[e.jsx("span",{className:"mr-auto text-[10px] text-text-muted",children:"⌘+↵ to send · esc to cancel"}),e.jsx("button",{type:"button",onClick:()=>{s(!1),u("")},className:"px-3 py-1 text-[11px] text-text-muted hover:text-text",children:"Cancel"}),e.jsx("button",{type:"button",onClick:m,disabled:!i.trim(),className:"px-3 py-1 text-[11px] font-semibold rounded-md bg-gradient-to-br from-accent to-accent2 text-bg-deep disabled:opacity-50 disabled:cursor-not-allowed",children:"Send answer"})]})]}):e.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),s(!0)},className:"mt-2 text-[11px] text-text-muted hover:text-text-secondary underline underline-offset-2",children:"or type a custom answer…"})}function le({status:t}){const r={done:"bg-success/15 text-success border-success/30",failed:"bg-error/15 text-error border-error/30",needs_info:"bg-warning/15 text-warning border-warning/30",blocked:"bg-warning/15 text-warning border-warning/30",cancelled:"bg-text-muted/15 text-text-muted border-border"}[t]??"bg-bg-tertiary/60 text-text-secondary border-border";return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[11px] font-medium border ${r}`,children:t})}function D(t){try{return new Date(t).toLocaleString([],{weekday:"short",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}}function oe(t){if(t<1e3)return`${t}ms`;if(t<6e4)return`${(t/1e3).toFixed(1)}s`;const a=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return`${a}m ${r}s`}function ie({artifact:t,expanded:a,onToggle:r,latestSummary:s,latestBy:i,wordCount:u}){const d=t.content.split(`
|
|
7
|
+
`).filter(Boolean).slice(0,2).join(" ").slice(0,240);return e.jsxs("div",{className:"self-stretch my-1 rounded-xl border border-border bg-bg-secondary/40 overflow-hidden relative",children:[e.jsx("div",{className:"absolute left-0 right-0 top-0 h-[2px] overflow-hidden",children:e.jsx("div",{className:"h-full w-1/3 bg-gradient-to-r from-transparent via-accent to-transparent animate-pulse"})}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-bg-tertiary flex items-center justify-center text-sm",children:"📄"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold truncate",children:"Live document"}),e.jsxs("div",{className:"text-[11px] text-text-muted truncate",children:[i," ",s," · ",u," words · updating live"]})]}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),e.jsx("button",{onClick:r,className:"px-2.5 py-1 text-[11px] font-semibold bg-bg-tertiary border border-border rounded-md text-text-secondary hover:text-text",children:a?"▴ Collapse":"▾ Open"})]}),a?e.jsx("div",{className:"px-5 py-4 font-serif text-sm leading-relaxed whitespace-pre-wrap",style:{background:"var(--theme-paper, #f7f5ee)",color:"var(--theme-ink, #1a1f2e)"},children:t.content||e.jsx("span",{className:"italic",style:{color:"var(--theme-ink-soft, #8a8472)"},children:"empty for now…"})}):e.jsx("div",{className:"px-4 py-3 text-sm text-text-secondary font-serif italic",children:d||e.jsx("span",{className:"text-text-muted not-italic",children:"empty for now…"})})]})}function ce({room:t}){const a=t.team.filter(s=>s.state==="working"&&s.currentActivity);if(a.length===0)return null;const r=a[a.length-1];return e.jsxs("div",{className:"self-start flex items-start gap-2 px-3 py-2 bg-bg-secondary/60 border border-border rounded-2xl backdrop-blur-sm max-w-[640px]",title:r.currentActivity??void 0,children:[e.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center text-bg-deep font-bold text-[10px] shrink-0 mt-0.5",style:{background:`linear-gradient(135deg, ${r.color}, ${w(r.color,-25)})`},children:r.name[0]}),e.jsxs("span",{className:"text-xs text-text-muted leading-relaxed break-words flex-1 min-w-0",children:[e.jsx("span",{className:"text-text font-semibold",children:r.name})," ",r.currentActivity??"is working"]}),e.jsxs("span",{className:"inline-flex gap-0.5 ml-1 shrink-0 mt-1.5",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-text-muted animate-bounce [animation-delay:0ms]"}),e.jsx("span",{className:"w-1 h-1 rounded-full bg-text-muted animate-bounce [animation-delay:150ms]"}),e.jsx("span",{className:"w-1 h-1 rounded-full bg-text-muted animate-bounce [animation-delay:300ms]"})]})]})}function de(t){let a=0,r=0;for(const s of t.team)(s.state==="working"||s.state==="editing")&&a++,s.state==="blocked"&&r++;return{working:a,blocked:r}}function xe(t,a,r){return t==="paused"?"Paused":t==="done"?"Done":t==="failed"?"Failed":r>0?`${a} working · ${r} needs you`:a>0?`${a} working`:t==="forming"?"Forming team…":"Idle"}function ue(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function me(t){switch(t){case"working":return"bg-accent animate-pulse";case"editing":return"bg-warning animate-pulse";case"blocked":return"bg-error animate-pulse";case"done":return"bg-success";default:return"bg-text-muted"}}function pe(t){switch(t){case"working":return"#6366f1";case"editing":return"#f59e0b";case"blocked":return"#ef4444";case"done":return"#22c55e";default:return"#71717a"}}function w(t,a){const r=t.replace("#","");if(r.length!==6)return t;const s=parseInt(r,16);let i=s>>16&255,u=s>>8&255,d=s&255;const m=Math.round(255*(a/100));return i=Math.max(0,Math.min(255,i+m)),u=Math.max(0,Math.min(255,u+m)),d=Math.max(0,Math.min(255,d+m)),"#"+(i<<16|u<<8|d).toString(16).padStart(6,"0")}export{ge as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{u as M,r as m,j as e}from"./index-B8YEFBRH.js";import{l as j,e as D}from"./missions-C3EC4uKT.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
|
+
|
|
3
|
+
"${n.slice(0,120)}${n.length>120?"…":""}"
|
|
4
|
+
|
|
5
|
+
The file is renamed (not destroyed), so the disk record can be recovered manually.`)){s(g=>(g??[]).filter(f=>f.id!==t));try{await D(t)}catch(g){i(g.message),j().then(({missions:f})=>s(f)).catch(()=>{})}}},[]),h=m.useMemo(()=>{if(!r)return[];const t=d.trim().toLowerCase();return r.filter(n=>!(l==="live"&&!["working","blocked","paused","forming"].includes(n.status)||l==="done"&&n.status!=="done"||l==="failed"&&n.status!=="failed"||t&&!n.goal.toLowerCase().includes(t)))},[r,l,d]),v=m.useMemo(()=>{const t={all:0,live:0,done:0,failed:0};for(const n of r??[])t.all++,["working","blocked","paused","forming"].includes(n.status)&&t.live++,n.status==="done"&&t.done++,n.status==="failed"&&t.failed++;return t},[r]),u=m.useMemo(()=>{const t=[],n=[],k=[],f=Date.now();for(const x of h){if(["working","blocked","paused","forming"].includes(x.status)){t.push(x);continue}(()=>{try{return f-new Date(x.updatedAt).getTime()}catch{return 1/0}})()<6048e5?n.push(x):k.push(x)}return{active:t,recent:n,archived:k}},[h]),N=h.length>8;return e.jsxs("div",{className:"h-full w-full flex flex-col overflow-hidden",style:{color:"var(--theme-paper-fg)",fontFamily:"var(--theme-font-display)",background:"var(--theme-bg-base)"},children:[e.jsxs("header",{className:"relative z-20 flex items-center gap-4 px-5 py-3",style:{paddingRight:T,background:"linear-gradient(180deg, var(--theme-leather-edge), var(--theme-leather))",borderBottom:"1px solid var(--theme-metal-dark)",boxShadow:"0 2px 12px var(--theme-shadow)"},children:[e.jsx("button",{onClick:()=>a("/mission"),className:"text-sm",style:{color:"var(--theme-metal)"},title:"Start a new mission",children:"←"}),e.jsx("button",{onClick:()=>a("/space/home"),className:"text-[10px] uppercase tracking-widest rounded-full px-2 py-0.5 shrink-0 inline-flex items-center gap-1 border",style:{color:"var(--theme-metal)",borderColor:"var(--theme-metal-dark)",fontFamily:"var(--theme-font-display)"},title:"Back to the canvas spaces",children:"🌌 Canvas"}),e.jsxs("div",{className:"font-semibold tracking-tight shrink-0",style:{color:"var(--theme-paper-fg)"},children:[e.jsx("span",{style:{color:"var(--theme-metal)"},children:"TITAN"}),e.jsx("span",{className:"font-normal",style:{color:"var(--theme-ink-soft)"},children:" › "}),"Mission Library"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:S,className:"text-xs px-3 py-1.5 rounded-full border transition-colors",style:{color:"var(--theme-ink-soft)",background:"var(--theme-leather)",borderColor:"var(--theme-metal-dark)",fontFamily:"var(--theme-font-display)"},onMouseEnter:t=>{t.currentTarget.style.color="var(--theme-metal-bright)",t.currentTarget.style.borderColor="var(--theme-metal)"},onMouseLeave:t=>{t.currentTarget.style.color="var(--theme-ink-soft)",t.currentTarget.style.borderColor="var(--theme-metal-dark)"},title:"Reload",children:"⟳ refresh"}),e.jsx("button",{onClick:()=>a("/mission"),className:"px-3 py-1.5 text-xs rounded-full font-semibold",style:{background:"linear-gradient(135deg, var(--theme-metal-bright), var(--theme-metal-dark))",color:"var(--theme-bolt)",boxShadow:"0 2px 8px var(--theme-shadow)",fontFamily:"var(--theme-font-display)"},children:"+ New mission"})]}),e.jsxs("div",{className:"relative z-10 px-5 py-3 flex items-center gap-3 border-b",style:{borderBottomColor:"var(--theme-metal-dark)",background:"var(--theme-leather-edge)"},children:[e.jsx(y,{active:l==="all",label:"All",count:v.all,onClick:()=>c("all")}),e.jsx(y,{active:l==="live",label:"In progress",count:v.live,onClick:()=>c("live"),dotColor:"var(--theme-accent)"}),e.jsx(y,{active:l==="done",label:"Done",count:v.done,onClick:()=>c("done"),dotColor:"var(--theme-metal)"}),e.jsx(y,{active:l==="failed",label:"Stopped",count:v.failed,onClick:()=>c("failed"),dotColor:"var(--theme-ink-soft)"}),e.jsx("div",{className:"flex-1"}),e.jsx(L,{value:d,onChange:F})]}),e.jsxs("main",{className:"relative z-10 flex-1 overflow-y-auto",children:[o&&e.jsx("div",{className:"max-w-3xl mx-auto px-5 py-6 text-sm",style:{color:"var(--theme-accent)",fontFamily:"var(--theme-font-mono)"},children:o}),r===null&&!o&&e.jsx("div",{className:"max-w-3xl mx-auto px-5 py-6 text-sm",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-mono)"},children:"Loading missions…"}),r!==null&&h.length===0&&e.jsx($,{filter:l,query:d,onStart:()=>a("/mission")}),r!==null&&h.length>0&&!N&&e.jsx("ul",{className:"max-w-3xl mx-auto px-5 py-4 flex flex-col gap-2",children:h.map(t=>e.jsx(b,{mission:t,onClick:()=>a(`/mission/${t.id}`),onDelete:()=>p(t.id,t.goal)},t.id))}),r!==null&&h.length>0&&N&&e.jsxs("div",{className:"max-w-3xl mx-auto px-5 py-4 flex flex-col gap-6",children:[u.active.length>0&&e.jsx(w,{title:"Active",subtitle:"working, blocked, paused, or forming",children:u.active.map(t=>e.jsx(b,{mission:t,onClick:()=>a(`/mission/${t.id}`),onDelete:()=>p(t.id,t.goal)},t.id))}),u.recent.length>0&&e.jsx(w,{title:"Recent",subtitle:"completed within the last 7 days",children:u.recent.map(t=>e.jsx(b,{mission:t,onClick:()=>a(`/mission/${t.id}`),onDelete:()=>p(t.id,t.goal)},t.id))}),u.archived.length>0&&e.jsx(w,{title:"Archived",subtitle:"older finished missions",children:u.archived.map(t=>e.jsx(b,{mission:t,onClick:()=>a(`/mission/${t.id}`),onDelete:()=>p(t.id,t.goal)},t.id))})]})]})]})}function w({title:a,subtitle:r,children:s}){return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"inline-flex items-baseline gap-3 self-start px-3 py-1 rounded-md border",style:{background:"linear-gradient(180deg, var(--theme-leather), var(--theme-leather-edge))",borderColor:"var(--theme-metal-dark)",boxShadow:"inset 0 0 0 1px var(--theme-metal-dark), 0 1px 4px var(--theme-shadow)"},children:[e.jsx("span",{className:"text-[11px] uppercase tracking-[0.18em] font-semibold",style:{color:"var(--theme-metal-bright)",fontFamily:"var(--theme-font-display)"},children:a}),r&&e.jsx("span",{className:"text-[10px]",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-mono)"},children:r})]}),e.jsx("ul",{className:"flex flex-col gap-2",children:s})]})}function L({value:a,onChange:r}){const[s,o]=m.useState(!1);return e.jsx("input",{value:a,onChange:i=>r(i.target.value),onFocus:()=>o(!0),onBlur:()=>o(!1),placeholder:"Search goals…",className:"w-72 rounded-full px-4 py-1.5 text-sm outline-none transition-colors",style:{background:"var(--theme-paper)",color:"var(--theme-ink)",border:`1px solid ${s?"var(--theme-metal)":"var(--theme-metal-dark)"}`,boxShadow:s?"0 0 0 2px var(--theme-menu-hover)":"none",fontFamily:"var(--theme-font-display)"}})}function y({active:a,label:r,count:s,onClick:o,dotColor:i}){const[l,c]=m.useState(!1);return e.jsxs("button",{onClick:o,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs border transition-colors",style:{background:a?"var(--theme-menu-active-bg)":l?"var(--theme-menu-hover)":"transparent",color:a?"var(--theme-menu-active-fg)":"var(--theme-ink-soft)",borderColor:a?"var(--theme-metal)":"var(--theme-metal-dark)",fontFamily:"var(--theme-font-display)"},children:[i&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:i}}),e.jsx("span",{children:r}),e.jsx("span",{style:{color:a?"var(--theme-menu-active-fg)":"var(--theme-ink-soft)",opacity:.7,fontFamily:"var(--theme-font-mono)"},children:s})]})}function b({mission:a,onClick:r,onDelete:s}){const[o,i]=m.useState(!1),l=R(a.updatedAt),c=["working","blocked","paused","forming"].includes(a.status);return e.jsxs("li",{className:"relative group",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[e.jsxs("button",{onClick:r,className:"w-full text-left rounded-xl px-4 py-3 transition-all",style:{background:o?"var(--theme-menu-hover)":"var(--theme-paper)",color:"var(--theme-ink)",border:`1px solid ${o?"var(--theme-metal)":"var(--theme-metal-dark)"}`,boxShadow:o?"0 3px 10px var(--theme-shadow)":"0 1px 3px var(--theme-shadow)",transform:o?"translateY(-1px)":"translateY(0)"},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"text-sm font-semibold flex-1 truncate",style:{color:"var(--theme-ink)",fontFamily:"var(--theme-font-display)"},children:a.goal||"(no goal)"}),e.jsxs("div",{className:"flex items-center gap-3 transition-opacity",style:{opacity:o?0:1},children:[e.jsx(E,{status:a.status}),e.jsx("div",{className:"text-[11px] shrink-0",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-mono)"},children:l})]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px]",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-mono)"},children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{children:a.team.length}),e.jsxs("span",{children:["helper",a.team.length===1?"":"s"]})]}),a.team.length>0&&e.jsxs("span",{className:"flex items-center gap-1 truncate max-w-[40%]",children:["· ",a.team.slice(0,4).map(d=>d.name).join(", "),a.team.length>4?`, +${a.team.length-4}`:""]}),a.cost.usd>0&&e.jsxs("span",{children:["· $",a.cost.usd.toFixed(2)," effort"]}),a.playId&&e.jsx("span",{className:"ml-auto text-[10px] uppercase tracking-widest",style:{color:"var(--theme-metal-dark)"},children:a.playId})]})]}),e.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1.5 transition-opacity",style:{opacity:o?1:0},children:[e.jsx(C,{label:c?"Resume":"Open",icon:c?"▶":"↗",variant:"primary",onClick:d=>{d.stopPropagation(),r()}}),e.jsx(C,{label:"Delete",icon:"🗑",variant:"muted",onClick:d=>{d.stopPropagation(),s()}})]})]})}function C({label:a,icon:r,variant:s,onClick:o}){const[i,l]=m.useState(!1);return s==="primary"?e.jsxs("button",{type:"button",onClick:o,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),className:"inline-flex items-center gap-1 px-2 py-1 rounded-md text-[10px] font-semibold uppercase tracking-widest border transition-colors",style:{background:i?"var(--theme-metal-bright)":"var(--theme-metal)",color:"var(--theme-bolt)",borderColor:"var(--theme-metal-dark)",fontFamily:"var(--theme-font-display)"},title:a,"aria-label":a,children:[e.jsx("span",{"aria-hidden":!0,children:r}),e.jsx("span",{children:a})]}):e.jsx("button",{type:"button",onClick:o,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),className:"inline-flex items-center justify-center w-7 h-7 rounded-md text-sm border transition-colors",style:{background:i?"var(--theme-accent)":"var(--theme-paper)",color:i?"var(--theme-paper)":"var(--theme-ink-soft)",borderColor:i?"var(--theme-accent)":"var(--theme-metal-dark)"},title:a,"aria-label":a,children:e.jsx("span",{"aria-hidden":!0,children:r})})}function E({status:a}){const r={forming:{label:"forming",bg:"var(--theme-leather)",fg:"var(--theme-metal-bright)",border:"var(--theme-metal-dark)"},working:{label:"live",bg:"var(--theme-accent)",fg:"var(--theme-paper)",border:"var(--theme-accent)"},blocked:{label:"needs you",bg:"var(--theme-accent)",fg:"var(--theme-paper)",border:"var(--theme-accent)",pulse:!0},paused:{label:"paused",bg:"var(--theme-metal)",fg:"var(--theme-bolt)",border:"var(--theme-metal-dark)"},done:{label:"done",bg:"var(--theme-menu-active-bg)",fg:"var(--theme-menu-active-fg)",border:"var(--theme-metal-dark)"},failed:{label:"stopped",bg:"var(--theme-leather-edge)",fg:"var(--theme-ink-soft)",border:"var(--theme-metal-dark)"}},s=r[a]??r.forming;return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold border uppercase tracking-widest ${s.pulse?"animate-pulse":""}`,style:{background:s.bg,color:s.fg,borderColor:s.border,fontFamily:"var(--theme-font-display)"},children:s.label})}function $({filter:a,query:r,onStart:s}){return r.trim().length>0?e.jsxs("div",{className:"max-w-md mx-auto px-5 py-12 text-center",children:[e.jsxs("div",{className:"text-sm mb-2",style:{color:"var(--theme-paper-fg)",fontFamily:"var(--theme-font-display)"},children:['No missions match "',r,'"']}),e.jsx("div",{className:"text-xs",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-mono)"},children:"Try a shorter search term, or clear the filter."})]}):a!=="all"?e.jsx("div",{className:"max-w-md mx-auto px-5 py-12 text-center",children:e.jsxs("div",{className:"text-sm",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-display)"},children:["No ",a==="live"?"in-progress":a," missions right now."]})}):e.jsxs("div",{className:"max-w-md mx-auto px-5 py-16 text-center flex flex-col items-center gap-5",children:[e.jsx("div",{className:"w-20 h-20 rounded-full flex items-center justify-center",style:{background:"radial-gradient(circle at 30% 25%, var(--theme-metal-bright), var(--theme-metal-dark) 70%)",boxShadow:"inset 0 -3px 6px var(--theme-shadow), 0 4px 14px var(--theme-shadow)",border:"1px solid var(--theme-metal-dark)",color:"var(--theme-bolt)",fontFamily:"var(--theme-font-display)",fontSize:28},"aria-hidden":!0,children:"⚙"}),e.jsx("div",{className:"text-base",style:{color:"var(--theme-paper-fg)",fontFamily:"var(--theme-font-display)"},children:"No missions yet."}),e.jsx("div",{className:"text-sm",style:{color:"var(--theme-ink-soft)",fontFamily:"var(--theme-font-display)"},children:"Start one from the Mission Start page."}),e.jsx("button",{onClick:s,className:"px-4 py-2 rounded-xl font-semibold transition-transform",style:{background:"linear-gradient(135deg, var(--theme-metal-bright), var(--theme-metal-dark))",color:"var(--theme-bolt)",boxShadow:"0 4px 14px var(--theme-shadow)",border:"1px solid var(--theme-metal-dark)",fontFamily:"var(--theme-font-display)"},onMouseDown:o=>{o.currentTarget.style.transform="translateY(1px)"},onMouseUp:o=>{o.currentTarget.style.transform="translateY(0)"},children:"Start your first mission"})]})}function R(a){try{const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?Math.floor(r/6e4)+"m ago":r<864e5?Math.floor(r/36e5)+"h ago":r<7*864e5?Math.floor(r/864e5)+"d ago":new Date(a).toLocaleDateString()}catch{return""}}export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as b,u as W,j as e}from"./index-B8YEFBRH.js";import{c as H}from"./missions-C3EC4uKT.js";const _={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"},G={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 reads the web on your topic and writes a fresh briefing every morning.",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:"Each morning at 7am, 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 every few hours so nothing rots.",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:"Overnight code review",blurb:"Builder reviews your repo changes while you sleep. Wakes you to nothing-pings only.",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:[G,D],whatItDoes:"Every night at 11pm, 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 watches 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:"Every few hours, 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:[_,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 hands you a fresh creative writing or music prompt every morning with breakfast.",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:"Every morning, Writer hands you one fresh creative prompt tailored to the discipline you chose, with a quick warm-up exercise to get the engine started. The prompt lands as a sticky note on the desk so you can grab it on the way to your studio.",accent:{from:"#ec4899",to:"#8b5cf6"}}];function Y(s,r){return s.goalTemplate.replace(/\{\{(\w+)\}\}/g,(i,o)=>{const u=r[o];return u&&u.trim().length>0?u.trim():o})}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)",n="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)",C="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,r]=b.useState(""),[i,o]=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)){o(!0),N(null);try{const{mission:w}=await H(f,p);S(`/mission/${w.id}`)}catch(w){N(w.message),o(!1)}}}return e.jsxs("div",{className:"fixed inset-0 flex flex-col items-center overflow-y-auto",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 py-10 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:n,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, ${C} 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(E,{position:"tl"}),e.jsx(E,{position:"tr"}),e.jsx(E,{position:"bl"}),e.jsx(E,{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.02em",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:n},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=>r(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 items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] tracking-wide",style:{color:n,fontFamily:d},children:"⌘↵ to dispatch · voice coming soon"}),e.jsxs("div",{className:"flex items-center gap-2",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:n,opacity:.55},children:"🎤"}),e.jsx("button",{type:"submit",disabled:!s.trim()||i,className:"px-6 h-11 rounded-xl font-bold text-sm tracking-wide transition-transform",style:{background:s.trim()&&!i?`linear-gradient(180deg, ${g} 0%, ${t} 60%, ${m} 100%)`:`${m}66`,color:F,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:n,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=`${C}`},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:["Always-on templates",e.jsx("span",{className:"ml-3 text-[10px] uppercase tracking-[0.3em]",style:{color:n,fontFamily:d},children:"recurring missions"})]}),e.jsx("span",{className:"text-[11px] tracking-wide",style:{color:n,fontFamily:d},children:"click → 3 steps → launch"})]}),e.jsx("p",{className:"text-sm leading-relaxed max-w-2xl",style:{color:n},children:"Pick a starter recipe, customize it, choose how often the team should run it, and TITAN keeps the agents on schedule."}),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(X,{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:r,children:i}){return e.jsx("button",{onClick:s,title:r,className:"px-3 py-1 text-[10px] uppercase tracking-[0.2em] rounded-full transition-colors",style:{color:n,border:`1px solid ${t}33`,background:"transparent",fontFamily:d},onMouseEnter:o=>{o.currentTarget.style.color=c,o.currentTarget.style.borderColor=`${t}99`},onMouseLeave:o=>{o.currentTarget.style.color=n,o.currentTarget.style.borderColor=`${t}33`},children:i})}function E({position:s}){const r={position:"absolute"};return s==="tl"&&(r.top=10,r.left=10),s==="tr"&&(r.top=10,r.right=10),s==="bl"&&(r.bottom=10,r.left=10),s==="br"&&(r.bottom=10,r.right=10),e.jsx("div",{style:{...r,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:r}){const[i,o]=b.useState(!1);return e.jsxs("button",{type:"button",onClick:r,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"text-left rounded-2xl relative overflow-hidden transition-all",style:{background:`linear-gradient(180deg, ${C} 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 X({template:s,onClose:r,onLaunch:i}){const[o,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=o!==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:r,children:e.jsxs("div",{className:"relative w-full max-w-2xl rounded-2xl overflow-hidden flex flex-col",style:{background:`linear-gradient(180deg, ${C} 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:n,fontFamily:d},children:["Step ",o," of 3 · ",o===1?"Customize":o===2?"Schedule":"Launch"]})]}),e.jsx("button",{onClick:r,className:"w-8 h-8 rounded-full flex items-center justify-center text-sm",style:{background:`${h}66`,border:`1px solid ${t}33`,color:n},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<=o?`linear-gradient(90deg, ${t}, ${g})`:`${h}66`}},l))}),e.jsxs("div",{className:"p-5 max-h-[60vh] overflow-y-auto",children:[o===1&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"text-sm",style:{color:n},children:s.blurb}),s.fields.length===0&&e.jsxs("div",{className:"text-sm italic",style:{color:n},children:["This template runs as-is — no setup needed. Click ",e.jsx("b",{style:{color:c},children:"Next"})," to pick a schedule."]}),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:n},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})]})]}),o===2&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm",style:{color:n},children:"How often should the team run this?"}),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:n},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:n,fontFamily:d},children:l.cadence})]}),e.jsx("code",{className:"text-[10px]",style:{color:n,fontFamily:d},children:l.cron})]},l.id)}),e.jsx("div",{className:"text-[11px] italic px-1 pt-1",style:{color:n},children:"The auto-fire daemon that re-runs missions on this cadence lands in the next ship. Today the first run starts immediately and the chosen schedule is remembered."})]}),o===3&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm",style:{color:n},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:n,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:()=>o>1?u(l=>l-1):r(),className:"px-4 py-2 text-sm",style:{color:n,background:"transparent",fontFamily:x},children:o>1?"← Back":"Cancel"}),o<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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,j as e,X as x}from"./index-B8YEFBRH.js";import{c as y}from"./clsx-B-dksMZM.js";import{A as p,m as l}from"./proxy-BjQ4lsww.js";const u={sm:"max-w-sm",md:"max-w-lg",lg:"max-w-2xl"};function j({open:s,onClose:t,title:i,children:m,footer:n,size:o="md",hideCloseButton:c=!1}){const a=r.useCallback(d=>{d.key==="Escape"&&t()},[t]);return r.useEffect(()=>{if(s)return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[s,a]),e.jsx(p,{children:s&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",children:[e.jsx(l.div,{className:"absolute inset-0 titan-menu-overlay",onClick:t,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15}}),e.jsxs(l.div,{className:y("relative w-full mx-4 titan-modal-surface",u[o]),initial:{opacity:0,y:-16,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-16,scale:.97},transition:{duration:.2,ease:"easeOut"},children:[i&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--theme-menu-border)"},children:[e.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--theme-ink)",fontFamily:"var(--theme-font-display)"},children:i}),!c&&e.jsx("button",{type:"button",onClick:t,className:"titan-close-btn","aria-label":"Close",children:e.jsx(x,{size:16})})]}),e.jsx("div",{className:"px-4 py-4",style:{color:"var(--theme-ink)",fontFamily:"var(--theme-font-display)"},children:m}),n&&e.jsx("div",{className:"flex items-center justify-end gap-2 px-4 py-3",style:{borderTop:"1px solid var(--theme-menu-border)"},children:n})]})]})})}export{j as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,b as y,j as e,C as U,h as K,Z as O,A as B,f as E,a9 as G,ah as T,at as D,E as L}from"./index-B8YEFBRH.js";import{R as V}from"./terminal-BvJZ1R3x.js";import{S as $}from"./save-PlTUvsN5.js";import{C as M}from"./circle-check-big-gkA-V2JW.js";import{E as F}from"./external-link-ByafQkZ7.js";import{S as H}from"./search-BHgLDT-j.js";const _={enabled:!1,apiKey:"",cuopt:{enabled:!1,url:"http://localhost:5000"},asr:{enabled:!1,grpcUrl:"localhost:50051",healthUrl:"http://localhost:9000"},openshell:{enabled:!1,binaryPath:"openshell",policyPath:""}};function f({status:s}){const l={unknown:"bg-border-light",checking:"bg-[#eab308] animate-pulse",healthy:"bg-success",unhealthy:"bg-error"},d={unknown:"Not checked",checking:"Checking...",healthy:"Healthy",unhealthy:"Unreachable"};return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-text-muted",children:[e.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${l[s]}`}),d[s]]})}function v({title:s,description:l,icon:d,enabled:r,onToggle:h,children:p}){return e.jsxs("div",{className:`rounded-xl border bg-bg-secondary transition-colors ${r?"border-[#76b900]/30":"border-bg-tertiary"}`,children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-9 w-9 items-center justify-center rounded-lg ${r?"bg-nvidia/15":"bg-bg-tertiary"}`,children:e.jsx(d,{className:`h-4.5 w-4.5 ${r?"text-nvidia":"text-text-muted"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:s}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:l})]})]}),e.jsx("button",{onClick:h,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${r?"bg-nvidia":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${r?"translate-x-6":"translate-x-1"}`})})]}),r&&e.jsx("div",{className:"border-t border-bg-tertiary px-5 py-4 space-y-3",children:p})]})}function u({id:s,label:l,value:d,onChange:r,placeholder:h,type:p="text",secret:x=!1}){const[m,b]=o.useState(!1);return e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:l}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:s,name:s,type:x&&!m?"password":p,value:d,onChange:n=>r(n.target.value),placeholder:h,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-[#76b900] transition-colors"}),x&&e.jsx("button",{type:"button",onClick:()=>b(!m),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:m?e.jsx(D,{className:"h-4 w-4"}):e.jsx(L,{className:"h-4 w-4"})})]})]})}function J(){const[s,l]=o.useState(_),[d,r]=o.useState(!0),[h,p]=o.useState(!1),[x,m]=o.useState(null),[b,n]=o.useState({cuopt:"unknown",asr:"unknown",nim:"unknown"}),[g,j]=o.useState(!1),N=o.useCallback((t,a)=>{m({type:t,message:a}),setTimeout(()=>m(null),3e3)},[]);o.useEffect(()=>{(async()=>{var a,c,w,S,k,A,I,C;try{const i=await G();i.nvidia&&(l({enabled:i.nvidia.enabled??!1,apiKey:"",cuopt:{enabled:((a=i.nvidia.cuopt)==null?void 0:a.enabled)??!1,url:((c=i.nvidia.cuopt)==null?void 0:c.url)??"http://localhost:5000"},asr:{enabled:((w=i.nvidia.asr)==null?void 0:w.enabled)??!1,grpcUrl:((S=i.nvidia.asr)==null?void 0:S.grpcUrl)??"localhost:50051",healthUrl:((k=i.nvidia.asr)==null?void 0:k.healthUrl)??"http://localhost:9000"},openshell:{enabled:((A=i.nvidia.openshell)==null?void 0:A.enabled)??!1,binaryPath:((I=i.nvidia.openshell)==null?void 0:I.binaryPath)??"openshell",policyPath:((C=i.nvidia.openshell)==null?void 0:C.policyPath)??""}}),j(i.nvidia.apiKeySet??!1))}catch{}finally{r(!1)}})()},[]);const P=o.useCallback(async()=>{if(s.cuopt.enabled){n(t=>({...t,cuopt:"checking"}));try{const a=await(await y("/api/nvidia/health/cuopt")).json();n(c=>({...c,cuopt:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,cuopt:"unhealthy"}))}}if(s.asr.enabled){n(t=>({...t,asr:"checking"}));try{const a=await(await y("/api/nvidia/health/asr")).json();n(c=>({...c,asr:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,asr:"unhealthy"}))}}if(g||s.apiKey){n(t=>({...t,nim:"checking"}));try{const a=await(await y("/api/nvidia/health/nim")).json();n(c=>({...c,nim:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,nim:"unhealthy"}))}}},[s.cuopt.enabled,s.asr.enabled,g,s.apiKey]),R=async()=>{p(!0);try{const t={nvidia:{enabled:s.enabled,cuopt:s.cuopt,asr:s.asr,openshell:s.openshell}};s.apiKey&&(t.nvidia.apiKey=s.apiKey),await T(t),N("success","NVIDIA configuration saved"),s.apiKey&&(j(!0),l(a=>({...a,apiKey:""})))}catch(t){N("error",t instanceof Error?t.message:"Failed to save")}finally{p(!1)}};return d?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((t,a)=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},a))}):e.jsxs("div",{className:"space-y-6 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-nvidia/15",children:e.jsx(U,{className:"h-5 w-5 text-nvidia"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"NVIDIA"}),e.jsx("p",{className:"text-xs text-text-muted",children:"GPU-accelerated AI services — NIM, cuOpt, Nemotron-ASR, OpenShell"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:P,className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary transition-colors",children:[e.jsx(V,{className:"h-3.5 w-3.5"}),"Check Health"]}),e.jsxs("button",{onClick:R,disabled:h,className:"flex items-center gap-2 rounded-lg bg-nvidia px-4 py-1.5 text-xs font-medium text-black transition-colors hover:bg-nvidia/80 disabled:opacity-50",children:[e.jsx($,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save"]})]})]}),x&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${x.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[x.type==="success"?e.jsx(M,{className:"h-4 w-4"}):e.jsx(K,{className:"h-4 w-4"}),x.message]}),e.jsx("div",{className:`rounded-xl border p-5 transition-colors ${s.enabled?"border-[#76b900]/30 bg-nvidia/5":"border-bg-tertiary bg-bg-secondary"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-medium text-text",children:"Enable NVIDIA Skills"}),e.jsxs("p",{className:"text-xs text-text-muted mt-0.5",children:["Load NVIDIA GPU-accelerated skills (cuOpt, AI-Q Research, etc.) when TITAN starts. Equivalent to setting ",e.jsx("code",{className:"text-nvidia/70 bg-nvidia/10 px-1 rounded",children:"TITAN_NVIDIA=1"})]})]}),e.jsx("button",{onClick:()=>l(t=>({...t,enabled:!t.enabled})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${s.enabled?"bg-nvidia":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${s.enabled?"translate-x-6":"translate-x-1"}`})})]})}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{className:"h-4 w-4 text-nvidia"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"NVIDIA NIM API"}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:"Cloud inference for Nemotron 3 Super and other NIM models"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{status:b.nim}),g&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-success"}),"Key configured"]})]})]}),e.jsx(u,{id:"nvidia-api-key",label:"API Key",value:s.apiKey,onChange:t=>l(a=>({...a,apiKey:t})),placeholder:g?"(configured — enter new key to replace)":"nvapi-...",secret:!0}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Get your key at"," ",e.jsxs("a",{href:"https://build.nvidia.com",target:"_blank",rel:"noopener noreferrer",className:"text-nvidia hover:underline inline-flex items-center gap-0.5",children:["build.nvidia.com ",e.jsx(F,{className:"h-2.5 w-2.5"})]})]})]}),e.jsxs(v,{title:"cuOpt Optimization",description:"GPU-accelerated routing, scheduling, and mathematical programming (MILP/LP/QP)",icon:B,enabled:s.cuopt.enabled,onToggle:()=>l(t=>({...t,cuopt:{...t.cuopt,enabled:!t.cuopt.enabled}})),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Service Status"}),e.jsx(f,{status:b.cuopt})]}),e.jsx(u,{id:"nvidia-cuopt-url",label:"cuOpt Server URL",value:s.cuopt.url,onChange:t=>l(a=>({...a,cuopt:{...a.cuopt,url:t}})),placeholder:"http://localhost:5000"}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Start cuOpt: ",e.jsx("code",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-secondary",children:"docker compose -f docker-compose.nvidia.yml --profile cuopt up -d"})]})]}),e.jsxs(v,{title:"Nemotron-ASR Streaming",description:"NVIDIA speech recognition with 24ms median finalization — replaces faster-whisper for voice chat",icon:H,enabled:s.asr.enabled,onToggle:()=>l(t=>({...t,asr:{...t.asr,enabled:!t.asr.enabled}})),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Service Status"}),e.jsx(f,{status:b.asr})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{id:"nvidia-asr-grpc-url",label:"gRPC Address",value:s.asr.grpcUrl,onChange:t=>l(a=>({...a,asr:{...a.asr,grpcUrl:t}})),placeholder:"localhost:50051"}),e.jsx(u,{id:"nvidia-asr-health-url",label:"Health Check URL",value:s.asr.healthUrl,onChange:t=>l(a=>({...a,asr:{...a.asr,healthUrl:t}})),placeholder:"http://localhost:9000"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Start ASR: ",e.jsx("code",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-secondary",children:"docker compose -f docker-compose.nvidia.yml --profile asr up -d"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["VRAM: ~3-4 GB. Set ",e.jsx("code",{className:"bg-bg-tertiary px-1 rounded text-text-secondary",children:"STT_ENGINE=nemotron-asr"})," in voice agent env."]})]}),e.jsxs(v,{title:"OpenShell Sandbox",description:"NVIDIA secure sandbox runtime for code execution with declarative policy enforcement",icon:E,enabled:s.openshell.enabled,onToggle:()=>l(t=>({...t,openshell:{...t.openshell,enabled:!t.openshell.enabled}})),children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{id:"nvidia-openshell-binary-path",label:"Binary Path",value:s.openshell.binaryPath,onChange:t=>l(a=>({...a,openshell:{...a.openshell,binaryPath:t}})),placeholder:"openshell"}),e.jsx(u,{id:"nvidia-openshell-policy-path",label:"Policy File Path (optional)",value:s.openshell.policyPath,onChange:t=>l(a=>({...a,openshell:{...a.openshell,policyPath:t}})),placeholder:"Auto-detected"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["When enabled, code execution uses OpenShell instead of Docker. Set ",e.jsx("code",{className:"bg-bg-tertiary px-1 rounded text-text-secondary",children:'sandbox.engine: "openshell"'})," in config."]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:"VRAM Budget (RTX 5090, 32 GB)"}),e.jsxs("div",{className:"space-y-2",children:[[{label:"Nemotron 3 Nano 30B",vram:"~24 GB",note:"Full local inference"},{label:"Nemotron 3 Nano 4B",vram:"~3 GB",note:"Lightweight variant"},{label:"Nemotron-ASR",vram:"~3-4 GB",note:"Speech recognition"},{label:"cuOpt",vram:"~2-4 GB",note:"Optimization solver"}].map(({label:t,vram:a,note:c})=>e.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-text",children:t}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2",children:c})]}),e.jsx("span",{className:"text-xs font-mono text-nvidia",children:a})]},t)),e.jsx("div",{className:"border-t border-bg-tertiary pt-2 mt-2",children:e.jsx("p",{className:"text-[10px] text-text-muted",children:"Recommended: Nano 4B + ASR + cuOpt = ~10 GB, leaving room for other models. Or use NIM cloud API for LLM inference (0 GB local)."})})]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-2",children:"Quick Start"}),e.jsxs("div",{className:"space-y-2 text-xs text-text-muted",children:[e.jsx("p",{children:"Start all NVIDIA services:"}),e.jsx("code",{className:"block bg-bg border border-bg-tertiary rounded-lg px-3 py-2 text-text-secondary font-mono text-xs",children:"docker compose -f docker-compose.nvidia.yml --profile all up -d"}),e.jsx("p",{className:"mt-2",children:"Or start individual services:"}),e.jsxs("div",{className:"space-y-1 font-mono text-[10px] text-text-muted",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"cuopt:"})," --profile cuopt"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"asr:"})," --profile asr (includes Riva bridge)"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"voice:"})," --profile voice (ASR + bridge)"]})]})]})]})]})}export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,
|
|
1
|
+
import{r as t,bh as b,bi as g,j as e,T as d,f,bj as h}from"./index-B8YEFBRH.js";import{P as p}from"./PageHeader-CiuoyvDR.js";import{R as j}from"./terminal-BvJZ1R3x.js";import{C as u}from"./circle-check-big-gkA-V2JW.js";import"./chevron-right-DAiXsK24.js";function A(){const[n,m]=t.useState([]),[i,o]=t.useState({}),[l,c]=t.useState(!0),r=t.useCallback(async()=>{c(!0);try{const[s,a]=await Promise.all([b(),g()]);m(s.alerts||[]),o(a)}catch{}c(!1)},[]);t.useEffect(()=>{r()},[r]);const x=async s=>{try{await h(s),await r()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(p,{title:"Organism Monitor",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Safety"},{label:"Organism"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:r,disabled:l,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(j,{className:`w-4 h-4 ${l?"animate-spin":""}`})," Refresh"]})}),Object.keys(i).length>0&&e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Object.entries(i).map(([s,a])=>e.jsxs("div",{className:"p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsx("div",{className:"text-xs text-[#52525b] capitalize",children:s}),e.jsx("div",{className:"text-sm font-semibold text-[#e4e4e7]",children:typeof a=="number"?a.toFixed(2):a})]},s))}),e.jsx("div",{className:"space-y-2",children:n.map(s=>e.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg border ${s.severity==="critical"?"bg-red-950/20 border-red-900/50":s.severity==="warning"?"bg-amber-950/20 border-amber-900/50":"bg-[#0a0a0f] border-[#27272a]"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[s.severity==="critical"?e.jsx(d,{className:"w-4 h-4 text-red-400"}):s.severity==="warning"?e.jsx(d,{className:"w-4 h-4 text-amber-400"}):e.jsx(f,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:s.message}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[s.source," • ",new Date(s.timestamp).toLocaleString()]})]})]}),!s.acknowledged&&e.jsxs("button",{onClick:()=>x(s.id),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] text-xs hover:bg-[#3f3f46]",children:[e.jsx(u,{className:"w-3.5 h-3.5"})," Ack"]})]},s.id))})]})}export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,j as e,Z as u,A as v,H as x,C as f,aX as h}from"./index-B8YEFBRH.js";import{S as s}from"./StatCard-2BmOlamJ.js";import{P as n}from"./PageHeader-CiuoyvDR.js";import{S as g}from"./SkeletonLoader-CNSsfH3f.js";import{C as j}from"./clock-qO5kIED9.js";import{M as b}from"./users-NPyAWbs5.js";import{b as y}from"./TitanCanvas-DLIN_wV3.js";import{L as S}from"./layers-tN-wIpE0.js";import"./chevron-right-DAiXsK24.js";import"./clsx-B-dksMZM.js";import"./chevron-up-BudRYwvy.js";import"./plus-CQwCh7WY.js";import"./wrench-BCKgeHj3.js";import"./network-ephW7nah.js";import"./terminal-BvJZ1R3x.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";function w(t){const r=Math.floor(t/86400),a=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return r>0?`${r}d ${a}h ${i}m`:a>0?`${a}h ${i}m`:`${i}m`}function c(t){const r=t/1024/1024;return r>1024?`${(r/1024).toFixed(1)} GB`:`${r.toFixed(0)} MB`}function K(){const[t,r]=l.useState(null),[a,i]=l.useState(null),[d,p]=l.useState(!0),m=async()=>{try{const o=await h();r(o),i(null)}catch(o){i(o instanceof Error?o.message:"Failed to fetch stats")}finally{p(!1)}};return l.useEffect(()=>{m();const o=setInterval(m,1e4);return()=>clearInterval(o)},[]),d?e.jsxs("div",{className:"space-y-4 md:space-y-6",children:[e.jsx(n,{title:"System Overview",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Monitoring"},{label:"Overview"}]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:e.jsx(g,{variant:"metric",count:8})})]}):a?e.jsx("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error",children:a}):t?e.jsxs("div",{className:"space-y-4 md:space-y-6",children:[e.jsx(n,{title:"System Overview",subtitle:"Real-time system health and metrics",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Monitoring"},{label:"Overview"}]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(s,{title:"Uptime",value:w(t.uptime),icon:e.jsx(j,{className:"h-5 w-5"})}),e.jsx(s,{title:"Total Requests",value:t.totalRequests.toLocaleString(),icon:e.jsx(u,{className:"h-5 w-5"})}),e.jsx(s,{title:"Active Agents",value:t.activeAgents,icon:e.jsx(v,{className:"h-5 w-5"})}),e.jsx(s,{title:"Active Sessions",value:t.activeSessions,icon:e.jsx(b,{className:"h-5 w-5"})}),e.jsx(s,{title:"Memory Usage",value:c(t.memoryUsage.heapUsed),icon:e.jsx(x,{className:"h-5 w-5"}),subtitle:`${c(t.memoryUsage.heapTotal)} total`}),e.jsx(s,{title:"Model",value:t.model,icon:e.jsx(f,{className:"h-5 w-5"})}),e.jsx(s,{title:"Provider",value:t.provider,icon:e.jsx(y,{className:"h-5 w-5"})}),e.jsx(s,{title:"Version",value:t.version,icon:e.jsx(S,{className:"h-5 w-5"})})]})]}):null}export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,
|
|
1
|
+
import{j as e,m as i}from"./index-B8YEFBRH.js";import{C as m}from"./chevron-right-DAiXsK24.js";function h({title:n,subtitle:l,breadcrumbs:t,actions:a}){return e.jsxs("div",{className:"mb-4 md:mb-6",children:[t&&t.length>0&&e.jsx("nav",{className:"mb-2 flex items-center gap-1 text-[10px] md:text-xs text-text-muted overflow-x-auto scrollbar-thin pb-1",children:t.map((s,x)=>e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[x>0&&e.jsx(m,{size:12,className:"opacity-50 flex-shrink-0"}),s.href?e.jsx(i,{to:s.href,className:"hover:text-text transition-colors whitespace-nowrap",children:s.label}):e.jsx("span",{className:x===t.length-1?"text-text-secondary whitespace-nowrap":"",children:s.label})]},x))}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg md:text-xl font-semibold text-text",children:n}),l&&e.jsx("p",{className:"mt-0.5 text-[11px] md:text-sm text-text-muted",children:l})]}),a&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:a})]})]})}export{h as P};
|
package/ui/dist/assets/{PersonaProfilesPanel-CfsQTMra.js → PersonaProfilesPanel-BO87DSVG.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as f,r,
|
|
1
|
+
import{c as f,r,am as j,an as g,j as e,ao as N}from"./index-B8YEFBRH.js";import{P as u}from"./PageHeader-CiuoyvDR.js";import{R as v}from"./terminal-BvJZ1R3x.js";import{C as m}from"./check-ChWLFWCx.js";import{P as h}from"./pause-DeggUVZc.js";import{a as w}from"./VoiceOverlay-B3fXJ-EC.js";import{C as y}from"./clock-qO5kIED9.js";import"./chevron-right-DAiXsK24.js";import"./chevron-down-CU_O_5h3.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as s,
|
|
1
|
+
import{r as a,j as s,ak as y,al as j}from"./index-B8YEFBRH.js";function w(){const[r,g]=a.useState([]),[c,l]=a.useState("default"),[h,f]=a.useState(!0),[o,d]=a.useState(null),[n,x]=a.useState(null),[i,b]=a.useState("all");a.useEffect(()=>{(async()=>{try{const t=await y();g(t.personas),l(t.active)}catch(t){d(t instanceof Error?t.message:"Failed to fetch personas")}finally{f(!1)}})()},[]);const p=a.useMemo(()=>{const e=new Set(r.map(t=>t.division));return["all",...Array.from(e).sort()]},[r]),m=a.useMemo(()=>i==="all"?r:r.filter(e=>e.division===i),[r,i]),v=async e=>{if(!(e===c||n)){x(e);try{const t=await j(e);l(t.active)}catch(t){d(t instanceof Error?t.message:"Failed to switch persona")}finally{x(null)}}};return h?s.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-3",children:Array.from({length:6}).map((e,t)=>s.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"},t))}):o?s.jsx("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error",children:o}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"text-lg font-semibold text-text",children:"Personas"}),s.jsxs("span",{className:"text-sm text-text-muted",children:[r.length," available"]})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(e=>s.jsx("button",{onClick:()=>b(e),className:`rounded-lg px-3 py-1.5 text-sm font-medium capitalize transition-colors ${i===e?"bg-accent text-white":"bg-bg-tertiary text-text-secondary hover:text-text"}`,children:e},e))}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[m.map(e=>{const t=e.id===c,u=e.id===n;return s.jsxs("button",{onClick:()=>v(e.id),disabled:t||!!n,className:`rounded-xl border p-4 text-left transition-all ${t?"border-accent bg-accent/10 ring-1 ring-accent/30":"border-border bg-bg-secondary hover:border-border-light hover:bg-bg-secondary"} ${u?"opacity-60":""} disabled:cursor-default`,children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("h3",{className:"font-medium text-text",children:e.name}),t&&s.jsx("span",{className:"rounded-full bg-accent/20 px-2 py-0.5 text-xs font-medium text-accent-hover",children:"Active"}),u&&s.jsx("span",{className:"text-xs text-text-secondary",children:"Switching..."})]}),s.jsx("p",{className:"text-sm text-text-secondary line-clamp-2",children:e.description}),s.jsx("p",{className:"mt-2 text-xs capitalize text-text-muted",children:e.division})]},e.id)}),m.length===0&&s.jsx("p",{className:"col-span-full py-12 text-center text-text-muted",children:"No personas in this division"})]})]})}export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,b6 as x,j as e,b7 as h,b8 as f}from"./index-B8YEFBRH.js";import{P as u}from"./PageHeader-CiuoyvDR.js";import{R as b}from"./terminal-BvJZ1R3x.js";import{B as g}from"./TitanCanvas-DLIN_wV3.js";import{P as j}from"./play-Dfc0ia6v.js";import{T as N}from"./trash-2-lPcFwnW5.js";import"./chevron-right-DAiXsK24.js";import"./chevron-up-BudRYwvy.js";import"./plus-CQwCh7WY.js";import"./users-NPyAWbs5.js";import"./wrench-BCKgeHj3.js";import"./network-ephW7nah.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./clock-qO5kIED9.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";function J(){const[o,m]=t.useState([]),[i,r]=t.useState(!0),[n,c]=t.useState(null),a=t.useCallback(async()=>{r(!0);try{const s=await x();m(s.recipes||[])}catch{}r(!1)},[]);t.useEffect(()=>{a()},[a]);const d=async s=>{c(s);try{await h(s)}catch{}c(null)},p=async s=>{if(confirm("Delete this recipe?"))try{await f(s),await a()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{title:"Recipe Kitchen",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Recipes"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:a,disabled:i,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(b,{className:`w-4 h-4 ${i?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:o.map(s=>{var l;return 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 min-w-0",children:[e.jsx(g,{className:"w-4 h-4 text-[#6366f1] shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-[#e4e4e7] truncate",children:s.name}),e.jsx("div",{className:"text-xs text-[#52525b] truncate",children:s.description}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[s.steps.length," steps • ",(l=s.tags)==null?void 0:l.join(", ")]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("button",{onClick:()=>d(s.id),disabled:n===s.id,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-[#6366f1] text-white text-xs hover:bg-[#4f46e5] disabled:opacity-50",children:[e.jsx(j,{className:"w-3.5 h-3.5"})," ",n===s.id?"Running...":"Run"]}),e.jsx("button",{onClick:()=>p(s.id),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400",children:e.jsx(N,{className:"w-3.5 h-3.5"})})]})]},s.id)})})]})}export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,b as n,j as e}from"./index-
|
|
1
|
+
import{r as t,b as n,j as e}from"./index-B8YEFBRH.js";import{P as i}from"./PageHeader-CiuoyvDR.js";import"./chevron-right-DAiXsK24.js";function b(){const[a,d]=t.useState(null),[o,l]=t.useState(!0);if(t.useEffect(()=>{n("/api/config",{headers:{"Content-Type":"application/json"}}).then(s=>s.json()).then(s=>d(s.security||{})).catch(()=>d({})).finally(()=>l(!1))},[]),o)return e.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading security config..."});const r=a||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(i,{title:"Security",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Settings"},{label:"Security"}]}),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:"Sandbox Mode"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:String(r.sandboxMode||"none")})]}),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:"Shield"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:r.shield?"Enabled":"Disabled"})]}),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:"Denied Tools"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:Array.isArray(r.deniedTools)?r.deniedTools.length:0})]})]}),Array.isArray(r.deniedTools)&&r.deniedTools.length>0&&e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("h2",{className:"text-sm font-medium text-[var(--text-secondary)] mb-2",children:"Denied Tools"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.deniedTools.map(s=>e.jsx("span",{className:"px-2 py-1 text-xs rounded bg-red-500/10 text-red-400 border border-red-500/20",children:s},s))})]})]})}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,a9 as Je,b as u,j as e,A as he,h as We,C as Ge,Z as be,k as Ve,ah as He}from"./index-B8YEFBRH.js";import{a as Pe,S as ge,R as Ke}from"./TitanCanvas-DLIN_wV3.js";import{R as k,T as Ue}from"./terminal-BvJZ1R3x.js";import{C as je}from"./circle-check-big-gkA-V2JW.js";import{C as Ze}from"./clock-qO5kIED9.js";import{T as ze}from"./trophy-Dv6zFfKM.js";import{T as fe}from"./trending-up-DqUbZfDe.js";import{W as Xe,B as Ye}from"./wrench-BCKgeHj3.js";import{C as I}from"./chevron-down-CU_O_5h3.js";import{C as Q}from"./chevron-right-DAiXsK24.js";import{P as ye}from"./play-Dfc0ia6v.js";import{T as et}from"./trash-2-lPcFwnW5.js";import"./chevron-up-BudRYwvy.js";import"./plus-CQwCh7WY.js";import"./users-NPyAWbs5.js";import"./network-ephW7nah.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./folder-DeG4RuOD.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";const D={prompts:"System Prompts","tool-selection":"Tool Selection","response-quality":"Response Quality","error-recovery":"Error Recovery"},J=[{label:"Once daily (2am)",value:["0 2 * * *"]},{label:"Twice daily (2am + 2pm)",value:["0 2 * * *","0 14 * * *"]},{label:"Three times (2am + 10am + 6pm)",value:["0 2 * * *","0 10 * * *","0 18 * * *"]}];function Ne({status:j}){const B={running:"bg-info/10 text-info",completed:"bg-success/10 text-success",failed:"bg-error/10 text-error",training:"bg-warning/10 text-warning",deployed:"bg-purple/10 text-purple"},f={running:"bg-info",completed:"bg-success",failed:"bg-error",training:"bg-warning",deployed:"bg-purple"};return e.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${B[j]||"bg-border-light/20 text-text-muted"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${f[j]||"bg-border-light"}`}),j]})}function Ct(){var me,pe;const[j,B]=a.useState(null),[f,ve]=a.useState([]),[W,we]=a.useState([]),[h,Se]=a.useState([]),[r,ke]=a.useState(null),[Ce,Re]=a.useState(!0),[C,G]=a.useState(null),[R,V]=a.useState(null),[A,_e]=a.useState(!1),[N,Te]=a.useState(!0),[i,H]=a.useState("tool_router"),[E,Me]=a.useState(!1),[p,v]=a.useState({baseModel:"unsloth/Qwen2.5-32B-bnb-4bit",loraRank:32,learningRate:1e-4,epochs:2,timeBudgetMin:60,maxSeqLength:2048}),[b,$e]=a.useState([]),[x,De]=a.useState(null),[P,K]=a.useState(!1),[U,Z]=a.useState(!1),[z,X]=a.useState(!1),[g,Y]=a.useState([]),[S,Be]=a.useState(!0),[Ae,_]=a.useState(!1),L=a.useRef(null),O=a.useRef(null),ee=a.useRef(null),[F,te]=a.useState(1),[T,se]=a.useState(30),[q,ae]=a.useState(120),[M,re]=a.useState(!1),[$,ne]=a.useState(!1),[le,ie]=a.useState([]),[xe,ce]=a.useState(0),m=a.useCallback((t,s)=>{V({type:t,message:s}),setTimeout(()=>V(null),3e3)},[]),y=a.useCallback(async()=>{try{const s=(await Je()).selfImprove||{};B(s),te(s.runsPerDay||1),se(s.budgetMinutes||30),ae(s.maxDailyBudgetMinutes||120),re(s.autoApply||!1),ne(s.pauseOnWeekends||!1),ie(s.areas||["prompts","tool-selection","response-quality","error-recovery"]);const c=s.schedule||["0 2 * * *"],o=J.findIndex(n=>JSON.stringify(n.value)===JSON.stringify(c));ce(o>=0?o:0);try{const n=await u("/api/self-improve/history");if(n.ok){const d=await n.json();ve(d.sessions||[])}}catch{}try{const n=await u("/api/training/runs");if(n.ok){const d=await n.json();we(d.runs||[])}}catch{}try{const[n,d]=await Promise.all([u("/api/autoresearch/results"),u("/api/autoresearch/performance")]);if(n.ok){const l=await n.json();Se(l.runs||[])}if(d.ok){const l=await d.json();ke(l)}}catch{}try{const[n,d]=await Promise.all([u("/api/autoresearch/results?type=agent"),u("/api/autoresearch/performance?type=agent")]);if(n.ok){const l=await n.json();$e(l.runs||[])}if(d.ok){const l=await d.json();De(l)}}catch{}}catch{}finally{Re(!1)}},[]);a.useEffect(()=>{y()},[y]),a.useEffect(()=>(N&&(L.current=setInterval(y,1e4)),()=>{L.current&&clearInterval(L.current)}),[N,y]),a.useEffect(()=>{const t=new EventSource("/api/training/stream");return ee.current=t,t.onopen=()=>_(!0),t.onerror=()=>_(!1),t.onmessage=s=>{try{const c=JSON.parse(s.data);if(c.type==="connected"){_(!0);return}Y(o=>{const n=[...o,c];return n.length>200?n.slice(-200):n})}catch{}},()=>{t.close(),ee.current=null,_(!1)}},[]),a.useEffect(()=>{O.current&&S&&O.current.scrollIntoView({behavior:"smooth"})},[g,S]);const Ee=a.useCallback(async()=>{try{await u("/api/training/progress",{method:"DELETE"}),Y([])}catch{}},[]),Le=async()=>{var t;try{await He({selfImprove:{runsPerDay:F,budgetMinutes:T,maxDailyBudgetMinutes:q,autoApply:M,pauseOnWeekends:$,areas:le,schedule:((t=J[xe])==null?void 0:t.value)||["0 2 * * *"]}}),m("success","Self-improvement settings saved"),await y()}catch(s){m("error",s instanceof Error?s.message:"Failed to save")}},de=async t=>{G(t);try{(await u("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:`Run a self-improvement experiment on ${t} using self_improve_start with area="${t}" and budgetMinutes=${T}`,sessionId:"self-improve"})})).ok?(m("success",`Self-improvement started for ${D[t]||t}`),setTimeout(y,2e3)):m("error","Failed to start self-improvement")}catch(s){m("error",s instanceof Error?s.message:"Failed to start")}finally{G(null)}},Oe=t=>{ie(s=>s.includes(t)?s.filter(c=>c!==t):[...s,t])},Fe=async()=>{K(!0);try{(await u("/api/autoresearch/generate-data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i})})).ok?m("success",`Training data generation started for ${i==="main_agent"?"Main Agent":"Tool Router"}`):m("error","Failed to start data generation")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{K(!1)}},qe=async()=>{Z(!0);try{(await u("/api/autoresearch/trigger",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i,config:p})})).ok?m("success",`Training started for ${i==="main_agent"?"Main Agent":"Tool Router"}`):m("error","Failed to start training")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{Z(!1)}},Ie=async()=>{X(!0);try{(await u("/api/autoresearch/deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i})})).ok?m("success",`Model deployed as ${i==="main_agent"?"titan-agent":"titan-qwen"}`):m("error","Failed to deploy model")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{X(!1)}};if(Ce)return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((t,s)=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},s))});const w=f.length,oe=w>0?(f.reduce((t,s)=>t+(s.bestScore-s.baselineScore),0)/w).toFixed(1):"0",Qe=w>0?(f.filter(t=>t.bestScore>t.baselineScore).length/w*100).toFixed(0):"0";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-purple/10",children:e.jsx(Pe,{className:"h-4 w-4 text-purple-light"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"Self-Improvement"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Autonomous optimization of prompts, tool selection, and response quality"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>Te(!N),className:`flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs transition-colors ${N?"border-success/30 text-success bg-success/5":"border-border text-text-muted hover:bg-bg-tertiary"}`,children:[e.jsx(he,{className:`h-3.5 w-3.5 ${N?"animate-pulse":""}`}),N?"Live":"Paused"]}),e.jsxs("button",{onClick:y,className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary transition-colors hover:bg-bg-tertiary",children:[e.jsx(k,{className:"h-3.5 w-3.5"}),"Refresh"]})]})]}),R&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${R.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[R.type==="success"?e.jsx(je,{className:"h-4 w-4"}):e.jsx(We,{className:"h-4 w-4"}),R.message]}),e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[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-1",children:[e.jsx(Ze,{className:"h-3.5 w-3.5 text-text-muted"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Total Sessions"})]}),e.jsx("p",{className:"text-2xl font-bold text-text",children:w+((r==null?void 0:r.totalRuns)||0)}),r&&r.totalRuns>0&&e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:[w," self-improve + ",r.totalRuns," autoresearch"]})]}),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-1",children:[e.jsx(ze,{className:"h-3.5 w-3.5 text-warning"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Best Val Score"})]}),e.jsx("p",{className:"text-2xl font-bold text-warning",children:(r==null?void 0:r.bestScore)||"—"}),r&&r.baseline>0&&(()=>{const t=r.bestScore-r.baseline,s=t>=0?"+":"",c=t>=0?"text-success":"text-error";return e.jsxs("p",{className:`text-[10px] mt-0.5 ${c}`,children:[s,t.toFixed(1)," from ",r.baseline," baseline"]})})()]}),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-1",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-success"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Success Rate"})]}),e.jsxs("p",{className:"text-2xl font-bold text-info",children:[Qe,"%"]}),e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:["avg improvement: ",Number(oe)>=0?"+":"",oe]})]}),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-1",children:[e.jsx(Ge,{className:"h-3.5 w-3.5 text-purple"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Deployed Model"})]}),e.jsx("p",{className:"text-lg font-bold text-purple",children:"titan-qwen"}),e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:["Q4_K_M • 19GB • ",(j==null?void 0:j.enabled)!==!1?"🟢 Active":"⚫ Off"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Model Training"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("button",{onClick:()=>H("tool_router"),className:`rounded-xl border p-4 text-left transition-all ${i==="tool_router"?"border-purple bg-purple/5 ring-1 ring-purple/20":"border-bg-tertiary bg-bg-secondary hover:border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg ${i==="tool_router"?"bg-purple/20":"bg-bg-tertiary"}`,children:e.jsx(Xe,{className:`h-3.5 w-3.5 ${i==="tool_router"?"text-purple-light":"text-text-muted"}`})}),e.jsx("span",{className:`text-sm font-medium ${i==="tool_router"?"text-text":"text-text-secondary"}`,children:"Tool Router"})]}),e.jsx("p",{className:"text-xs text-text-muted mb-1",children:"titan-qwen"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-success font-medium",children:["Score: ",(r==null?void 0:r.bestScore)||"—"]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"•"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:h.length>0?`${((me=h[h.length-1])==null?void 0:me.num_examples)||0} examples`:"No data"})]}),e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:"Brain / Tool Selection"})]}),e.jsxs("button",{onClick:()=>H("main_agent"),className:`rounded-xl border p-4 text-left transition-all ${i==="main_agent"?"border-purple bg-purple/5 ring-1 ring-purple/20":"border-bg-tertiary bg-bg-secondary hover:border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg ${i==="main_agent"?"bg-purple/20":"bg-bg-tertiary"}`,children:e.jsx(Ye,{className:`h-3.5 w-3.5 ${i==="main_agent"?"text-purple-light":"text-text-muted"}`})}),e.jsx("span",{className:`text-sm font-medium ${i==="main_agent"?"text-text":"text-text-secondary"}`,children:"Main Agent"})]}),e.jsx("p",{className:"text-xs text-text-muted mb-1",children:"titan-agent"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-warning font-medium",children:["Score: ",(x==null?void 0:x.bestScore)||"—"]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"•"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:b.length>0?`${((pe=b[b.length-1])==null?void 0:pe.num_examples)||0} examples`:"No data"})]}),e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:"Primary LLM / Full Agent"})]})]}),e.jsxs("button",{onClick:()=>Me(!E),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[E?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(ge,{className:"h-3.5 w-3.5"}),"Training Configuration"]}),E&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5 space-y-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Base Model"}),e.jsxs("select",{id:"train-base-model",name:"train-base-model",value:p.baseModel,onChange:t=>v(s=>({...s,baseModel:t.target.value})),className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none",children:[e.jsx("option",{value:"unsloth/Qwen2.5-32B-bnb-4bit",children:"Qwen 2.5 32B (4-bit)"}),e.jsx("option",{value:"unsloth/Qwen2.5-14B-bnb-4bit",children:"Qwen 2.5 14B (4-bit)"}),e.jsx("option",{value:"unsloth/Qwen2.5-7B-bnb-4bit",children:"Qwen 2.5 7B (4-bit)"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"LoRA Rank"}),e.jsx("span",{className:"text-sm font-medium text-text",children:p.loraRank})]}),e.jsx("input",{id:"train-lora-rank",name:"train-lora-rank",type:"range",min:4,max:64,step:4,value:p.loraRank,onChange:t=>v(s=>({...s,loraRank:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"4"}),e.jsx("span",{children:"32"}),e.jsx("span",{children:"64"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Learning Rate"}),e.jsx("span",{className:"text-sm font-medium text-text font-mono",children:p.learningRate.toExponential(0)})]}),e.jsx("input",{id:"train-learning-rate",name:"train-learning-rate",type:"range",min:-5,max:-3,step:.5,value:Math.log10(p.learningRate),onChange:t=>v(s=>({...s,learningRate:Math.pow(10,Number(t.target.value))})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1e-5"}),e.jsx("span",{children:"1e-4"}),e.jsx("span",{children:"1e-3"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Epochs"}),e.jsx("span",{className:"text-sm font-medium text-text",children:p.epochs})]}),e.jsx("input",{id:"train-epochs",name:"train-epochs",type:"range",min:1,max:10,value:p.epochs,onChange:t=>v(s=>({...s,epochs:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"5"}),e.jsx("span",{children:"10"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Time Budget"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[p.timeBudgetMin," min"]})]}),e.jsx("input",{id:"train-time-budget",name:"train-time-budget",type:"range",min:5,max:120,step:5,value:p.timeBudgetMin,onChange:t=>v(s=>({...s,timeBudgetMin:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"5 min"}),e.jsx("span",{children:"60 min"}),e.jsx("span",{children:"120 min"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max Sequence Length"}),e.jsx("span",{className:"text-sm font-medium text-text",children:p.maxSeqLength})]}),e.jsx("input",{id:"train-max-seq-length",name:"train-max-seq-length",type:"range",min:512,max:4096,step:256,value:p.maxSeqLength,onChange:t=>v(s=>({...s,maxSeqLength:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"512"}),e.jsx("span",{children:"2048"}),e.jsx("span",{children:"4096"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:Fe,disabled:P,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-purple/50 hover:bg-bg-secondary disabled:opacity-50",children:[P?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(be,{className:"h-3.5 w-3.5 text-warning"}),"Generate Training Data"]}),e.jsxs("button",{onClick:qe,disabled:U,className:"flex items-center justify-center gap-2 rounded-xl bg-purple px-4 py-3 text-xs font-medium text-white transition-colors hover:bg-purple/80 disabled:opacity-50",children:[U?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ye,{className:"h-3.5 w-3.5"}),"Start Training"]}),e.jsxs("button",{onClick:Ie,disabled:z,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-success/50 hover:bg-bg-secondary disabled:opacity-50",children:[z?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(je,{className:"h-3.5 w-3.5 text-success"}),"Deploy Best Model"]}),e.jsxs("button",{onClick:()=>de(i==="main_agent"?"agent-benchmark":"tool-benchmark"),disabled:C!==null,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-[#3b82f6]/50 hover:bg-bg-secondary disabled:opacity-50",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-info"}),"Run Benchmark"]})]})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>Be(!S),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[S?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(Ue,{className:"h-3.5 w-3.5"}),"Live Training Activity",e.jsxs("span",{className:"ml-auto flex items-center gap-1.5",children:[Ae?e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-success",children:[e.jsx(Ke,{className:"h-3 w-3 animate-pulse"})," Connected"]}):e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-error",children:[e.jsx(Ve,{className:"h-3 w-3"})," Disconnected"]}),g.length>0&&e.jsx("span",{className:"rounded-full bg-purple/20 px-1.5 py-0.5 text-[10px] text-purple-light",children:g.length})]})]}),S&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg overflow-hidden",children:[g.length>0&&(()=>{var c,o,n;const t=[...g].reverse().find(d=>{var l;return((l=d.detail)==null?void 0:l.pct)!==void 0});if(!t||t.type==="complete")return null;const s=((c=t.detail)==null?void 0:c.pct)||0;return e.jsxs("div",{className:"border-b border-bg-tertiary px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:t.message}),e.jsxs("span",{className:"text-xs font-medium text-purple",children:[s,"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-purple to-accent transition-all duration-500",style:{width:`${s}%`}})}),((o=t.detail)==null?void 0:o.current)!==void 0&&((n=t.detail)==null?void 0:n.total)!==void 0&&e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsxs("span",{className:"text-[10px] text-text-muted",children:[t.detail.current," / ",t.detail.total," examples"]}),t.detail.category&&e.jsxs("span",{className:"text-[10px] text-text-muted",children:["Category: ",t.detail.category]})]})]})})(),e.jsxs("div",{className:"max-h-64 overflow-y-auto p-3 font-mono text-[11px] leading-5 scrollbar-thin",children:[g.length===0?e.jsxs("div",{className:"flex items-center justify-center py-8 text-text-muted",children:[e.jsx(he,{className:"h-4 w-4 mr-2"}),e.jsx("span",{children:"No training activity yet. Start training to see live progress."})]}):g.map((t,s)=>{var ue;const c={info:"text-info",progress:"text-purple",success:"text-success",error:"text-error",complete:"text-warning",connected:"text-success"},o={info:"●",progress:"◆",success:"✓",error:"✗",complete:"★",connected:"◉"},n=c[t.type]||"text-text-muted",d=o[t.type]||"·",l=t.timestamp?new Date(t.timestamp).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"";return e.jsxs("div",{className:"flex items-start gap-2 hover:bg-bg-secondary/50 rounded px-1",children:[e.jsx("span",{className:"text-border shrink-0 select-none",children:l}),e.jsx("span",{className:`shrink-0 ${n}`,children:d}),e.jsxs("span",{className:`${t.type==="error"?"text-error":"text-text-secondary"}`,children:[t.message,((ue=t.detail)==null?void 0:ue.category)&&t.type==="progress"&&e.jsxs("span",{className:"text-text-muted",children:[" [",t.detail.category,"]"]})]})]},s)}),e.jsx("div",{ref:O})]}),g.length>0&&e.jsxs("div",{className:"border-t border-bg-tertiary px-3 py-2 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] text-text-muted",children:[g.filter(t=>t.type==="success"||t.type==="progress").length," successes"," · ",g.filter(t=>t.type==="error").length," errors"]}),e.jsxs("button",{onClick:Ee,className:"flex items-center gap-1 text-[10px] text-text-muted hover:text-text-secondary transition-colors",children:[e.jsx(et,{className:"h-3 w-3"}),"Clear"]})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Run Now"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(D).map(([t,s])=>e.jsxs("button",{onClick:()=>de(t),disabled:C!==null,className:"flex items-center gap-3 rounded-xl border border-bg-tertiary bg-bg-secondary p-4 text-left transition-colors hover:border-purple/50 hover:bg-bg-secondary disabled:opacity-50",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-purple/10",children:C===t?e.jsx(k,{className:"h-4 w-4 text-purple-light animate-spin"}):e.jsx(ye,{className:"h-4 w-4 text-purple-light"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text",children:s}),e.jsx("p",{className:"text-xs text-text-muted",children:C===t?"Running...":"Start experiment"})]})]},t))})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>_e(!A),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[A?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(ge,{className:"h-3.5 w-3.5"}),"Schedule Settings"]}),A&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-6 space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Runs per day"}),e.jsx("span",{className:"text-sm font-medium text-text",children:F})]}),e.jsx("input",{id:"schedule-runs-per-day",name:"schedule-runs-per-day",type:"range",min:1,max:12,value:F,onChange:t=>te(Number(t.target.value)),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"6"}),e.jsx("span",{children:"12"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Schedule"}),e.jsx("select",{id:"schedule-preset",name:"schedule-preset",value:xe,onChange:t=>ce(Number(t.target.value)),className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none",children:J.map((t,s)=>e.jsx("option",{value:s,children:t.label},s))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Budget per run (minutes)"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[T," min"]})]}),e.jsx("input",{id:"schedule-budget-minutes",name:"schedule-budget-minutes",type:"range",min:5,max:120,step:5,value:T,onChange:t=>se(Number(t.target.value)),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"5 min"}),e.jsx("span",{children:"60 min"}),e.jsx("span",{children:"120 min"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max daily budget (minutes)"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[q," min"]})]}),e.jsx("input",{id:"schedule-max-daily-budget",name:"schedule-max-daily-budget",type:"range",min:30,max:480,step:30,value:q,onChange:t=>ae(Number(t.target.value)),className:"w-full accent-purple"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs text-text-muted",children:"Improvement areas"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(D).map(([t,s])=>e.jsx("button",{onClick:()=>Oe(t),className:`rounded-full px-3 py-1 text-xs font-medium transition-colors ${le.includes(t)?"bg-purple text-white":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:s},t))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Auto-apply improvements"}),e.jsx("button",{onClick:()=>re(!M),className:`relative h-5 w-9 rounded-full transition-colors ${M?"bg-purple":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-transform ${M?"translate-x-4":""}`})})]}),e.jsxs("label",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Pause on weekends"}),e.jsx("button",{onClick:()=>ne(!$),className:`relative h-5 w-9 rounded-full transition-colors ${$?"bg-purple":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-transform ${$?"translate-x-4":""}`})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:Le,className:"flex items-center gap-2 rounded-lg bg-purple px-4 py-2 text-xs font-medium text-white transition-colors hover:bg-purple/80",children:"Save Settings"})})]})]}),f.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Session History"}),e.jsx("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Area"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Baseline"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Best"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"+Δ"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"K/D/C"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Status"})]})}),e.jsx("tbody",{children:f.slice().reverse().slice(0,10).map(t=>{const s=t.bestScore-t.baselineScore;return e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:t.startedAt.slice(0,10)}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text",children:D[t.area]||t.area}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.baselineScore}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text font-medium",children:t.bestScore}),e.jsxs("td",{className:`px-4 py-2.5 text-xs font-medium ${s>0?"text-success":"text-text-muted"}`,children:[s>0?"+":"",s]}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[t.keeps,"/",t.discards,"/",t.crashes]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(Ne,{status:t.applied?"deployed":t.status})})]},t.id)})})]})})]}),W.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Model Training"}),e.jsx("div",{className:"space-y-2",children:W.slice().reverse().slice(0,5).map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(be,{className:"h-4 w-4 text-warning"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text",children:t.id}),e.jsxs("p",{className:"text-xs text-text-muted",children:[t.baseModel," • ",t.dataPoints," samples • ",t.method]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.finalLoss!==void 0&&e.jsxs("span",{className:"text-xs text-text-muted",children:["loss: ",t.finalLoss.toFixed(4)]}),e.jsx(Ne,{status:t.status})]})]},t.id))})]}),h.length>0&&i==="tool_router"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Autoresearch Experiments — Tool Router"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-bg-tertiary",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Val Score Over Time"}),e.jsxs("span",{className:"text-xs text-success font-medium",children:["Best: ",(r==null?void 0:r.bestScore)||Math.max(...h.map(t=>t.val_score))]})]}),e.jsx("div",{className:"h-16 flex items-end gap-1",children:h.map((t,s)=>{const c=Math.max(...h.map(l=>l.val_score),100),o=Math.min(...h.map(l=>l.val_score),0),n=c-o||1,d=(t.val_score-o)/n*100;return e.jsx("div",{className:"flex-1 rounded-t transition-all hover:opacity-80",style:{height:`${Math.max(d,4)}%`,backgroundColor:(r==null?void 0:r.baseline)!=null?t.val_score>=r.baseline?"var(--color-success)":"var(--color-error)":"var(--color-purple)"},title:`Run ${s+1}: ${t.val_score} (${new Date(t.timestamp).toLocaleDateString()})`},s)})}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("div",{className:"border-t border-dashed border-border-light/50 absolute w-full"}),e.jsx("span",{className:"text-[9px] text-text-muted relative -top-2",children:(r==null?void 0:r.baseline)!=null?`baseline: ${r.baseline}`:"baseline: —"})]})]}),e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Score"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"LR"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Rank"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Epochs"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Examples"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Duration"})]})}),e.jsx("tbody",{children:h.slice().reverse().slice(0,20).map((t,s)=>e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:h.length-s}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:new Date(t.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:`px-4 py-2.5 text-xs font-bold ${t.val_score>=((r==null?void 0:r.baseline)||78)?"text-success":"text-error"}`,children:t.val_score}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted font-mono",children:t.hyperparams.lr}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.rank}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.epochs}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.num_examples}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[Math.round(t.training_time_s/60),"m ",Math.round(t.training_time_s%60),"s"]})]},s))})]})]})]}),b.length>0&&i==="main_agent"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Autoresearch Experiments — Main Agent"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-bg-tertiary",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Val Score Over Time"}),e.jsxs("span",{className:"text-xs text-warning font-medium",children:["Best: ",(x==null?void 0:x.bestScore)||Math.max(...b.map(t=>t.val_score))]})]}),e.jsx("div",{className:"h-16 flex items-end gap-1",children:b.map((t,s)=>{const c=Math.max(...b.map(l=>l.val_score),100),o=Math.min(...b.map(l=>l.val_score),0),n=c-o||1,d=(t.val_score-o)/n*100;return e.jsx("div",{className:"flex-1 rounded-t transition-all hover:opacity-80",style:{height:`${Math.max(d,4)}%`,backgroundColor:(x==null?void 0:x.baseline)!=null?t.val_score>=x.baseline?"var(--color-warning)":"var(--color-error)":"var(--color-purple)"},title:`Run ${s+1}: ${t.val_score} (${new Date(t.timestamp).toLocaleDateString()})`},s)})}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("div",{className:"border-t border-dashed border-border-light/50 absolute w-full"}),e.jsx("span",{className:"text-[9px] text-text-muted relative -top-2",children:(x==null?void 0:x.baseline)!=null?`baseline: ${x.baseline}`:"baseline: —"})]})]}),e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Score"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"LR"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Rank"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Epochs"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Examples"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Duration"})]})}),e.jsx("tbody",{children:b.slice().reverse().slice(0,20).map((t,s)=>e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:b.length-s}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:new Date(t.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:`px-4 py-2.5 text-xs font-bold ${t.val_score>=((x==null?void 0:x.baseline)||70)?"text-warning":"text-error"}`,children:t.val_score}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted font-mono",children:t.hyperparams.lr}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.rank}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.epochs}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.num_examples}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[Math.round(t.training_time_s/60),"m ",Math.round(t.training_time_s%60),"s"]})]},s))})]})]})]})]})}export{Ct as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as i,b as m,j as t,T as E,k as v,i as h}from"./index-
|
|
2
|
-
`+a.bundlePath),await o()}finally{l(null)}},k=async e=>{if(window.confirm("Dismiss this self-proposal? This marks it rejected and prevents PR creation.")){l(e);try{await m(`/api/self-proposals/${e}/dismiss`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"dismissed by user from UI"})}),await o()}finally{l(null)}}};return y?t.jsxs("div",{className:"space-y-6",children:[t.jsx(g,{title:"Self-Proposals",subtitle:"Autonomous outputs captured for human-gated merge",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"}]}),t.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-6",children:[t.jsx("p",{className:"text-[var(--text)] font-medium mb-2",children:"Self-Modification is off."}),t.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["Enable by setting ",t.jsx("code",{className:"bg-[var(--bg-tertiary)] px-1 rounded",children:"selfMod.enabled: true"})," in ",t.jsx("code",{className:"bg-[var(--bg-tertiary)] px-1 rounded",children:"titan.json"}),". When on, autonomous writes from Soma-driven goals are captured, reviewed by the specialist panel, and proposed as GitHub PRs for your merge."]})]})]}):j?t.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading self-proposals..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(g,{title:"Self-Proposals",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"},{label:"Self-Proposals"}]}),t.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"TITAN autonomously wrote these outputs while working on Soma-driven goals. Its specialist panel (Analyst, Builder, Writer) reviews each for safety + utility. You are the final merge gate — no PR is ever merged without your click on GitHub."})}),x.length===0?t.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-6 text-center",children:t.jsx("p",{className:"text-[var(--text-muted)]",children:"No self-proposals yet. They appear here when TITAN writes code under an autonomous Soma-driven session."})}):t.jsx("div",{className:"space-y-3",children:x.map(e=>{const r=M[e.status],a=r.icon,d=w===e.id;return t.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden",children:[t.jsx("button",{className:"w-full p-4 text-left hover:bg-[var(--bg-tertiary)]",onClick:()=>P(d?null:e.id),children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx(a,{className:`w-4 h-4 ${r.color}`}),t.jsx("span",{className:`text-xs font-medium ${r.color}`,children:r.label}),e.drive&&t.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--bg-tertiary)] text-[var(--text-muted)]",children:["drive: ",e.drive]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:[e.files.length," file",e.files.length===1?"":"s"]})]}),t.jsx("p",{className:"text-sm font-medium text-[var(--text)] truncate",children:e.title}),e.goalTitle&&t.jsxs("p",{className:"text-xs text-[var(--text-muted)] mt-1 truncate",children:["Goal: ",e.goalTitle]})]}),t.jsx("div",{className:"text-xs text-[var(--text-muted)] whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()})]})}),d&&t.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-[var(--border)]",children:[e.rejectionReason&&t.jsxs("div",{className:"mt-3 p-3 bg-rose-500/10 border border-rose-500/30 rounded text-sm",children:[t.jsx("p",{className:"font-medium text-rose-400 mb-1",children:"Rejection"}),t.jsx("p",{className:"text-[var(--text)]",children:e.rejectionReason})]}),e.errorMessage&&t.jsxs("div",{className:"mt-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded text-sm",children:[t.jsx("p",{className:"font-medium text-amber-400 mb-1",children:"Error"}),t.jsx("p",{className:"text-[var(--text)]",children:e.errorMessage})]}),e.verdicts.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"text-xs font-medium text-[var(--text-muted)] mb-2",children:"Specialist verdicts"}),t.jsx("div",{className:"space-y-2",children:e.verdicts.map(s=>t.jsxs("div",{className:"p-2 bg-[var(--bg-tertiary)] rounded text-xs",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"font-semibold text-[var(--text)] capitalize",children:s.specialistId}),t.jsx("span",{className:s.vote==="approve"?"text-emerald-400":s.vote==="reject"?"text-rose-400":"text-amber-400",children:s.vote})]}),t.jsx("p",{className:"text-[var(--text-muted)]",children:s.rationale})]},s.specialistId))})]}),e.files.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"text-xs font-medium text-[var(--text-muted)] mb-2",children:"Captured files"}),t.jsx("div",{className:"space-y-2",children:e.files.map(s=>{var c;return t.jsxs("details",{className:"bg-[var(--bg-tertiary)] rounded",onToggle:A=>{A.target.open&&R(e.id,s.capturedPath)},children:[t.jsxs("summary",{className:"p-2 cursor-pointer text-xs text-[var(--text)]",children:[t.jsx("code",{children:s.capturedPath}),t.jsxs("span",{className:"text-[var(--text-muted)] ml-2",children:["(",s.lineCount," lines, ",s.size," bytes)"]})]}),t.jsx("pre",{className:"p-3 text-xs overflow-x-auto max-h-96 bg-[var(--bg-primary)] text-[var(--text)]",children:((c=b[e.id])==null?void 0:c[s.capturedPath])??"Loading..."})]},s.capturedPath)})})]}),t.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.status==="captured"&&t.jsx("button",{onClick:()=>C(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-blue-600 hover:bg-blue-500 disabled:opacity-50 text-white rounded",children:n===e.id?"Reviewing...":"Run specialist review"}),e.status==="approved"&&t.jsx("button",{onClick:()=>T(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-purple-600 hover:bg-purple-500 disabled:opacity-50 text-white rounded",children:n===e.id?"Opening PR...":"Open GitHub PR"}),e.prUrl&&t.jsxs("a",{href:e.prUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs bg-[var(--bg-tertiary)] hover:bg-[var(--bg-primary)] text-[var(--text)] rounded border border-[var(--border)]",children:["View PR #",e.prNumber??""]}),(e.status==="captured"||e.status==="review_pending"||e.status==="approved")&&t.jsx("button",{onClick:()=>k(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-[var(--bg-tertiary)] hover:bg-rose-600 hover:text-white disabled:opacity-50 text-[var(--text-muted)] rounded border border-[var(--border)]",children:"Dismiss"})]})]})]},e.id)})})]})}export{
|
|
1
|
+
import{r as i,b as m,j as t,T as E,k as v,i as h}from"./index-B8YEFBRH.js";import{P as g}from"./PageHeader-CiuoyvDR.js";import{G as I}from"./TitanCanvas-DLIN_wV3.js";import{C as f}from"./clock-qO5kIED9.js";import"./chevron-right-DAiXsK24.js";import"./chevron-up-BudRYwvy.js";import"./plus-CQwCh7WY.js";import"./users-NPyAWbs5.js";import"./wrench-BCKgeHj3.js";import"./network-ephW7nah.js";import"./terminal-BvJZ1R3x.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";const M={captured:{label:"Captured",color:"text-blue-400",icon:f},review_pending:{label:"Reviewing",color:"text-amber-400",icon:f},approved:{label:"Approved — ready for PR",color:"text-emerald-400",icon:h},rejected:{label:"Rejected",color:"text-rose-400",icon:v},pr_open:{label:"PR open — awaiting merge",color:"text-purple-400",icon:I},merged:{label:"Merged ✓",color:"text-emerald-500",icon:h},closed_unmerged:{label:"Closed unmerged",color:"text-slate-400",icon:v},error:{label:"Error",color:"text-rose-500",icon:E}};function te(){const[x,p]=i.useState([]),[j,u]=i.useState(!0),[y,N]=i.useState(!1),[w,P]=i.useState(null),[n,l]=i.useState(null),[b,S]=i.useState({}),o=i.useCallback(async()=>{try{const e=await m("/api/self-proposals");if(e.status===404){N(!0),u(!1);return}const r=await e.json();p(r.proposals||[])}catch{p([])}finally{u(!1)}},[]);i.useEffect(()=>{o();const e=setInterval(o,15e3);return()=>clearInterval(e)},[o]);const R=async(e,r)=>{var a;if(!((a=b[e])!=null&&a[r]))try{const d=await m(`/api/self-proposals/${e}/files/${r}`);if(!d.ok)return;const s=await d.text();S(c=>({...c,[e]:{...c[e]||{},[r]:s}}))}catch{}},C=async e=>{l(e);try{await m(`/api/self-proposals/${e}/review`,{method:"POST"}),await o()}finally{l(null)}},T=async e=>{l(e);try{const a=await(await m(`/api/self-proposals/${e}/open-pr`,{method:"POST"})).json();a.prUrl?window.open(a.prUrl,"_blank"):a.errorMessage?alert("PR creation failed: "+a.errorMessage):a.bundlePath&&alert(`No git checkout — bundle exported to:
|
|
2
|
+
`+a.bundlePath),await o()}finally{l(null)}},k=async e=>{if(window.confirm("Dismiss this self-proposal? This marks it rejected and prevents PR creation.")){l(e);try{await m(`/api/self-proposals/${e}/dismiss`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"dismissed by user from UI"})}),await o()}finally{l(null)}}};return y?t.jsxs("div",{className:"space-y-6",children:[t.jsx(g,{title:"Self-Proposals",subtitle:"Autonomous outputs captured for human-gated merge",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"}]}),t.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-6",children:[t.jsx("p",{className:"text-[var(--text)] font-medium mb-2",children:"Self-Modification is off."}),t.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["Enable by setting ",t.jsx("code",{className:"bg-[var(--bg-tertiary)] px-1 rounded",children:"selfMod.enabled: true"})," in ",t.jsx("code",{className:"bg-[var(--bg-tertiary)] px-1 rounded",children:"titan.json"}),". When on, autonomous writes from Soma-driven goals are captured, reviewed by the specialist panel, and proposed as GitHub PRs for your merge."]})]})]}):j?t.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading self-proposals..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(g,{title:"Self-Proposals",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"},{label:"Self-Proposals"}]}),t.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"TITAN autonomously wrote these outputs while working on Soma-driven goals. Its specialist panel (Analyst, Builder, Writer) reviews each for safety + utility. You are the final merge gate — no PR is ever merged without your click on GitHub."})}),x.length===0?t.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-6 text-center",children:t.jsx("p",{className:"text-[var(--text-muted)]",children:"No self-proposals yet. They appear here when TITAN writes code under an autonomous Soma-driven session."})}):t.jsx("div",{className:"space-y-3",children:x.map(e=>{const r=M[e.status],a=r.icon,d=w===e.id;return t.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden",children:[t.jsx("button",{className:"w-full p-4 text-left hover:bg-[var(--bg-tertiary)]",onClick:()=>P(d?null:e.id),children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx(a,{className:`w-4 h-4 ${r.color}`}),t.jsx("span",{className:`text-xs font-medium ${r.color}`,children:r.label}),e.drive&&t.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--bg-tertiary)] text-[var(--text-muted)]",children:["drive: ",e.drive]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:[e.files.length," file",e.files.length===1?"":"s"]})]}),t.jsx("p",{className:"text-sm font-medium text-[var(--text)] truncate",children:e.title}),e.goalTitle&&t.jsxs("p",{className:"text-xs text-[var(--text-muted)] mt-1 truncate",children:["Goal: ",e.goalTitle]})]}),t.jsx("div",{className:"text-xs text-[var(--text-muted)] whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()})]})}),d&&t.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-[var(--border)]",children:[e.rejectionReason&&t.jsxs("div",{className:"mt-3 p-3 bg-rose-500/10 border border-rose-500/30 rounded text-sm",children:[t.jsx("p",{className:"font-medium text-rose-400 mb-1",children:"Rejection"}),t.jsx("p",{className:"text-[var(--text)]",children:e.rejectionReason})]}),e.errorMessage&&t.jsxs("div",{className:"mt-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded text-sm",children:[t.jsx("p",{className:"font-medium text-amber-400 mb-1",children:"Error"}),t.jsx("p",{className:"text-[var(--text)]",children:e.errorMessage})]}),e.verdicts.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"text-xs font-medium text-[var(--text-muted)] mb-2",children:"Specialist verdicts"}),t.jsx("div",{className:"space-y-2",children:e.verdicts.map(s=>t.jsxs("div",{className:"p-2 bg-[var(--bg-tertiary)] rounded text-xs",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"font-semibold text-[var(--text)] capitalize",children:s.specialistId}),t.jsx("span",{className:s.vote==="approve"?"text-emerald-400":s.vote==="reject"?"text-rose-400":"text-amber-400",children:s.vote})]}),t.jsx("p",{className:"text-[var(--text-muted)]",children:s.rationale})]},s.specialistId))})]}),e.files.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"text-xs font-medium text-[var(--text-muted)] mb-2",children:"Captured files"}),t.jsx("div",{className:"space-y-2",children:e.files.map(s=>{var c;return t.jsxs("details",{className:"bg-[var(--bg-tertiary)] rounded",onToggle:A=>{A.target.open&&R(e.id,s.capturedPath)},children:[t.jsxs("summary",{className:"p-2 cursor-pointer text-xs text-[var(--text)]",children:[t.jsx("code",{children:s.capturedPath}),t.jsxs("span",{className:"text-[var(--text-muted)] ml-2",children:["(",s.lineCount," lines, ",s.size," bytes)"]})]}),t.jsx("pre",{className:"p-3 text-xs overflow-x-auto max-h-96 bg-[var(--bg-primary)] text-[var(--text)]",children:((c=b[e.id])==null?void 0:c[s.capturedPath])??"Loading..."})]},s.capturedPath)})})]}),t.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.status==="captured"&&t.jsx("button",{onClick:()=>C(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-blue-600 hover:bg-blue-500 disabled:opacity-50 text-white rounded",children:n===e.id?"Reviewing...":"Run specialist review"}),e.status==="approved"&&t.jsx("button",{onClick:()=>T(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-purple-600 hover:bg-purple-500 disabled:opacity-50 text-white rounded",children:n===e.id?"Opening PR...":"Open GitHub PR"}),e.prUrl&&t.jsxs("a",{href:e.prUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs bg-[var(--bg-tertiary)] hover:bg-[var(--bg-primary)] text-[var(--text)] rounded border border-[var(--border)]",children:["View PR #",e.prNumber??""]}),(e.status==="captured"||e.status==="review_pending"||e.status==="approved")&&t.jsx("button",{onClick:()=>k(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-[var(--bg-tertiary)] hover:bg-rose-600 hover:text-white disabled:opacity-50 text-[var(--text-muted)] rounded border border-[var(--border)]",children:"Dismiss"})]})]})]},e.id)})})]})}export{te as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,j as s,X as k,aY as C,aZ as M,a_ as L,a$ as E}from"./index-B8YEFBRH.js";import{P as D}from"./PageHeader-CiuoyvDR.js";import"./Input-j10hONMY.js";import{D as P}from"./DataTable-DZ2cG3Cv.js";import{I as A}from"./InlineEditableField-fDk3eGVo.js";import{S as F}from"./search-BHgLDT-j.js";import{T as I}from"./trash-2-lPcFwnW5.js";import"./chevron-right-DAiXsK24.js";import"./clsx-B-dksMZM.js";import"./check-ChWLFWCx.js";import"./terminal-BvJZ1R3x.js";function B(){const[p,g]=a.useState([]),[b,f]=a.useState(!0),[c,n]=a.useState(null),[o,y]=a.useState(""),[l,i]=a.useState(null),[m,r]=a.useState([]),[j,x]=a.useState(!1),d=async()=>{try{const e=await C();g(e),n(null)}catch(e){n(e instanceof Error?e.message:"Failed to fetch sessions")}finally{f(!1)}};a.useEffect(()=>{d()},[]);const N=async e=>{i(e.id),x(!0);try{const t=await M(e.id);r(t)}catch{r([])}finally{x(!1)}},w=async e=>{try{await E(e),l===e&&(i(null),r([])),await d()}catch(t){n(t instanceof Error?t.message:"Failed to delete session")}},S=p.filter(e=>{var u,h;if(!o)return!0;const t=o.toLowerCase();return e.id.toLowerCase().includes(t)||((u=e.name)==null?void 0:u.toLowerCase().includes(t))||((h=e.lastMessage)==null?void 0:h.toLowerCase().includes(t))}),v=[{key:"id",header:"ID",render:e=>s.jsxs("span",{className:"font-mono text-xs",children:[e.id.slice(0,12),"..."]})},{key:"name",header:"Name",render:e=>s.jsx("span",{className:"text-sm text-text",children:s.jsx(A,{value:e.name??"",onSave:async t=>{await L(e.id,t),await d()},placeholder:"Session name",emptyLabel:"Untitled",hidePencil:!0})})},{key:"messageCount",header:"Messages"},{key:"lastMessage",header:"Last Message",render:e=>s.jsx("span",{className:"block max-w-xs truncate text-text-secondary",children:e.lastMessage??"-"})},{key:"createdAt",header:"Created",render:e=>s.jsx("span",{children:new Date(e.createdAt).toLocaleString()})},{key:"_actions",header:"",className:"w-16",render:e=>s.jsx("button",{onClick:t=>{t.stopPropagation(),w(e.id)},className:"rounded-md p-1.5 text-error transition-colors hover:bg-bg-tertiary",title:"Delete session",children:s.jsx(I,{className:"h-4 w-4"})})}];return b?s.jsx("div",{className:"h-64 animate-pulse rounded-xl border border-border bg-bg-secondary"}):s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:`space-y-4 ${l?"flex-1":"w-full"}`,children:[s.jsx(D,{title:"Sessions",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Monitoring"},{label:"Sessions"}]}),s.jsxs("div",{className:"relative",children:[s.jsx(F,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-muted"}),s.jsx("input",{value:o,onChange:e=>y(e.target.value),placeholder:"Search sessions...",className:"w-full rounded-lg border border-border bg-bg py-2 pl-10 pr-3 text-sm text-text outline-none focus:border-accent"})]}),c&&s.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:c}),s.jsx(P,{columns:v,data:S,onRowClick:N,emptyMessage:"No sessions found"})]}),l&&s.jsxs("div",{className:"w-96 shrink-0 rounded-xl border border-border bg-bg-secondary",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[s.jsx("h3",{className:"text-sm font-medium text-text",children:"Messages"}),s.jsx("button",{onClick:()=>{i(null),r([])},className:"rounded-md p-1 text-text-muted hover:text-text",children:s.jsx(k,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"max-h-[600px] overflow-y-auto p-4",children:j?s.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-bg-tertiary"},t))}):m.length===0?s.jsx("p",{className:"text-center text-sm text-text-muted",children:"No messages"}):s.jsx("div",{className:"space-y-3",children:m.map((e,t)=>s.jsxs("div",{className:`rounded-lg p-3 text-sm ${e.role==="user"?"bg-accent/10 text-text":e.role==="assistant"?"bg-bg-tertiary text-text":"bg-bg text-text-secondary"}`,children:[s.jsx("span",{className:"mb-1 block text-xs font-medium uppercase text-text-muted",children:e.role}),s.jsx("p",{className:"whitespace-pre-wrap",children:e.content})]},t))})})]})]})}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,b as j,X as A}from"./index-
|
|
1
|
+
import{r as c,j as e,b as j,X as A}from"./index-B8YEFBRH.js";import{A as E,m as v}from"./proxy-BjQ4lsww.js";const C=["initiative","deliberation","autopilot","agent-","company-","swarm","subagent","plan-"],S=["webchat","messenger-admin","messenger","twilio-admin","twilio","livekit","api"];function p(s){return C.some(a=>s===a||s.startsWith(a))}function g(s){return S.some(a=>s===a||s.startsWith(a))}function F(){const[s,a]=c.useState([]),[o,x]=c.useState(!0),[l,m]=c.useState("internal"),[u,n]=c.useState(null);c.useEffect(()=>{let t=!0;const i=async()=>{try{const h=await j("/api/sessions");if(!h.ok)return;const b=await h.json();if(!t)return;a(Array.isArray(b)?b:[]),x(!1)}catch{}};i();const r=setInterval(i,15e3);return()=>{t=!1,clearInterval(r)}},[]);const d=c.useMemo(()=>{let t=s;return l==="internal"?t=t.filter(i=>p(i.channel)):l==="user"?t=t.filter(i=>g(i.channel)):l!=="all"&&(t=t.filter(i=>i.channel===l)),t.sort((i,r)=>(r.lastActive||"").localeCompare(i.lastActive||""))},[s,l]),w=c.useMemo(()=>{const t=new Map;for(const i of d){const r=t.get(i.channel)||[];r.push(i),t.set(i.channel,r)}return[...t.entries()].sort((i,r)=>i[0].localeCompare(r[0]))},[d]),y=s.filter(t=>p(t.channel)).length,k=s.filter(t=>g(t.channel)).length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] text-text-muted mb-2",children:"Internal sessions are TITAN's background thought-trains: autopilot runs, deliberation plans, sub-agent delegations. You wouldn't normally see these in chat."}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsxs(f,{active:l==="internal",onClick:()=>m("internal"),children:["Internal ",e.jsxs("span",{className:"text-text-muted ml-1",children:["(",y,")"]})]}),e.jsxs(f,{active:l==="user",onClick:()=>m("user"),children:["User chats ",e.jsxs("span",{className:"text-text-muted ml-1",children:["(",k,")"]})]}),e.jsxs(f,{active:l==="all",onClick:()=>m("all"),children:["All ",e.jsxs("span",{className:"text-text-muted ml-1",children:["(",s.length,")"]})]})]})]}),o?e.jsx("div",{className:"p-6 text-center text-[12px] text-text-muted",children:"Loading sessions…"}):d.length===0?e.jsx("div",{className:"p-8 text-center text-[12px] text-text-muted bg-bg-secondary/50 border border-border rounded-xl",children:"No sessions in this filter."}):e.jsx("div",{className:"space-y-4",children:w.map(([t,i])=>e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2.5 flex items-center justify-between border-b border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[12px] text-text-secondary font-medium",children:t}),e.jsx("span",{className:"text-[10px] text-text-muted",children:i.length})]}),e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:p(t)?"internal":g(t)?"user":"other"})]}),e.jsxs("div",{className:"divide-y divide-border/30",children:[i.slice(0,8).map(r=>{var h;return e.jsxs("div",{onClick:()=>n(r),className:"px-4 py-2.5 flex items-start gap-3 hover:bg-bg-tertiary/30 cursor-pointer",children:[e.jsx("div",{className:`w-1.5 h-1.5 rounded-full mt-1.5 flex-shrink-0 ${r.status==="active"?"bg-emerald-400":"bg-white/20"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[12px] text-text truncate",children:r.name||((h=r.lastMessage)==null?void 0:h.slice(0,80))||"(untitled)"}),e.jsxs("div",{className:"text-[10px] text-white/35 mt-0.5",children:[r.messageCount," msg · ",N(r.lastActive)," · ",r.userId]})]})]},r.id)}),i.length>8&&e.jsxs("div",{className:"px-4 py-2 text-[10px] text-text-muted italic",children:["+ ",i.length-8," more ",t," session",i.length-8===1?"":"s"]})]})]},t))}),e.jsx(I,{open:u!==null,session:u,onClose:()=>n(null)})]})}function f({active:s,onClick:a,children:o}){return e.jsx("button",{onClick:a,className:`px-3 py-1 text-[11px] rounded-lg transition-colors ${s?"bg-indigo-600 text-white":"bg-bg-tertiary text-text-muted hover:text-text"}`,children:o})}function I({open:s,session:a,onClose:o}){const[x,l]=c.useState([]),[m,u]=c.useState(!1);return c.useEffect(()=>{if(!s||!a){l([]);return}u(!0),j(`/api/sessions/${a.id}`).then(n=>n.ok?n.json():null).then(n=>{const d=Array.isArray(n)?n:(n==null?void 0:n.messages)||[];l(d)}).catch(()=>{}).finally(()=>u(!1))},[s,a]),c.useEffect(()=>{if(!s)return;const n=d=>{d.key==="Escape"&&o()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[s,o]),e.jsx(E,{children:s&&a&&e.jsxs(e.Fragment,{children:[e.jsx(v.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},onClick:o,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",zIndex:99}},"backdrop"),e.jsxs(v.aside,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{duration:.28,ease:[.32,.72,0,1]},style:{position:"fixed",top:0,right:0,bottom:0,width:"min(600px, 100vw)",background:"rgba(10, 12, 20, 0.96)",backdropFilter:"blur(24px)",borderLeft:"1px solid rgba(167, 139, 250, 0.15)",zIndex:100,display:"flex",flexDirection:"column",boxShadow:"-20px 0 60px rgba(0,0,0,0.5)"},children:[e.jsxs("div",{className:"px-6 py-4 border-b border-border flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted font-semibold mb-1",children:a.channel}),e.jsx("div",{className:"text-[16px] font-semibold text-white/95 truncate",children:a.name||"(untitled session)"}),e.jsxs("div",{className:"text-[11px] text-white/35 mt-1",children:[a.messageCount," messages · ",N(a.lastActive)]})]}),e.jsx("button",{onClick:o,className:"text-white/55 hover:text-text p-1.5 rounded","aria-label":"Close",children:e.jsx(A,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-3",children:[m&&e.jsx("div",{className:"text-[12px] text-white/35",children:"Loading transcript…"}),!m&&x.length===0&&e.jsx("div",{className:"text-[12px] text-white/35 italic",children:"No messages."}),x.map((n,d)=>e.jsxs("div",{className:`p-3 rounded-lg border-l-2 ${n.role==="assistant"?"bg-purple-500/[0.03] border-purple-400/50":n.role==="user"?"bg-bg-tertiary/30 border-white/20":"bg-bg-secondary/50 border-white/10"}`,children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-muted font-semibold mb-1",children:n.role}),e.jsxs("div",{className:"text-[12px] text-white/85 whitespace-pre-wrap leading-relaxed",style:{wordBreak:"break-word"},children:[(n.content||"").slice(0,2e3),(n.content||"").length>2e3&&e.jsx("span",{className:"text-text-muted",children:"… (truncated)"})]})]},d))]})]},"panel")]})})}function N(s){if(!s)return"";const a=Date.parse(s);if(isNaN(a))return"";const o=Math.max(0,Math.floor((Date.now()-a)/1e3));if(o<60)return`${o}s ago`;const x=Math.floor(o/60);if(x<60)return`${x}m ago`;const l=Math.floor(x/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}export{C as INTERNAL_CHANNEL_PREFIXES,S as USER_CHANNEL_PREFIXES,F as default,p as isInternalChannel,g as isUserChannel};
|