adam-agent-server 1.8.0 → 1.9.0
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/README.md +8 -0
- package/dist/App-5QZKMPRM.js +13 -0
- package/dist/adam-tools-FSI5XKDL.js +1 -0
- package/dist/{approval-handler-PB7PSLUS.js → approval-handler-JYCGXQUE.js} +1 -1
- package/dist/audit-manager-CLKTJPLM.js +1 -0
- package/dist/bree-engine-XJR5TKVC.js +1 -0
- package/dist/channels-DY2OW7YQ.js +1 -0
- package/dist/{channels-ULFUCUUZ.js → channels-ZNMTMMCY.js} +1 -1
- package/dist/{chunk-BQ3ZAYHC.js → chunk-3HZE5DQZ.js} +1 -1
- package/dist/chunk-3IQADR6L.js +144 -0
- package/dist/{chunk-NASJH4NT.js → chunk-3N7MGASP.js} +1 -1
- package/dist/{chunk-TAF2DBBC.js → chunk-56QP5ZHF.js} +7 -7
- package/dist/{chunk-PG6LMSX6.js → chunk-5AUQIK3Q.js} +1 -1
- package/dist/{chunk-NUITL62I.js → chunk-6M2QCKAS.js} +1 -1
- package/dist/{chunk-WMB7P64J.js → chunk-6XVWIRR2.js} +1 -1
- package/dist/{chunk-5EPG2US5.js → chunk-7F4SZXI2.js} +39 -10
- package/dist/{chunk-JJH2RCVC.js → chunk-7WJF65TQ.js} +1 -1
- package/dist/{chunk-RZ7LCZVK.js → chunk-ARQF52V6.js} +1 -1
- package/dist/{chunk-NWMOV23A.js → chunk-C2SD2NMZ.js} +1 -1
- package/dist/{chunk-2L2347UQ.js → chunk-DKMF4B33.js} +1 -1
- package/dist/{chunk-EQZFOBAJ.js → chunk-EJBGJLA2.js} +1 -1
- package/dist/{chunk-T33BLZV2.js → chunk-HSEP6LNQ.js} +1 -1
- package/dist/{chunk-GSFLLRS7.js → chunk-IZ3WZHCM.js} +1 -1
- package/dist/chunk-J4Y54LIC.js +50 -0
- package/dist/{chunk-AQ3ASS4B.js → chunk-KO7XBNPV.js} +1 -1
- package/dist/{chunk-RI3V72RP.js → chunk-KUJFQDT5.js} +2 -2
- package/dist/{chunk-DVN3BFPP.js → chunk-LV4XLPCD.js} +1 -1
- package/dist/chunk-MYVYH4PQ.js +77 -0
- package/dist/chunk-OFTIPZTH.js +1 -0
- package/dist/{chunk-K4C43YDD.js → chunk-OY2KVSIX.js} +1 -1
- package/dist/{chunk-IKPYPZ64.js → chunk-PFYYS7CI.js} +1 -1
- package/dist/chunk-QMW7VEPC.js +0 -0
- package/dist/{chunk-A5OCDYTW.js → chunk-QPIWPQWM.js} +1 -1
- package/dist/chunk-S6OV7Z6K.js +1 -0
- package/dist/{chunk-2YTDCR6A.js → chunk-TTP7QRAQ.js} +1 -1
- package/dist/{chunk-B6LOT5CG.js → chunk-UQDC3X6O.js} +1 -1
- package/dist/{chunk-M4YI4WVX.js → chunk-UYOLAFUR.js} +1 -1
- package/dist/chunk-VPZSOYE5.js +6 -0
- package/dist/{chunk-5QZXYKMS.js → chunk-W7U3ASGR.js} +1 -1
- package/dist/chunk-XIQVXRZH.js +27 -0
- package/dist/{chunk-FPZEZYUB.js → chunk-XTOOD44S.js} +1 -1
- package/dist/{chunk-6KF7OO2B.js → chunk-YKMWAVUH.js} +1 -1
- package/dist/{chunk-UQJZU3R5.js → chunk-YVVKUPGL.js} +1 -1
- package/dist/{chunk-HQRUJQN7.js → chunk-YWUX3ZTO.js} +4 -4
- package/dist/cli.js +2 -2
- package/dist/{config-HBQPBIWL.js → config-CILWJYZB.js} +1 -1
- package/dist/config-W2OD7PXZ.js +1 -0
- package/dist/{db-QEWTZGU3.js → db-JO24ZLIN.js} +1 -1
- package/dist/{delivery-log-AC476GX7.js → delivery-log-QPQM5YU7.js} +1 -1
- package/dist/engine-ZAPYG7G4.js +1 -0
- package/dist/{evolution-audit-XMBDUN3T.js → evolution-audit-ZLYQ3ZYV.js} +1 -1
- package/dist/{external-api-V74YTLBY.js → external-api-QKRNGSYS.js} +1 -1
- package/dist/index.js +20 -16
- package/dist/{learner-VCS3Q7BR.js → learner-ACHENH6R.js} +1 -1
- package/dist/{memories-VMOGFVPU.js → memories-LXH4VHCH.js} +1 -1
- package/dist/{memory-extractor-4WJNHYWR.js → memory-extractor-URH4YHK3.js} +2 -2
- package/dist/memory-service-23P6VNKZ.js +1 -0
- package/dist/outbound-gateway-Y3P3T3VH.js +1 -0
- package/dist/presets-XR2OBXUP.js +1 -0
- package/dist/role-presets-DYWDEQYU.js +1 -0
- package/dist/role-workspace-LHW7AWPF.js +1 -0
- package/dist/{roles-ZYCFQMAY.js → roles-DRPLO4LY.js} +1 -1
- package/dist/{runtime-VDBZZ4KG.js → runtime-YPBWWMXW.js} +1 -1
- package/dist/session-manager-Z6K4U5X7.js +1 -0
- package/dist/{task-templates-4KCZOUN5.js → task-templates-4DWXHLFZ.js} +1 -1
- package/dist/workflow-executor-6ZMNL34C.js +1 -0
- package/package.json +2 -1
- package/web/dist/assets/{AlertDialog-B1zj0Qs3.js → AlertDialog-DhA65f_0.js} +1 -1
- package/web/dist/assets/{Button-BehrGSvy.js → Button-CYDgoTTo.js} +1 -1
- package/web/dist/assets/{Card-B5E56u94.js → Card-DDGXsHus.js} +1 -1
- package/web/dist/assets/{ChannelDetail-BaSlX2yb.js → ChannelDetail-Bb8P8It_.js} +1 -1
- package/web/dist/assets/{Channels-CLhgGEmS.js → Channels-8j28oydE.js} +2 -2
- package/web/dist/assets/{Chat-BZpf1DSF.js → Chat-BZwLDoYO.js} +2 -2
- package/web/dist/assets/{Dashboard-HR4Qmdwg.js → Dashboard-Cv0AtO-o.js} +1 -1
- package/web/dist/assets/{EmptyState-tTclFq_B.js → EmptyState-EuQHAv5Y.js} +1 -1
- package/web/dist/assets/{EnvVarEditor-BzJNsDt0.js → EnvVarEditor-r-l-u4V7.js} +1 -1
- package/web/dist/assets/{EventDefDetail-CjoqsH0e.js → EventDefDetail-asUFrbQE.js} +1 -1
- package/web/dist/assets/Events-DtkHL-r2.js +1 -0
- package/web/dist/assets/{Evolution-CUn8g34X.js → Evolution-DIqYOSb8.js} +1 -1
- package/web/dist/assets/FeatureRequests-BxPqLR1x.js +1 -0
- package/web/dist/assets/{GoalDetail-DgPvXb6z.js → GoalDetail-Bkvgg6uI.js} +1 -1
- package/web/dist/assets/Goals-CkKJDCiU.js +1 -0
- package/web/dist/assets/{Logs-CvFC-GbD.js → Logs-DnaaHV0Y.js} +1 -1
- package/web/dist/assets/{Memories-B5pvI6Oj.js → Memories-Dq9S-Tsi.js} +1 -1
- package/web/dist/assets/Mistakes-D5lW31Co.js +1 -0
- package/web/dist/assets/{NotFound-D-OII_Lp.js → NotFound-gJVrOtER.js} +1 -1
- package/web/dist/assets/{PageHeader-B2CgcZ-t.js → PageHeader-CugYeCci.js} +1 -1
- package/web/dist/assets/Plugins-CoRmK2UG.js +1 -0
- package/web/dist/assets/{RoleDetail-BBJxaZip.js → RoleDetail-BHJA_PAn.js} +2 -2
- package/web/dist/assets/Roles-EBUueS_P.js +1 -0
- package/web/dist/assets/{SectionHeader-CmXz6PM3.js → SectionHeader-DihC0CnO.js} +1 -1
- package/web/dist/assets/Settings-DZHAGazz.js +1 -0
- package/web/dist/assets/{Strategies-Ddb5HiUS.js → Strategies-3IV9eueQ.js} +1 -1
- package/web/dist/assets/{Switch-yrTepsdl.js → Switch-B3w5KMMc.js} +1 -1
- package/web/dist/assets/{Table-CXAcZ8Ru.js → Table-Cf6m8zLu.js} +1 -1
- package/web/dist/assets/{TaskDetail-CHwHgfZq.js → TaskDetail-BmXaH3sx.js} +2 -2
- package/web/dist/assets/Work-CvQrOKtL.js +1 -0
- package/web/dist/assets/api-D-UzHSDq.js +1 -0
- package/web/dist/assets/index-BsKlGx3x.js +2 -0
- package/web/dist/assets/index-EqsPGp9a.css +2 -0
- package/web/dist/assets/{useIsMobileLayout-dYzXP1EC.js → useIsMobileLayout-2GbB90oO.js} +1 -1
- package/web/dist/assets/{vendor-icons-Dk0hMuJz.js → vendor-icons-PF9RcPJx.js} +1 -1
- package/web/dist/assets/{vendor-react-C6faO6LO.js → vendor-react-Cxy4EVtR.js} +1 -1
- package/web/dist/assets/{vendor-state-DahK0J-G.js → vendor-state-aQJ7d4tA.js} +1 -1
- package/web/dist/index.html +8 -8
- package/dist/App-ZRCRM7WR.js +0 -13
- package/dist/adam-automator-skills-EZGBICHT.js +0 -18
- package/dist/adam-tools-V5LPU47X.js +0 -1
- package/dist/audit-manager-BSBBDUER.js +0 -1
- package/dist/bree-engine-7S33CWS7.js +0 -1
- package/dist/channels-SITUUC4J.js +0 -1
- package/dist/chunk-4PQHGLZH.js +0 -99
- package/dist/chunk-5XOTPEAK.js +0 -6
- package/dist/chunk-BCH2HAIM.js +0 -23
- package/dist/chunk-GSMC3VUM.js +0 -1
- package/dist/chunk-IZNEOYRP.js +0 -1
- package/dist/chunk-QGYDGZSC.js +0 -49
- package/dist/chunk-ULTK7RD6.js +0 -27
- package/dist/config-ZBNGRASI.js +0 -1
- package/dist/engine-6K4RG644.js +0 -1
- package/dist/memory-service-ZS6MBUIC.js +0 -1
- package/dist/outbound-gateway-H7RFG6D2.js +0 -1
- package/dist/role-presets-XAEOYEAW.js +0 -1
- package/dist/role-workspace-NKGAH6J6.js +0 -1
- package/dist/session-manager-COLCNIB7.js +0 -1
- package/dist/workflow-executor-Z7JFMR56.js +0 -1
- package/web/dist/assets/Events-IeznRpCj.js +0 -1
- package/web/dist/assets/Goals-DYrggK-M.js +0 -1
- package/web/dist/assets/Plugins-BuE7GImW.js +0 -1
- package/web/dist/assets/Roles-C5eVA6LM.js +0 -1
- package/web/dist/assets/Settings-BblOdOih.js +0 -1
- package/web/dist/assets/Work-Corw0ITh.js +0 -1
- package/web/dist/assets/api-Bux34u4-.js +0 -1
- package/web/dist/assets/index-B3_4_qY6.js +0 -2
- package/web/dist/assets/index-Cu5neZGw.css +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{C as t,D as ee,E as te,b as ne,lt as n,s as re,t as ie}from"./vendor-icons-PF9RcPJx.js";import{d as ae,t as r}from"./vendor-react-Cxy4EVtR.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./AlertDialog-DhA65f_0.js";import{t as f}from"./Button-CYDgoTTo.js";import{t as p}from"./api-D-UzHSDq.js";import{i as m,t as oe}from"./index-BsKlGx3x.js";import{t as h}from"./Card-DDGXsHus.js";import{t as se}from"./SectionHeader-DihC0CnO.js";import{a as ce}from"./format-BUYXZqDw.js";import{t as le}from"./EmptyState-EuQHAv5Y.js";import{a as ue,i as g,n as de,o as _,r as v,t as fe}from"./Table-Cf6m8zLu.js";import{t as pe}from"./Switch-B3w5KMMc.js";var y=e(n(),1),b=r(),me={webhook:`info`,directory_watch:`warning`,cron:`success`,manual:`muted`};function x(e){let t=e.trim().split(/\s+/);return t.length===5?t.every(e=>/^(\*|(\*\/)?\d+(-\d+)?(,\d+(-\d+)?)*)$/.test(e)):!1}function S(){let e=ae(),[n,r]=(0,y.useState)([]),[S,C]=(0,y.useState)(!0),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)(``),[O,he]=(0,y.useState)(`webhook`),[k,A]=(0,y.useState)(``),[j,M]=(0,y.useState)(``),[N,P]=(0,y.useState)(``),[F,I]=(0,y.useState)(``),[L,R]=(0,y.useState)(!1),[z,B]=(0,y.useState)(null),[V,ge]=(0,y.useState)(``),[H,U]=(0,y.useState)(``),[W,_e]=(0,y.useState)(`webhook`),[ve,ye]=(0,y.useState)(``),[G,be]=(0,y.useState)(``),[xe,K]=(0,y.useState)(``),[Se,Ce]=(0,y.useState)(!1),[q,J]=(0,y.useState)(null),[Y,X]=(0,y.useState)(null),[Z,we]=(0,y.useState)(``),[Q,Te]=(0,y.useState)(!1),$=(0,y.useCallback)(async()=>{C(!0);try{r(await p(`/event-defs`))}catch{m.error(`Failed to load events`)}finally{C(!1)}},[]);(0,y.useEffect)(()=>{$()},[$]);let Ee=async()=>{if(E.trim()){if(O===`cron`&&!x(N)){I(`Invalid cron expression (expected 5 fields: minute hour day month weekday)`);return}R(!0);try{let e={name:E.trim(),sourceType:O,description:k.trim()||void 0,enabled:!0};O===`directory_watch`&&j.trim()?e.sourceConfig={path:j.trim(),stability_delay_ms:5e3}:O===`cron`&&N.trim()&&(e.sourceConfig={cron:N.trim()}),await p(`/event-defs`,{method:`POST`,body:JSON.stringify(e)}),D(``),A(``),M(``),P(``),I(``),T(!1),$(),m.success(`Event created`)}catch(e){let t=e instanceof Error?e.message:`Failed to create event`;m.error(t)}finally{R(!1)}}},De=e=>{B(e.id),ge(e.name),U(e.description??``),_e(e.sourceType),ye(e.sourceConfig?.path??``),be(e.sourceConfig?.cron??``),K(``)},Oe=async()=>{if(!(!z||!V.trim())){if(W===`cron`&&!x(G)){K(`Invalid cron expression`);return}Ce(!0);try{let e={name:V.trim(),description:H.trim()||void 0};W===`directory_watch`?e.sourceConfig={path:ve.trim(),stability_delay_ms:5e3}:W===`cron`&&(e.sourceConfig={cron:G.trim()}),await p(`/event-defs/${z}`,{method:`PATCH`,body:JSON.stringify(e)}),B(null),$(),m.success(`Event updated`)}catch(e){let t=e instanceof Error?e.message:`Failed to update event`;m.error(t)}finally{Ce(!1)}}},ke=async e=>{try{await p(`/event-defs/${e.id}`,{method:`PATCH`,body:JSON.stringify({enabled:!e.enabled})}),$()}catch(e){let t=e instanceof Error?e.message:`Failed to toggle`;m.error(t)}},Ae=async e=>{try{await p(`/event-defs/${e}`,{method:`DELETE`}),J(null),$(),m.success(`Event deleted`)}catch(e){let t=e instanceof Error?e.message:`Failed to delete`;m.error(t)}},je=async e=>{Te(!0);try{let t={};if(Z.trim())try{t.payload=JSON.parse(Z)}catch{t.payload={raw:Z}}await p(`/event-defs/${e}/fire`,{method:`POST`,body:JSON.stringify(t)}),X(null),we(``),m.success(`Event fired`)}catch(e){let t=e instanceof Error?e.message:`Failed to fire event`;m.error(t)}finally{Te(!1)}},Me=n.find(e=>e.id===q);return(0,b.jsxs)(`div`,{className:`space-y-4`,children:[(0,b.jsx)(se,{title:`Events`,description:`Event definitions that trigger automations. Configure webhooks, schedules, or file watchers.`,compact:!0,action:(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>void $(),children:(0,b.jsx)(ne,{size:14})}),(0,b.jsxs)(f,{size:`sm`,onClick:()=>T(!w),children:[(0,b.jsx)(t,{size:14}),`New Event`]})]})}),w&&(0,b.jsxs)(h,{className:`space-y-3`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:`New Event`}),(0,b.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Event name`,value:E,onChange:e=>D(e.target.value)}),(0,b.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Description (optional)`,value:k,onChange:e=>A(e.target.value)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Source:`}),(0,b.jsxs)(`select`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:O,onChange:e=>he(e.target.value),children:[(0,b.jsx)(`option`,{value:`webhook`,children:`Webhook (HTTP)`}),(0,b.jsx)(`option`,{value:`cron`,children:`Schedule (Cron)`}),(0,b.jsx)(`option`,{value:`directory_watch`,children:`File Watcher`}),(0,b.jsx)(`option`,{value:`manual`,children:`Manual`})]})]}),O===`directory_watch`&&(0,b.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Watch directory path (absolute)`,value:j,onChange:e=>M(e.target.value)}),O===`cron`&&(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Cron expression (minute hour day month weekday)`,value:N,onChange:e=>{P(e.target.value),I(``)}}),F&&(0,b.jsx)(`p`,{className:`text-xs text-[var(--app-danger)]`,children:F})]}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(f,{onClick:()=>void Ee(),disabled:L||!E.trim()||O===`directory_watch`&&!j.trim(),children:L?`Creating...`:`Create`}),(0,b.jsx)(f,{variant:`ghost`,onClick:()=>T(!1),children:`Cancel`})]})]}),z!==null&&(n.find(e=>e.id===z)?(0,b.jsxs)(h,{className:`space-y-3`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:`Edit Event`}),(0,b.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Event name`,value:V,onChange:e=>ge(e.target.value)}),(0,b.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)]`,placeholder:`Description (optional)`,value:H,onChange:e=>U(e.target.value)}),W===`directory_watch`&&(0,b.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)]`,placeholder:`Watch directory path`,value:ve,onChange:e=>ye(e.target.value)}),W===`cron`&&(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)]`,placeholder:`Cron expression`,value:G,onChange:e=>{be(e.target.value),K(``)}}),xe&&(0,b.jsx)(`p`,{className:`text-xs text-[var(--app-danger)]`,children:xe})]}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(f,{onClick:()=>void Oe(),disabled:Se||!V.trim(),children:Se?`Saving...`:`Save`}),(0,b.jsx)(f,{variant:`ghost`,onClick:()=>B(null),children:`Cancel`})]})]}):null),(0,b.jsx)(h,{padding:!1,children:S?(0,b.jsx)(`div`,{className:`flex items-center justify-center p-8`,children:(0,b.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):n.length===0?(0,b.jsx)(le,{icon:(0,b.jsx)(ie,{size:32}),title:`No events`,description:`Events are triggered by webhooks, schedules, or file changes and can start automations.`}):(0,b.jsxs)(fe,{children:[(0,b.jsx)(ue,{children:(0,b.jsxs)(_,{children:[(0,b.jsx)(g,{children:`Name`}),(0,b.jsx)(g,{children:`Source`}),(0,b.jsx)(g,{children:`Enabled`}),(0,b.jsx)(g,{children:`Last Fired`}),(0,b.jsx)(g,{children:`Actions`})]})}),(0,b.jsx)(de,{children:n.map(t=>(0,b.jsxs)(_,{children:[(0,b.jsxs)(v,{children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>e(`/events/${t.id}`),className:`font-medium text-[var(--app-text)] hover:text-[var(--app-accent)] transition-colors text-left`,children:t.name}),t.description&&(0,b.jsx)(`div`,{className:`text-xs text-[var(--app-text-muted)] truncate max-w-[200px]`,children:t.description})]}),(0,b.jsx)(v,{children:(0,b.jsx)(oe,{variant:me[t.sourceType],children:t.sourceType===`directory_watch`?`file watcher`:t.sourceType})}),(0,b.jsx)(v,{children:(0,b.jsx)(pe,{checked:t.enabled,onCheckedChange:()=>void ke(t),"aria-label":`Toggle ${t.name}`})}),(0,b.jsx)(v,{className:`text-xs text-[var(--app-text-muted)]`,children:t.lastFiredAt?ce(t.lastFiredAt):`—`}),(0,b.jsx)(v,{children:(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>De(t),title:`Edit`,children:(0,b.jsx)(ee,{size:12})}),t.sourceType===`manual`&&t.enabled&&(0,b.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>X(t.id),title:`Fire now`,children:(0,b.jsx)(te,{size:12})}),(0,b.jsx)(f,{variant:`ghost`,size:`sm`,className:`text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,onClick:()=>J(t.id),title:`Delete`,children:(0,b.jsx)(re,{size:12})})]})})]},t.id))})]})}),(0,b.jsx)(d,{open:Y!==null,onOpenChange:e=>{e||X(null)},children:(0,b.jsxs)(o,{children:[(0,b.jsxs)(u,{children:[(0,b.jsx)(a,{children:`Fire Event`}),(0,b.jsx)(i,{children:`Fire the manual event immediately. Optionally provide a JSON payload.`})]}),(0,b.jsx)(`textarea`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-2 text-sm text-[var(--app-text)] placeholder='{}' focus:border-[var(--app-accent)] focus:outline-none font-mono`,rows:4,placeholder:`{"key": "value"}`,value:Z,onChange:e=>we(e.target.value)}),(0,b.jsxs)(c,{children:[(0,b.jsx)(l,{children:`Cancel`}),(0,b.jsx)(s,{onClick:()=>{Y&&je(Y),X(null)},disabled:Q,children:Q?`Firing...`:`Fire Event`})]})]})}),(0,b.jsx)(d,{open:q!==null,onOpenChange:e=>{e||J(null)},children:(0,b.jsxs)(o,{children:[(0,b.jsxs)(u,{children:[(0,b.jsx)(a,{children:`Delete Event`}),(0,b.jsxs)(i,{children:[`Delete “`,Me?.name,`”? This action cannot be undone.`]})]}),(0,b.jsxs)(c,{children:[(0,b.jsx)(l,{children:`Cancel`}),(0,b.jsx)(s,{className:`bg-[var(--app-danger)] hover:bg-[var(--app-danger)]`,onClick:()=>{q&&Ae(q)},children:`Delete`})]})]})})]})}export{S as Events};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{B as t,b as n,lt as r}from"./vendor-icons-PF9RcPJx.js";import{t as i}from"./vendor-react-Cxy4EVtR.js";import{t as a}from"./Button-CYDgoTTo.js";import{t as o}from"./api-D-UzHSDq.js";import{r as s,t as c}from"./index-BsKlGx3x.js";import{t as l}from"./Card-DDGXsHus.js";import{t as u}from"./PageHeader-CugYeCci.js";import{a as d}from"./format-BUYXZqDw.js";import{t as f}from"./EmptyState-EuQHAv5Y.js";var p=e(r(),1),m=i();function h(){let e=s(e=>e.roles),r=s(e=>e.fetchRoles),[i,h]=(0,p.useState)([]),[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(`all`);(0,p.useEffect)(()=>{r()},[r]);let b=(0,p.useCallback)(async()=>{_(!0);try{let e=new URLSearchParams({limit:`50`});v!==`all`&&e.set(`roleId`,v),h(await o(`/evolution-audit?${e}`))}catch{h([])}finally{_(!1)}},[v]);(0,p.useEffect)(()=>{b()},[b]);let x=t=>t?e.find(e=>e.id===t)?.name??t.slice(0,8):`System`;return(0,m.jsxs)(`div`,{className:`space-y-5`,children:[(0,m.jsx)(u,{eyebrow:`Learning`,title:`Evolution Audit`,compact:!0,description:`Rule mutations and diagnostic reports across roles.`,metrics:[{label:`Visible`,value:i.length},{label:`Role Filter`,value:v===`all`?`All`:x(v)},{label:`Catalog`,value:e.length}],actions:(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsxs)(`select`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:v,onChange:e=>y(e.target.value),children:[(0,m.jsx)(`option`,{value:`all`,children:`All roles`}),e.map(e=>(0,m.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,m.jsx)(a,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:(0,m.jsx)(n,{size:14})})]})}),(0,m.jsx)(l,{children:g?(0,m.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,m.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):i.length===0?(0,m.jsx)(f,{icon:(0,m.jsx)(t,{size:32}),title:`No evolution records`,description:`Evolution occurs when roles accumulate enough task experience.`,className:`py-8`}):(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[i.length,` records`]}),i.map(e=>(0,m.jsxs)(`div`,{className:`rounded border border-[var(--app-border)] p-3`,children:[(0,m.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,m.jsx)(c,{variant:`info`,children:x(e.roleId)}),(0,m.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:d(e.timestamp)}),e.triggerTaskId&&(0,m.jsxs)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:[`triggered by task `,e.triggerTaskId.slice(0,8)]})]}),e.diff.includes(`--- Diagnostic Report ---`)?(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsxs)(`div`,{className:`rounded bg-[var(--app-canvas)] p-2`,children:[(0,m.jsx)(`p`,{className:`mb-1 text-[10px] font-medium text-[var(--app-text-muted)]`,children:`Diagnostic Report`}),(0,m.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs text-[var(--app-text-muted)]`,children:e.diff.split(`--- Rules Diff ---`)[0]?.replace(`--- Diagnostic Report ---
|
|
2
2
|
`,``).trim()})]}),(0,m.jsxs)(`div`,{className:`rounded bg-[var(--app-canvas)] p-2`,children:[(0,m.jsx)(`p`,{className:`mb-1 text-[10px] font-medium text-[var(--app-text-muted)]`,children:`Rules Changes`}),(0,m.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap font-mono text-xs`,children:(e.diff.split(`--- Rules Diff ---`)[1]??``).trim().split(`
|
|
3
3
|
`).map((e,t)=>(0,m.jsxs)(`span`,{className:e.startsWith(`+`)?`text-[var(--app-success)]`:e.startsWith(`-`)?`text-[var(--app-danger)]`:`text-[var(--app-text-muted)]`,children:[e,`
|
|
4
4
|
`]},t))})]})]}):(0,m.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap rounded bg-[var(--app-canvas)] p-2 font-mono text-xs`,children:e.diff.split(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{lt as t}from"./vendor-icons-PF9RcPJx.js";import{t as n}from"./vendor-react-Cxy4EVtR.js";import{t as r}from"./Button-CYDgoTTo.js";import{t as i}from"./api-D-UzHSDq.js";import{t as a}from"./index-BsKlGx3x.js";import{t as o}from"./Card-DDGXsHus.js";import{t as s}from"./SectionHeader-DihC0CnO.js";import{t as c}from"./EmptyState-EuQHAv5Y.js";var l=e(t(),1),u=n(),d={new:`muted`,reviewed:`success`,dismissed:`secondary`,converted:`warning`};function f(e){let t=Date.now()-e;if(Math.floor(t/6e4)<1)return`just now`;let n=Math.floor(t/36e5);return n<24?`${n}h ago`:`${Math.floor(t/864e5)}d ago`}function p(){let[e,t]=(0,l.useState)([]),[n,p]=(0,l.useState)(!0),[m,h]=(0,l.useState)(`all`),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(null),b=(0,l.useCallback)(async()=>{p(!0);try{let e=new URLSearchParams({limit:`200`});m!==`all`&&e.set(`status`,m),t((await i(`/feature-requests?${e}`)).featureRequests)}catch{t([])}finally{p(!1)}},[m]);(0,l.useEffect)(()=>{b()},[b]);let x=async(e,t)=>{y(e);try{await i(`/feature-requests/${e}`,{method:`PATCH`,body:JSON.stringify({status:t})}),await b()}finally{y(null)}};return(0,u.jsxs)(`div`,{className:`space-y-5`,children:[(0,u.jsx)(s,{title:`Feature Requests`,description:`Unmet user needs identified by the Feature Miner role.`,compact:!0,action:(0,u.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:`Refresh`})}),(0,u.jsx)(`div`,{className:`flex gap-2`,children:[`all`,`new`,`reviewed`,`dismissed`,`converted`].map(e=>(0,u.jsx)(`button`,{type:`button`,onClick:()=>h(e),className:`rounded px-3 py-1.5 text-xs font-medium transition-colors ${m===e?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:text-[var(--app-text)]`}`,children:e===`all`?`All`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),n?(0,u.jsx)(o,{children:(0,u.jsx)(`p`,{className:`text-sm text-[var(--app-text-muted)]`,children:`Loading...`})}):e.length===0?(0,u.jsx)(o,{children:(0,u.jsx)(c,{title:`No feature requests`,description:`Run the Feature Mining template to extract unmet needs from chat sessions.`})}):(0,u.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,u.jsxs)(o,{padding:!1,children:[(0,u.jsx)(`div`,{className:`p-4 cursor-pointer hover:bg-black/[0.02]`,onClick:()=>_(g===e.id?null:e.id),role:`button`,tabIndex:0,onKeyDown:t=>{t.key===`Enter`&&_(g===e.id?null:e.id)},children:(0,u.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,u.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(a,{variant:d[e.status],children:e.status}),(0,u.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:f(e.extractedAt)}),e.tags&&e.tags.length>0&&(0,u.jsx)(`div`,{className:`flex gap-1`,children:e.tags.slice(0,3).map(e=>(0,u.jsx)(`span`,{className:`rounded border border-[var(--app-border)] px-1.5 py-0.5 text-[10px] text-[var(--app-text-muted)]`,children:e},e))})]}),e.summary?(0,u.jsx)(`p`,{className:`text-sm font-medium text-[var(--app-text)]`,children:e.summary}):null,(0,u.jsx)(`p`,{className:`text-sm text-[var(--app-text-muted)] line-clamp-2`,children:e.content})]})})}),g===e.id&&(0,u.jsxs)(`div`,{className:`border-t border-[var(--app-border)] p-4 space-y-3`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`text-xs font-medium text-[var(--app-text-subtle)] uppercase tracking-[0.14em] mb-1`,children:`Content`}),(0,u.jsx)(`p`,{className:`text-sm text-[var(--app-text)]`,children:e.content})]}),e.evidenceQuote&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`text-xs font-medium text-[var(--app-text-subtle)] uppercase tracking-[0.14em] mb-1`,children:`Evidence Quote`}),(0,u.jsx)(`blockquote`,{className:`border-l-2 border-[var(--app-border)] pl-3 text-sm text-[var(--app-text-muted)] italic`,children:e.evidenceQuote})]}),e.tags&&e.tags.length>0&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`text-xs font-medium text-[var(--app-text-subtle)] uppercase tracking-[0.14em] mb-1`,children:`Tags`}),(0,u.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tags.map(e=>(0,u.jsx)(`span`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-0.5 text-xs text-[var(--app-text)]`,children:e},e))})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,u.jsxs)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`Extracted: `,new Date(e.extractedAt).toLocaleString()]}),e.sourceSessionId&&(0,u.jsxs)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`Session: `,e.sourceSessionId.slice(0,8)]})]}),(0,u.jsx)(`div`,{className:`flex gap-2 pt-1`,children:[`new`,`reviewed`,`dismissed`,`converted`].map(t=>(0,u.jsx)(r,{variant:e.status===t?`default`:`ghost`,size:`sm`,disabled:v===e.id||e.status===t,onClick:n=>{n.stopPropagation(),x(e.id,t)},children:t.charAt(0).toUpperCase()+t.slice(1)},t))})]})]},e.id))})]})}export{p as FeatureRequests};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{J as t,L as n,l as r,lt as i,ot as a,q as o}from"./vendor-icons-PF9RcPJx.js";import{f as s,r as c,t as l}from"./vendor-react-Cxy4EVtR.js";import{t as u}from"./api-D-UzHSDq.js";import{t as d}from"./index-BsKlGx3x.js";import{i as f,r as p,t as m}from"./Card-DDGXsHus.js";import{t as h}from"./PageHeader-CugYeCci.js";import{t as g}from"./SectionHeader-DihC0CnO.js";import{n as _}from"./format-BUYXZqDw.js";var v=e(i(),1),y=l();function b(){let{id:e}=s(),[i,l]=(0,v.useState)(null),[b,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(null);if((0,v.useEffect)(()=>{e&&(async()=>{try{let t=await u(`/goals/${e}`);l(t.goal),w(null);try{S((await u(`/strategies?role=${t.goal.roleId}`)).strategies??[])}catch{}}catch(e){w(e instanceof Error?e.message:`Failed to load goal`)}})()},[e]),C)return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Goals`]}),(0,y.jsx)(m,{className:`text-center text-[var(--app-danger)]`,children:C})]});if(!i)return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Goals`]}),(0,y.jsx)(m,{className:`text-center text-[var(--app-text-subtle)]`,children:`Loading...`})]});let T=i.targetValue>0?Math.min(100,i.currentValue/i.targetValue*100):0,E=i.deadline>0&&i.deadline<Date.now()&&i.status!==`completed`;return(0,y.jsxs)(`div`,{className:`space-y-5`,children:[(0,y.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Goals`]}),(0,y.jsx)(h,{eyebrow:`Goal`,title:i.name,compact:!0,description:i.description||`Progress, delivery targets, and strategy support before raw metrics.`,metrics:[{label:`Status`,value:(0,y.jsx)(d,{variant:(e=>e===`completed`?`success`:e===`executing`||e===`evaluating`?`warning`:e===`failed`?`destructive`:`secondary`)(i.status),children:i.status})},{label:`Role`,value:i.roleId},{label:`Metric`,value:i.metricType},{label:`Progress`,value:`${T.toFixed(1)}%`}]}),(0,y.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Goal ID`}),(0,y.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-[var(--app-text)]`,children:i.id})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Current delta`}),(0,y.jsx)(`p`,{className:`mt-2 text-2xl font-semibold text-[var(--app-text)]`,children:Math.max(i.targetValue-i.currentValue,0)})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Strategies in play`}),(0,y.jsx)(`p`,{className:`mt-2 text-2xl font-semibold text-[var(--app-text)]`,children:b.length})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Deadline state`}),(0,y.jsx)(`p`,{className:`mt-2 text-sm font-medium ${E?`text-[var(--app-danger-soft-text)]`:`text-[var(--app-text)]`}`,children:E?`Overdue`:`On track`})]})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,y.jsx)(x,{icon:r,label:`Progress`,value:`${i.currentValue} / ${i.targetValue}`}),(0,y.jsx)(x,{icon:t,label:E?`Overdue`:`Deadline`,value:_(i.deadline),mono:!0}),(0,y.jsx)(x,{icon:o,label:`Budget`,value:`$${i.budgetUsd.toFixed(2)}`}),(0,y.jsx)(x,{icon:n,label:`Created`,value:_(i.createdAt),mono:!0})]}),(0,y.jsx)(g,{title:`Progress`,compact:!0,description:`Completion first, then delivery targets and strategy support.`}),(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsx)(f,{children:`Progress`})}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`flex-1 h-3 rounded-full bg-[var(--app-panel-muted)] overflow-hidden`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full transition-[width] ${E?`bg-[var(--app-danger)]`:`bg-[var(--app-accent)]`}`,style:{width:`${T}%`}})}),(0,y.jsxs)(`span`,{className:`text-sm text-[var(--app-text)] font-mono`,children:[T.toFixed(1),`%`]})]}),(0,y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between text-xs text-[var(--app-text-subtle)]`,children:[(0,y.jsxs)(`span`,{children:[i.currentValue,` current`]}),(0,y.jsxs)(`span`,{children:[i.targetValue,` target`]})]})]}),(i.deliverTo??[]).length>0&&(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsx)(f,{children:`Delivery Targets`})}),(0,y.jsx)(`div`,{className:`space-y-1.5`,children:(i.deliverTo??[]).map((e,t)=>(0,y.jsx)(`div`,{className:`flex items-center gap-2 text-sm text-[var(--app-text)]`,children:e.type===`channel`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{variant:`outline`,children:`Channel`}),(0,y.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,y.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{variant:`outline`,children:`Session`}),(0,y.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Chat session`})]})},t))})]}),b.length>0&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(g,{title:`Strategy Support`,compact:!0,description:`Strategy candidates already associated with the goal's role.`}),(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,y.jsx)(n,{size:14}),` Strategies (`,b.length,`)`]})}),(0,y.jsx)(`div`,{className:`space-y-2`,children:b.map(e=>(0,y.jsxs)(`div`,{className:`flex items-center justify-between text-sm border-b border-[var(--app-border)] pb-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.name}),(0,y.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:e.taskType})]}),(0,y.jsxs)(d,{variant:`outline`,children:[e.trialCount,` trials`]})]},e.id))})]})]})]})}function x({icon:e,label:t,value:n,mono:r}){return(0,y.jsxs)(m,{className:`flex flex-col gap-1`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[var(--app-text-subtle)]`,children:[(0,y.jsx)(e,{size:12}),(0,y.jsx)(`span`,{className:`text-xs`,children:t})]}),(0,y.jsx)(`span`,{className:`text-sm text-[var(--app-text)] truncate ${r?`font-mono text-xs`:``}`,children:n})]})}export{b as GoalDetail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{C as t,D as n,E as r,O as i,b as a,l as o,lt as s,n as c,s as l}from"./vendor-icons-PF9RcPJx.js";import{t as u}from"./vendor-react-Cxy4EVtR.js";import{a as ee,c as d,i as f,l as p,n as m,o as h,r as te,s as g,t as ne}from"./AlertDialog-DhA65f_0.js";import{t as _}from"./Button-CYDgoTTo.js";import{t as v}from"./api-D-UzHSDq.js";import{i as y,n as re,r as b,t as x}from"./index-BsKlGx3x.js";import{i as S,r as C,t as w}from"./Card-DDGXsHus.js";import{t as ie}from"./PageHeader-CugYeCci.js";import{n as T,t as E}from"./format-BUYXZqDw.js";import{t as D}from"./EmptyState-EuQHAv5Y.js";var O=e(s(),1),k=u();function A({value:e,onChange:t,label:n=`Delivery Targets`}){let[r,i]=(0,O.useState)([]),[a,o]=(0,O.useState)(!1);(0,O.useEffect)(()=>{let e=!1;return Promise.all([v(`/channels`).catch(()=>({channels:[]})),v(`/chat/sessions`).catch(()=>({sessions:[]}))]).then(([t,n])=>{if(e)return;let r=new Map(t.channels.map(e=>[e.id,e])),a=[];for(let e of n.sessions)if(e.source.type===`channel`&&e.source.channelId&&e.source.chatId){let t=r.get(e.source.channelId);a.push({id:e.id,channelId:e.source.channelId,channelName:t?.name??e.source.channelId.slice(0,8),platform:t?.platform??`unknown`,chatId:e.source.chatId})}let o=new Set;i(a.filter(e=>{let t=`${e.channelId}:${e.chatId}`;return o.has(t)?!1:(o.add(t),!0)}))}),()=>{e=!0}},[]);let s=(t,n)=>e.some(e=>e.type===`channel`&&e.channelId===t&&e.chatId===n),c=(n,r)=>{s(n,r)?t(e.filter(e=>!(e.type===`channel`&&e.channelId===n&&e.chatId===r))):t([...e,{type:`channel`,channelId:n,chatId:r}])},l=e.filter(e=>e.type===`channel`).length;return(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:n}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>o(!a),className:`mt-1 w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-left text-sm text-[var(--app-text)] hover:border-[var(--app-border-strong)] focus:border-[var(--app-accent)] focus:outline-none`,children:l===0?`Default (current session)`:`${l} channel${l>1?`s`:``} selected`}),a&&(0,k.jsxs)(`div`,{className:`absolute z-10 mt-1 w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] py-1 shadow-lg`,children:[r.length===0?(0,k.jsx)(`div`,{className:`px-3 py-2 text-xs text-[var(--app-text-subtle)]`,children:`No active channel conversations. Start a chat on WeChat/Telegram first.`}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`px-3 py-1 text-xs text-[var(--app-text-subtle)]`,children:`Channel conversations`}),r.map(e=>(0,k.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 px-3 py-1.5 text-xs text-[var(--app-text)] hover:bg-[var(--app-panel-muted)]`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:s(e.channelId,e.chatId),onChange:()=>c(e.channelId,e.chatId),className:`rounded border-[var(--app-border-strong)] bg-[var(--app-panel-muted)]`}),(0,k.jsx)(`span`,{className:`truncate font-medium`,children:e.channelName}),(0,k.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`(`,e.platform,`)`]})]},`${e.channelId}:${e.chatId}`))]}),l>0&&(0,k.jsx)(`button`,{type:`button`,onClick:()=>{t([]),o(!1)},className:`mt-1 w-full border-t border-[var(--app-border)] px-3 py-1 text-left text-xs text-[var(--app-danger)] hover:bg-[var(--app-panel-muted)]`,children:`Clear all`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:`w-full border-t border-[var(--app-border)] px-3 py-1 text-left text-xs text-[var(--app-text-subtle)] hover:bg-[var(--app-panel-muted)]`,children:`Done`})]})]})}var j={active:`paused`,paused:`active`,completed:`active`,failed:`active`},M={active:(0,k.jsx)(i,{size:12}),paused:(0,k.jsx)(r,{size:12}),completed:(0,k.jsx)(a,{size:12}),failed:(0,k.jsx)(a,{size:12})};function N(){let e=b(e=>e.goals),i=b(e=>e.fetchGoals),s=b(e=>e.updateGoal),u=b(e=>e.deleteGoal),[N,P]=(0,O.useState)(!1),[F,I]=(0,O.useState)(``),[L,R]=(0,O.useState)(!1),[z,B]=(0,O.useState)(null),[V,H]=(0,O.useState)(null),[U,W]=(0,O.useState)(``),[G,K]=(0,O.useState)(``),[q,J]=(0,O.useState)([]),[Y,X]=(0,O.useState)([]),[Z,ae]=(0,O.useState)([]),[Q,$]=(0,O.useState)([]),oe=e.filter(e=>e.status===`active`).length,se=e.filter(e=>e.status===`paused`).length,ce=e.filter(e=>e.status===`completed`).length;(0,O.useEffect)(()=>{i();let e=setInterval(()=>void i(),1e4);return()=>clearInterval(e)},[i]);let le=async()=>{if(F.trim()){R(!0),B(null);try{await v(`/goals`,{method:`POST`,body:JSON.stringify({input:F.trim(),deliverTo:Z.length>0?Z:void 0,reportTo:Q.length>0?Q:void 0})}),I(``),P(!1),i()}catch(e){B(e instanceof Error?e.message:`Failed to create goal`)}finally{R(!1)}}};return(0,k.jsxs)(`div`,{className:`space-y-4`,children:[(0,k.jsx)(ie,{eyebrow:`Operations`,title:`Goals`,compact:!0,description:`Long-running outcomes, budgets, and delivery targets.`,metrics:[{label:`Active`,value:oe},{label:`Paused`,value:se},{label:`Completed`,value:ce}],actions:(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[(0,k.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:(0,k.jsx)(a,{size:14})}),(0,k.jsxs)(_,{size:`sm`,onClick:()=>P(!N),children:[(0,k.jsx)(t,{size:14}),`New Goal`]})]})}),N&&(0,k.jsxs)(w,{className:`space-y-3`,children:[(0,k.jsx)(`textarea`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-2 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Describe your goal in natural language...`,rows:3,value:F,onChange:e=>I(e.target.value)}),(0,k.jsx)(A,{value:Z,onChange:ae,label:`Deliver To (results)`}),(0,k.jsx)(A,{value:Q,onChange:$,label:`Report To (status)`}),z&&(0,k.jsx)(`p`,{className:`text-xs text-[var(--app-danger)]`,children:z}),(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[(0,k.jsx)(_,{onClick:()=>void le(),disabled:L||!F.trim(),children:L?`Creating...`:`Create`}),(0,k.jsx)(_,{variant:`ghost`,onClick:()=>P(!1),children:`Cancel`})]})]}),e.length===0?(0,k.jsx)(D,{icon:(0,k.jsx)(o,{size:32}),title:`No goals`,description:`Create a goal to start goal-driven task orchestration`}):(0,k.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let t=e.targetValue>0?Math.min(100,Math.round(e.currentValue/e.targetValue*100)):0,i=new Date(e.deadline).getTime()<Date.now()&&e.status!==`completed`,a=V===e.id;return(0,k.jsxs)(w,{children:[(0,k.jsxs)(C,{children:[a?(0,k.jsx)(`input`,{className:`flex-1 rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:U,onChange:e=>W(e.target.value),autoFocus:!0}):(0,k.jsx)(S,{className:`max-w-full text-[var(--app-text)] text-sm font-medium truncate sm:max-w-[180px]`,children:e.name}),(0,k.jsx)(x,{variant:re(e.status),children:e.status})]}),a?(0,k.jsx)(`textarea`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none mb-3`,placeholder:`Description...`,rows:2,value:G,onChange:e=>K(e.target.value)}):e.description?(0,k.jsx)(`p`,{className:`text-xs text-[var(--app-text-muted)] mb-3 line-clamp-2`,children:e.description}):null,a&&(0,k.jsxs)(`div`,{className:`mb-3 space-y-2`,children:[(0,k.jsx)(A,{value:q,onChange:J,label:`Deliver To (results)`}),(0,k.jsx)(A,{value:Y,onChange:X,label:`Report To (status)`})]}),(0,k.jsxs)(`div`,{className:`mb-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,k.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Progress`}),(0,k.jsxs)(`span`,{className:`font-mono text-xs text-[var(--app-text)]`,children:[t,`%`]})]}),(0,k.jsx)(`div`,{className:`h-1.5 rounded-full bg-[var(--app-panel-elevated)]`,children:(0,k.jsx)(`div`,{className:`h-full rounded-full transition-[width] ${t>=100?`bg-[var(--app-success)]`:`bg-[var(--app-accent)]`}`,style:{width:`${t}%`}})}),(0,k.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,k.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--app-text-subtle)]`,children:[e.currentValue,` / `,e.targetValue]}),(0,k.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--app-text-subtle)]`,children:e.metricType})]})]}),(0,k.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,k.jsxs)(`div`,{className:`flex justify-between`,children:[(0,k.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Role`}),(0,k.jsx)(x,{variant:`muted`,className:`text-[10px]`,children:e.roleId})]}),(0,k.jsxs)(`div`,{className:`flex justify-between`,children:[(0,k.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Budget`}),(0,k.jsx)(`span`,{className:`font-mono text-[var(--app-text)]`,children:E(e.budgetUsd)})]}),(0,k.jsxs)(`div`,{className:`flex justify-between`,children:[(0,k.jsx)(`span`,{className:`text-[var(--app-text-subtle)] ${i?`text-[var(--app-danger)]`:``}`,children:`Deadline`}),(0,k.jsx)(`span`,{className:`text-[var(--app-text)] ${i?`text-[var(--app-danger)]`:``}`,children:T(e.deadline)})]}),(0,k.jsxs)(`div`,{className:`flex justify-between`,children:[(0,k.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Created`}),(0,k.jsx)(`span`,{className:`text-[var(--app-text-muted)]`,children:T(e.createdAt)})]})]}),(0,k.jsx)(`div`,{className:`flex items-center gap-1 mt-3 pt-3 border-t border-[var(--app-border)]`,children:a?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(_,{size:`sm`,variant:`ghost`,onClick:async()=>{try{await s(e.id,{name:U,description:G,deliverTo:q,reportTo:Y}),H(null),y.success(`Goal updated`)}catch(e){y.error(e instanceof Error?e.message:`Failed to update`)}},children:`Save`}),(0,k.jsx)(_,{size:`sm`,variant:`ghost`,onClick:()=>H(null),children:(0,k.jsx)(c,{size:14})})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(_,{size:`sm`,variant:`ghost`,title:`Edit`,onClick:()=>{H(e.id),W(e.name),K(e.description??``),J(e.deliverTo??[]),X(e.reportTo??[])},children:(0,k.jsx)(n,{size:14})}),(0,k.jsxs)(_,{size:`sm`,variant:`ghost`,title:`Change to ${j[e.status]}`,onClick:async()=>{try{await s(e.id,{status:j[e.status]}),y.success(`Status changed to ${j[e.status]}`)}catch(e){y.error(e instanceof Error?e.message:`Failed to update status`)}},children:[M[e.status]??(0,k.jsx)(r,{size:12}),(0,k.jsx)(`span`,{className:`text-xs`,children:j[e.status]})]}),(0,k.jsx)(`div`,{className:`ml-auto`,children:(0,k.jsxs)(ne,{children:[(0,k.jsx)(p,{asChild:!0,children:(0,k.jsx)(_,{size:`sm`,variant:`ghost`,title:`Delete`,className:`text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,children:(0,k.jsx)(l,{size:14})})}),(0,k.jsxs)(f,{children:[(0,k.jsxs)(g,{children:[(0,k.jsx)(d,{children:`Delete goal`}),(0,k.jsxs)(ee,{children:[`This will permanently delete "`,e.name,`". This action cannot be undone.`]})]}),(0,k.jsxs)(h,{children:[(0,k.jsx)(te,{children:`Cancel`}),(0,k.jsx)(m,{className:`bg-[var(--app-danger)] hover:bg-[var(--app-danger-strong)]`,onClick:async()=>{try{await u(e.id),y.success(`Goal deleted`)}catch(e){y.error(e instanceof Error?e.message:`Failed to delete`)}},children:`Delete`})]})]})]})})]})})]},e.id)})})]})}export{N as Goals,A as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{E as t,G as n,O as r,c as i,lt as a}from"./vendor-icons-PF9RcPJx.js";import{t as o}from"./vendor-react-Cxy4EVtR.js";import{t as s}from"./Button-CYDgoTTo.js";import{r as c}from"./index-BsKlGx3x.js";import{t as l}from"./Card-DDGXsHus.js";import{t as u}from"./PageHeader-CugYeCci.js";import{t as d}from"./EmptyState-EuQHAv5Y.js";import{t as f}from"./ui-CerQw0jA.js";var p=e(a(),1),m=o(),h={debug:`text-[var(--app-text-subtle)]`,info:`text-[var(--app-accent)]`,warn:`text-[var(--app-warning)]`,error:`text-[var(--app-danger)]`},g={adam:`text-[var(--app-log-adam)]`,manager:`text-[var(--app-log-manager)]`,worker:`text-[var(--app-success)]`,scheduler:`text-[var(--app-log-scheduler)]`,api:`text-[var(--app-accent)]`,ws:`text-[var(--app-log-ws)]`,store:`text-[var(--app-log-store)]`,embedding:`text-[var(--app-log-embedding)]`},_=[`adam`,`manager`,`worker`,`scheduler`,`api`,`ws`,`store`,`embedding`],v=[`debug`,`info`,`warn`,`error`];function y(){let e=c(e=>e.logs),a=(0,p.useRef)(null),[o,y]=(0,p.useState)(!0),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),T=(0,p.useMemo)(()=>e.filter(e=>!(x&&e.level!==x||C&&e.component!==C)),[e,x,C]);return(0,p.useEffect)(()=>{o&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[T,o]),(0,m.jsxs)(`div`,{className:`flex h-full flex-col gap-5`,children:[(0,m.jsx)(u,{title:`Logs`,compact:!0,description:`Backend events with inline filters and a stable reading surface.`,metrics:[{label:`Visible`,value:T.length},{label:`Total`,value:e.length},{label:`Mode`,value:o?`Live`:`Paused`}],className:`px-4 py-3 lg:px-4 lg:py-3`,actions:(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>y(!o),title:o?`Pause auto-scroll`:`Resume auto-scroll`,children:o?(0,m.jsx)(r,{size:f.sm}):(0,m.jsx)(t,{size:f.sm})}),(0,m.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>{c.setState({logs:[]})},title:`Clear logs`,children:(0,m.jsx)(n,{size:f.sm})})]})}),(0,m.jsx)(l,{className:`surface-panel-muted py-3`,children:(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Level:`}),(0,m.jsxs)(`div`,{className:`flex gap-1`,children:[(0,m.jsx)(b,{active:x===null,onClick:()=>S(null),children:`All`}),v.map(e=>(0,m.jsx)(b,{active:x===e,onClick:()=>S(x===e?null:e),children:e},e))]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Component:`}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,m.jsx)(b,{active:C===null,onClick:()=>w(null),children:`All`}),_.map(e=>(0,m.jsx)(b,{active:C===e,onClick:()=>w(C===e?null:e),children:e},e))]})]})]})}),(0,m.jsx)(l,{padding:!1,className:`flex-1 min-h-0`,children:T.length===0?(0,m.jsx)(`div`,{className:`p-4`,children:(0,m.jsx)(d,{icon:(0,m.jsx)(i,{size:32}),title:`No log entries`,description:`Log events will appear here in real-time via WebSocket.`,compact:!0,className:`min-h-[10rem]`})}):(0,m.jsx)(`div`,{ref:a,className:`h-full max-h-[calc(100vh-280px)] overflow-y-auto p-3 font-mono text-xs leading-5`,children:T.map((e,t)=>{let n=new Date(e.timestamp).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3}),r=h[e.level]??`text-[var(--app-text-muted)]`,i=g[e.component]??`text-[var(--app-text-muted)]`;return(0,m.jsxs)(`div`,{className:`flex gap-2 hover:bg-[var(--app-panel-elevated)]/30 px-1 rounded`,children:[(0,m.jsx)(`span`,{className:`text-[var(--app-text-subtle)] shrink-0`,children:n}),(0,m.jsx)(`span`,{className:`w-12 shrink-0 uppercase ${r}`,children:e.level.padEnd(5)}),(0,m.jsxs)(`span`,{className:`w-20 shrink-0 ${i}`,children:[`[`,e.component,`]`]}),(0,m.jsx)(`span`,{className:`text-[var(--app-text)] break-all`,children:e.msg})]},t)})})}),(0,m.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-[var(--app-text-subtle)]`,children:[(0,m.jsxs)(`span`,{children:[T.length,` entries `,T.length!==e.length&&`(${e.length} total)`]}),(0,m.jsx)(`span`,{children:o?`Following live feed`:`Scroll paused`})]})]})}function b({active:e,onClick:t,children:n}){return(0,m.jsx)(`button`,{onClick:t,className:`rounded px-2 py-0.5 text-xs transition-colors ${e?`bg-[var(--app-panel-muted)] text-[var(--app-text)]`:`text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:n})}export{y as Logs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,b as n,it as r,lt as i}from"./vendor-icons-PF9RcPJx.js";import{t as a}from"./vendor-react-Cxy4EVtR.js";import{t as o}from"./Button-CYDgoTTo.js";import{t as s}from"./api-D-UzHSDq.js";import{r as c,t as l}from"./index-BsKlGx3x.js";import{t as u}from"./Card-DDGXsHus.js";import{t as d}from"./PageHeader-CugYeCci.js";import{t as f}from"./SectionHeader-DihC0CnO.js";import{a as p}from"./format-BUYXZqDw.js";import{t as m}from"./EmptyState-EuQHAv5Y.js";var h=e(i(),1),g=a();function _(){let e=c(e=>e.roles),i=c(e=>e.fetchRoles),[a,_]=(0,h.useState)(``),[v,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!1),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(!1),[E,D]=(0,h.useState)(`all`),[O,k]=(0,h.useState)(new Set);(0,h.useEffect)(()=>{i()},[i]),(0,h.useEffect)(()=>{!a&&e.length>0&&_(e[0].id)},[e,a]);let A=(0,h.useCallback)(async()=>{if(a){x(!0);try{y((await s(`/memories/${a}?limit=100`)).memories)}catch{y([])}finally{x(!1)}}},[a]);(0,h.useEffect)(()=>{a&&A()},[a,A]);let j=async()=>{if(!(!S.trim()||!a)){T(!0);try{y((await s(`/memories/query`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agentId:a,prompt:S.trim(),topK:20})})).memories)}catch{y([])}finally{T(!1)}}},M=()=>{C(``),A()},N=v.filter(e=>E===`high`?e.importance>3:E===`medium`?e.importance===3:E===`low`?e.importance<3:!0),P=e=>e>=4?`text-[var(--app-danger)]`:e===3?`text-[var(--app-warning)]`:`text-[var(--app-text-subtle)]`;return(0,g.jsxs)(`div`,{className:`space-y-5`,children:[(0,g.jsx)(d,{eyebrow:`Knowledge`,title:`Memories`,compact:!0,description:`What each role is retaining and how retrieval changes the visible recall set.`,metrics:[{label:`Role`,value:e.find(e=>e.id===a)?.name??`None`},{label:`Visible`,value:N.length},{label:`High Importance`,value:v.filter(e=>e.importance>3).length}],actions:(0,g.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void A(),children:(0,g.jsx)(n,{size:14})})}),(0,g.jsx)(f,{title:`Recall Controls`,compact:!0,description:`Switch role context, run a retrieval query, or narrow by importance.`}),(0,g.jsx)(u,{className:`surface-panel-muted`,children:(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,g.jsx)(`select`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:a,onChange:e=>_(e.target.value),children:e.map(e=>(0,g.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(`input`,{className:`w-64 rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] placeholder-slate-600 focus:border-[var(--app-accent)] focus:outline-none`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>e.key===`Enter`&&void j(),placeholder:`Search memories...`}),(0,g.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>void j(),disabled:w,children:(0,g.jsx)(t,{size:14})}),S&&(0,g.jsx)(o,{size:`sm`,variant:`ghost`,onClick:M,children:`Clear`})]}),(0,g.jsx)(`div`,{className:`flex gap-1`,children:[`all`,`high`,`medium`,`low`].map(e=>(0,g.jsx)(`button`,{className:`rounded px-2 py-1 text-xs transition-colors ${E===e?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:bg-[var(--app-panel-muted)]`}`,onClick:()=>D(e),children:e},e))})]})}),(0,g.jsx)(u,{children:b||w?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,g.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):N.length===0?(0,g.jsx)(m,{icon:(0,g.jsx)(r,{size:32}),title:`No memories`,description:S?`No results for this query`:`This agent has no memories yet`,className:`py-8`}):(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsxs)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[N.length,` memories`]}),N.map(e=>(0,g.jsxs)(`div`,{className:`rounded border border-[var(--app-border)] p-3`,children:[(0,g.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,g.jsx)(l,{variant:e.type===`reflection`?`info`:e.type===`thought`?`warning`:`muted`,children:e.type}),(0,g.jsx)(l,{variant:`muted`,children:e.sourceType}),(0,g.jsx)(`span`,{className:`text-xs font-medium ${P(e.importance)}`,children:`*`.repeat(e.importance)}),e.score!=null&&(0,g.jsxs)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:[`score: `,e.score.toFixed(3)]})]}),(0,g.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-[var(--app-text)]`,children:e.content}),(0,g.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:e.keywords.map(e=>(0,g.jsx)(`span`,{className:`rounded bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-[10px] text-[var(--app-text-subtle)]`,children:e},e))}),e.type===`reflection`&&e.evidence&&e.evidence.length>0&&(0,g.jsxs)(`div`,{className:`mt-2`,children:[(0,g.jsxs)(`button`,{className:`text-[10px] text-[var(--app-accent)] hover:text-[var(--app-accent)]`,onClick:()=>k(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),children:[O.has(e.id)?`Hide`:`Show`,` evidence (`,e.evidence.length,` memories)`]}),O.has(e.id)&&(0,g.jsx)(`div`,{className:`mt-1.5 space-y-1 border-l-2 border-[var(--app-border)] pl-2`,children:e.evidence.map(e=>{let t=v.find(t=>t.id===e);return(0,g.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:t?t.content.slice(0,120)+(t.content.length>120?`...`:``):(0,g.jsxs)(`span`,{className:`italic`,children:[`Memory `,e.slice(0,8),` (not in current view)`]})},e)})})]}),(0,g.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-[var(--app-text-subtle)]`,children:[p(e.createdAt),` | accessed `,e.retrievedCount,`x | last: `,p(e.lastAccessed)]})]},e.id))]})})]})}export{_ as Memories};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{lt as t}from"./vendor-icons-PF9RcPJx.js";import{t as n}from"./vendor-react-Cxy4EVtR.js";import{t as r}from"./Button-CYDgoTTo.js";import{o as i,u as a}from"./api-D-UzHSDq.js";import{t as o}from"./index-BsKlGx3x.js";import{t as s}from"./Card-DDGXsHus.js";import{t as c}from"./SectionHeader-DihC0CnO.js";import{t as l}from"./EmptyState-EuQHAv5Y.js";var u=e(t(),1),d=n(),f={new:`muted`,acknowledged:`success`,dismissed:`secondary`};function p(e){let t=Date.now()-e;if(Math.floor(t/6e4)<1)return`just now`;let n=Math.floor(t/36e5);return n<24?`${n}h ago`:`${Math.floor(t/864e5)}d ago`}function m(e){return new Date(e).toLocaleString()}function h(){let[e,t]=(0,u.useState)([]),[n,h]=(0,u.useState)(!0),[g,_]=(0,u.useState)(`all`),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(null),S=(0,u.useCallback)(async()=>{h(!0);try{t(await i(g===`all`?void 0:g))}catch{t([])}finally{h(!1)}},[g]);(0,u.useEffect)(()=>{S()},[S]);let C=async(e,t)=>{x(e);try{await a(e,t),await S()}finally{x(null)}};return(0,d.jsxs)(`div`,{className:`space-y-5`,children:[(0,d.jsx)(c,{title:`Mistake Patterns`,description:`Cross-role failure patterns extracted from audit data.`,compact:!0,action:(0,d.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>void S(),children:`Refresh`})}),(0,d.jsx)(`div`,{className:`flex gap-2`,children:[`all`,`new`,`acknowledged`,`dismissed`].map(e=>(0,d.jsx)(`button`,{type:`button`,onClick:()=>_(e),className:`rounded px-3 py-1.5 text-xs font-medium transition-colors ${g===e?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:text-[var(--app-text)]`}`,children:e===`all`?`All`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),n?(0,d.jsx)(s,{children:(0,d.jsx)(`p`,{className:`text-sm text-[var(--app-text-muted)]`,children:`Loading...`})}):e.length===0?(0,d.jsx)(s,{children:(0,d.jsx)(l,{title:`No mistake patterns`,description:`Run the Mistake Digest template to aggregate failure signals from audit data.`})}):(0,d.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,d.jsxs)(s,{padding:!1,children:[(0,d.jsx)(`div`,{className:`p-4 cursor-pointer hover:bg-black/[0.02]`,onClick:()=>y(v===e.id?null:e.id),role:`button`,tabIndex:0,onKeyDown:t=>{t.key===`Enter`&&y(v===e.id?null:e.id)},children:(0,d.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,d.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,d.jsx)(o,{variant:f[e.status],children:e.status}),(0,d.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:p(e.lastSeen)}),(0,d.jsx)(`span`,{className:`rounded border border-[var(--app-border)] px-1.5 py-0.5 text-[10px] text-[var(--app-text-muted)] font-mono`,children:e.dimensionType})]}),(0,d.jsx)(`p`,{className:`text-sm font-medium text-[var(--app-text)]`,children:e.dimensionValue}),(0,d.jsxs)(`p`,{className:`text-xs text-[var(--app-text-muted)]`,children:[e.count,` occurrence`,e.count===1?``:`s`,` across `,e.roleIds.length,` role`,e.roleIds.length===1?``:`s`]})]})})}),v===e.id&&(0,d.jsxs)(`div`,{className:`border-t border-[var(--app-border)] p-4 space-y-3`,children:[(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-[var(--app-text-subtle)] uppercase tracking-[0.14em] mb-1`,children:`Dimension`}),(0,d.jsx)(`p`,{className:`text-sm text-[var(--app-text)] font-mono`,children:e.dimensionType})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-[var(--app-text-subtle)] uppercase tracking-[0.14em] mb-1`,children:`Dimension Value`}),(0,d.jsx)(`p`,{className:`text-sm text-[var(--app-text)] font-mono break-all`,children:e.dimensionValue})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-[var(--app-text-subtle)] uppercase tracking-[0.14em] mb-1`,children:`Affected Roles`}),(0,d.jsx)(`p`,{className:`text-sm text-[var(--app-text)]`,children:e.roleIds.length>0?e.roleIds.join(`, `):`—`})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-[var(--app-text-subtle)] uppercase tracking-[0.14em] mb-1`,children:`Evidence Items`}),(0,d.jsx)(`p`,{className:`text-sm text-[var(--app-text)]`,children:e.sampleEvidenceIds.length>0?(0,d.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[e.sampleEvidenceIds.slice(0,5).map(e=>(0,d.jsxs)(`span`,{className:`text-xs`,children:[(0,d.jsx)(`span`,{className:`rounded border border-[var(--app-border)] px-1 py-0.5 text-[10px] font-mono`,children:e.source}),` `,e.id]},e.id)),e.sampleEvidenceIds.length>5&&(0,d.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`+`,e.sampleEvidenceIds.length-5,` more`]})]}):`—`})]})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-4 pt-1`,children:[(0,d.jsxs)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`First seen: `,m(e.firstSeen)]}),(0,d.jsxs)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`Last seen: `,m(e.lastSeen)]})]}),(0,d.jsx)(`div`,{className:`flex gap-2 pt-1`,children:[`new`,`acknowledged`,`dismissed`].map(t=>(0,d.jsx)(r,{variant:e.status===t?`default`:`ghost`,size:`sm`,disabled:b===e.id||e.status===t,onClick:n=>{n.stopPropagation(),C(e.id,t)},children:t.charAt(0).toUpperCase()+t.slice(1)},t))})]})]},e.id))})]})}export{h as Mistakes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-icons-
|
|
1
|
+
import"./vendor-icons-PF9RcPJx.js";import{r as e,t}from"./vendor-react-Cxy4EVtR.js";var n=t();function r(){return(0,n.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 text-[var(--app-text-muted)]`,children:[(0,n.jsx)(`span`,{className:`text-6xl font-bold text-[var(--app-text-subtle)]`,children:`404`}),(0,n.jsx)(`p`,{className:`text-lg`,children:`Page not found`}),(0,n.jsx)(e,{to:`/`,className:`text-[var(--app-accent)] hover:text-[var(--app-accent)] underline`,children:`Back to Dashboard`})]})}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./vendor-react-
|
|
1
|
+
import{t as e}from"./vendor-react-Cxy4EVtR.js";import{n as t}from"./dist-CgGno8kE.js";var n=e();function r({title:e,description:r,eyebrow:i,metrics:a,actions:o,compact:s=!1,className:c}){return(0,n.jsx)(`section`,{className:t(`surface-panel-elevated rounded-xl`,s?`px-4 py-4 lg:px-5 lg:py-5`:`px-5 py-5 lg:px-6 lg:py-6`,c),children:(0,n.jsxs)(`div`,{className:t(`flex flex-col lg:flex-row lg:justify-between`,s?`gap-3 lg:items-start`:`gap-4 lg:items-end`),children:[(0,n.jsxs)(`div`,{className:t(s?`space-y-1.5`:`space-y-2`),children:[i?(0,n.jsx)(`p`,{className:`text-kicker`,children:i}):null,(0,n.jsxs)(`div`,{className:t(s?`space-y-0.5`:`space-y-1`),children:[(0,n.jsx)(`h1`,{className:`text-title`,children:e}),r?(0,n.jsx)(`p`,{className:t(`max-w-2xl text-sm text-[var(--app-text-muted)]`,s?`leading-5`:`leading-6`),children:r}):null]}),a&&a.length>0?(0,n.jsx)(`div`,{className:t(`flex flex-wrap gap-x-4 gap-y-2 pt-1`,s?`pt-0.5`:`pt-1`),children:a.map(e=>(0,n.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,n.jsx)(`span`,{className:`block text-[10px] uppercase tracking-[0.18em] text-[var(--app-text-subtle)]`,children:e.label}),(0,n.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:e.value})]},e.label))}):null]}),o?(0,n.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 lg:w-auto lg:justify-end`,children:o}):null]})})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{C as t,K as n,N as r,S as i,_ as a,b as o,et as s,lt as c,n as ee,rt as te,s as l,tt as u,u as ne,z as re}from"./vendor-icons-PF9RcPJx.js";import{t as d}from"./vendor-react-Cxy4EVtR.js";import{t as f}from"./Button-CYDgoTTo.js";import{t as p}from"./api-D-UzHSDq.js";import{i as m,t as h}from"./index-BsKlGx3x.js";import{t as g}from"./Card-DDGXsHus.js";import{t as ie}from"./PageHeader-CugYeCci.js";import{t as ae}from"./SectionHeader-DihC0CnO.js";import{a as oe}from"./format-BUYXZqDw.js";import{t as se}from"./EmptyState-EuQHAv5Y.js";import{t as _}from"./ui-CerQw0jA.js";import{t as ce}from"./useIsMobileLayout-2GbB90oO.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./Table-Cf6m8zLu.js";var w=e(c(),1),T=d();function E({manifest:e}){if(!e)return null;let t=[];return e.skills.length>0&&t.push({label:`Skill(${e.skills.length})`,variant:`info`}),e.agents.length>0&&t.push({label:`Agent(${e.agents.length})`,variant:`success`}),e.mcpServers.length>0&&t.push({label:`MCP(${e.mcpServers.length})`,variant:`warning`}),e.hooks.length>0&&t.push({label:`Hook(${e.hooks.length})`,variant:`default`}),e.lspServers.length>0&&t.push({label:`LSP(${e.lspServers.length})`,variant:`default`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>(0,T.jsx)(h,{variant:e.variant,children:e.label},e.label))})}function D({label:e,value:t}){return(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 px-3 py-2`,children:[(0,T.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:e}),(0,T.jsx)(`p`,{className:`mt-1 text-sm font-medium text-[var(--app-text)]`,children:t})]})}function O({plugin:e,roles:t,operatingId:n,onInstallToRole:r}){return e.manifest?(0,T.jsxs)(`div`,{className:`space-y-4 text-xs`,children:[e.manifest.description?(0,T.jsx)(`p`,{className:`text-[var(--app-text-muted)]`,children:e.manifest.description}):null,(0,T.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-4`,children:[(0,T.jsx)(D,{label:`Version`,value:e.version?`v${e.version}`:`—`}),(0,T.jsx)(D,{label:`Scope`,value:e.scope}),(0,T.jsx)(D,{label:`Capability Count`,value:e.manifest.skills.length+e.manifest.agents.length+e.manifest.mcpServers.length+e.manifest.hooks.length+e.manifest.lspServers.length}),(0,T.jsx)(D,{label:`Activation`,value:e.globalEnabled?`User On`:`User Off`})]}),(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 px-3 py-2`,children:[(0,T.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Install Path`}),(0,T.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-[var(--app-text-muted)]`,title:e.installPath,children:e.installPath})]}),(0,T.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[e.manifest.skills.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Skills`}),e.manifest.skills.map(e=>(0,T.jsxs)(`div`,{className:`inline-flex items-baseline gap-1 text-[var(--app-text-muted)]`,children:[(0,T.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.name}),e.description?(0,T.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`; `,e.description]}):null]},e.name))]}),e.manifest.agents.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Agents`}),e.manifest.agents.map(e=>(0,T.jsxs)(`div`,{className:`inline-flex items-baseline gap-1 text-[var(--app-text-muted)]`,children:[(0,T.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.name}),e.description?(0,T.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`; `,e.description]}):null]},e.name))]}),e.manifest.mcpServers.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`MCP Servers`}),e.manifest.mcpServers.map(e=>(0,T.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]}),e.manifest.hooks.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Hooks`}),e.manifest.hooks.map(e=>(0,T.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]}),e.manifest.lspServers.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`LSP Servers`}),e.manifest.lspServers.map(e=>(0,T.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]})]}),t.length>0&&e.scope===`user`?(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`p`,{className:`mb-2 text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Install to Role`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>(0,T.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-[10px]`,disabled:n===e.id,onClick:()=>void r(e.id,t.id,t.workspacePath),children:t.name},t.id))})]}):null]}):(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Loading manifest...`})}function k(){let[e,c]=(0,w.useState)([]),[d,D]=(0,w.useState)([]),[k,le]=(0,w.useState)([]),[ue,de]=(0,w.useState)(new Set),[fe,A]=(0,w.useState)(!0),[j,M]=(0,w.useState)(!1),[N,P]=(0,w.useState)(null),[F,pe]=(0,w.useState)(!1),[I,me]=(0,w.useState)(``),[L,R]=(0,w.useState)(null),[z,B]=(0,w.useState)(!1),[V,H]=(0,w.useState)(``),[U,he]=(0,w.useState)([]),[W,ge]=(0,w.useState)(!1),[G,_e]=(0,w.useState)(new Set),[K,q]=(0,w.useState)(`all`),[J,ve]=(0,w.useState)([]),ye=ce(),Y=(0,w.useCallback)(async()=>{A(!0);try{c((await p(`/plugins`)).plugins)}catch(e){m.error(e instanceof Error?e.message:`Failed to load plugins`)}finally{A(!1)}},[]),X=(0,w.useCallback)(async()=>{M(!0),P(null);try{let[e,t]=await Promise.all([p(`/plugins/marketplace`).catch(()=>({available:[],installed:[]})),p(`/plugins/marketplaces`)]);le(e.available),de(new Set(e.installed.map(e=>e.id))),D(t.sources)}catch(e){P(e instanceof Error?e.message:`Failed to load marketplace`)}finally{M(!1)}},[]),be=(0,w.useCallback)(async()=>{try{he((await p(`/plugins/stats?limit=20`)).stats)}catch{}},[]),Z=(0,w.useCallback)(async()=>{try{ve((await p(`/roles`)).roles)}catch{}},[]);(0,w.useEffect)(()=>{Y(),X(),Z()},[Y,X,Z]);let xe=async(e,t)=>{R(e);try{await p(`/plugins/${encodeURIComponent(e)}/${t?`enable`:`disable`}`,{method:`POST`}),m.success(`${e} ${t?`enabled`:`disabled`} globally`),c(n=>n.map(n=>n.id===e?{...n,globalEnabled:t}:n))}catch(e){m.error(e instanceof Error?e.message:`Failed to ${t?`enable`:`disable`} plugin`)}finally{R(null)}},Se=async e=>{R(e);try{await p(`/plugins/uninstall/${encodeURIComponent(e)}`,{method:`POST`}),m.success(`Plugin uninstalled`),await Promise.all([Y(),X()])}catch(e){m.error(e instanceof Error?e.message:`Uninstall failed`)}finally{R(null)}},Ce=async(e,t,n)=>{R(e);try{await p(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:`project`,cwd:n})});let r=J.find(e=>e.id===t)?.name??t;m.success(`Installed ${e.split(`@`)[0]} for ${r}`),await Y()}catch(e){m.error(e instanceof Error?e.message:`Install to role failed`)}finally{R(null)}},we=async()=>{let e=V.trim();if(e)try{await p(`/plugins/marketplaces`,{method:`POST`,body:JSON.stringify({url:e})}),m.success(`Marketplace added`),H(``),B(!1),await X()}catch(e){m.error(e instanceof Error?e.message:`Failed to add marketplace`)}},Q=async(e,t=`user`,n)=>{R(e);try{await p(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:t,cwd:n})});let r=t===`project`&&n?`${e.split(`@`)[0]} for ${n.split(`/`).pop()}`:e.split(`@`)[0];m.success(`Installed ${r}`),await Promise.all([Y(),X()])}catch(e){m.error(e instanceof Error?e.message:`Install failed`)}finally{R(null)}},Te=e=>{_e(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},$=K===`all`?e:e.filter(e=>e.scope===K),Ee=I?k.filter(e=>e.name.toLowerCase().includes(I.toLowerCase())||e.description.toLowerCase().includes(I.toLowerCase())):k;return(0,T.jsxs)(`div`,{className:`space-y-5`,children:[(0,T.jsx)(ie,{eyebrow:`Capabilities`,title:`Plugins`,compact:!0,description:`Installed capabilities, scope, and activation.`,metrics:[{label:`Total`,value:e.length},{label:`Project Scope`,value:e.filter(e=>e.scope===`project`).length},{label:`Catalog`,value:k.length}],actions:(0,T.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),children:(0,T.jsx)(o,{size:14})})}),(0,T.jsx)(ae,{title:`Installed Plugins`,compact:!0,description:`Filter by scope, inspect manifests, and keep every activation path reachable from one place.`}),(0,T.jsxs)(g,{children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(re,{size:14,className:`text-[var(--app-text-muted)] flex-shrink-0`}),(0,T.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${K===`all`?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:bg-[var(--app-panel-muted)]`}`,onClick:()=>q(`all`),children:`All`}),(0,T.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${K===`user`?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:bg-[var(--app-panel-muted)]`}`,onClick:()=>q(`user`),children:`User`}),(0,T.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${K===`project`?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:bg-[var(--app-panel-muted)]`}`,onClick:()=>q(`project`),children:`Project`}),(0,T.jsx)(`span`,{className:`h-4 w-px bg-[var(--app-panel-muted)] mx-1`}),d.map(e=>(0,T.jsx)(h,{variant:`muted`,className:`text-xs`,children:e.name},e.name)),(0,T.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[j&&(0,T.jsx)(r,{size:12,className:`animate-spin text-[var(--app-text-subtle)]`}),j?null:(0,T.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>B(!z),children:z?(0,T.jsx)(ee,{size:12}):(0,T.jsx)(t,{size:12})})]})]}),z&&(0,T.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,T.jsx)(`input`,{className:`flex-1 rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:V,onChange:e=>H(e.target.value),placeholder:`https://github.com/org/marketplace-repo`,onKeyDown:e=>{e.key===`Enter`&&we()}}),(0,T.jsx)(f,{size:`sm`,onClick:()=>void we(),disabled:!V.trim(),children:`Add`})]})]}),fe?(0,T.jsx)(g,{children:(0,T.jsx)(`div`,{className:`py-8 text-center text-sm text-[var(--app-text-subtle)]`,children:`Loading...`})}):$.length===0?(0,T.jsx)(g,{children:(0,T.jsx)(se,{icon:(0,T.jsx)(i,{size:32}),title:`No plugins`,description:K===`all`?`No plugins installed. Browse the marketplace or install from a URL.`:`No ${K}-scope plugins installed.`,className:`py-8`})}):ye?(0,T.jsx)(`div`,{className:`space-y-3`,children:$.map((e,t)=>{let n=G.has(e.id),i=e.id.split(`@`)[0],a=L===e.id,o=e.projectPath?`${e.id}:${e.projectPath}`:`${e.id}:${t}`;return(0,T.jsxs)(g,{children:[(0,T.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,T.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`button`,{onClick:()=>Te(e.id),className:`text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`,children:n?(0,T.jsx)(u,{size:14}):(0,T.jsx)(s,{size:14})}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`truncate text-sm font-medium text-[var(--app-text)]`,children:i}),(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-muted)]`,children:e.version?`v${e.version}`:`—`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(h,{variant:e.scope===`user`?`info`:`warning`,children:e.scope}),(0,T.jsx)(h,{variant:e.globalEnabled?`success`:`destructive`,children:e.globalEnabled?`User On`:`User Off`})]}),e.scope===`project`&&e.projectPath?(0,T.jsx)(`p`,{className:`truncate text-[11px] text-[var(--app-text-subtle)]`,title:e.projectPath,children:e.projectPath}):null,(0,T.jsx)(E,{manifest:e.manifest})]})}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,disabled:a,onClick:()=>void xe(e.id,!e.globalEnabled),children:a?(0,T.jsx)(r,{size:_.xs,className:`animate-spin`}):e.globalEnabled?`Disable`:`Enable`}),(0,T.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-[var(--app-danger)]`,disabled:a,onClick:()=>void Se(e.id),children:(0,T.jsx)(l,{size:_.xs})})]}),n?(0,T.jsx)(`div`,{className:`mt-4 rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:(0,T.jsx)(O,{plugin:e,roles:J,operatingId:L,onInstallToRole:Ce})}):null]},o)})}):(0,T.jsx)(g,{padding:!1,children:(0,T.jsxs)(C,{children:[(0,T.jsx)(v,{children:(0,T.jsxs)(x,{children:[(0,T.jsx)(y,{className:`w-8`}),(0,T.jsx)(y,{children:`Name`}),(0,T.jsx)(y,{children:`Version`}),(0,T.jsx)(y,{children:`Scope`}),(0,T.jsx)(y,{children:`Type`}),(0,T.jsx)(y,{children:`Activation`}),(0,T.jsx)(y,{children:`Actions`})]})}),(0,T.jsx)(b,{children:$.map((e,t)=>{let n=G.has(e.id),i=e.id.split(`@`)[0],a=L===e.id,o=e.projectPath?`${e.id}:${e.projectPath}`:`${e.id}:${t}`;return(0,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(x,{className:`group`,children:[(0,T.jsx)(S,{children:(0,T.jsx)(`button`,{onClick:()=>Te(e.id),className:`text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`,children:n?(0,T.jsx)(u,{size:_.xs}):(0,T.jsx)(s,{size:_.xs})})}),(0,T.jsx)(S,{className:`font-medium text-[var(--app-text)]`,children:i}),(0,T.jsx)(S,{className:`text-xs text-[var(--app-text-muted)]`,children:e.version?`v${e.version}`:`—`}),(0,T.jsxs)(S,{children:[(0,T.jsx)(h,{variant:e.scope===`user`?`info`:`warning`,children:e.scope}),e.scope===`project`&&e.projectPath&&(0,T.jsx)(`div`,{className:`text-[10px] text-[var(--app-text-subtle)] truncate max-w-[120px]`,title:e.projectPath,children:e.projectPath.split(`/`).pop()})]}),(0,T.jsx)(S,{children:(0,T.jsx)(E,{manifest:e.manifest})}),(0,T.jsx)(S,{children:(0,T.jsx)(h,{variant:e.globalEnabled?`success`:`destructive`,children:e.globalEnabled?`User On`:`User Off`})}),(0,T.jsx)(S,{children:(0,T.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,disabled:a,onClick:()=>void xe(e.id,!e.globalEnabled),children:a?(0,T.jsx)(r,{size:_.xs,className:`animate-spin`}):e.globalEnabled?`Disable`:`Enable`}),(0,T.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs text-[var(--app-danger)]`,disabled:a,onClick:()=>void Se(e.id),children:(0,T.jsx)(l,{size:_.xs})})]})})]}),n&&(0,T.jsx)(x,{className:`bg-[var(--app-panel)]/50`,children:(0,T.jsx)(S,{colSpan:7,className:`px-6 py-3`,children:(0,T.jsx)(O,{plugin:e,roles:J,operatingId:L,onInstallToRole:Ce})})},`${e.id}-detail`)]},o)})})]})}),(0,T.jsxs)(g,{children:[(0,T.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-[var(--app-text)]`,onClick:()=>pe(!F),children:[(0,T.jsx)(ne,{size:_.sm,className:`text-[var(--app-text-muted)]`}),`Marketplace (`,k.length,`)`,F?(0,T.jsx)(u,{size:_.xs,className:`ml-auto`}):(0,T.jsx)(s,{size:_.xs,className:`ml-auto`})]}),F&&(0,T.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,T.jsxs)(`div`,{className:`relative`,children:[(0,T.jsx)(a,{size:_.sm,className:`absolute left-2.5 top-2 text-[var(--app-text-subtle)]`}),(0,T.jsx)(`input`,{className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] pl-8 pr-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,value:I,onChange:e=>me(e.target.value),placeholder:`Search available plugins...`})]}),j?(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] text-center py-2`,children:`Loading marketplace...`}):N?(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-danger)] text-center py-2`,children:N}):Ee.length===0?(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] text-center py-2`,children:I?`No plugins match your search`:`No marketplace plugins available`}):(0,T.jsxs)(C,{children:[(0,T.jsx)(v,{children:(0,T.jsxs)(x,{children:[(0,T.jsx)(y,{children:`Name`}),(0,T.jsx)(y,{children:`Description`}),(0,T.jsx)(y,{children:`Source`}),(0,T.jsx)(y,{children:`Action`})]})}),(0,T.jsx)(b,{children:Ee.map(e=>{let t=ue.has(e.pluginId),i=L===e.pluginId;return(0,T.jsxs)(x,{children:[(0,T.jsx)(S,{className:`font-medium text-[var(--app-text)] text-xs`,children:e.name}),(0,T.jsx)(S,{className:`text-xs text-[var(--app-text-muted)] max-w-[300px] truncate`,title:e.description,children:e.description}),(0,T.jsx)(S,{children:(0,T.jsx)(h,{variant:`muted`,className:`text-[10px]`,children:e.marketplaceName})}),(0,T.jsx)(S,{children:t?(0,T.jsx)(h,{variant:`success`,className:`text-[10px]`,children:`Installed`}):(0,T.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,disabled:i,onClick:()=>void Q(e.pluginId),children:i?(0,T.jsx)(r,{size:_.xs,className:`animate-spin`}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(n,{size:_.xs}),` Install`]})}),J.length>0&&(0,T.jsxs)(`div`,{className:`relative group/install`,children:[(0,T.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-1 text-xs text-[var(--app-text-subtle)]`,children:(0,T.jsx)(u,{size:_.xs})}),(0,T.jsx)(`div`,{className:`absolute right-0 top-full mt-1 z-10 hidden group-hover/install:block bg-[var(--app-panel-elevated)] border border-[var(--app-border)] rounded shadow-lg py-1 min-w-[140px]`,children:J.map(t=>(0,T.jsx)(`button`,{className:`block w-full text-left px-3 py-1 text-xs text-[var(--app-text)] hover:bg-[var(--app-panel-muted)]`,disabled:i,onClick:()=>void Q(e.pluginId,`project`,t.workspacePath),children:t.name},t.id))})]})]})})]},e.pluginId)})})]})]})]}),(0,T.jsxs)(g,{children:[(0,T.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-[var(--app-text)]`,onClick:()=>{!W&&U.length===0&&be(),ge(!W)},children:[(0,T.jsx)(te,{size:14,className:`text-[var(--app-text-muted)]`}),`Usage Stats`,W?(0,T.jsx)(u,{size:12,className:`ml-auto`}):(0,T.jsx)(s,{size:12,className:`ml-auto`})]}),W&&(0,T.jsx)(`div`,{className:`mt-3`,children:U.length===0?(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] text-center py-2`,children:`No usage data yet`}):(0,T.jsxs)(C,{children:[(0,T.jsx)(v,{children:(0,T.jsxs)(x,{children:[(0,T.jsx)(y,{children:`Plugin`}),(0,T.jsx)(y,{children:`Usage Count`}),(0,T.jsx)(y,{children:`Last Used`})]})}),(0,T.jsx)(b,{children:U.map(e=>(0,T.jsxs)(x,{children:[(0,T.jsx)(S,{className:`font-medium text-[var(--app-text)] text-xs`,children:e.pluginName}),(0,T.jsx)(S,{className:`font-mono text-xs text-[var(--app-text-muted)]`,children:e.usageCount}),(0,T.jsx)(S,{className:`text-xs text-[var(--app-text-muted)]`,children:e.lastUsed?oe(e.lastUsed):`—`})]},e.pluginPath))})]})})]})]})}export{k as Plugins};
|