adam-agent-server 0.1.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/LICENSE +21 -0
- package/README.md +424 -0
- package/dist/App-23CRAK2P.js +9 -0
- package/dist/adam-tools-MKUMZWCR.js +1 -0
- package/dist/approval-handler-SBFVVFGH.js +4 -0
- package/dist/channels-CNLMTKHM.js +1 -0
- package/dist/channels-VNG7U6UQ.js +1 -0
- package/dist/chunk-37OAKNKA.js +15 -0
- package/dist/chunk-3DAK2XWP.js +1 -0
- package/dist/chunk-3HM54J2N.js +1 -0
- package/dist/chunk-3OYRYMJW.js +11 -0
- package/dist/chunk-5AKFAMQL.js +29 -0
- package/dist/chunk-5BAD3NCT.js +1 -0
- package/dist/chunk-5GMYXCL3.js +1 -0
- package/dist/chunk-62PXAOD6.js +7 -0
- package/dist/chunk-B3CVXD44.js +104 -0
- package/dist/chunk-CV3ROBUM.js +1 -0
- package/dist/chunk-EJJDJY34.js +5 -0
- package/dist/chunk-F2IS5LWD.js +1 -0
- package/dist/chunk-FCV2DPZQ.js +1 -0
- package/dist/chunk-FUBKGVWI.js +8 -0
- package/dist/chunk-HMXDNPFE.js +5 -0
- package/dist/chunk-J5YZQQTS.js +3 -0
- package/dist/chunk-MMIO6BCA.js +10 -0
- package/dist/chunk-Q3N5LVPZ.js +5 -0
- package/dist/chunk-QOPUUA7O.js +1 -0
- package/dist/chunk-TGQYM4TH.js +6 -0
- package/dist/chunk-TYR3QUCL.js +23 -0
- package/dist/chunk-VURJZLM6.js +49 -0
- package/dist/chunk-W6JITSZF.js +569 -0
- package/dist/chunk-WGRTN6TX.js +1 -0
- package/dist/chunk-ZN5Q3YET.js +1 -0
- package/dist/cli.js +15 -0
- package/dist/config-42ZJPZDM.js +1 -0
- package/dist/db-ZDEA7EUY.js +1 -0
- package/dist/delivery-log-7DQ36UGP.js +1 -0
- package/dist/dist-CDWBOTZS.js +1 -0
- package/dist/engine-7VBPXTGK.js +1 -0
- package/dist/evolution-audit-MDA2ZVJW.js +1 -0
- package/dist/external-api-T7FFXVHL.js +1 -0
- package/dist/index.js +152 -0
- package/dist/logger-BEG4WFIM.js +1 -0
- package/dist/memories-BUNOVQVG.js +1 -0
- package/dist/onnxruntime_binding-6Q6HXASN.node +0 -0
- package/dist/onnxruntime_binding-EKZT2NRK.node +0 -0
- package/dist/onnxruntime_binding-P6S7V3CI.node +0 -0
- package/dist/onnxruntime_binding-PJNNIIUO.node +0 -0
- package/dist/onnxruntime_binding-UN6SPTQK.node +0 -0
- package/dist/role-presets-2X3VW75D.js +1 -0
- package/dist/roles-CMV5FMIA.js +1 -0
- package/dist/runtime-772O2XKZ.js +1 -0
- package/dist/server-bus-N5LCY73J.js +1 -0
- package/dist/session-manager-KO4CR3W6.js +1 -0
- package/dist/task-templates-AKQB7RRB.js +1 -0
- package/package.json +77 -0
- package/web/dist/assets/Card-BpwkRtmi.js +1 -0
- package/web/dist/assets/ChannelDetail-050qK78l.js +1 -0
- package/web/dist/assets/Channels-DA4gN6nU.js +12 -0
- package/web/dist/assets/Chat-LzhfKGQ5.js +1 -0
- package/web/dist/assets/Dashboard-Bh32YC_E.js +1 -0
- package/web/dist/assets/EmptyState-B08f3BH6.js +1 -0
- package/web/dist/assets/Evolution-BwsOuVbZ.js +3 -0
- package/web/dist/assets/GoalDetail-Zo16ZrYD.js +1 -0
- package/web/dist/assets/Goals-BmfVadFN.js +1 -0
- package/web/dist/assets/Logs-CYfQ9k_6.js +1 -0
- package/web/dist/assets/Memories-CgSb60RC.js +1 -0
- package/web/dist/assets/Plugins-DHgIfely.js +1 -0
- package/web/dist/assets/RoleDetail-CNJkMSuz.js +1 -0
- package/web/dist/assets/Roles-DGpN5Vm6.js +1 -0
- package/web/dist/assets/Settings-PjFyeX8n.js +1 -0
- package/web/dist/assets/Strategies-DBp2jYdi.js +1 -0
- package/web/dist/assets/Switch-yk5-dsti.js +1 -0
- package/web/dist/assets/Table-DWR4p9xA.js +1 -0
- package/web/dist/assets/TaskDetail-DMg-JAbC.js +2 -0
- package/web/dist/assets/Work-BYgMw2qj.js +1 -0
- package/web/dist/assets/dist-jv3vbjrx.js +1 -0
- package/web/dist/assets/format-DvtQjPZn.js +1 -0
- package/web/dist/assets/index-CWY8H-cU.js +52 -0
- package/web/dist/assets/index-OXMtvYRJ.css +2 -0
- package/web/dist/assets/rolldown-runtime-DF2fYuay.js +1 -0
- package/web/dist/assets/vendor-icons-DqHipOFA.js +1 -0
- package/web/dist/assets/vendor-react-C2hDj0vl.js +11 -0
- package/web/dist/assets/vendor-state-CRsbPXtF.js +1 -0
- package/web/dist/favicon.svg +1 -0
- package/web/dist/icons.svg +24 -0
- package/web/dist/index.html +19 -0
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "adam-agent-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Goal-driven AI agent orchestration server with Role+Skill model, real-time streaming, and multi-channel delivery",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/",
|
|
10
|
+
"web/dist",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"bin": {
|
|
14
|
+
"adam": "dist/cli.js"
|
|
15
|
+
},
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"onnxruntime-node": "^1.24.3"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
|
|
21
|
+
"@anthropic-ai/sdk": "^0.80.0",
|
|
22
|
+
"@fastify/cors": "^10.0.0",
|
|
23
|
+
"@fastify/static": "^9.0.0",
|
|
24
|
+
"@fastify/swagger": "^9.7.0",
|
|
25
|
+
"@fastify/swagger-ui": "^5.2.5",
|
|
26
|
+
"@fastify/websocket": "^11.0.0",
|
|
27
|
+
"better-sqlite3": "^11.0.0",
|
|
28
|
+
"bree": "^9.2.9",
|
|
29
|
+
"chalk": "^5.0.0",
|
|
30
|
+
"commander": "^13.0.0",
|
|
31
|
+
"cron-parser": "^5.5.0",
|
|
32
|
+
"fastify": "^5.0.0",
|
|
33
|
+
"ink": "^5.0.0",
|
|
34
|
+
"ink-spinner": "^5.0.0",
|
|
35
|
+
"ink-text-input": "^6.0.0",
|
|
36
|
+
"pino": "^10.3.1",
|
|
37
|
+
"pino-pretty": "^13.1.3",
|
|
38
|
+
"react": "^18.0.0",
|
|
39
|
+
"uuid": "^11.0.0",
|
|
40
|
+
"yaml": "^2.6.0",
|
|
41
|
+
"zod": "^4.3.6"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@testing-library/react": "^16.3.2",
|
|
45
|
+
"@types/better-sqlite3": "^7.6.0",
|
|
46
|
+
"@types/node": "^22.0.0",
|
|
47
|
+
"@types/react": "^18.0.0",
|
|
48
|
+
"@types/react-dom": "^19.2.3",
|
|
49
|
+
"@types/uuid": "^10.0.0",
|
|
50
|
+
"@types/ws": "^8.18.1",
|
|
51
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
52
|
+
"happy-dom": "^20.8.4",
|
|
53
|
+
"ink-testing-library": "^4.0.0",
|
|
54
|
+
"react-dom": "^18.3.1",
|
|
55
|
+
"tsup": "^8.0.0",
|
|
56
|
+
"tsx": "^4.0.0",
|
|
57
|
+
"typescript": "^5.7.0",
|
|
58
|
+
"vitest": "^4.1.0",
|
|
59
|
+
"ws": "^8.19.0"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=20.0.0"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsup",
|
|
66
|
+
"build:all": "tsup && cd web && pnpm build",
|
|
67
|
+
"dev": "tsx watch src/index.ts",
|
|
68
|
+
"start": "node dist/index.js",
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"test:watch": "vitest",
|
|
71
|
+
"test:coverage": "vitest run --coverage",
|
|
72
|
+
"test:e2e": "vitest run src/__tests__/e2e/",
|
|
73
|
+
"test:unit": "vitest run --exclude 'src/__tests__/e2e/**'",
|
|
74
|
+
"typecheck": "tsc --noEmit",
|
|
75
|
+
"postinstall": "npm rebuild better-sqlite3 2>/dev/null || true"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{X as t}from"./vendor-icons-DqHipOFA.js";import{t as n}from"./vendor-react-C2hDj0vl.js";import{n as r}from"./dist-jv3vbjrx.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,padding:t=!0,...n},i)=>(0,a.jsx)(`div`,{ref:i,className:r(`rounded-lg border border-slate-800 bg-slate-900 text-slate-200 shadow-sm`,t&&`p-4`,e),...n}));o.displayName=`Card`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`mb-3 flex items-center justify-between`,e),...t}));s.displayName=`CardHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`h3`,{ref:n,className:r(`text-sm font-medium text-slate-400`,e),...t}));c.displayName=`CardTitle`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`p`,{ref:n,className:r(`text-xs text-slate-500`,e),...t}));l.displayName=`CardDescription`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(``,e),...t}));u.displayName=`CardContent`;var d=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`flex items-center pt-2`,e),...t}));d.displayName=`CardFooter`;export{s as n,c as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{J as t,L as n,S as r,X as i,_ as a,j as o}from"./vendor-icons-DqHipOFA.js";import{l as s,r as c,t as l}from"./vendor-react-C2hDj0vl.js";import{r as u}from"./dist-jv3vbjrx.js";import{t as d}from"./index-CWY8H-cU.js";import{n as f,r as p,t as m}from"./Card-BpwkRtmi.js";import{n as h}from"./format-DvtQjPZn.js";var g=e(i(),1),_=l();function v(){let{id:e}=s(),[i,l]=(0,g.useState)(null),[v,b]=(0,g.useState)([]),[x,S]=(0,g.useState)([]),[C,w]=(0,g.useState)(null);if((0,g.useEffect)(()=>{e&&((async()=>{try{l((await u(`/channels/${e}`)).channel),w(null)}catch(e){w(e instanceof Error?e.message:`Failed to load channel`)}})(),u(`/delivery-rules`).then(t=>b(t.filter(t=>t.target.type===`channel`&&t.target.channelId===e))).catch(()=>b([])),u(`/delivery-rules`).then(async t=>{let n=t.filter(t=>t.target.type===`channel`&&t.target.channelId===e),r=[];for(let e of n.slice(0,3))try{let t=await u(`/delivery-rules/${e.id}/log`);r.push(...t.log??[])}catch{}r.sort((e,t)=>t.createdAt-e.createdAt),S(r.slice(0,20))}).catch(()=>S([])))},[e]),C)return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(c,{to:`/channels`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,_.jsx)(t,{size:14}),` Back to Channels`]}),(0,_.jsx)(m,{className:`text-center text-red-400`,children:C})]});if(!i)return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(c,{to:`/channels`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,_.jsx)(t,{size:14}),` Back to Channels`]}),(0,_.jsx)(m,{className:`text-center text-slate-500`,children:`Loading...`})]});let T=e=>e===`connected`?`success`:e===`connecting`?`warning`:e===`error`?`destructive`:`secondary`,E=e=>{switch(e){case`wechat`:return`WeChat`;case`telegram`:return`Telegram`;case`slack`:return`Slack`;case`discord`:return`Discord`;default:return e.charAt(0).toUpperCase()+e.slice(1)}},D={...i.config};for(let e of[`botToken`,`apiKey`,`secret`,`password`,`token`])e in D&&(D[e]=`********`);return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(c,{to:`/channels`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,_.jsx)(t,{size:14}),` Back to Channels`]}),(0,_.jsx)(m,{children:(0,_.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,_.jsx)(d,{variant:T(i.status),children:i.status}),(0,_.jsx)(d,{variant:`outline`,children:E(i.platform)}),i.enabled?(0,_.jsx)(d,{variant:`success`,children:`enabled`}):(0,_.jsx)(d,{variant:`secondary`,children:`disabled`}),(0,_.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:i.id})]}),(0,_.jsx)(`h2`,{className:`text-lg font-semibold text-slate-200`,children:i.name})]})})}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,_.jsx)(y,{icon:n,label:`Created`,value:h(i.createdAt),mono:!0}),(0,_.jsx)(y,{icon:r,label:`Messages`,value:String(i.messageCount),mono:!0}),i.lastMessageAt&&(0,_.jsx)(y,{icon:n,label:`Last Message`,value:h(i.lastMessageAt),mono:!0}),i.linkedAgentId&&(0,_.jsx)(y,{icon:a,label:`Linked Agent`,value:i.linkedAgentId.slice(0,8)+`...`,mono:!0})]}),(0,_.jsxs)(m,{children:[(0,_.jsx)(f,{children:(0,_.jsx)(p,{children:`Configuration`})}),(0,_.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap rounded-md bg-slate-800 p-3 font-mono text-xs text-slate-300`,children:JSON.stringify(D,null,2)})]}),v.length>0&&(0,_.jsxs)(m,{children:[(0,_.jsx)(f,{children:(0,_.jsxs)(p,{className:`flex items-center gap-2`,children:[(0,_.jsx)(o,{size:14}),` Delivery Rules (`,v.length,`)`]})}),(0,_.jsx)(`div`,{className:`space-y-2`,children:v.map(e=>(0,_.jsxs)(`div`,{className:`rounded-md border border-slate-700 bg-slate-800/50 p-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(d,{variant:`outline`,children:e.eventType}),e.enabled?(0,_.jsx)(d,{variant:`success`,children:`active`}):(0,_.jsx)(d,{variant:`secondary`,children:`disabled`}),(0,_.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[`max `,e.maxPerMinute,`/min`]})]}),(0,_.jsxs)(`p`,{className:`mt-1 text-xs text-slate-400 font-mono`,children:[`Rule: `,e.id]})]},e.id))})]}),x.length>0&&(0,_.jsxs)(m,{children:[(0,_.jsx)(f,{children:(0,_.jsxs)(p,{className:`flex items-center gap-2`,children:[(0,_.jsx)(r,{size:14}),` Delivery Log (`,x.length,`)`]})}),(0,_.jsx)(`div`,{className:`space-y-2`,children:x.slice(0,10).map(e=>(0,_.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-slate-800 p-2`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`span`,{className:`text-sm text-slate-300 font-mono`,children:e.taskId.slice(0,8)}),(0,_.jsx)(`span`,{className:`text-xs text-slate-500 ml-2`,children:h(e.createdAt)})]}),(0,_.jsx)(d,{variant:e.status===`delivered`?`default`:e.status===`failed`?`destructive`:`outline`,children:e.status})]},e.id))})]})]})}function y({icon:e,label:t,value:n,mono:r}){return(0,_.jsxs)(m,{className:`flex flex-col gap-1`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 text-slate-500`,children:[(0,_.jsx)(e,{size:12}),(0,_.jsx)(`span`,{className:`text-xs`,children:t})]}),(0,_.jsx)(`span`,{className:`text-sm text-slate-200 truncate ${r?`font-mono text-xs`:``}`,children:n})]})}export{v as ChannelDetail};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{S as t,X as n,_ as r,a as i,b as a,g as o,m as s,t as c,v as l}from"./vendor-icons-DqHipOFA.js";import{t as u}from"./vendor-react-C2hDj0vl.js";import{r as d}from"./dist-jv3vbjrx.js";import{f,t as p}from"./index-CWY8H-cU.js";import{n as m,r as h,t as g}from"./Card-BpwkRtmi.js";import{t as _}from"./EmptyState-B08f3BH6.js";var v=e(n(),1),y=u(),b=[`telegram`,`slack`,`discord`,`openclaw`,`wechat`,`whatsapp`],x={telegram:`{
|
|
2
|
+
"botToken": ""
|
|
3
|
+
}`,slack:`{
|
|
4
|
+
"botToken": "",
|
|
5
|
+
"signingSecret": ""
|
|
6
|
+
}`,discord:`{
|
|
7
|
+
"botToken": ""
|
|
8
|
+
}`,openclaw:`{
|
|
9
|
+
"gatewayUrl": "ws://127.0.0.1:18789"
|
|
10
|
+
}`,wechat:`{
|
|
11
|
+
"baseUrl": "https://ilinkai.weixin.qq.com"
|
|
12
|
+
}`,whatsapp:`{}`},S=e=>{switch(e){case`connected`:return`success`;case`connecting`:return`warning`;case`error`:return`destructive`;default:return`secondary`}};function C({initial:e,onSubmit:t,onCancel:n}){let[r,i]=(0,v.useState)(e?.name??``),[a,o]=(0,v.useState)(e?.platform??`telegram`),[s,l]=(0,v.useState)(e?.config?JSON.stringify(e.config,null,2):x[e?.platform??`telegram`]??`{}`),[u,d]=(0,v.useState)(e?.enabled??!0),[p,m]=(0,v.useState)(``);function _(e){if(e.preventDefault(),!r.trim()){m(`Name is required`);return}let n;try{n=JSON.parse(s)}catch{m(`Invalid JSON in config`);return}m(``),t({name:r.trim(),platform:a,config:n,enabled:u})}return(0,y.jsx)(g,{children:(0,y.jsxs)(`form`,{onSubmit:_,className:`space-y-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(h,{className:`text-slate-200`,children:e?`Edit Channel`:`New Channel`}),(0,y.jsx)(f,{variant:`ghost`,size:`icon`,type:`button`,onClick:n,children:(0,y.jsx)(c,{size:14})})]}),p&&(0,y.jsx)(`div`,{className:`text-xs text-red-400`,children:p}),(0,y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsx)(`label`,{className:`text-xs text-slate-400`,children:`Name`}),(0,y.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`My Telegram Bot`,className:`rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`})]}),(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsx)(`label`,{className:`text-xs text-slate-400`,children:`Platform`}),(0,y.jsx)(`select`,{value:a,onChange:t=>{o(t.target.value),e||l(x[t.target.value]??`{}`)},className:`rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,children:b.map(e=>(0,y.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsx)(`label`,{className:`text-xs text-slate-400`,children:`Config (JSON)`}),(0,y.jsx)(`textarea`,{value:s,onChange:e=>l(e.target.value),rows:4,className:`resize-none rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 font-mono text-xs text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`input`,{type:`checkbox`,id:`ch-enabled`,checked:u,onChange:e=>d(e.target.checked),className:`rounded border-slate-700 bg-slate-800`}),(0,y.jsx)(`label`,{htmlFor:`ch-enabled`,className:`text-xs text-slate-400`,children:`Enabled`})]}),!e&&a===`wechat`&&(0,y.jsx)(`div`,{className:`rounded bg-blue-900/30 border border-blue-800/50 px-3 py-2 text-xs text-blue-300`,children:`Creating a WeChat channel will start a QR code scan. Have your WeChat app ready.`}),(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(f,{type:`submit`,size:`sm`,children:e?`Save`:a===`wechat`&&!e?`Create & Connect`:`Create`}),(0,y.jsx)(f,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,children:`Cancel`})]})]})})}function w({channelId:e,onClose:t}){let[n,r]=(0,v.useState)([]),[i,a]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{(async()=>{try{r((await d(`/channels/${e}/messages`)).messages)}catch{}a(!1)})()},[e]),(0,y.jsxs)(g,{children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,y.jsx)(h,{children:`Channel Messages`}),(0,y.jsx)(f,{variant:`ghost`,size:`icon`,onClick:t,children:(0,y.jsx)(c,{size:14})})]}),i?(0,y.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Loading...`}):n.length===0?(0,y.jsx)(`div`,{className:`text-xs text-slate-500`,children:`No messages yet`}):(0,y.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-2`,children:n.map(e=>(0,y.jsxs)(`div`,{className:`rounded bg-slate-800/50 px-3 py-2 text-xs`,children:[(0,y.jsx)(`span`,{className:e.role===`user`?`text-blue-400`:`text-emerald-400`,children:e.role}),(0,y.jsx)(`span`,{className:`text-slate-500 ml-2`,children:new Date(e.createdAt).toLocaleTimeString()}),(0,y.jsx)(`div`,{className:`mt-1 text-slate-300`,children:e.content})]},e.id))})]})}function T(){let[e,n]=(0,v.useState)([]),[c,u]=(0,v.useState)(!0),[b,x]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(!1);(0,v.useEffect)(()=>{N()},[]);async function N(){try{n((await d(`/channels`)).channels)}catch{}u(!1)}async function P(e){try{let t=await d(`/channels`,{method:`POST`,body:JSON.stringify(e)});x(!1),N(),e.platform===`wechat`&&t.channel?.id&&I(t.channel.id)}catch{}}async function F(e){if(T)try{await d(`/channels/${T.id}`,{method:`PATCH`,body:JSON.stringify(e)}),E(null),N()}catch{}}async function I(t){if(e.find(e=>e.id===t)?.platform===`wechat`)try{let e=await d(`/channels/${t}/wechat/qr-start`,{method:`POST`});if(e.qrcodeUrl&&e.sessionKey){A({channelId:t,qrcodeUrl:e.qrcodeUrl,sessionKey:e.sessionKey}),M(!0);try{(await d(`/channels/${t}/wechat/qr-wait`,{method:`POST`,body:JSON.stringify({sessionKey:e.sessionKey,timeoutMs:12e4})})).connected&&N()}catch{}A(null),M(!1)}}catch{}else try{await d(`/channels/${t}/connect`,{method:`POST`}),N()}catch{}}async function L(e){try{await d(`/channels/${e}/disconnect`,{method:`POST`}),N()}catch{}}async function R(e){try{await d(`/channels/${e}`,{method:`DELETE`}),n(t=>t.filter(t=>t.id!==e))}catch{}}return c?(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,y.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-slate-700 border-t-blue-500`})}):(0,y.jsxs)(`div`,{className:`space-y-6`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Channels`}),(0,y.jsxs)(f,{size:`sm`,onClick:()=>{x(!0),E(null)},children:[(0,y.jsx)(o,{size:14}),` Add Channel`]})]}),b&&!T&&(0,y.jsx)(C,{onSubmit:P,onCancel:()=>x(!1)}),T&&(0,y.jsx)(C,{initial:T,onSubmit:F,onCancel:()=>E(null)}),D&&(0,y.jsx)(w,{channelId:D,onClose:()=>O(null)}),k&&(0,y.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,y.jsxs)(g,{className:`max-w-sm text-center`,children:[(0,y.jsx)(h,{className:`mb-3 text-slate-200`,children:`Scan QR Code with WeChat`}),(0,y.jsx)(`img`,{src:`https://api.qrserver.com/v1/create-qr-code/?size=256x256&data=${encodeURIComponent(k.qrcodeUrl)}`,alt:`WeChat QR Code`,className:`mx-auto h-64 w-64 rounded bg-white p-2`}),(0,y.jsx)(`p`,{className:`mt-3 text-xs text-slate-400`,children:j?`Waiting for scan...`:`Open WeChat and scan the QR code`}),(0,y.jsx)(`a`,{href:k.qrcodeUrl,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 block text-[10px] text-blue-400 hover:text-blue-300 truncate max-w-[280px] mx-auto`,children:k.qrcodeUrl}),(0,y.jsx)(f,{variant:`ghost`,size:`sm`,className:`mt-3`,onClick:()=>{A(null),M(!1)},children:`Cancel`})]})}),e.length===0&&!b?(0,y.jsx)(_,{icon:(0,y.jsx)(s,{size:24}),title:`No channels`,description:`Add a channel to connect Adam to messaging platforms like Telegram, Slack, or Discord.`}):(0,y.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,y.jsxs)(g,{children:[(0,y.jsxs)(m,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(s,{size:16,className:`text-slate-400`}),(0,y.jsx)(h,{className:`text-slate-200`,children:e.name})]}),(0,y.jsx)(p,{variant:S(e.status),children:e.status})]}),(0,y.jsxs)(`div`,{className:`space-y-2 text-xs text-slate-400`,children:[(0,y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,y.jsx)(`span`,{children:`Platform`}),(0,y.jsx)(`span`,{className:`text-slate-300`,children:e.platform})]}),(0,y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,y.jsx)(`span`,{children:`Messages`}),(0,y.jsx)(`span`,{className:`text-slate-300`,children:e.messageCount})]}),(0,y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,y.jsx)(`span`,{children:`Enabled`}),(0,y.jsx)(`span`,{className:e.enabled?`text-emerald-400`:`text-slate-500`,children:e.enabled?`Yes`:`No`})]})]}),(0,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-slate-800 pt-3`,children:[e.status===`connected`?(0,y.jsxs)(f,{variant:`secondary`,size:`sm`,onClick:()=>void L(e.id),children:[(0,y.jsx)(l,{size:12}),` Disconnect`]}):(0,y.jsxs)(f,{variant:`secondary`,size:`sm`,onClick:()=>void I(e.id),children:[(0,y.jsx)(r,{size:12}),` Connect`]}),(0,y.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>{E(e),x(!1)},children:(0,y.jsx)(a,{size:12})}),(0,y.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>O(e.id),children:(0,y.jsx)(t,{size:12})}),(0,y.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>void R(e.id),children:(0,y.jsx)(i,{size:12})})]})]},e.id))})]})}export{T as Channels};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{C as t,X as n,Y as r,a as i,f as a,g as o,l as s}from"./vendor-icons-DqHipOFA.js";import{t as c}from"./vendor-react-C2hDj0vl.js";import{i as l,r as u}from"./dist-jv3vbjrx.js";import{t as d}from"./vendor-state-CRsbPXtF.js";import{f}from"./index-CWY8H-cU.js";import{a as p}from"./format-DvtQjPZn.js";var m=e(n(),1),h=d((e,t)=>({sessions:[],activeSessionId:null,messages:[],loading:!1,sending:!1,_chatWs:null,_chatWsReconnectDelay:1e3,fetchSessions:async()=>{try{e({sessions:(await u(`/chat/sessions`)).sessions})}catch{}},fetchMessages:async t=>{e({loading:!0});try{e({messages:(await u(`/chat/sessions/${t}`)).messages,loading:!1})}catch{e({messages:[],loading:!1})}},sendMessage:async n=>{if(t().sending)return null;e({sending:!0});try{let r=await u(`/chat/messages`,{method:`POST`,body:JSON.stringify({content:n,source:{type:`web`},sessionId:t().activeSessionId??void 0})});return e({activeSessionId:r.sessionId,sending:!1}),t().fetchSessions(),r}catch{return e({sending:!1}),null}},createSession:async()=>{try{let t=await u(`/chat/sessions`,{method:`POST`,body:JSON.stringify({source:{type:`web`}})});return e(e=>({sessions:[t.session,...e.sessions],activeSessionId:t.session.id,messages:[]})),t.session}catch{return null}},archiveSession:async t=>{try{await u(`/chat/sessions/${t}/archive`,{method:`POST`}),e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,status:`archived`}:e),activeSessionId:e.activeSessionId===t?null:e.activeSessionId,messages:e.activeSessionId===t?[]:e.messages}))}catch{}},restoreSession:async t=>{try{await u(`/chat/sessions/${t}/restore`,{method:`POST`}),e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,status:`active`}:e)}))}catch{}},deleteSession:async t=>{try{await u(`/chat/sessions/${t}`,{method:`DELETE`}),e(e=>({sessions:e.sessions.filter(e=>e.id!==t),activeSessionId:e.activeSessionId===t?null:e.activeSessionId,messages:e.activeSessionId===t?[]:e.messages}))}catch{}},setActiveSession:n=>{e({activeSessionId:n,messages:[]}),n&&t().fetchMessages(n)},connectChatStream:()=>{let n=t()._chatWs;if(n&&n.readyState<=1)return;let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=localStorage.getItem(`adam_api_key`),a=new URL(`${r}//${window.location.host}/chat/stream`);i&&a.searchParams.set(`api_key`,i);let o=new WebSocket(a.toString());o.onopen=()=>{e({_chatWs:o,_chatWsReconnectDelay:1e3})},o.onclose=()=>{let n=t()._chatWsReconnectDelay;e({_chatWs:null,_chatWsReconnectDelay:Math.min(n*2,1e4)}),setTimeout(()=>{t().connectChatStream()},n)},o.onerror=()=>{o.close()},o.onmessage=n=>{try{let r=JSON.parse(n.data);if(r.type===`chat_message`&&r.message){let n=r.message,{activeSessionId:i,messages:a}=t();if(n.sessionId!==i||a.some(e=>e.id===n.id))return;e(e=>({messages:[...e.messages,n]}))}else r.type===`session_created`&&t().fetchSessions()}catch{}},e({_chatWs:o})},disconnectChatStream:()=>{let n=t()._chatWs;n&&(n.onclose=null,n.onerror=null,n.onmessage=null,n.close(),e({_chatWs:null}))}})),g=c();function _({message:e}){let t=e.role===`user`;return(0,g.jsx)(`div`,{className:l(`flex`,t?`justify-end`:`justify-start`),children:(0,g.jsxs)(`div`,{className:l(`max-w-[80%] rounded-lg px-3.5 py-2.5 text-sm leading-relaxed`,t?`bg-blue-600 text-white`:`border border-slate-700 bg-slate-800 text-slate-200`),children:[(0,g.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:e.content}),(0,g.jsx)(`div`,{className:l(`mt-1.5 text-[10px]`,t?`text-blue-200/60`:`text-slate-500`),children:p(typeof e.createdAt==`number`?e.createdAt:new Date(e.createdAt).getTime())})]})})}function v({onSend:e,disabled:t,placeholder:n=`Type a message...`}){let[r,i]=(0,m.useState)(``),a=(0,m.useRef)(null),o=()=>{let n=r.trim();!n||t||(e(n),i(``),a.current&&(a.current.style.height=`auto`))},c=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),o())},l=()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)};return(0,g.jsxs)(`div`,{className:`flex items-end gap-2 border-t border-slate-800 bg-slate-950 px-4 py-3`,children:[(0,g.jsx)(`textarea`,{ref:a,value:r,onChange:e=>{i(e.target.value),l()},onKeyDown:c,placeholder:n,disabled:t,rows:1,className:`flex-1 resize-none rounded-md border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:opacity-50`}),(0,g.jsx)(f,{onClick:o,disabled:t||!r.trim(),size:`default`,"aria-label":`Send message`,children:(0,g.jsx)(s,{size:16})})]})}function y(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function b({session:e,isActive:t,onSelect:n,onArchive:o,onRestore:s,onDelete:c}){let u=e.status===`archived`;return(0,g.jsxs)(`button`,{onClick:n,className:l(`group flex w-full flex-col gap-1 rounded-md px-2.5 py-2 text-left transition-colors`,t?`bg-slate-800 text-slate-100`:`text-slate-400 hover:bg-slate-800/50 hover:text-slate-300`,u&&`opacity-60`),children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`span`,{className:`truncate text-xs font-medium`,children:e.title??e.id.slice(0,8)}),(0,g.jsxs)(`div`,{className:`flex gap-0.5 opacity-0 group-hover:opacity-100`,children:[u?(0,g.jsx)(`span`,{role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),s()},onKeyDown:e=>{e.key===`Enter`&&(e.stopPropagation(),s())},className:`rounded p-0.5 text-slate-500 hover:text-emerald-400`,title:`Restore`,children:(0,g.jsx)(a,{size:12})}):(0,g.jsx)(`span`,{role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.stopPropagation(),o())},className:`rounded p-0.5 text-slate-500 hover:text-amber-400`,title:`Archive`,children:(0,g.jsx)(r,{size:12})}),(0,g.jsx)(`span`,{role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),c()},onKeyDown:e=>{e.key===`Enter`&&(e.stopPropagation(),c())},className:`rounded p-0.5 text-slate-500 hover:text-red-400`,title:`Delete`,children:(0,g.jsx)(i,{size:12})})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-slate-500`,children:[(0,g.jsxs)(`span`,{children:[e.messageCount,` turns`]}),(0,g.jsx)(`span`,{children:y(e.lastActiveAt)}),u&&(0,g.jsx)(`span`,{className:`rounded bg-slate-700 px-1 py-0.5 text-[9px]`,children:`archived`})]})]})}function x({sessions:e,activeSessionId:t,onSelectSession:n,onNewSession:r,onArchiveSession:i,onRestoreSession:a,onDeleteSession:s}){let c=e.filter(e=>e.status===`active`),l=e.filter(e=>e.status===`archived`);return(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-800 px-3 py-2.5`,children:[(0,g.jsx)(`span`,{className:`text-xs font-medium text-slate-400`,children:`Sessions`}),(0,g.jsx)(f,{variant:`ghost`,size:`sm`,onClick:r,children:(0,g.jsx)(o,{size:14})})]}),(0,g.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-1.5 py-1.5`,children:[c.length===0&&l.length===0&&(0,g.jsx)(`div`,{className:`px-2 py-4 text-center text-xs text-slate-500`,children:`No sessions yet`}),c.length>0&&(0,g.jsx)(`div`,{className:`space-y-0.5`,children:c.map(e=>(0,g.jsx)(b,{session:e,isActive:e.id===t,onSelect:()=>n(e.id),onArchive:()=>i(e.id),onRestore:()=>a(e.id),onDelete:()=>s(e.id)},e.id))}),l.length>0&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`mt-3 mb-1 px-2 text-[10px] font-medium uppercase tracking-wider text-slate-600`,children:`Archived`}),(0,g.jsx)(`div`,{className:`space-y-0.5`,children:l.map(e=>(0,g.jsx)(b,{session:e,isActive:e.id===t,onSelect:()=>n(e.id),onArchive:()=>i(e.id),onRestore:()=>a(e.id),onDelete:()=>s(e.id)},e.id))})]})]})]})}function S(){let e=h(e=>e.sessions),n=h(e=>e.activeSessionId),r=h(e=>e.messages),i=h(e=>e.sending),a=h(e=>e.fetchSessions),o=h(e=>e.sendMessage),s=h(e=>e.createSession),c=h(e=>e.archiveSession),l=h(e=>e.restoreSession),u=h(e=>e.deleteSession),d=h(e=>e.setActiveSession),f=h(e=>e.connectChatStream),p=h(e=>e.disconnectChatStream),y=(0,m.useRef)(null);return(0,m.useEffect)(()=>{a()},[a]),(0,m.useEffect)(()=>(f(),()=>p()),[f,p]),(0,m.useEffect)(()=>{y.current?.scrollIntoView?.({behavior:`smooth`})},[r]),(0,g.jsxs)(`div`,{className:`flex h-[calc(100vh-3.5rem)] overflow-hidden`,children:[(0,g.jsx)(`div`,{className:`hidden w-56 flex-shrink-0 border-r border-slate-800 bg-slate-950 lg:block`,children:(0,g.jsx)(x,{sessions:e,activeSessionId:n,onSelectSession:d,onNewSession:()=>void s(),onArchiveSession:e=>void c(e),onRestoreSession:e=>void l(e),onDeleteSession:e=>void u(e)})}),(0,g.jsxs)(`div`,{className:`flex flex-1 flex-col`,children:[(0,g.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:r.length===0?(0,g.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-slate-500`,children:[(0,g.jsx)(`div`,{className:`rounded-full bg-slate-800 p-3`,children:(0,g.jsx)(t,{size:24})}),(0,g.jsx)(`div`,{className:`text-sm`,children:`Start a conversation with Adam`}),(0,g.jsx)(`div`,{className:`text-xs text-slate-600`,children:`Type a message below to begin`})]}):(0,g.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-3`,children:[r.map(e=>(0,g.jsx)(_,{message:e},e.id)),(0,g.jsx)(`div`,{ref:y})]})}),(0,g.jsx)(`div`,{className:`mx-auto w-full max-w-3xl`,children:(0,g.jsx)(v,{onSend:async e=>{await o(e)},disabled:i})})]})]})}export{S as Chat};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{B as t,D as n,H as r,I as i,L as a,V as o,X as s,s as c,z as l}from"./vendor-icons-DqHipOFA.js";import{r as u,t as d}from"./vendor-react-C2hDj0vl.js";import{C as f,n as p,t as m}from"./index-CWY8H-cU.js";import{n as h,r as g,t as _}from"./Card-BpwkRtmi.js";import{a as v,o as y,t as b}from"./format-DvtQjPZn.js";import{a as x,i as S,n as C,o as w,r as T,t as E}from"./Table-DWR4p9xA.js";var D=e(s(),1),O=d();function k(){let e=f(e=>e.tasks),s=f(e=>e.goals),d=f(e=>e.stats),k=f(e=>e.readiness),j=f(e=>e.roles),M=f(e=>e.executionPool),N=f(e=>e.fetchTasks),P=f(e=>e.fetchGoals),F=f(e=>e.fetchRoles),I=f(e=>e.fetchExecutionPool);(0,D.useEffect)(()=>{N(),P(),F(),I();let e=setInterval(()=>{N(),I()},5e3);return()=>clearInterval(e)},[N,P,F,I]);let L=e.filter(e=>e.status===`running`).length,R=e.filter(e=>e.status===`pending`||e.status===`queued`).length,z=e.filter(e=>e.status===`completed`).length,B=e.filter(e=>e.status===`failed`).length,V=[...e].sort((e,t)=>t.createdAt-e.createdAt).slice(0,8);return(0,O.jsxs)(`div`,{className:`space-y-6`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Dashboard`}),k&&(0,O.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:(0,O.jsx)(m,{variant:k.status===`ready`?`success`:`destructive`,children:k.status===`ready`?`Server Ready`:`Not Ready`})})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,role:`region`,"aria-label":`Server statistics`,children:[(0,O.jsx)(A,{icon:n,label:`Active Tasks`,value:d.activeTasks||L,color:`text-blue-400`}),(0,O.jsx)(A,{icon:a,label:`Queued`,value:d.queuedTasks||R,color:`text-amber-400`}),(0,O.jsx)(A,{icon:l,label:`Roles`,value:j.length,color:`text-emerald-400`}),(0,O.jsx)(A,{icon:t,label:`Cost Today`,value:b(d.totalCostToday),color:`text-purple-400`})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,role:`region`,"aria-label":`Additional statistics`,children:[(0,O.jsx)(A,{icon:o,label:`Completed`,value:z,color:`text-emerald-400`}),(0,O.jsx)(A,{icon:r,label:`Failed`,value:B,color:`text-red-400`}),(0,O.jsx)(A,{icon:c,label:`Goals`,value:s.length,color:`text-orange-400`}),(0,O.jsx)(A,{icon:i,label:`Execution Pool`,value:`${M.active}/${M.max} | ${M.queued} queued`,color:`text-blue-400`})]}),(0,O.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-1`,children:(0,O.jsxs)(_,{children:[(0,O.jsx)(h,{children:(0,O.jsx)(g,{children:`System Checks`})}),k?(0,O.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.entries(k.checks).map(([e,t])=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-slate-800/30 px-3 py-2`,children:[(0,O.jsx)(`div`,{className:t?`h-2 w-2 rounded-full bg-emerald-500`:`h-2 w-2 rounded-full bg-red-500`}),(0,O.jsx)(`span`,{className:`text-xs capitalize text-slate-300`,children:e})]},e))}):(0,O.jsx)(`span`,{className:`text-xs text-slate-500`,children:`Loading...`})]})}),(0,O.jsxs)(_,{padding:!1,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-4 pt-4`,children:[(0,O.jsx)(g,{children:`Recent Tasks`}),(0,O.jsx)(u,{to:`/work`,className:`text-xs text-blue-400 hover:text-blue-300`,children:`View all`})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsxs)(E,{children:[(0,O.jsx)(x,{children:(0,O.jsxs)(w,{children:[(0,O.jsx)(S,{children:`ID`}),(0,O.jsx)(S,{children:`Prompt`}),(0,O.jsx)(S,{children:`Status`}),(0,O.jsx)(S,{children:`Agent`}),(0,O.jsx)(S,{children:`Created`})]})}),(0,O.jsxs)(C,{children:[V.map(e=>(0,O.jsxs)(w,{children:[(0,O.jsx)(T,{children:(0,O.jsx)(u,{to:`/tasks/${e.id}`,className:`font-mono text-xs text-blue-400 hover:text-blue-300`,children:e.id.slice(0,8)})}),(0,O.jsx)(T,{children:y(e.prompt,60)}),(0,O.jsx)(T,{children:(0,O.jsx)(m,{variant:p(e.status),children:e.status})}),(0,O.jsx)(T,{children:(0,O.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:e.roleId?e.roleId.slice(0,12):`—`})}),(0,O.jsx)(T,{className:`text-xs text-slate-500`,children:v(e.createdAt)})]},e.id)),V.length===0&&(0,O.jsx)(w,{children:(0,O.jsx)(T,{colSpan:5,className:`text-center text-slate-500`,children:`No tasks yet`})})]})]})})]})]})}function A({icon:e,label:t,value:n,color:r}){return(0,O.jsxs)(_,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-slate-800 p-2 ${r}`,children:(0,O.jsx)(e,{size:16})}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-lg font-semibold text-slate-100`,children:n}),(0,O.jsx)(`div`,{className:`text-xs text-slate-500`,children:t})]})]})}export{k as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./vendor-react-C2hDj0vl.js";import{n as t}from"./dist-jv3vbjrx.js";var n=e();function r({icon:e,title:r,description:i,action:a,className:o}){return(0,n.jsxs)(`div`,{className:t(`flex flex-col items-center justify-center py-16 text-center`,o),children:[e&&(0,n.jsx)(`div`,{className:`mb-3 text-slate-600`,children:e}),(0,n.jsx)(`h3`,{className:`text-sm font-medium text-slate-400`,children:r}),i&&(0,n.jsx)(`p`,{className:`mt-1 text-xs text-slate-500`,children:i}),a&&(0,n.jsx)(`div`,{className:`mt-4`,children:a})]})}export{r as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{N as t,X as n,p as r}from"./vendor-icons-DqHipOFA.js";import{t as i}from"./vendor-react-C2hDj0vl.js";import{r as a}from"./dist-jv3vbjrx.js";import{C as o,f as s,t as c}from"./index-CWY8H-cU.js";import{t as l}from"./Card-BpwkRtmi.js";import{a as u}from"./format-DvtQjPZn.js";import{t as d}from"./EmptyState-B08f3BH6.js";var f=e(n(),1),p=i();function m(){let e=o(e=>e.roles),n=o(e=>e.fetchRoles),[i,m]=(0,f.useState)([]),[h,g]=(0,f.useState)(!0),[_,v]=(0,f.useState)(`all`);(0,f.useEffect)(()=>{n()},[n]);let y=(0,f.useCallback)(async()=>{g(!0);try{let e=new URLSearchParams({limit:`50`});_!==`all`&&e.set(`roleId`,_),m(await a(`/evolution-audit?${e}`))}catch{m([])}finally{g(!1)}},[_]);(0,f.useEffect)(()=>{y()},[y]);let b=t=>t?e.find(e=>e.id===t)?.name??t.slice(0,8):`System`;return(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Evolution Audit`}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsxs)(`select`,{className:`rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:_,onChange:e=>v(e.target.value),children:[(0,p.jsx)(`option`,{value:`all`,children:`All roles`}),e.map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,p.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:(0,p.jsx)(r,{size:14})})]})]}),(0,p.jsx)(l,{children:h?(0,p.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,p.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-slate-700 border-t-blue-500`})}):i.length===0?(0,p.jsx)(d,{icon:(0,p.jsx)(t,{size:32}),title:`No evolution records`,description:`Evolution occurs when roles accumulate enough task experience`}):(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`p`,{className:`text-xs text-slate-500`,children:[i.length,` records`]}),i.map(e=>(0,p.jsxs)(`div`,{className:`rounded border border-slate-800 p-3`,children:[(0,p.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,p.jsx)(c,{variant:`info`,children:b(e.roleId)}),(0,p.jsx)(`span`,{className:`text-xs text-slate-500`,children:u(e.timestamp)}),e.triggerTaskId&&(0,p.jsxs)(`span`,{className:`text-[10px] text-slate-600`,children:[`triggered by task `,e.triggerTaskId.slice(0,8)]})]}),(0,p.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap rounded bg-slate-950 p-2 font-mono text-xs`,children:e.diff.split(`
|
|
2
|
+
`).map((e,t)=>(0,p.jsxs)(`span`,{className:e.startsWith(`+`)?`text-green-400`:e.startsWith(`-`)?`text-red-400`:`text-slate-400`,children:[e,`
|
|
3
|
+
`]},t))})]},e.id))]})})]})}export{m as Evolution};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,F as n,J as r,L as i,X as a,s as o}from"./vendor-icons-DqHipOFA.js";import{l as s,r as c,t as l}from"./vendor-react-C2hDj0vl.js";import{r as u}from"./dist-jv3vbjrx.js";import{t as d}from"./index-CWY8H-cU.js";import{n as f,r as p,t as m}from"./Card-BpwkRtmi.js";import{n as h}from"./format-DvtQjPZn.js";var g=e(a(),1),_=l();function v(){let{id:e}=s(),[a,l]=(0,g.useState)(null),[v,b]=(0,g.useState)([]),[x,S]=(0,g.useState)(null);if((0,g.useEffect)(()=>{e&&(async()=>{try{let t=await u(`/goals/${e}`);l(t.goal),S(null);try{b((await u(`/strategies?role=${t.goal.roleId}`)).strategies??[])}catch{}}catch(e){S(e instanceof Error?e.message:`Failed to load goal`)}})()},[e]),x)return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,_.jsx)(r,{size:14}),` Back to Goals`]}),(0,_.jsx)(m,{className:`text-center text-red-400`,children:x})]});if(!a)return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,_.jsx)(r,{size:14}),` Back to Goals`]}),(0,_.jsx)(m,{className:`text-center text-slate-500`,children:`Loading...`})]});let C=a.targetValue>0?Math.min(100,a.currentValue/a.targetValue*100):0,w=a.deadline>0&&a.deadline<Date.now()&&a.status!==`completed`;return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,_.jsx)(r,{size:14}),` Back to Goals`]}),(0,_.jsx)(m,{children:(0,_.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,_.jsx)(d,{variant:(e=>e===`completed`?`success`:e===`executing`||e===`evaluating`?`warning`:e===`failed`?`destructive`:`secondary`)(a.status),children:a.status}),(0,_.jsx)(d,{variant:`outline`,children:a.roleId}),(0,_.jsx)(d,{variant:`outline`,children:a.metricType}),(0,_.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:a.id})]}),(0,_.jsx)(`h2`,{className:`text-lg font-semibold text-slate-200`,children:a.name}),a.description&&(0,_.jsx)(`p`,{className:`text-sm text-slate-400 mt-1`,children:a.description})]})})}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,_.jsx)(y,{icon:o,label:`Progress`,value:`${a.currentValue} / ${a.targetValue}`}),(0,_.jsx)(y,{icon:i,label:w?`Overdue`:`Deadline`,value:h(a.deadline),mono:!0}),(0,_.jsx)(y,{icon:n,label:`Budget`,value:`$${a.budgetUsd.toFixed(2)}`}),(0,_.jsx)(y,{icon:t,label:`Created`,value:h(a.createdAt),mono:!0})]}),(0,_.jsxs)(m,{children:[(0,_.jsx)(f,{children:(0,_.jsx)(p,{children:`Progress`})}),(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`flex-1 h-3 rounded-full bg-slate-700 overflow-hidden`,children:(0,_.jsx)(`div`,{className:`h-full rounded-full transition-all ${w?`bg-red-500`:`bg-blue-500`}`,style:{width:`${C}%`}})}),(0,_.jsxs)(`span`,{className:`text-sm text-slate-300 font-mono`,children:[C.toFixed(1),`%`]})]}),(0,_.jsxs)(`div`,{className:`mt-2 flex items-center justify-between text-xs text-slate-500`,children:[(0,_.jsxs)(`span`,{children:[a.currentValue,` current`]}),(0,_.jsxs)(`span`,{children:[a.targetValue,` target`]})]})]}),(a.deliverTo??a.notifyTargets??[]).length>0&&(0,_.jsxs)(m,{children:[(0,_.jsx)(f,{children:(0,_.jsx)(p,{children:`Delivery Targets`})}),(0,_.jsx)(`div`,{className:`space-y-1.5`,children:(a.deliverTo??a.notifyTargets??[]).map((e,t)=>(0,_.jsx)(`div`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:e.type===`channel`?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(d,{variant:`outline`,children:`Channel`}),(0,_.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,_.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(d,{variant:`outline`,children:`Session`}),(0,_.jsx)(`span`,{className:`text-xs text-slate-400`,children:`Chat session`})]})},t))})]}),v.length>0&&(0,_.jsxs)(m,{children:[(0,_.jsx)(f,{children:(0,_.jsxs)(p,{className:`flex items-center gap-2`,children:[(0,_.jsx)(t,{size:14}),` Strategies (`,v.length,`)`]})}),(0,_.jsx)(`div`,{className:`space-y-2`,children:v.map(e=>(0,_.jsxs)(`div`,{className:`flex items-center justify-between text-sm border-b border-slate-800 pb-2`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-200`,children:e.name}),(0,_.jsx)(`span`,{className:`text-xs text-slate-500 ml-2`,children:e.taskType})]}),(0,_.jsxs)(d,{variant:`outline`,children:[e.trialCount,` trials`]})]},e.id))})]})]})}function y({icon:e,label:t,value:n,mono:r}){return(0,_.jsxs)(m,{className:`flex flex-col gap-1`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 text-slate-500`,children:[(0,_.jsx)(e,{size:12}),(0,_.jsx)(`span`,{className:`text-xs`,children:t})]}),(0,_.jsx)(`span`,{className:`text-sm text-slate-200 truncate ${r?`font-mono text-xs`:``}`,children:n})]})}export{v as GoalDetail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{X as t,a as n,b as r,g as i,p as a,s as o,t as s,x as c,y as l}from"./vendor-icons-DqHipOFA.js";import{t as u}from"./vendor-react-C2hDj0vl.js";import{r as d}from"./dist-jv3vbjrx.js";import{C as f,a as p,c as m,d as h,f as g,i as _,l as v,n as y,o as b,r as x,s as S,t as C,u as w,w as T}from"./index-CWY8H-cU.js";import{n as E,r as D,t as O}from"./Card-BpwkRtmi.js";import{n as k,t as A}from"./format-DvtQjPZn.js";import{t as j}from"./EmptyState-B08f3BH6.js";var M=e(t(),1),N=u();function P({value:e,onChange:t,label:n=`Delivery Targets`}){let[r,i]=(0,M.useState)([]),[a,o]=(0,M.useState)(!1);(0,M.useEffect)(()=>{let e=!1;return Promise.all([d(`/channels`).catch(()=>({channels:[]})),d(`/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,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsx)(`label`,{className:`text-xs text-slate-400`,children:n}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>o(!a),className:`mt-1 w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-left text-sm text-slate-200 hover:border-slate-600 focus:border-blue-500 focus:outline-none`,children:l===0?`Default (current session)`:`${l} channel${l>1?`s`:``} selected`}),a&&(0,N.jsxs)(`div`,{className:`absolute z-10 mt-1 w-full rounded-md border border-slate-700 bg-slate-800 py-1 shadow-lg`,children:[r.length===0?(0,N.jsx)(`div`,{className:`px-3 py-2 text-xs text-slate-500`,children:`No active channel conversations. Start a chat on WeChat/Telegram first.`}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`px-3 py-1 text-xs text-slate-500`,children:`Channel conversations`}),r.map(e=>(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 px-3 py-1.5 text-xs text-slate-300 hover:bg-slate-700`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:s(e.channelId,e.chatId),onChange:()=>c(e.channelId,e.chatId),className:`rounded border-slate-600 bg-slate-700`}),(0,N.jsx)(`span`,{className:`truncate font-medium`,children:e.channelName}),(0,N.jsxs)(`span`,{className:`text-slate-500`,children:[`(`,e.platform,`)`]})]},`${e.channelId}:${e.chatId}`))]}),l>0&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>{t([]),o(!1)},className:`mt-1 w-full border-t border-slate-700 px-3 py-1 text-left text-xs text-red-400 hover:bg-slate-700`,children:`Clear all`}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:`w-full border-t border-slate-700 px-3 py-1 text-left text-xs text-slate-500 hover:bg-slate-700`,children:`Done`})]})]})}var F={active:`paused`,paused:`active`,completed:`active`,failed:`active`},I={active:(0,N.jsx)(c,{size:12}),paused:(0,N.jsx)(l,{size:12}),completed:(0,N.jsx)(a,{size:12}),failed:(0,N.jsx)(a,{size:12})};function L(){let e=f(e=>e.goals),t=f(e=>e.fetchGoals),c=f(e=>e.updateGoal),u=f(e=>e.deleteGoal),[L,R]=(0,M.useState)(!1),[z,B]=(0,M.useState)(``),[V,H]=(0,M.useState)(!1),[U,W]=(0,M.useState)(null),[G,K]=(0,M.useState)(null),[q,J]=(0,M.useState)(``),[Y,X]=(0,M.useState)(``),[Z,Q]=(0,M.useState)([]),[$,ee]=(0,M.useState)([]);(0,M.useEffect)(()=>{t();let e=setInterval(()=>void t(),1e4);return()=>clearInterval(e)},[t]);let te=async()=>{if(z.trim()){H(!0),W(null);try{await d(`/goals`,{method:`POST`,body:JSON.stringify({input:z.trim(),notifyTargets:$.length>0?$:void 0})}),B(``),R(!1),t()}catch(e){W(e instanceof Error?e.message:`Failed to create goal`)}finally{H(!1)}}};return(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Goals`}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>void t(),children:(0,N.jsx)(a,{size:14})}),(0,N.jsxs)(g,{size:`sm`,onClick:()=>R(!L),children:[(0,N.jsx)(i,{size:14}),`New Goal`]})]})]}),L&&(0,N.jsxs)(O,{className:`space-y-3`,children:[(0,N.jsx)(`textarea`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Describe your goal in natural language...`,rows:3,value:z,onChange:e=>B(e.target.value)}),(0,N.jsx)(P,{value:$,onChange:ee,label:`Notify on completion`}),U&&(0,N.jsx)(`p`,{className:`text-xs text-red-400`,children:U}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsx)(g,{onClick:()=>void te(),disabled:V||!z.trim(),children:V?`Creating...`:`Create`}),(0,N.jsx)(g,{variant:`ghost`,onClick:()=>R(!1),children:`Cancel`})]})]}),e.length===0?(0,N.jsx)(j,{icon:(0,N.jsx)(o,{size:32}),title:`No goals`,description:`Create a goal to start goal-driven task orchestration`}):(0,N.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=G===e.id;return(0,N.jsxs)(O,{children:[(0,N.jsxs)(E,{children:[a?(0,N.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-2 py-1 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:q,onChange:e=>J(e.target.value),autoFocus:!0}):(0,N.jsx)(D,{className:`text-slate-200 text-sm font-medium truncate max-w-[180px]`,children:e.name}),(0,N.jsx)(C,{variant:y(e.status),children:e.status})]}),a?(0,N.jsx)(`textarea`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-2 py-1 text-xs text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none mb-3`,placeholder:`Description...`,rows:2,value:Y,onChange:e=>X(e.target.value)}):e.description?(0,N.jsx)(`p`,{className:`text-xs text-slate-400 mb-3 line-clamp-2`,children:e.description}):null,a&&(0,N.jsx)(`div`,{className:`mb-3`,children:(0,N.jsx)(P,{value:Z,onChange:Q})}),(0,N.jsxs)(`div`,{className:`mb-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,N.jsx)(`span`,{className:`text-xs text-slate-500`,children:`Progress`}),(0,N.jsxs)(`span`,{className:`font-mono text-xs text-slate-300`,children:[t,`%`]})]}),(0,N.jsx)(`div`,{className:`h-1.5 rounded-full bg-slate-800`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full transition-all ${t>=100?`bg-emerald-500`:`bg-blue-500`}`,style:{width:`${t}%`}})}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,N.jsxs)(`span`,{className:`font-mono text-[10px] text-slate-500`,children:[e.currentValue,` / `,e.targetValue]}),(0,N.jsx)(`span`,{className:`font-mono text-[10px] text-slate-500`,children:e.metricType})]})]}),(0,N.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-slate-500`,children:`Role`}),(0,N.jsx)(C,{variant:`muted`,className:`text-[10px]`,children:e.roleId})]}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-slate-500`,children:`Budget`}),(0,N.jsx)(`span`,{className:`font-mono text-slate-300`,children:A(e.budgetUsd)})]}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-slate-500 ${i?`text-red-400`:``}`,children:`Deadline`}),(0,N.jsx)(`span`,{className:`text-slate-300 ${i?`text-red-400`:``}`,children:k(e.deadline)})]}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-slate-500`,children:`Created`}),(0,N.jsx)(`span`,{className:`text-slate-400`,children:k(e.createdAt)})]})]}),(0,N.jsx)(`div`,{className:`flex items-center gap-1 mt-3 pt-3 border-t border-slate-800`,children:a?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(g,{size:`sm`,variant:`ghost`,onClick:async()=>{try{await c(e.id,{name:q,description:Y,notifyTargets:Z}),K(null),T.success(`Goal updated`)}catch(e){T.error(e instanceof Error?e.message:`Failed to update`)}},children:`Save`}),(0,N.jsx)(g,{size:`sm`,variant:`ghost`,onClick:()=>K(null),children:(0,N.jsx)(s,{size:14})})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(g,{size:`sm`,variant:`ghost`,title:`Edit`,onClick:()=>{K(e.id),J(e.name),X(e.description??``),Q(e.notifyTargets??[])},children:(0,N.jsx)(r,{size:14})}),(0,N.jsxs)(g,{size:`sm`,variant:`ghost`,title:`Change to ${F[e.status]}`,onClick:async()=>{try{await c(e.id,{status:F[e.status]}),T.success(`Status changed to ${F[e.status]}`)}catch(e){T.error(e instanceof Error?e.message:`Failed to update status`)}},children:[I[e.status]??(0,N.jsx)(l,{size:12}),(0,N.jsx)(`span`,{className:`ml-1 text-xs`,children:F[e.status]})]}),(0,N.jsx)(`div`,{className:`ml-auto`,children:(0,N.jsxs)(x,{children:[(0,N.jsx)(h,{asChild:!0,children:(0,N.jsx)(g,{size:`sm`,variant:`ghost`,title:`Delete`,className:`text-red-400 hover:text-red-300`,children:(0,N.jsx)(n,{size:14})})}),(0,N.jsxs)(b,{children:[(0,N.jsxs)(v,{children:[(0,N.jsx)(w,{children:`Delete goal`}),(0,N.jsxs)(S,{children:[`This will permanently delete "`,e.name,`". This action cannot be undone.`]})]}),(0,N.jsxs)(m,{children:[(0,N.jsx)(p,{children:`Cancel`}),(0,N.jsx)(_,{className:`bg-red-600 hover:bg-red-700`,onClick:async()=>{try{await u(e.id),T.success(`Goal deleted`)}catch(e){T.error(e instanceof Error?e.message:`Failed to delete`)}},children:`Delete`})]})]})]})})]})})]},e.id)})})]})}export{L as Goals,P as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{X as t,a as n,o as r,x as i,y as a}from"./vendor-icons-DqHipOFA.js";import{t as o}from"./vendor-react-C2hDj0vl.js";import{C as s,f as c}from"./index-CWY8H-cU.js";import{t as l}from"./Card-BpwkRtmi.js";import{t as u}from"./EmptyState-B08f3BH6.js";var d=e(t(),1),f=o(),p={debug:`text-slate-500`,info:`text-blue-400`,warn:`text-amber-400`,error:`text-red-400`},m={adam:`text-purple-400`,manager:`text-cyan-400`,worker:`text-green-400`,scheduler:`text-orange-400`,api:`text-blue-400`,ws:`text-teal-400`,store:`text-yellow-400`,embedding:`text-pink-400`},h=[`adam`,`manager`,`worker`,`scheduler`,`api`,`ws`,`store`,`embedding`],g=[`debug`,`info`,`warn`,`error`];function _(){let e=s(e=>e.logs),t=(0,d.useRef)(null),[o,_]=(0,d.useState)(!0),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)(null),C=(0,d.useMemo)(()=>e.filter(e=>!(y&&e.level!==y||x&&e.component!==x)),[e,y,x]);return(0,d.useEffect)(()=>{o&&t.current&&(t.current.scrollTop=t.current.scrollHeight)},[C,o]),(0,f.jsxs)(`div`,{className:`flex h-full flex-col gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Logs`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>_(!o),title:o?`Pause auto-scroll`:`Resume auto-scroll`,children:o?(0,f.jsx)(i,{size:14}):(0,f.jsx)(a,{size:14})}),(0,f.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>{s.setState({logs:[]})},title:`Clear logs`,children:(0,f.jsx)(n,{size:14})})]})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`span`,{className:`text-xs text-slate-500`,children:`Level:`}),(0,f.jsxs)(`div`,{className:`flex gap-1`,children:[(0,f.jsx)(v,{active:y===null,onClick:()=>b(null),children:`All`}),g.map(e=>(0,f.jsx)(v,{active:y===e,onClick:()=>b(y===e?null:e),children:e},e))]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`span`,{className:`text-xs text-slate-500`,children:`Component:`}),(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,f.jsx)(v,{active:x===null,onClick:()=>S(null),children:`All`}),h.map(e=>(0,f.jsx)(v,{active:x===e,onClick:()=>S(x===e?null:e),children:e},e))]})]})]}),(0,f.jsx)(l,{padding:!1,className:`flex-1 min-h-0`,children:C.length===0?(0,f.jsx)(u,{icon:(0,f.jsx)(r,{size:32}),title:`No log entries`,description:`Log events will appear here in real-time via WebSocket`}):(0,f.jsx)(`div`,{ref:t,className:`h-full max-h-[calc(100vh-280px)] overflow-y-auto p-3 font-mono text-xs leading-5`,children:C.map((e,t)=>{let n=new Date(e.timestamp).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3}),r=p[e.level]??`text-slate-400`,i=m[e.component]??`text-slate-400`;return(0,f.jsxs)(`div`,{className:`flex gap-2 hover:bg-slate-800/30 px-1 rounded`,children:[(0,f.jsx)(`span`,{className:`text-slate-600 shrink-0`,children:n}),(0,f.jsx)(`span`,{className:`w-12 shrink-0 uppercase ${r}`,children:e.level.padEnd(5)}),(0,f.jsxs)(`span`,{className:`w-20 shrink-0 ${i}`,children:[`[`,e.component,`]`]}),(0,f.jsx)(`span`,{className:`text-slate-300 break-all`,children:e.msg})]},t)})})}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-slate-500`,children:[(0,f.jsxs)(`span`,{children:[C.length,` entries `,C.length!==e.length&&`(${e.length} total)`]}),(0,f.jsx)(`span`,{children:o?`Auto-scrolling`:`Paused`})]})]})}function v({active:e,onClick:t,children:n}){return(0,f.jsx)(`button`,{onClick:t,className:`rounded px-2 py-0.5 text-xs transition-colors ${e?`bg-slate-700 text-slate-200`:`text-slate-500 hover:text-slate-300`}`,children:n})}export{_ as Logs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{X as t,p as n,q as r,u as i}from"./vendor-icons-DqHipOFA.js";import{t as a}from"./vendor-react-C2hDj0vl.js";import{r as o}from"./dist-jv3vbjrx.js";import{C as s,f as c,t as l}from"./index-CWY8H-cU.js";import{t as u}from"./Card-BpwkRtmi.js";import{a as d}from"./format-DvtQjPZn.js";import{t as f}from"./EmptyState-B08f3BH6.js";var p=e(t(),1),m=a();function h(){let e=s(e=>e.roles),t=s(e=>e.fetchRoles),[a,h]=(0,p.useState)(``),[g,_]=(0,p.useState)([]),[v,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(!1),[w,T]=(0,p.useState)(`all`);(0,p.useEffect)(()=>{t()},[t]),(0,p.useEffect)(()=>{!a&&e.length>0&&h(e[0].id)},[e,a]);let E=(0,p.useCallback)(async()=>{if(a){y(!0);try{_((await o(`/memories/${a}?limit=100`)).memories)}catch{_([])}finally{y(!1)}}},[a]);(0,p.useEffect)(()=>{a&&E()},[a,E]);let D=async()=>{if(!(!b.trim()||!a)){C(!0);try{_((await o(`/memories/query`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agentId:a,prompt:b.trim(),topK:20})})).memories)}catch{_([])}finally{C(!1)}}},O=()=>{x(``),E()},k=g.filter(e=>w===`high`?e.importance>3:w===`medium`?e.importance===3:w===`low`?e.importance<3:!0),A=e=>e>=4?`text-red-400`:e===3?`text-yellow-400`:`text-slate-500`;return(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,m.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Memories`}),(0,m.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>void E(),children:(0,m.jsx)(n,{size:14})})]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,m.jsx)(`select`,{className:`rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:a,onChange:e=>h(e.target.value),children:e.map(e=>(0,m.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(`input`,{className:`w-64 rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 placeholder-slate-600 focus:border-blue-500 focus:outline-none`,value:b,onChange:e=>x(e.target.value),onKeyDown:e=>e.key===`Enter`&&void D(),placeholder:`Search memories...`}),(0,m.jsx)(c,{size:`sm`,variant:`ghost`,onClick:()=>void D(),disabled:S,children:(0,m.jsx)(i,{size:14})}),b&&(0,m.jsx)(c,{size:`sm`,variant:`ghost`,onClick:O,children:`Clear`})]}),(0,m.jsx)(`div`,{className:`flex gap-1`,children:[`all`,`high`,`medium`,`low`].map(e=>(0,m.jsx)(`button`,{className:`rounded px-2 py-1 text-xs transition-colors ${w===e?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>T(e),children:e},e))})]}),(0,m.jsx)(u,{children:v||S?(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-slate-700 border-t-blue-500`})}):k.length===0?(0,m.jsx)(f,{icon:(0,m.jsx)(r,{size:32}),title:`No memories`,description:b?`No results for this query`:`This agent has no memories yet`}):(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsxs)(`p`,{className:`text-xs text-slate-500`,children:[k.length,` memories`]}),k.map(e=>(0,m.jsxs)(`div`,{className:`rounded border border-slate-800 p-3`,children:[(0,m.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,m.jsx)(l,{variant:e.type===`reflection`?`info`:e.type===`thought`?`warning`:`muted`,children:e.type}),(0,m.jsx)(l,{variant:`muted`,children:e.sourceType}),(0,m.jsx)(`span`,{className:`text-xs font-medium ${A(e.importance)}`,children:`*`.repeat(e.importance)}),e.score!=null&&(0,m.jsxs)(`span`,{className:`text-[10px] text-slate-600`,children:[`score: `,e.score.toFixed(3)]})]}),(0,m.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-slate-300`,children:e.content}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:e.keywords.map(e=>(0,m.jsx)(`span`,{className:`rounded bg-slate-800 px-1.5 py-0.5 text-[10px] text-slate-500`,children:e},e))}),(0,m.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-slate-600`,children:[d(e.createdAt),` | accessed `,e.retrievedCount,`x | last: `,d(e.lastAccessed)]})]},e.id))]})})]})}export{h as Memories};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{E as t,K as n,M as r,U as i,W as a,X as o,a as ee,g as te,h as s,p as c,t as l}from"./vendor-icons-DqHipOFA.js";import{t as u}from"./vendor-react-C2hDj0vl.js";import{r as d}from"./dist-jv3vbjrx.js";import{f,t as p,w as m}from"./index-CWY8H-cU.js";import{t as h}from"./Card-BpwkRtmi.js";import{a as g}from"./format-DvtQjPZn.js";import{t as ne}from"./EmptyState-B08f3BH6.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./Table-DWR4p9xA.js";var C=e(o(),1),w=u();function T({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,w.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>(0,w.jsx)(p,{variant:e.variant,children:e.label},e.label))})}function E(){let[e,o]=(0,C.useState)([]),[u,E]=(0,C.useState)([]),[,D]=(0,C.useState)([]),[,O]=(0,C.useState)(new Set),[re,k]=(0,C.useState)(!0),[A,j]=(0,C.useState)(!1),[,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(null),[F,I]=(0,C.useState)(!1),[L,R]=(0,C.useState)(``),[z,B]=(0,C.useState)([]),[V,H]=(0,C.useState)(!1),[U,W]=(0,C.useState)(new Set),[G,K]=(0,C.useState)(`all`),[q,J]=(0,C.useState)([]),Y=(0,C.useCallback)(async()=>{k(!0);try{o((await d(`/plugins`)).plugins)}catch(e){m.error(e instanceof Error?e.message:`Failed to load plugins`)}finally{k(!1)}},[]),X=(0,C.useCallback)(async()=>{j(!0),M(null);try{let[e,t]=await Promise.all([d(`/plugins/marketplace`).catch(()=>({available:[],installed:[]})),d(`/plugins/marketplaces`)]);D(e.available),O(new Set(e.installed.map(e=>e.id))),E(t.sources)}catch(e){M(e instanceof Error?e.message:`Failed to load marketplace`)}finally{j(!1)}},[]),ie=(0,C.useCallback)(async()=>{try{B((await d(`/plugins/stats?limit=20`)).stats)}catch{}},[]),Z=(0,C.useCallback)(async()=>{try{J((await d(`/roles`)).roles)}catch{}},[]);(0,C.useEffect)(()=>{Y(),X(),Z()},[Y,X,Z]);let ae=async(e,t)=>{P(e);try{await d(`/plugins/${encodeURIComponent(e)}/${t?`enable`:`disable`}`,{method:`POST`}),m.success(`${e} ${t?`enabled`:`disabled`} globally`),o(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{P(null)}},oe=async e=>{P(e);try{await d(`/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{P(null)}},se=async(e,t,n)=>{P(e);try{await d(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:`project`,cwd:n})});let r=q.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{P(null)}},Q=async()=>{if(L.trim())try{await d(`/plugins/install/${encodeURIComponent(L.trim())}`,{method:`POST`,body:JSON.stringify({})}),m.success(`Source added`),R(``),I(!1),await X()}catch(e){m.error(e instanceof Error?e.message:`Failed to add source`)}},ce=e=>{W(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},$=G===`all`?e:e.filter(e=>e.scope===G);return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Plugins`}),(0,w.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),children:(0,w.jsx)(c,{size:14})})]}),(0,w.jsxs)(h,{children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(r,{size:14,className:`text-slate-400 flex-shrink-0`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${G===`all`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>K(`all`),children:`All`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${G===`user`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>K(`user`),children:`User`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${G===`project`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>K(`project`),children:`Project`}),(0,w.jsx)(`span`,{className:`h-4 w-px bg-slate-700 mx-1`}),u.map(e=>(0,w.jsx)(p,{variant:`muted`,className:`text-xs`,children:e.name},e.name)),(0,w.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[A&&(0,w.jsx)(t,{size:12,className:`animate-spin text-slate-500`}),A?null:(0,w.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>I(!F),children:F?(0,w.jsx)(l,{size:12}):(0,w.jsx)(te,{size:12})})]})]}),F&&(0,w.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,w.jsx)(`input`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:L,onChange:e=>R(e.target.value),placeholder:`https://github.com/org/marketplace-repo`,onKeyDown:e=>{e.key===`Enter`&&Q()}}),(0,w.jsx)(f,{size:`sm`,onClick:()=>void Q(),disabled:!L.trim(),children:`Add`})]})]}),re?(0,w.jsx)(h,{children:(0,w.jsx)(`div`,{className:`py-8 text-center text-sm text-slate-500`,children:`Loading...`})}):$.length===0?(0,w.jsx)(h,{children:(0,w.jsx)(ne,{icon:(0,w.jsx)(s,{size:32}),title:`No plugins`,description:G===`all`?`No plugins installed. Browse the marketplace or install from a URL.`:`No ${G}-scope plugins installed.`})}):(0,w.jsx)(h,{padding:!1,children:(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{className:`w-8`}),(0,w.jsx)(v,{children:`Name`}),(0,w.jsx)(v,{children:`Version`}),(0,w.jsx)(v,{children:`Scope`}),(0,w.jsx)(v,{children:`Type`}),(0,w.jsx)(v,{children:`Activation`}),(0,w.jsx)(v,{children:`Actions`})]})}),(0,w.jsx)(y,{children:$.map(e=>{let n=U.has(e.id),r=e.id.split(`@`)[0],o=N===e.id;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(b,{className:`group`,children:[(0,w.jsx)(x,{children:(0,w.jsx)(`button`,{onClick:()=>ce(e.id),className:`text-slate-500 hover:text-slate-300`,children:n?(0,w.jsx)(a,{size:12}):(0,w.jsx)(i,{size:12})})}),(0,w.jsx)(x,{className:`font-medium text-slate-200`,children:r}),(0,w.jsx)(x,{className:`text-xs text-slate-400`,children:e.version?`v${e.version}`:`—`}),(0,w.jsxs)(x,{children:[(0,w.jsx)(p,{variant:e.scope===`user`?`info`:`warning`,children:e.scope}),e.scope===`project`&&e.projectPath&&(0,w.jsx)(`div`,{className:`text-[10px] text-slate-600 truncate max-w-[120px]`,title:e.projectPath,children:e.projectPath.split(`/`).pop()})]}),(0,w.jsx)(x,{children:(0,w.jsx)(T,{manifest:e.manifest})}),(0,w.jsx)(x,{children:(0,w.jsx)(p,{variant:e.globalEnabled?`success`:`destructive`,children:e.globalEnabled?`User On`:`User Off`})}),(0,w.jsx)(x,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,disabled:o,onClick:()=>void ae(e.id,!e.globalEnabled),children:o?(0,w.jsx)(t,{size:10,className:`animate-spin`}):e.globalEnabled?`Disable`:`Enable`}),(0,w.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs text-red-400`,disabled:o,onClick:()=>void oe(e.id),children:(0,w.jsx)(ee,{size:10})})]})})]},e.id),n&&(0,w.jsx)(b,{className:`bg-slate-900/50`,children:(0,w.jsx)(x,{colSpan:7,className:`px-6 py-3`,children:e.manifest?(0,w.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[e.manifest.description&&(0,w.jsx)(`p`,{className:`text-slate-400`,children:e.manifest.description}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[e.manifest.skills.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Skills`}),e.manifest.skills.map(e=>(0,w.jsxs)(`div`,{className:`text-slate-400`,children:[(0,w.jsx)(`span`,{className:`text-slate-200`,children:e.name}),e.description&&(0,w.jsxs)(`span`,{className:`ml-1 text-slate-500`,children:[`— `,e.description]})]},e.name))]}),e.manifest.agents.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Agents`}),e.manifest.agents.map(e=>(0,w.jsxs)(`div`,{className:`text-slate-400`,children:[(0,w.jsx)(`span`,{className:`text-slate-200`,children:e.name}),e.description&&(0,w.jsxs)(`span`,{className:`ml-1 text-slate-500`,children:[`— `,e.description]})]},e.name))]}),e.manifest.mcpServers.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`MCP Servers`}),e.manifest.mcpServers.map(e=>(0,w.jsx)(`div`,{className:`text-slate-400`,children:e},e))]}),e.manifest.hooks.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Hooks`}),e.manifest.hooks.map(e=>(0,w.jsx)(`div`,{className:`text-slate-400`,children:e},e))]})]}),(0,w.jsx)(`div`,{className:`text-slate-600 font-mono truncate mt-1`,title:e.installPath,children:e.installPath}),q.length>0&&e.scope===`user`&&(0,w.jsxs)(`div`,{className:`mt-3 pt-2 border-t border-slate-800`,children:[(0,w.jsx)(`span`,{className:`text-slate-400 mr-2`,children:`Install to Role:`}),q.map(t=>(0,w.jsx)(f,{variant:`ghost`,size:`sm`,className:`h-5 px-2 text-[10px] mr-1`,disabled:N===e.id,onClick:()=>void se(e.id,t.id,t.workspacePath),children:t.name},t.id))]})]}):(0,w.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Loading manifest...`})})},`${e.id}-detail`)]})})})]})}),(0,w.jsxs)(h,{children:[(0,w.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-slate-300`,onClick:()=>{!V&&z.length===0&&ie(),H(!V)},children:[(0,w.jsx)(n,{size:14,className:`text-slate-400`}),`Usage Stats`,V?(0,w.jsx)(a,{size:12,className:`ml-auto`}):(0,w.jsx)(i,{size:12,className:`ml-auto`})]}),V&&(0,w.jsx)(`div`,{className:`mt-3`,children:z.length===0?(0,w.jsx)(`p`,{className:`text-xs text-slate-500 text-center py-2`,children:`No usage data yet`}):(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{children:`Plugin`}),(0,w.jsx)(v,{children:`Usage Count`}),(0,w.jsx)(v,{children:`Last Used`})]})}),(0,w.jsx)(y,{children:z.map(e=>(0,w.jsxs)(b,{children:[(0,w.jsx)(x,{className:`font-medium text-slate-200 text-xs`,children:e.pluginName}),(0,w.jsx)(x,{className:`font-mono text-xs text-slate-400`,children:e.usageCount}),(0,w.jsx)(x,{className:`text-xs text-slate-400`,children:e.lastUsed?g(e.lastUsed):`—`})]},e.pluginPath))})]})})]})]})}export{E as Plugins};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{J as t,X as n,g as r}from"./vendor-icons-DqHipOFA.js";import{c as i,l as a,r as o,t as s}from"./vendor-react-C2hDj0vl.js";import{r as c}from"./dist-jv3vbjrx.js";import{C as l,a as u,c as d,d as f,f as p,i as m,l as h,o as g,r as _,s as v,t as y,u as b,w as x}from"./index-CWY8H-cU.js";import{n as S,r as C,t as w}from"./Card-BpwkRtmi.js";import{a as T,n as E,t as D}from"./format-DvtQjPZn.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./Table-DWR4p9xA.js";import{t as P}from"./Switch-yk5-dsti.js";var F=e(n(),1),I=[`Read`,`Write`,`Edit`,`Bash`,`Grep`,`Glob`,`WebSearch`,`WebFetch`,`LSP`,`NotebookEdit`,`Agent`],L=s();function R(){let{id:e}=a(),n=i(),[r,s]=(0,F.useState)(null),[P,I]=(0,F.useState)([]),[R,ie]=(0,F.useState)([]),[ae,oe]=(0,F.useState)(``),[V,H]=(0,F.useState)([]),[U,W]=(0,F.useState)([]),[se,G]=(0,F.useState)([]),[K,q]=(0,F.useState)(null),[ce,J]=(0,F.useState)(!1),[Y,X]=(0,F.useState)(``),[le,ue]=(0,F.useState)(!1),[de,fe]=(0,F.useState)(!1),pe=l(e=>e.updateRole),me=l(e=>e.deleteRole),Z=(0,F.useCallback)(async()=>{if(e)try{let t=await c(`/roles/${e}`);s(t.role),X(t.role.cagPrompt),oe(t.workspacePath),I(t.projectPlugins.map(e=>({pluginId:e.id,name:e.name||e.id,path:e.installPath,boundAt:0}))),q(null)}catch(e){q(e instanceof Error?e.message:`Failed to load role`)}},[e]),Q=(0,F.useCallback)(async()=>{try{ie((await c(`/plugins`)).plugins??[])}catch{ie([])}},[]),he=(0,F.useCallback)(async()=>{if(e)try{H((await c(`/memories/${e}`)).memories??[])}catch{H([])}},[e]),ge=(0,F.useCallback)(async()=>{if(e)try{let t=await c(`/evolution-audit?roleId=${e}`);W(Array.isArray(t)?t:t.entries??[])}catch{W([])}},[e]);(0,F.useEffect)(()=>{Z(),Q()},[Z,Q]);let _e=(0,F.useCallback)(async()=>{try{G((await c(`/tasks`)).tasks??[])}catch{G([])}},[]);(0,F.useEffect)(()=>{he(),ge(),_e()},[he,ge,_e]);let $=se.filter(t=>t.roleId===e),ve=async()=>{if(e){ue(!0);try{await pe(e,{cagPrompt:Y}),await Z(),J(!1),x.success(`CAG prompt updated`)}catch(e){x.error(e instanceof Error?e.message:`Failed to save`)}finally{ue(!1)}}},ye=async()=>{if(e){fe(!0);try{await me(e),n(`/roles`)}catch(e){x.error(e instanceof Error?e.message:`Failed to delete role`),fe(!1)}}};return K?(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(o,{to:`/roles`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,L.jsx)(t,{size:14}),` Back to Roles`]}),(0,L.jsx)(w,{className:`text-center text-red-400`,children:K})]}):r?(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(o,{to:`/roles`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,L.jsx)(t,{size:14}),` Back to Roles`]}),(0,L.jsx)(w,{children:(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,L.jsx)(y,{variant:(e=>e===`active`?`success`:e===`inactive`?`secondary`:e===`retired`?`destructive`:e===`probation`?`warning`:`secondary`)(r.status),children:r.status}),(0,L.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:r.id})]}),(0,L.jsx)(`h2`,{className:`text-lg font-semibold text-slate-200`,children:r.name})]}),(0,L.jsxs)(_,{children:[(0,L.jsx)(f,{asChild:!0,children:(0,L.jsx)(p,{variant:`ghost`,className:`scale-75 text-red-400`,children:`Delete`})}),(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(b,{children:`Delete Role`}),(0,L.jsxs)(v,{children:[`Are you sure you want to delete "`,r.name,`"? This action cannot be undone.`]})]}),(0,L.jsxs)(d,{children:[(0,L.jsx)(u,{children:`Cancel`}),(0,L.jsx)(m,{className:`bg-red-600 text-white hover:bg-red-700`,onClick:()=>void ye(),disabled:de,children:de?`Deleting...`:`Delete`})]})]})]})]})}),(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsx)(C,{children:`CAG Prompt`})}),ce?(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`textarea`,{className:`w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,rows:8,value:Y,onChange:e=>X(e.target.value)}),(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(p,{variant:`ghost`,className:`scale-75`,onClick:()=>{J(!1),X(r.cagPrompt)},children:`Cancel`}),Y!==r.cagPrompt&&(0,L.jsx)(p,{className:`scale-75`,onClick:()=>void ve(),disabled:le,children:le?`Saving...`:`Save`})]})]}):(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm text-slate-300`,children:r.cagPrompt||`(no CAG prompt)`}),(0,L.jsx)(p,{variant:`ghost`,className:`scale-75`,onClick:()=>J(!0),children:`Edit`})]})]}),(0,L.jsx)(z,{role:r,onSave:()=>void Z()}),(0,L.jsx)(B,{boundPlugins:P,allPlugins:R,workspacePath:ae,onRefresh:()=>void Z()}),(0,L.jsx)(re,{role:r,onSave:()=>void Z()}),(0,L.jsx)(ee,{role:r,onSave:()=>void Z()}),(0,L.jsx)(te,{role:r,onSave:()=>void Z()}),(0,L.jsx)(ne,{role:r,onSave:()=>void Z()}),(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsxs)(C,{children:[`Memories (`,V.length,`)`]})}),V.length===0?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No memories for this role.`}):(0,L.jsx)(`div`,{className:`space-y-2`,children:V.slice(0,10).map(e=>(0,L.jsxs)(`div`,{className:`rounded-md border border-slate-800 px-3 py-2`,children:[(0,L.jsx)(`p`,{className:`text-sm text-slate-300`,children:e.content}),(0,L.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-slate-500`,children:[e.importance!=null&&(0,L.jsxs)(`span`,{children:[`Importance: `,e.importance.toFixed(2)]}),(0,L.jsx)(`span`,{children:E(e.createdAt)})]})]},e.id))})]}),(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsxs)(C,{children:[`Evolution History (`,U.length,`)`]})}),U.length===0?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No evolution history for this role.`}):(0,L.jsxs)(N,{children:[(0,L.jsx)(O,{children:(0,L.jsxs)(j,{children:[(0,L.jsx)(k,{children:`When`}),(0,L.jsx)(k,{children:`Source`}),(0,L.jsx)(k,{children:`Score Change`}),(0,L.jsx)(k,{children:`Summary`})]})}),(0,L.jsx)(A,{children:U.slice(0,10).map(e=>(0,L.jsxs)(j,{children:[(0,L.jsx)(M,{className:`text-xs text-slate-500`,children:T(e.createdAt)}),(0,L.jsx)(M,{children:(0,L.jsx)(y,{variant:`secondary`,children:e.source})}),(0,L.jsx)(M,{children:e.previousScore!=null&&e.newScore!=null?(0,L.jsxs)(`span`,{className:`font-mono text-xs`,children:[(e.previousScore*100).toFixed(0),`% → `,(e.newScore*100).toFixed(0),`%`]}):(0,L.jsx)(`span`,{className:`text-slate-500`,children:`—`})}),(0,L.jsx)(M,{className:`text-sm text-slate-400`,children:e.diffSummary??`—`})]},e.id))})]})]}),(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsxs)(C,{children:[`Execution History (`,$.length,`)`]})}),$.length===0?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No tasks executed with this role.`}):(0,L.jsxs)(N,{children:[(0,L.jsx)(O,{children:(0,L.jsxs)(j,{children:[(0,L.jsx)(k,{children:`Task ID`}),(0,L.jsx)(k,{children:`Status`}),(0,L.jsx)(k,{children:`Duration`}),(0,L.jsx)(k,{children:`Cost`})]})}),(0,L.jsx)(A,{children:$.slice(0,20).map(e=>(0,L.jsxs)(j,{children:[(0,L.jsx)(M,{children:(0,L.jsx)(o,{to:`/tasks/${e.id}`,className:`font-mono text-xs text-blue-400 hover:text-blue-300`,children:e.id.slice(0,8)})}),(0,L.jsx)(M,{children:(0,L.jsx)(y,{variant:e.status===`completed`?`success`:e.status===`failed`?`destructive`:`secondary`,children:e.status})}),(0,L.jsx)(M,{className:`text-xs text-slate-500`,children:e.totalDurationMs==null?`—`:`${(e.totalDurationMs/1e3).toFixed(1)}s`}),(0,L.jsx)(M,{className:`text-xs text-slate-500`,children:e.costUsd==null?`—`:D(e.costUsd)})]},e.id))})]})]})]}):(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(o,{to:`/roles`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,L.jsx)(t,{size:14}),` Back to Roles`]}),(0,L.jsx)(w,{className:`text-center text-slate-500`,children:`Loading...`})]})}function z({role:e,onSave:t}){let[n,r]=(0,F.useState)(new Set(e?.allowedTools??[])),[i,a]=(0,F.useState)(null);(0,F.useEffect)(()=>{r(new Set(e?.allowedTools??[]))},[e?.id]);let o=async o=>{if(!e||i)return;let s=new Set(n),l=new Set(n);l.has(o)?l.delete(o):l.add(o),r(l),a(o);try{await c(`/roles/${e.id}`,{method:`PATCH`,body:JSON.stringify({allowedTools:Array.from(l)})}),t()}catch(e){r(s),x.error(e instanceof Error?e.message:`Failed to save`)}finally{a(null)}};return(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsx)(C,{children:`Tool Permissions`})}),(0,L.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5`,children:I.map(e=>(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-300 hover:border-slate-600`,children:[(0,L.jsx)(P,{checked:n.has(e),onCheckedChange:()=>void o(e),disabled:i!==null,"aria-label":`Toggle ${e}`}),e]},e))})]})}function B({boundPlugins:e,allPlugins:t,workspacePath:n,onRefresh:i}){let[a,o]=(0,F.useState)(null),[s,l]=(0,F.useState)(!1),[u,d]=(0,F.useState)([]),f=(0,F.useCallback)(async()=>{try{let t=await c(`/plugins`),n=new Set(e.map(e=>e.pluginId));d(t.plugins.filter(e=>e.scope===`user`&&!n.has(e.id)).map(e=>({id:e.id,name:e.id.split(`@`)[0],version:e.version})))}catch{}},[e]),m=async e=>{o(e);try{await c(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:`project`,cwd:n})}),x.success(`Installed ${e.split(`@`)[0]} for this role`),l(!1),i()}catch(e){x.error(e instanceof Error?e.message:`Install failed`)}finally{o(null)}},h=async e=>{o(e);try{await c(`/plugins/uninstall/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:`project`,cwd:n})}),x.success(`Uninstalled ${e.split(`@`)[0]} from this role`),i()}catch(e){x.error(e instanceof Error?e.message:`Uninstall failed`)}finally{o(null)}};return(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsx)(C,{children:`Role Plugins`}),(0,L.jsx)(p,{variant:`ghost`,size:`sm`,onClick:()=>{l(!s),s||f()},children:(0,L.jsx)(r,{size:14})})]})}),s&&(0,L.jsxs)(`div`,{className:`mb-3 rounded border border-slate-700 bg-slate-900 p-3`,children:[(0,L.jsx)(`p`,{className:`mb-2 text-xs font-semibold text-slate-300`,children:`Install plugin for this Role (project-scope)`}),u.length===0&&a?(0,L.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Loading...`}):u.length===0?(0,L.jsx)(`p`,{className:`text-xs text-slate-500`,children:`No user-scope plugins available to install. Install plugins globally first.`}):(0,L.jsx)(`div`,{className:`space-y-1 max-h-48 overflow-y-auto`,children:u.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between rounded px-2 py-1 hover:bg-slate-800`,children:[(0,L.jsxs)(`span`,{className:`text-xs text-slate-300`,children:[e.name,` `,(0,L.jsxs)(`span`,{className:`text-slate-500`,children:[`v`,e.version]})]}),(0,L.jsx)(p,{size:`sm`,className:`h-5 px-2 text-[10px]`,disabled:a===e.id,onClick:()=>void m(e.id),children:`Install`})]},e.id))})]}),e.length===0?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No project-scope plugins installed for this role.`}):(0,L.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let n=t.find(t=>t.id===e.pluginId);return(0,L.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-slate-800 px-3 py-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-slate-200`,children:n?.name??e.pluginId.split(`@`)[0]}),n?.hasMcp&&(0,L.jsx)(y,{variant:`outline`,className:`text-xs`,children:`MCP`})]}),(0,L.jsx)(`p`,{className:`font-mono text-xs text-slate-500`,children:e.path})]}),(0,L.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs text-red-400`,disabled:a===e.pluginId,onClick:()=>void h(e.pluginId),children:`Uninstall`})]},e.pluginId)})})]})}function ee({role:e,onSave:t}){let{id:n}=a(),[i,o]=(0,F.useState)(!1),[s,l]=(0,F.useState)(()=>(e?.additionalDirectories??[]).map(e=>typeof e==`string`?{path:e}:e)),[u,d]=(0,F.useState)(``),[f,m]=(0,F.useState)(!1),[h,g]=(0,F.useState)(null),[_,v]=(0,F.useState)({}),[y,b]=(0,F.useState)([]),[T,E]=(0,F.useState)(-1),[D,O]=(0,F.useState)(!1),k=(0,F.useRef)(null),A=(0,F.useRef)(null);(0,F.useEffect)(()=>{l((e?.additionalDirectories??[]).map(e=>typeof e==`string`?{path:e}:e))},[e?.id]);let j=(0,F.useCallback)(async e=>{if(!e||!e.startsWith(`/`)){b([]),O(!1);return}O(!0);try{b((await c(`/fs/suggest-dirs?prefix=${encodeURIComponent(e)}`)).suggestions??[]),E(-1)}catch{b([])}finally{O(!1)}},[]),M=e=>{if(d(e),E(-1),k.current&&clearTimeout(k.current),!e||!e.startsWith(`/`)){b([]),O(!1);return}O(!0),k.current=setTimeout(()=>{j(e)},300)},N=e=>{d(e.endsWith(`/`)?e.slice(0,-1):e),b([]),E(-1),j(e.endsWith(`/`)?e:e+`/`)},I=()=>{let e=u.trim();if(e){if(!e.startsWith(`/`)){x.error(`Path must be absolute (must start with /)`);return}if(s.some(t=>t.path===e)){x.error(`Directory already in list`);return}l(t=>[...t,{path:e}]),d(``),b([]),m(!1)}},R=e=>{l(t=>t.filter(t=>t.path!==e)),v(t=>{let n={...t};return delete n[e],n})},z=(e,t)=>{l(n=>n.map(n=>n.path===e?{...n,[t]:!n[t]}:n))},B=async e=>{if(n){g(e);try{let t=await c(`/roles/${n}/scan-directory`,{method:`POST`,body:JSON.stringify({path:e})});v(n=>({...n,[e]:t}))}catch(e){x.error(e instanceof Error?e.message:`Failed to scan directory`)}finally{g(null)}}},ee=async()=>{if(e){o(!0);try{await c(`/roles/${e.id}`,{method:`PATCH`,body:JSON.stringify({additionalDirectories:s})}),x.success(`Additional directories saved`),t()}catch(e){x.error(e instanceof Error?e.message:`Failed to save`)}finally{o(!1)}}},te=()=>{m(!1),d(``),b([]),E(-1)},ne=JSON.stringify(s)!==JSON.stringify(e?.additionalDirectories??[]);return(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsx)(C,{children:`Additional Directories`}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsxs)(p,{variant:`ghost`,className:`scale-75`,onClick:()=>{m(!f),b([]),E(-1)},children:[(0,L.jsx)(r,{size:14}),` Add Directory`]}),ne&&(0,L.jsx)(p,{className:`scale-75`,onClick:()=>void ee(),disabled:i,children:i?`Saving...`:`Save`})]})]})}),f&&(0,L.jsxs)(`div`,{className:`relative mb-3 flex gap-2`,children:[(0,L.jsxs)(`div`,{className:`relative flex-1`,children:[(0,L.jsx)(`input`,{ref:A,className:`w-full rounded border border-slate-700 bg-slate-900 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:u,onChange:e=>M(e.target.value),placeholder:`/absolute/path/to/directory`,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),E(e=>Math.min(y.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),E(e=>Math.max(0,e-1))):e.key===`Tab`&&T>=0?(e.preventDefault(),N(y[T])):e.key===`Enter`?T>=0?N(y[T]):I():e.key===`Escape`&&(b([]),E(-1))},autoFocus:!0}),y.length>0&&(0,L.jsx)(`div`,{className:`absolute z-10 mt-1 w-full rounded-md border border-slate-700 bg-slate-800 py-1 shadow-lg`,children:y.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>N(e),onMouseEnter:()=>E(t),className:`w-full px-3 py-1.5 text-left text-sm ${t===T?`bg-blue-600 text-white`:`text-slate-300 hover:bg-slate-700`}`,children:[e,`/`]},e))}),D&&y.length===0&&u&&(0,L.jsx)(`div`,{className:`absolute z-10 mt-1 w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-500 shadow-lg`,children:`Loading...`})]}),(0,L.jsx)(p,{className:`scale-75`,onClick:()=>void I(),children:`Add`}),(0,L.jsx)(p,{variant:`ghost`,className:`scale-75`,onClick:te,children:`Cancel`})]}),s.length===0?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No additional directories configured.`}):(0,L.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let t=_[e.path],n=h===e.path;return(0,L.jsxs)(`div`,{className:`rounded-md border border-slate-700 p-3 space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`font-mono text-xs text-slate-200 truncate`,title:e.path,children:e.path}),(0,L.jsx)(`button`,{onClick:()=>R(e.path),className:`flex-shrink-0 cursor-pointer text-slate-400 hover:text-red-400 ml-2`,"aria-label":`Remove ${e.path}`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,L.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer`,children:[(0,L.jsx)(P,{checked:!!e.inheritPlugins,onCheckedChange:()=>z(e.path,`inheritPlugins`),className:`scale-75`}),`Plugins`]}),(0,L.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer`,children:[(0,L.jsx)(P,{checked:!!e.inheritMcp,onCheckedChange:()=>z(e.path,`inheritMcp`),className:`scale-75`}),`MCP`]}),(0,L.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer`,children:[(0,L.jsx)(P,{checked:!!e.inheritPermissions,onCheckedChange:()=>z(e.path,`inheritPermissions`),className:`scale-75`}),`Permissions`]}),(0,L.jsx)(`button`,{className:`text-xs text-blue-400 hover:text-blue-300 ml-auto disabled:opacity-50`,onClick:()=>void B(e.path),disabled:n,children:n?`Scanning...`:`Scan`})]}),t&&(0,L.jsxs)(`div`,{className:`rounded bg-slate-900 p-2 space-y-1`,children:[Object.keys(t.enabledPlugins).length>0&&(0,L.jsxs)(`div`,{className:`text-xs text-slate-400`,children:[(0,L.jsx)(`span`,{className:`text-slate-500`,children:`Plugins: `}),Object.entries(t.enabledPlugins).filter(([,e])=>e).map(([e])=>e).join(`, `)||`none enabled`]}),Object.keys(t.mcpServers).length>0&&(0,L.jsxs)(`div`,{className:`text-xs text-slate-400`,children:[(0,L.jsx)(`span`,{className:`text-slate-500`,children:`MCP: `}),Object.keys(t.mcpServers).join(`, `)]}),t.allowedTools.length>0&&(0,L.jsxs)(`div`,{className:`text-xs text-slate-400`,children:[(0,L.jsx)(`span`,{className:`text-slate-500`,children:`Tools: `}),t.allowedTools.join(`, `)]})]})]},e.path)})})]})}function te({role:e,onSave:t}){let[n,r]=(0,F.useState)(!1),[i,a]=(0,F.useState)(e?.allowedChannels??[]),[o,s]=(0,F.useState)(e?.allowedChannels===void 0?`unrestricted`:e.allowedChannels.length===0?`block-all`:`whitelist`),[l,u]=(0,F.useState)([]),[d,f]=(0,F.useState)(!1);(0,F.useEffect)(()=>{a(e?.allowedChannels??[]),s(e?.allowedChannels===void 0?`unrestricted`:e.allowedChannels.length===0?`block-all`:`whitelist`)},[e?.id]);let m=(0,F.useCallback)(async()=>{f(!0);try{u((await c(`/channels?enabled=true`)).channels??[])}catch{u([])}finally{f(!1)}},[]),h=async n=>{if(e){r(!0);try{let r=n===`unrestricted`?{allowedChannels:null}:{allowedChannels:[]};await c(`/roles/${e.id}`,{method:`PATCH`,body:JSON.stringify(r)}),s(n),a([]),t()}catch(e){x.error(e instanceof Error?e.message:`Failed to save`)}finally{r(!1)}}},g=async()=>{if(e){r(!0);try{await c(`/roles/${e.id}`,{method:`PATCH`,body:JSON.stringify({allowedChannels:i})}),t()}catch(e){x.error(e instanceof Error?e.message:`Failed to save`)}finally{r(!1)}}},_=e=>{o!==`whitelist`&&(s(`whitelist`),m()),a(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},v=e?.allowedChannels??[],b=o===`whitelist`&&(i.length!==v.length||i.some(e=>!v.includes(e)));return(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsx)(C,{children:`Allowed Channels`}),(0,L.jsxs)(`div`,{className:`flex gap-1`,children:[(0,L.jsx)(p,{variant:o===`unrestricted`?`default`:`ghost`,className:`scale-75`,disabled:n,onClick:()=>{o!==`unrestricted`&&h(`unrestricted`)},children:`Unrestricted`}),(0,L.jsx)(p,{variant:o===`block-all`?`default`:`ghost`,className:`scale-75`,disabled:n,onClick:()=>{o!==`block-all`&&h(`block-all`)},children:`Block All`}),(0,L.jsx)(p,{variant:o===`whitelist`?`default`:`ghost`,className:`scale-75`,disabled:n,onClick:()=>{o!==`whitelist`&&(s(`whitelist`),m())},children:`Whitelist`})]})]})}),o===`unrestricted`?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`This role can use all channels.`}):o===`block-all`?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`This role is blocked from using any channel.`}):(0,L.jsxs)(L.Fragment,{children:[d?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`Loading channels...`}):l.length===0?(0,L.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No enabled channels found.`}):(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:l.map(e=>(0,L.jsx)(y,{variant:i.includes(e.name)?`default`:`outline`,className:`cursor-pointer px-3 py-1.5 text-xs`,onClick:()=>_(e.name),children:e.name},e.id))}),b&&(0,L.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,L.jsx)(p,{className:`scale-75`,onClick:()=>void g(),disabled:n,children:n?`Saving...`:`Save`})})]})]})}function ne({role:e,onSave:t}){let[n,r]=(0,F.useState)(!1),i=e?.inheritUserSettings??!1,a=async()=>{if(e){r(!0);try{await c(`/roles/${e.id}`,{method:`PATCH`,body:JSON.stringify({inheritUserSettings:!i})}),t()}catch(e){x.error(e instanceof Error?e.message:`Failed to update`)}finally{r(!1)}}};return(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsx)(C,{children:`Inherit User Settings`}),(0,L.jsx)(P,{checked:i,onCheckedChange:()=>void a(),disabled:n})]})}),(0,L.jsx)(`p`,{className:`text-sm text-slate-400`,children:`When enabled, this role has access to all globally installed plugins and MCP servers.`}),i&&(0,L.jsx)(`p`,{className:`mt-2 text-xs text-amber-400`,children:`Warning: This role will inherit user-level settings. Ensure the role is trusted.`})]})}function re({role:e,onSave:t}){let[n,r]=(0,F.useState)(!1),[i,a]=(0,F.useState)(e?.executionMode??`inline`),[o,s]=(0,F.useState)(e?.model??``),[l,u]=(0,F.useState)(e?.maxBudgetUsd??``);(0,F.useEffect)(()=>{a(e?.executionMode??`inline`),s(e?.model??``),u(e?.maxBudgetUsd??``)},[e?.id]);let d=async()=>{if(e){r(!0);try{let n={};i&&(n.executionMode=i),o!==void 0&&(n.model=o),l!==``&&(n.maxBudgetUsd=Number(l)),await c(`/roles/${e.id}`,{method:`PATCH`,body:JSON.stringify(n)}),x.success(`Execution config saved`),t()}catch(e){x.error(e instanceof Error?e.message:`Failed to save`)}finally{r(!1)}}},f=i!==(e?.executionMode??`inline`)||o!==(e?.model??``)||String(l)!==String(e?.maxBudgetUsd??``);return(0,L.jsxs)(w,{children:[(0,L.jsx)(S,{children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsx)(C,{children:`Execution Config`}),f&&(0,L.jsx)(p,{className:`scale-75`,onClick:()=>void d(),disabled:n,children:n?`Saving...`:`Save`})]})}),(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,L.jsx)(`label`,{className:`w-28 text-sm text-slate-400`,children:`Mode`}),(0,L.jsxs)(`select`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:i,onChange:e=>a(e.target.value),children:[(0,L.jsx)(`option`,{value:`inline`,children:`inline`}),(0,L.jsx)(`option`,{value:`isolated`,children:`isolated`})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,L.jsx)(`label`,{className:`w-28 text-sm text-slate-400`,children:`Model`}),(0,L.jsx)(`input`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:o,onChange:e=>s(e.target.value),placeholder:`sonnet, opus, haiku, or blank to inherit`})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,L.jsx)(`label`,{className:`w-28 text-sm text-slate-400`,children:`Max Budget (USD)`}),(0,L.jsx)(`input`,{type:`number`,className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:l,onChange:e=>u(e.target.value===``?``:Number(e.target.value)),placeholder:`0 = unlimited`,min:0,step:.1})]})]})]})}export{R as RoleDetail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{X as t,g as n,p as r,t as i}from"./vendor-icons-DqHipOFA.js";import{r as a,t as o}from"./vendor-react-C2hDj0vl.js";import{C as s,f as c,t as l,w as u}from"./index-CWY8H-cU.js";import{t as d}from"./Card-BpwkRtmi.js";import{a as f}from"./format-DvtQjPZn.js";import{t as p}from"./EmptyState-B08f3BH6.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./Table-DWR4p9xA.js";var b=e(t(),1),x=o();function S(){let e=s(e=>e.roles),t=s(e=>e.fetchRoles),o=s(e=>e.createRole),[S,C]=(0,b.useState)(!1),[w,T]=(0,b.useState)(!1),[E,D]=(0,b.useState)(``),[O,k]=(0,b.useState)(``),[A,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(null),P=(0,b.useCallback)(async()=>{C(!0),await t(),C(!1)},[t]),F=()=>{D(``),k(``),N(null),j(!1)},I=async()=>{let e=E.trim();if(!e){N(`Name is required.`);return}j(!0),N(null);try{await o({name:e,cagPrompt:O.trim()}),await t(),T(!1),F(),u.success(`Role created`)}catch(e){N(e instanceof Error?e.message:`Failed to create role`)}finally{j(!1)}};(0,b.useEffect)(()=>{P()},[P]);let L=e=>e===`active`?`success`:e===`inactive`?`secondary`:e===`retired`?`destructive`:e===`probation`?`warning`:`secondary`;return(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Roles`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>void P(),disabled:S,children:(0,x.jsx)(r,{size:14,className:S?`animate-spin`:``})}),(0,x.jsx)(c,{size:`sm`,onClick:()=>T(!0),children:(0,x.jsx)(n,{size:14})})]})]}),e.length===0&&!S?(0,x.jsx)(d,{children:(0,x.jsx)(p,{title:`No roles yet`,description:`Create a role to define agent behavior and bind plugins.`})}):(0,x.jsx)(d,{padding:!1,children:(0,x.jsxs)(y,{children:[(0,x.jsx)(m,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(h,{children:`Name`}),(0,x.jsx)(h,{children:`Status`}),(0,x.jsx)(h,{children:`Score`}),(0,x.jsx)(h,{children:`Memories`}),(0,x.jsx)(h,{children:`Created`})]})}),(0,x.jsx)(g,{children:e.map(e=>(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{children:(0,x.jsx)(a,{to:`/roles/${e.id}`,className:`font-medium text-blue-400 hover:text-blue-300`,children:e.name})}),(0,x.jsx)(v,{children:(0,x.jsx)(l,{variant:L(e.status),children:e.status})}),(0,x.jsx)(v,{children:e.performanceScore==null?(0,x.jsx)(`span`,{className:`text-slate-500`,children:`—`}):(0,x.jsxs)(`span`,{className:`font-mono text-xs text-slate-300`,children:[(e.performanceScore*100).toFixed(0),`%`]})}),(0,x.jsx)(v,{children:(0,x.jsx)(`span`,{className:`text-sm text-slate-400`,children:e.memoryStreamId?e.memoryStreamId.slice(0,8):`—`})}),(0,x.jsx)(v,{className:`text-xs text-slate-500`,children:f(e.createdAt)})]},e.id))})]})}),w&&(0,x.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,onClick:e=>{e.target===e.currentTarget&&(T(!1),F())},children:(0,x.jsxs)(`div`,{className:`w-full max-w-md rounded-lg border border-slate-700 bg-slate-900 p-6 shadow-lg`,children:[(0,x.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,x.jsx)(`h2`,{className:`text-lg font-semibold text-slate-100`,children:`Create Role`}),(0,x.jsx)(`button`,{className:`text-slate-400 hover:text-slate-200`,onClick:()=>{T(!1),F()},children:(0,x.jsx)(i,{size:16})})]}),(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`label`,{className:`mb-1 block text-sm font-medium text-slate-300`,htmlFor:`role-name`,children:[`Name `,(0,x.jsx)(`span`,{className:`text-red-400`,children:`*`})]}),(0,x.jsx)(`input`,{id:`role-name`,className:`w-full rounded border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`e.g. Engineer, Reviewer`,value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I()},autoFocus:!0})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-slate-300`,htmlFor:`role-cag-prompt`,children:`CAG Prompt`}),(0,x.jsx)(`textarea`,{id:`role-cag-prompt`,className:`w-full rounded border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Character and Guidance prompt for this role...`,rows:5,value:O,onChange:e=>k(e.target.value)})]}),M&&(0,x.jsx)(`p`,{className:`text-sm text-red-400`,children:M}),(0,x.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,x.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>{T(!1),F()},children:`Cancel`}),(0,x.jsx)(c,{size:`sm`,onClick:()=>void I(),disabled:A,children:A?`Creating...`:`Create`})]})]})]})})]})}export{S as Roles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{T as t,X as n,c as r,d as i,p as a}from"./vendor-icons-DqHipOFA.js";import{t as o}from"./vendor-react-C2hDj0vl.js";import{r as s}from"./dist-jv3vbjrx.js";import{C as c,f as l}from"./index-CWY8H-cU.js";import{t as u}from"./Card-BpwkRtmi.js";import{i as d}from"./format-DvtQjPZn.js";import{t as f}from"./EmptyState-B08f3BH6.js";var p=e(n(),1),m=o(),h={defaults:{label:`Defaults`,paths:[`defaults.model`,`defaults.effort`,`defaults.maxTurns`,`defaults.maxBudgetUsd`,`defaults.timeout`]},server:{label:`Server`,paths:[`server.port`,`server.host`],mutablePaths:[`server.timezone`]},logging:{label:`Logging`,paths:[`logging.level`]},evolution:{label:`Evolution`,paths:[`roles.evolution.triggerEvery`,`roles.evolution.reflectionThreshold`]},chat:{label:`Chat`,paths:[`chat.sessionTimeoutMinutes`,`chat.maxSessionTurns`,`chat.autoTitle`,`chat.archiveExtractMemory`]}},g={"defaults.model":`Model`,"defaults.effort":`Effort Level`,"defaults.maxTurns":`Max Turns`,"defaults.maxBudgetUsd":`Max Budget (USD)`,"defaults.timeout":`Timeout (seconds)`,"server.port":`Port`,"server.host":`Host`,"server.timezone":`Timezone`,"logging.level":`Log Level`,"roles.evolution.triggerEvery":`Evolution Trigger Every (tasks)`,"roles.evolution.reflectionThreshold":`Reflection Threshold (tokens)`,"chat.sessionTimeoutMinutes":`Session Timeout (minutes)`,"chat.maxSessionTurns":`Max Session Turns`,"chat.autoTitle":`Auto-generate Session Title`,"chat.archiveExtractMemory":`Extract Memory on Archive`},_={"defaults.effort":[`low`,`medium`,`high`,`max`],"logging.level":[`debug`,`info`,`warn`,`error`],"server.timezone":[`system`,`Asia/Shanghai`,`Asia/Tokyo`,`Asia/Singapore`,`America/New_York`,`America/Los_Angeles`,`America/Chicago`,`Europe/London`,`Europe/Berlin`,`Europe/Paris`,`UTC`]};function v(){let[e,n]=(0,p.useState)({}),[o,v]=(0,p.useState)([]),[y,b]=(0,p.useState)({}),[x,S]=(0,p.useState)(new Set),[C,w]=(0,p.useState)(!1),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(!0),k=c(e=>e.configVersion),A=(0,p.useCallback)(async()=>{try{let e=await s(`/config`);n(e.config),v(e.mutable);let t={};for(let[n,r]of Object.entries(e.config))t[n]=String(r.value??``);b(t),S(new Set);let r=e.config[`server.timezone`]?.value;r&&d(r)}catch(e){E({type:`error`,text:e instanceof Error?e.message:`Failed to load config`})}finally{O(!1)}},[]);(0,p.useEffect)(()=>{A()},[A]),(0,p.useEffect)(()=>{k>0&&A()},[k,A]);let j=(e,t)=>{b(n=>({...n,[e]:t})),S(t=>new Set(t).add(e)),E(null)},M=async()=>{if(x.size!==0){w(!0),E(null);try{let t={};for(let n of x){let r=e[n],i=y[n];if(r&&typeof r.value==`number`&&(i=Number(i),isNaN(i))){E({type:`error`,text:`"${g[n]??n}" must be a number`}),w(!1);return}t[n]=i}let n=await s(`/config`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(n.updated.length>0&&(E({type:`success`,text:`Updated ${n.updated.length} setting(s)`}),n.updated.includes(`server.timezone`))){let e=y[`server.timezone`];d(e)}n.errors.length>0&&E({type:`error`,text:n.errors.join(`; `)}),S(new Set),A()}catch(e){E({type:`error`,text:e instanceof Error?e.message:`Save failed`})}finally{w(!1)}}};return D?(0,m.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,m.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-slate-700 border-t-blue-500`})}):Object.keys(e).length===0?(0,m.jsx)(f,{icon:(0,m.jsx)(r,{size:32}),title:`No configuration`,description:`Config API not available`}):(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,m.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Settings`}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>void A(),children:(0,m.jsx)(a,{size:14})}),x.size>0&&(0,m.jsxs)(l,{size:`sm`,onClick:()=>void M(),disabled:C,children:[(0,m.jsx)(i,{size:14}),C?`Saving...`:`Save (${x.size})`]})]})]}),T&&(0,m.jsx)(`div`,{className:`rounded px-3 py-2 text-sm ${T.type===`success`?`bg-green-900/30 text-green-400`:`bg-red-900/30 text-red-400`}`,children:T.text}),Object.entries(h).map(([n,{label:r,paths:i,mutablePaths:a}])=>{let s=[...i,...a??[]];return(0,m.jsxs)(u,{children:[(0,m.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-slate-300`,children:r}),(0,m.jsx)(`div`,{className:`space-y-3`,children:s.map(n=>{let r=e[n];if(!r)return null;let i=o.includes(n),a=g[n]??n,s=y[n]??String(r.value??``),c=x.has(n),l=_[n];return(0,m.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,m.jsxs)(`div`,{className:`w-56 flex items-center gap-1.5`,children:[!i&&(0,m.jsx)(t,{size:12,className:`text-slate-600`}),(0,m.jsx)(`label`,{className:`text-sm text-slate-400`,children:a})]}),(0,m.jsx)(`div`,{className:`flex-1`,children:l?(0,m.jsx)(`select`,{className:`w-full rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none disabled:opacity-50`,value:s,onChange:e=>j(n,e.target.value),disabled:!i,children:l.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))}):(0,m.jsx)(`input`,{className:`w-full rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none disabled:opacity-50`,value:s,onChange:e=>j(n,e.target.value),disabled:!i})}),(0,m.jsxs)(`div`,{className:`w-24 text-right`,children:[!i&&(0,m.jsx)(`span`,{className:`text-[10px] text-slate-600`,children:`restart required`}),c&&i&&(0,m.jsx)(`span`,{className:`text-[10px] text-yellow-500`,children:`modified`})]})]},n)})})]},n)})]})}export{v as Settings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{O as t,X as n,p as r}from"./vendor-icons-DqHipOFA.js";import{t as i}from"./vendor-react-C2hDj0vl.js";import{C as a,f as o,t as s}from"./index-CWY8H-cU.js";import{t as c}from"./Card-BpwkRtmi.js";import{a as l}from"./format-DvtQjPZn.js";import{t as u}from"./EmptyState-B08f3BH6.js";import{a as d,i as f,n as p,o as m,r as h,t as g}from"./Table-DWR4p9xA.js";var _=e(n(),1),v=i(),y={engineer:`info`,analyst:`warning`,content_creator:`success`,reviewer:`muted`};function b(){let e=a(e=>e.strategies),n=a(e=>e.fetchStrategies);(0,_.useEffect)(()=>{n()},[n]);let i=new Map;for(let t of e){let e=i.get(t.roleId)??[];e.push(t),i.set(t.roleId,e)}return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Strategies`}),(0,v.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void n(),children:(0,v.jsx)(r,{size:14})})]}),e.length===0?(0,v.jsx)(u,{icon:(0,v.jsx)(t,{size:32}),title:`No strategies`,description:`Strategies are created by the Thompson Sampling engine as agents process tasks`}):Array.from(i.entries()).map(([e,t])=>(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(s,{variant:y[e]??`muted`,children:e}),(0,v.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[t.length,` strategies`]})]}),(0,v.jsx)(c,{padding:!1,children:(0,v.jsxs)(g,{children:[(0,v.jsx)(d,{children:(0,v.jsxs)(m,{children:[(0,v.jsx)(f,{children:`Name`}),(0,v.jsx)(f,{children:`Task Type`}),(0,v.jsx)(f,{children:`Alpha`}),(0,v.jsx)(f,{children:`Beta`}),(0,v.jsx)(f,{children:`Trials`}),(0,v.jsx)(f,{children:`Avg Reward`}),(0,v.jsx)(f,{children:`Created`})]})}),(0,v.jsx)(p,{children:t.map(e=>(0,v.jsxs)(m,{children:[(0,v.jsx)(h,{className:`font-medium text-slate-200`,children:e.name}),(0,v.jsx)(h,{children:(0,v.jsx)(`span`,{className:`rounded bg-slate-800 px-1.5 py-0.5 font-mono text-[10px] text-slate-400`,children:e.taskType})}),(0,v.jsx)(h,{className:`font-mono text-xs`,children:e.alpha.toFixed(2)}),(0,v.jsx)(h,{className:`font-mono text-xs`,children:e.beta.toFixed(2)}),(0,v.jsx)(h,{className:`font-mono text-xs`,children:e.totalTrials}),(0,v.jsx)(h,{className:`font-mono text-xs`,children:e.avgReward==null?`—`:e.avgReward.toFixed(3)}),(0,v.jsx)(h,{className:`text-xs text-slate-500`,children:l(e.createdAt)})]},e.id))})]})})]},e))]})}export{b as Strategies};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{X as t}from"./vendor-icons-DqHipOFA.js";import{t as n}from"./vendor-react-C2hDj0vl.js";import{n as r}from"./dist-jv3vbjrx.js";import{S as i,_ as a,b as o,h as s,x as c,y as l}from"./index-CWY8H-cU.js";var u=e(t(),1);function d(e){let t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function f(e){let[t,n]=u.useState(void 0);return l(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var p=n(),m=`Switch`,[h,g]=i(m),[_,v]=h(m),y=u.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:l,required:d,disabled:f,value:h=`on`,onCheckedChange:g,form:v,...y}=e,[b,x]=u.useState(null),S=c(t,e=>x(e)),T=u.useRef(!1),E=b?v||!!b.closest(`form`):!0,[D,O]=a({prop:i,defaultProp:l??!1,onChange:g,caller:m});return(0,p.jsxs)(_,{scope:n,checked:D,disabled:f,children:[(0,p.jsx)(s.button,{type:`button`,role:`switch`,"aria-checked":D,"aria-required":d,"data-state":w(D),"data-disabled":f?``:void 0,disabled:f,value:h,...y,ref:S,onClick:o(e.onClick,e=>{O(e=>!e),E&&(T.current=e.isPropagationStopped(),T.current||e.stopPropagation())})}),E&&(0,p.jsx)(C,{control:b,bubbles:!T.current,name:r,value:h,checked:D,required:d,disabled:f,form:v,style:{transform:`translateX(-100%)`}})]})});y.displayName=m;var b=`SwitchThumb`,x=u.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=v(b,n);return(0,p.jsx)(s.span,{"data-state":w(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});x.displayName=b;var S=`SwitchBubbleInput`,C=u.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=u.useRef(null),s=c(o,a),l=d(n),m=f(t);return u.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(l!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[l,n,r]),(0,p.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...m,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});C.displayName=S;function w(e){return e?`checked`:`unchecked`}var T=y,E=x,D=u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(T,{className:r(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-900 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-slate-700`,e),...t,ref:n,children:(0,p.jsx)(E,{className:r(`pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));D.displayName=T.displayName;export{D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{X as t}from"./vendor-icons-DqHipOFA.js";import{t as n}from"./vendor-react-C2hDj0vl.js";import{n as r}from"./dist-jv3vbjrx.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{className:`overflow-x-auto`,children:(0,a.jsx)(`table`,{ref:n,className:r(`w-full text-sm`,e),...t})}));o.displayName=`Table`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`thead`,{ref:n,className:r(`border-b border-slate-800`,e),...t}));s.displayName=`TableHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`tbody`,{ref:n,className:r(`divide-y divide-slate-800/50`,e),...t}));c.displayName=`TableBody`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`tr`,{ref:n,className:r(`transition-colors hover:bg-slate-800/30`,e),...t}));l.displayName=`TableRow`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`th`,{ref:n,className:r(`px-3 py-2.5 text-left text-xs font-medium uppercase tracking-wider text-slate-500`,e),...t}));u.displayName=`TableHead`;var d=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`td`,{ref:n,className:r(`px-3 py-2.5 text-slate-300`,e),...t}));d.displayName=`TableCell`;var f=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`caption`,{ref:n,className:r(`mt-2 text-xs text-slate-500`,e),...t}));f.displayName=`TableCaption`;var p=s,m=c,h=l,g=u,_=d;export{p as a,g as i,m as n,h as o,_ as r,o as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,F as n,J as r,L as i,R as a,X as o,i as s,j as c}from"./vendor-icons-DqHipOFA.js";import{l,r as u,t as d}from"./vendor-react-C2hDj0vl.js";import{r as f}from"./dist-jv3vbjrx.js";import{f as p,n as m,t as h}from"./index-CWY8H-cU.js";import{n as g,r as _,t as v}from"./Card-BpwkRtmi.js";import{a as y,n as b,r as x,t as S}from"./format-DvtQjPZn.js";var C=e(o(),1),w=d(),T={reasoning:`bg-blue-500`,tool_call:`bg-blue-400`,tool_result:`bg-green-500`,approval_request:`bg-yellow-500`,approval_response:`bg-yellow-400`,permission_denied:`bg-orange-500`,error:`bg-red-500`,plugin_error:`bg-red-600`};function E({logs:e}){let[t,n]=(0,C.useState)(new Set);return e.length===0?(0,w.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No execution steps yet.`}):(0,w.jsx)(`div`,{className:`space-y-0`,children:e.map((r,i)=>{let a=i>0?e[i-1].timestamp:null,o=a?r.timestamp-a:null,s=r.type===`plugin_error`,c=t.has(i)?r.content:r.content.length>200?r.content.slice(0,200)+`...`:r.content;return(0,w.jsxs)(`div`,{className:`flex gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,w.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full mt-1.5 flex-shrink-0 ${T[r.type]??`bg-slate-500`} ${s?`ring-2 ring-red-400`:``}`}),i<e.length-1&&(0,w.jsx)(`div`,{className:`w-0.5 flex-1 bg-slate-700 mt-0.5`})]}),(0,w.jsxs)(`div`,{className:`flex-1 pb-4 ${s?`border border-red-500/40 rounded-md bg-red-950/10 p-2`:``}`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,w.jsxs)(`span`,{className:`text-xs font-mono text-slate-500`,children:[`#`,r.index]}),(0,w.jsx)(`span`,{className:`text-sm font-medium text-slate-200`,children:r.toolName??r.type}),s&&(0,w.jsx)(h,{variant:`destructive`,children:`Plugin Error`}),(0,w.jsx)(`span`,{className:`text-xs text-slate-500`,children:y(r.timestamp)}),o!=null&&o>0&&(0,w.jsxs)(`span`,{className:`text-xs text-slate-600`,children:[`+`,o,`ms`]}),r.truncated&&(0,w.jsx)(h,{variant:`outline`,children:`truncated`})]}),c&&(0,w.jsx)(`button`,{className:`mt-1 text-xs text-slate-400 hover:text-slate-300 text-left w-full font-mono`,onClick:()=>{n(e=>{let t=new Set(e);return t.has(i)?t.delete(i):t.add(i),t})},children:c})]})]},r.id)})})}function D(){let{id:e}=l(),[o,d]=(0,C.useState)(null),[y,T]=(0,C.useState)([]),[D,k]=(0,C.useState)([]),[A,j]=(0,C.useState)(null),[M,N]=(0,C.useState)(!1);(0,C.useEffect)(()=>{if(!e)return;let t=async()=>{try{d((await f(`/tasks/${e}`)).task),j(null)}catch(e){j(e instanceof Error?e.message:`Failed to load task`)}};t(),f(`/tasks/${e}/plan`).then(e=>T(e.plans)).catch(()=>T([])),f(`/tasks/${e}/logs?limit=200`).then(e=>k(e.logs)).catch(()=>k([]));let n=setInterval(t,3e3);return()=>clearInterval(n)},[e]);let P=async()=>{if(e){N(!0);try{await f(`/tasks/${e}/cancel`,{method:`POST`}),d(e=>e&&{...e,status:`cancelled`})}finally{N(!1)}}};if(A)return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,w.jsx)(r,{size:14}),` Back to Tasks`]}),(0,w.jsx)(v,{className:`text-center text-red-400`,children:A})]});if(!o)return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,w.jsx)(r,{size:14}),` Back to Tasks`]}),(0,w.jsx)(v,{className:`text-center text-slate-500`,children:`Loading...`})]});let F=[`running`,`queued`,`pending`,`paused`].includes(o.status);return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,w.jsx)(r,{size:14}),` Back to Tasks`]}),F&&(0,w.jsxs)(p,{variant:`destructive`,size:`sm`,onClick:()=>void P(),disabled:M,children:[(0,w.jsx)(a,{size:14}),M?`Cancelling...`:`Cancel Task`]})]}),(0,w.jsx)(v,{children:(0,w.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,w.jsx)(h,{variant:m(o.status),children:o.status}),(0,w.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:o.id})]}),(0,w.jsx)(`p`,{className:`text-sm text-slate-200 whitespace-pre-wrap`,children:o.prompt})]})})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,w.jsx)(O,{icon:i,label:`Created`,value:b(o.createdAt)}),(0,w.jsx)(O,{icon:i,label:`Duration`,value:o.totalDurationMs?x(o.totalDurationMs):o.startedAt?x(Date.now()-o.startedAt):`—`}),(0,w.jsx)(O,{icon:n,label:`Cost`,value:o.costUsd==null?`—`:S(o.costUsd)}),(0,w.jsx)(O,{icon:c,label:`Turns`,value:String(o.numTurns??`—`)})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,w.jsx)(O,{icon:s,label:`Role`,value:o.roleId??`—`,mono:!0}),(0,w.jsx)(O,{icon:t,label:`Parent`,value:o.parentId??`—`,mono:!0}),o.templateId?(0,w.jsxs)(u,{to:`/work`,className:`block`,children:[(0,w.jsx)(O,{icon:t,label:`Template`,value:o.templateId,mono:!0}),(0,w.jsx)(`span`,{className:`mt-0.5 block text-xs text-blue-400 hover:text-blue-300`,children:`View in Automations →`})]}):(0,w.jsx)(O,{icon:t,label:`Template`,value:`—`,mono:!0}),o.sourceSessionId&&(0,w.jsx)(O,{icon:c,label:`Source Session`,value:o.sourceSessionId.slice(0,8),mono:!0})]}),(o.deliverTo||o.reportTo)&&(0,w.jsxs)(v,{children:[(0,w.jsx)(g,{children:(0,w.jsx)(_,{children:`Delivery Targets`})}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[o.deliverTo&&o.deliverTo.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-xs text-slate-500 mb-1`,children:`Output`}),(0,w.jsx)(`div`,{className:`space-y-1`,children:o.deliverTo.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,w.jsx)(h,{variant:`outline`,children:e.type===`channel`?`Channel`:`Session`}),e.type===`channel`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,w.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,w.jsxs)(`span`,{className:`text-xs text-slate-400`,children:[`session `,e.sessionId?.slice(0,8)]})]},`d-${t}`))})]}),o.reportTo&&o.reportTo.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-xs text-slate-500 mb-1`,children:`Status Reports`}),(0,w.jsx)(`div`,{className:`space-y-1`,children:o.reportTo.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,w.jsx)(h,{variant:`outline`,children:e.type===`channel`?`Channel`:`Session`}),e.type===`channel`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,w.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,w.jsxs)(`span`,{className:`text-xs text-slate-400`,children:[`session `,e.sessionId?.slice(0,8)]})]},`r-${t}`))})]})]})]}),o.tokenUsage&&(0,w.jsxs)(v,{children:[(0,w.jsx)(g,{children:(0,w.jsx)(_,{children:`Token Usage`})}),(0,w.jsxs)(`div`,{className:`flex gap-6 text-sm`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-slate-500`,children:`Input:`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-slate-200`,children:o.tokenUsage.input.toLocaleString()})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-slate-500`,children:`Output:`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-slate-200`,children:o.tokenUsage.output.toLocaleString()})]})]})]}),y.length>0&&(()=>{let e=y[0],t=e.plan.overallRisk===`high`?`destructive`:e.plan.overallRisk===`medium`?`warning`:`secondary`;return(0,w.jsxs)(v,{children:[(0,w.jsx)(g,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(_,{children:`Execution Plan`}),(0,w.jsxs)(h,{variant:t,children:[e.plan.overallRisk.toUpperCase(),` RISK`]}),(0,w.jsx)(h,{variant:`outline`,children:e.status})]})}),(0,w.jsxs)(`h4`,{className:`text-sm font-medium text-slate-300 mb-2`,children:[`Plan Steps (`,e.plan.steps.length,`)`]}),(0,w.jsx)(`div`,{className:`space-y-2`,children:e.plan.steps.map(e=>(0,w.jsxs)(`div`,{className:`rounded-md border border-slate-700 bg-slate-800/50 p-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsxs)(`span`,{className:`text-xs font-mono text-slate-500`,children:[`#`,e.index]}),(0,w.jsx)(`span`,{className:`text-sm text-slate-200`,children:e.description})]}),(0,w.jsx)(h,{variant:e.riskLevel===`high`?`destructive`:e.riskLevel===`medium`?`warning`:`secondary`,children:e.riskLevel})]}),(0,w.jsxs)(`div`,{className:`mt-1 text-xs text-slate-400`,children:[`Tools: `,e.toolsNeeded.join(`, `)||`none`]}),e.expectedOutput&&(0,w.jsxs)(`div`,{className:`mt-0.5 text-xs text-slate-500`,children:[`Expected: `,e.expectedOutput]})]},e.index))}),Object.keys(e.plan.requiredPermissions).length>0&&(0,w.jsxs)(`div`,{className:`mt-2`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-slate-300 mb-1`,children:`Required Permissions`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.keys(e.plan.requiredPermissions).map(e=>(0,w.jsx)(h,{variant:`secondary`,children:e},e))})]}),e.deviationReport&&(0,w.jsxs)(`div`,{className:`mt-3 rounded-md border border-amber-900/50 bg-amber-950/20 p-3`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-amber-400 mb-2`,children:`Deviation Report`}),(0,w.jsxs)(`div`,{className:`text-xs text-slate-400 mb-2`,children:[`Planned: `,e.deviationReport.stepsPlanned,` | Executed: `,e.deviationReport.stepsExecuted,` | Accuracy: `,(e.deviationReport.overallAccuracy*100).toFixed(0),`%`]}),e.deviationReport.deviations.length>0&&(0,w.jsx)(`div`,{className:`space-y-1`,children:e.deviationReport.deviations.map((e,t)=>(0,w.jsxs)(`div`,{className:`text-xs`,children:[(0,w.jsxs)(`span`,{className:`text-amber-400 font-mono`,children:[`[`,e.deviationType,`]`]}),(0,w.jsxs)(`span`,{className:`text-slate-400`,children:[` Step `,e.stepIndex,`: `]}),(0,w.jsx)(`span`,{className:`text-slate-300`,children:e.actual})]},t))})]}),e.learnedRules&&e.learnedRules.length>0&&(0,w.jsxs)(`div`,{className:`mt-3`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-slate-300 mb-2`,children:`Learned Rules`}),(0,w.jsx)(`ul`,{className:`space-y-1`,children:e.learnedRules.map((e,t)=>(0,w.jsxs)(`li`,{className:`text-xs text-slate-400 flex items-start gap-1.5`,children:[(0,w.jsx)(`span`,{className:`text-blue-400 mt-0.5`,children:`*`}),e]},t))})]})]})})(),D.length>0&&(0,w.jsxs)(v,{children:[(0,w.jsx)(g,{children:(0,w.jsxs)(_,{children:[`Execution Timeline (`,D.length,` steps)`]})}),(0,w.jsx)(E,{logs:D})]}),o.result&&(0,w.jsxs)(v,{children:[(0,w.jsx)(g,{children:(0,w.jsx)(_,{children:`Result`})}),(0,w.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-slate-800 p-3 font-mono text-xs text-slate-300`,children:o.result})]}),o.error&&(()=>{let e=[`plugin`,`--plugin-dir`,`failed to load plugin`],t=o.error.toLowerCase(),n=e.some(e=>t.includes(e)),r=n?o.error.split(`
|
|
2
|
+
`).find(t=>e.some(e=>t.toLowerCase().includes(e))):null;return(0,w.jsxs)(v,{className:n?`border-red-500`:``,children:[(0,w.jsx)(g,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(_,{children:`Error`}),n&&(0,w.jsx)(h,{variant:`warning`,children:`Plugin Issue`})]})}),n&&r&&(0,w.jsx)(`div`,{className:`mb-2 rounded bg-amber-950/30 px-2 py-1 text-xs text-amber-400`,children:r}),(0,w.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-red-950/30 p-3 font-mono text-xs text-red-400`,children:o.error})]})})()]})}function O({icon:e,label:t,value:n,mono:r}){return(0,w.jsxs)(v,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 text-slate-500`,children:[(0,w.jsx)(e,{size:12}),(0,w.jsx)(`span`,{className:`text-xs`,children:t})]}),(0,w.jsx)(`span`,{className:`text-sm text-slate-200 truncate ${r?`font-mono text-xs`:``}`,children:n})]})}export{D as TaskDetail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{D as t,G as n,P as r,R as i,X as a,a as o,b as s,g as c,p as l,y as u}from"./vendor-icons-DqHipOFA.js";import{r as d,t as f}from"./vendor-react-C2hDj0vl.js";import{n as p,r as m}from"./dist-jv3vbjrx.js";import{C as h,S as g,_,a as v,b as y,c as b,f as x,g as S,h as C,i as w,l as T,m as E,n as D,o as O,p as k,r as ee,s as te,t as ne,u as re,v as ie,w as A,x as j}from"./index-CWY8H-cU.js";import{t as M}from"./Card-BpwkRtmi.js";import{a as ae,o as N,t as P}from"./format-DvtQjPZn.js";import{t as oe}from"./EmptyState-B08f3BH6.js";import{a as se,i as F,n as ce,o as I,r as L,t as le}from"./Table-DWR4p9xA.js";import{Goals as R,t as ue}from"./Goals-BmfVadFN.js";import{t as de}from"./Switch-yk5-dsti.js";var z=e(a(),1),B=f();function V(e){let t=e+`CollectionProvider`,[n,r]=g(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=z.useRef(null),a=z.useRef(new Map).current;return(0,B.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=S(s),l=z.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,B.jsx)(c,{ref:j(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=S(u),p=z.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=z.useRef(null),s=j(t,o),c=a(u,n);return z.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,B.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return z.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var H=z.createContext(void 0);function U(e){let t=z.useContext(H);return e||t||`ltr`}var W=`rovingFocusGroup.onEntryFocus`,fe={bubbles:!1,cancelable:!0},G=`RovingFocusGroup`,[K,q,pe]=V(G),[J,me]=g(G,[pe]),[he,ge]=J(G),Y=z.forwardRef((e,t)=>(0,B.jsx)(K.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(K.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(_e,{...e,ref:t})})}));Y.displayName=G;var _e=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=z.useRef(null),p=j(t,f),m=U(a),[h,g]=_({prop:o,defaultProp:s??null,onChange:c,caller:G}),[v,b]=z.useState(!1),x=E(l),S=q(n),w=z.useRef(!1),[T,D]=z.useState(0);return z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(W,x),()=>e.removeEventListener(W,x)},[x]),(0,B.jsx)(he,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:z.useCallback(e=>g(e),[g]),onItemShiftTab:z.useCallback(()=>b(!0),[]),onFocusableItemAdd:z.useCallback(()=>D(e=>e+1),[]),onFocusableItemRemove:z.useCallback(()=>D(e=>e-1),[]),children:(0,B.jsx)(C.div,{tabIndex:v||T===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:y(e.onMouseDown,()=>{w.current=!0}),onFocus:y(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(W,fe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);xe([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}w.current=!1}),onBlur:y(e.onBlur,()=>b(!1))})})}),X=`RovingFocusGroupItem`,Z=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=ie(),l=a||c,u=ge(X,n),d=u.currentTabStopId===l,f=q(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(K.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(C.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:y(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:y(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:y(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=be(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Se(n,r+1):n.slice(r+1)}setTimeout(()=>xe(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Z.displayName=X;var ve={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ye(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function be(e,t,n){let r=ye(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return ve[r]}function xe(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Se(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ce=Y,we=Z,Q=`Tabs`,[Te,Ee]=g(Q,[me]),De=me(),[Oe,ke]=Te(Q),Ae=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=U(s),[d,f]=_({prop:r,onChange:i,defaultProp:a??``,caller:Q});return(0,B.jsx)(Oe,{scope:n,baseId:ie(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,B.jsx)(C.div,{dir:u,"data-orientation":o,...l,ref:t})})});Ae.displayName=Q;var je=`TabsList`,Me=z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=ke(je,n),o=De(n);return(0,B.jsx)(Ce,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,B.jsx)(C.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Me.displayName=je;var Ne=`TabsTrigger`,Pe=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=ke(Ne,n),s=De(n),c=Le(o.baseId,r),l=Re(o.baseId,r),u=r===o.value;return(0,B.jsx)(we,{asChild:!0,...s,focusable:!i,active:u,children:(0,B.jsx)(C.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:y(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:y(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:y(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Pe.displayName=Ne;var Fe=`TabsContent`,Ie=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=ke(Fe,n),c=Le(s.baseId,r),l=Re(s.baseId,r),u=r===s.value,d=z.useRef(u);return z.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,B.jsx)(k,{present:i||u,children:({present:n})=>(0,B.jsx)(C.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Ie.displayName=Fe;function Le(e,t){return`${e}-trigger-${t}`}function Re(e,t){return`${e}-content-${t}`}var ze=Ae,Be=Me,Ve=Pe,He=Ie,Ue=ze,We=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Be,{ref:n,className:p(`inline-flex h-9 items-center justify-center rounded-lg bg-slate-800/50 p-1 text-slate-400`,e),...t}));We.displayName=Be.displayName;var Ge=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Ve,{ref:n,className:p(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-slate-950 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-slate-900 data-[state=active]:text-slate-100 data-[state=active]:shadow`,e),...t}));Ge.displayName=Ve.displayName;var Ke=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(He,{ref:n,className:p(`mt-2 ring-offset-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2`,e),...t}));Ke.displayName=He.displayName;var qe=[{label:`All`,value:`all`},{label:`Running`,value:`running`},{label:`Pending`,value:`pending`},{label:`Completed`,value:`completed`},{label:`Failed`,value:`failed`},{label:`Cancelled`,value:`cancelled`}],$=new Set([`pending`,`queued`,`running`,`paused`]);function Je(){let e=h(e=>e.tasks),r=h(e=>e.fetchTasks),[a,o]=(0,z.useState)(`all`),[s,u]=(0,z.useState)(!1),[f,p]=(0,z.useState)(``),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(new Set),[b,S]=(0,z.useState)(!1);(0,z.useEffect)(()=>{let e=a===`all`?void 0:a;r(e);let t=setInterval(()=>void r(e),5e3);return()=>clearInterval(t)},[r,a]),(0,z.useEffect)(()=>{y(new Set)},[a]);let C=async()=>{if(f.trim()){_(!0);try{await m(`/tasks`,{method:`POST`,body:JSON.stringify({prompt:f.trim()})}),p(``),u(!1),r(a===`all`?void 0:a)}finally{_(!1)}}},w=e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},T=()=>{let e=O.filter(e=>$.has(e.status)).map(e=>e.id);y(new Set(e))},E=async()=>{if(v.size!==0){S(!0);try{await m(`/tasks/batch-cancel`,{method:`POST`,body:JSON.stringify({taskIds:Array.from(v)})}),y(new Set),r(a===`all`?void 0:a)}finally{S(!1)}}},O=[...e].sort((e,t)=>t.createdAt-e.createdAt),k=Array.from(v).filter(t=>{let n=e.find(e=>e.id===t);return n&&$.has(n.status)});return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Tasks`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[v.size>0&&(0,B.jsxs)(x,{variant:`destructive`,size:`sm`,onClick:()=>void E(),disabled:b||k.length===0,children:[(0,B.jsx)(i,{size:14}),b?`Cancelling...`:`Cancel ${k.length} task${k.length===1?``:`s`}`]}),(0,B.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>void r(a===`all`?void 0:a),children:(0,B.jsx)(l,{size:14})}),(0,B.jsxs)(x,{size:`sm`,onClick:()=>u(!s),children:[(0,B.jsx)(c,{size:14}),`New Task`]})]})]}),s&&(0,B.jsxs)(M,{className:`flex gap-2`,children:[(0,B.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Enter task prompt...`,value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()}}),(0,B.jsx)(x,{onClick:()=>void C(),disabled:g||!f.trim(),children:g?`Creating...`:`Create`}),(0,B.jsx)(x,{variant:`ghost`,onClick:()=>u(!1),children:`Cancel`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`flex gap-1.5`,children:qe.map(e=>(0,B.jsx)(`button`,{onClick:()=>o(e.value),className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${a===e.value?`bg-slate-800 text-slate-100`:`text-slate-500 hover:text-slate-300`}`,children:e.label},e.value))}),O.some(e=>$.has(e.status))&&(0,B.jsx)(`button`,{onClick:T,className:`text-xs text-slate-500 hover:text-slate-300`,children:`Select all cancellable`}),v.size>0&&(0,B.jsxs)(`button`,{onClick:()=>y(new Set),className:`text-xs text-slate-500 hover:text-slate-300`,children:[`Clear selection (`,v.size,`)`]})]}),(0,B.jsx)(M,{padding:!1,children:O.length===0?(0,B.jsx)(oe,{icon:(0,B.jsx)(t,{size:32}),title:`No tasks found`,description:a===`all`?`Create a task to get started`:`No tasks with status "${a}"`}):(0,B.jsxs)(le,{children:[(0,B.jsx)(se,{children:(0,B.jsxs)(I,{children:[(0,B.jsx)(F,{className:`w-8`,children:(0,B.jsx)(`button`,{onClick:()=>{v.size>0&&v.size===O.filter(e=>$.has(e.status)).length?y(new Set):T()},className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${v.size>0&&v.size===O.filter(e=>$.has(e.status)).length?`border-blue-600 bg-blue-600 text-white`:`border-slate-600 bg-transparent hover:border-slate-400`}`,children:v.size>0&&v.size===O.filter(e=>$.has(e.status)).length&&(0,B.jsx)(n,{size:12})})}),(0,B.jsx)(F,{children:`ID`}),(0,B.jsx)(F,{children:`Prompt`}),(0,B.jsx)(F,{children:`Status`}),(0,B.jsx)(F,{children:`Role`}),(0,B.jsx)(F,{children:`Cost`}),(0,B.jsx)(F,{children:`Created`})]})}),(0,B.jsx)(ce,{children:O.map(e=>(0,B.jsxs)(I,{className:v.has(e.id)?`bg-slate-800/50`:``,children:[(0,B.jsx)(L,{children:$.has(e.status)?(0,B.jsx)(`button`,{onClick:()=>w(e.id),className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${v.has(e.id)?`border-blue-600 bg-blue-600 text-white`:`border-slate-600 bg-transparent hover:border-slate-400`}`,children:v.has(e.id)&&(0,B.jsx)(n,{size:12})}):(0,B.jsx)(`span`,{className:`inline-block w-4`})}),(0,B.jsx)(L,{children:(0,B.jsx)(d,{to:`/tasks/${e.id}`,className:`font-mono text-xs text-blue-400 hover:text-blue-300`,children:e.id.slice(0,8)})}),(0,B.jsx)(L,{children:N(e.prompt,80)}),(0,B.jsx)(L,{children:(0,B.jsx)(ne,{variant:D(e.status),children:e.status})}),(0,B.jsx)(L,{children:(0,B.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:e.roleId?e.roleId.slice(0,12):`—`})}),(0,B.jsx)(L,{className:`font-mono text-xs`,children:e.costUsd==null?`—`:P(e.costUsd)}),(0,B.jsx)(L,{className:`text-xs text-slate-500`,children:ae(e.createdAt)})]},e.id))})]})})]})}function Ye(){let e=h(e=>e.templates),t=h(e=>e.fetchTemplates),n=h(e=>e.goals),i=h(e=>e.fetchGoals),[a,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(``),[g,_]=(0,z.useState)(`manual`),[y,S]=(0,z.useState)(``),[C,E]=(0,z.useState)(``),[D,k]=(0,z.useState)(!1),[ie,j]=(0,z.useState)(null),[N,P]=(0,z.useState)(null),[R,V]=(0,z.useState)(null),[H,U]=(0,z.useState)(null),[W,fe]=(0,z.useState)(``),[G,K]=(0,z.useState)(`manual`),[q,pe]=(0,z.useState)(``),[J,me]=(0,z.useState)(``),[he,ge]=(0,z.useState)(!1),[Y,_e]=(0,z.useState)(`prompt`),[X,Z]=(0,z.useState)([]),[ve,ye]=(0,z.useState)([]),[be,xe]=(0,z.useState)([]);(0,z.useEffect)(()=>{t(),i()},[t,i]);let Se=async()=>{if(f.trim()&&!(Y===`prompt`&&!C.trim())&&!(Y===`goal`&&X.length===0)){k(!0);try{let e={name:f.trim(),trigger:{type:g,...g===`cron`&&y?{cron:y}:{}},enabled:!0,...ve.length>0?{deliverTo:ve}:{}};Y===`prompt`?e.steps=[{id:`step-1`,prompt:C.trim()}]:(e.goalIds=X,e.steps=[]),await m(`/task-templates`,{method:`POST`,body:JSON.stringify(e)}),p(``),E(``),S(``),Z([]),ye([]),d(!1),t()}finally{k(!1)}}},Ce=async t=>{let n=e.find(e=>e.id===t);j(t);try{await m(`/task-templates/${t}/run`,{method:`POST`}),A.success(`Triggered: ${n?.name??t}`)}catch(e){let t=e instanceof Error?e.message:`Failed to trigger template`;A.error(`Trigger failed: ${t}`)}finally{j(null)}},we=async n=>{let r=e.find(e=>e.id===n);try{await m(`/task-templates/${n}`,{method:`DELETE`}),A.success(`Deleted: ${r?.name??n}`),t()}catch(e){let t=e instanceof Error?e.message:`Failed to delete template`;A.error(`Delete failed: ${t}`)}},Q=async n=>{let r=e.find(e=>e.id===n);if(!r)return;if(r.trigger.type!==`cron`&&r.trigger.type!==`event`){A.error(`Toggle not applicable for manual triggers`);return}let i=!r.enabled;try{await m(`/task-templates/${n}`,{method:`PATCH`,body:JSON.stringify({enabled:i})}),A.success(`${r.name} ${i?`enabled`:`disabled`}`),t()}catch(e){let t=e instanceof Error?e.message:`Failed to toggle template`;A.error(`Toggle failed: ${t}`)}},Te=e=>{U(e.id),fe(e.name),K(e.trigger.type),pe(e.trigger.cron??``),me(e.steps[0]?.prompt??``),xe(e.deliverTo??e.notifyTargets??[])},Ee=async()=>{if(!(!H||!W.trim()||!J.trim())){ge(!0);try{await m(`/task-templates/${H}`,{method:`PATCH`,body:JSON.stringify({name:W.trim(),trigger:{type:G,...G===`cron`&&q?{cron:q}:{}},steps:[{id:`step-1`,prompt:J.trim()}],enabled:e.find(e=>e.id===H)?.enabled??!0,deliverTo:be.length>0?be:void 0})}),U(null),t(),A.success(`Template updated`)}catch(e){let t=e instanceof Error?e.message:`Failed to update template`;A.error(t)}finally{ge(!1)}}},De=e.find(e=>e.id===N),Oe=e.find(e=>e.id===R);return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Automations`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>void t(),children:(0,B.jsx)(l,{size:14})}),(0,B.jsxs)(x,{size:`sm`,onClick:()=>d(!a),children:[(0,B.jsx)(c,{size:14}),`New Automation`]})]})]}),a&&(0,B.jsxs)(M,{className:`space-y-3`,children:[(0,B.jsx)(`input`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Template name`,value:f,onChange:e=>p(e.target.value)}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsxs)(`select`,{className:`rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:g,onChange:e=>_(e.target.value),children:[(0,B.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,B.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,B.jsx)(`option`,{value:`event`,children:`Event`})]}),g===`cron`&&(0,B.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Cron expression (e.g. */5 * * * *)`,value:y,onChange:e=>S(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`span`,{className:`text-xs text-slate-400`,children:`Action type:`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>_e(`prompt`),className:`rounded px-2 py-1 text-xs ${Y===`prompt`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:text-slate-300`}`,children:`Custom Prompt`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>_e(`goal`),className:`rounded px-2 py-1 text-xs ${Y===`goal`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:text-slate-300`}`,children:`Goal Reference`})]})]}),Y===`prompt`?(0,B.jsx)(`textarea`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Step prompt`,rows:3,value:C,onChange:e=>E(e.target.value)}):(0,B.jsx)(`div`,{className:`space-y-1`,children:n.length===0?(0,B.jsx)(`p`,{className:`text-xs text-slate-500`,children:`No goals available`}):n.map(e=>(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-slate-300 hover:text-slate-100 cursor-pointer`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:X.includes(e.id),onChange:t=>{t.target.checked?Z([...X,e.id]):Z(X.filter(t=>t!==e.id))},className:`rounded border-slate-600 bg-slate-800`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name}),(0,B.jsx)(ne,{variant:`muted`,className:`text-[10px]`,children:e.status})]},e.id))}),(0,B.jsx)(ue,{value:ve,onChange:ye}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(x,{onClick:()=>void Se(),disabled:D||!f.trim()||Y===`prompt`&&!C.trim()||Y===`goal`&&X.length===0,children:D?`Creating...`:`Create`}),(0,B.jsx)(x,{variant:`ghost`,onClick:()=>d(!1),children:`Cancel`})]})]}),H!==null&&(0,B.jsxs)(M,{className:`space-y-3`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-slate-200`,children:`Edit Automation`}),(0,B.jsx)(`input`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Template name`,value:W,onChange:e=>fe(e.target.value)}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsxs)(`select`,{className:`rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:G,onChange:e=>K(e.target.value),children:[(0,B.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,B.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,B.jsx)(`option`,{value:`event`,children:`Event`})]}),G===`cron`&&(0,B.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Cron expression`,value:q,onChange:e=>pe(e.target.value)})]}),(0,B.jsx)(`textarea`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Step prompt`,rows:3,value:J,onChange:e=>me(e.target.value)}),(0,B.jsx)(ue,{value:be,onChange:xe}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(x,{onClick:()=>void Ee(),disabled:he||!W.trim()||!J.trim(),children:he?`Saving...`:`Save`}),(0,B.jsx)(x,{variant:`ghost`,onClick:()=>U(null),children:`Cancel`})]})]}),(0,B.jsx)(M,{padding:!1,children:e.length===0?(0,B.jsx)(oe,{icon:(0,B.jsx)(r,{size:32}),title:`No automations`,description:`Create an automation to run recurring tasks`}):(0,B.jsxs)(le,{children:[(0,B.jsx)(se,{children:(0,B.jsxs)(I,{children:[(0,B.jsx)(F,{children:`Name`}),(0,B.jsx)(F,{children:`Trigger`}),(0,B.jsx)(F,{children:`Schedule`}),(0,B.jsx)(F,{children:`Steps`}),(0,B.jsx)(F,{children:`Enabled`}),(0,B.jsx)(F,{children:`Created`}),(0,B.jsx)(F,{children:`Webhook URL`}),(0,B.jsx)(F,{children:`Actions`})]})}),(0,B.jsx)(ce,{children:e.map(e=>(0,B.jsxs)(I,{children:[(0,B.jsx)(L,{className:`font-medium text-slate-200`,children:e.name}),(0,B.jsx)(L,{children:(0,B.jsx)(ne,{variant:e.trigger.type===`cron`?`info`:e.trigger.type===`event`?`warning`:`muted`,children:e.trigger.type})}),(0,B.jsx)(L,{className:`font-mono text-xs`,children:e.trigger.cron??`—`}),(0,B.jsx)(L,{className:`font-mono text-xs`,children:e.goalIds&&e.goalIds.length>0?`Goals: ${e.goalIds.length}`:e.steps.length}),(0,B.jsx)(L,{children:e.trigger.type!==`cron`&&e.trigger.type!==`event`?(0,B.jsx)(`span`,{className:`text-xs text-slate-500`,children:`—`}):(0,B.jsx)(de,{checked:e.enabled,onCheckedChange:()=>void Q(e.id),"aria-label":`Toggle ${e.name}`})}),(0,B.jsx)(L,{className:`text-xs text-slate-500`,children:e.createdAt?ae(e.createdAt):`—`}),(0,B.jsx)(L,{className:`font-mono text-xs text-slate-400`,children:e.enabled?`POST /webhooks/${e.id}`:`—`}),(0,B.jsx)(L,{children:(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[(0,B.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>Te(e),title:`Edit`,children:(0,B.jsx)(s,{size:12})}),(0,B.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>P(e.id),disabled:ie===e.id,title:`Run now`,children:(0,B.jsx)(u,{size:12})}),(0,B.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>V(e.id),title:`Delete`,children:(0,B.jsx)(o,{size:12,className:`text-red-400`})})]})})]},e.id))})]})}),(0,B.jsx)(ee,{open:N!==null,onOpenChange:e=>{e||P(null)},children:(0,B.jsxs)(O,{children:[(0,B.jsxs)(T,{children:[(0,B.jsx)(re,{children:`Run Template`}),(0,B.jsxs)(te,{children:[`Run “`,De?.name,`” now? This will execute the template immediately.`]})]}),(0,B.jsxs)(b,{children:[(0,B.jsx)(v,{children:`Cancel`}),(0,B.jsx)(w,{onClick:()=>{N&&Ce(N),P(null)},children:`Run Now`})]})]})}),(0,B.jsx)(ee,{open:R!==null,onOpenChange:e=>{e||V(null)},children:(0,B.jsxs)(O,{children:[(0,B.jsxs)(T,{children:[(0,B.jsx)(re,{children:`Delete Template`}),(0,B.jsxs)(te,{children:[`Delete “`,Oe?.name,`”? This action cannot be undone.`]})]}),(0,B.jsxs)(b,{children:[(0,B.jsx)(v,{children:`Cancel`}),(0,B.jsx)(w,{className:`bg-red-600 hover:bg-red-500`,onClick:()=>{R&&we(R),V(null)},children:`Delete`})]})]})})]})}function Xe(){return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Work`}),(0,B.jsxs)(Ue,{defaultValue:`tasks`,children:[(0,B.jsxs)(We,{children:[(0,B.jsx)(Ge,{value:`tasks`,children:`Tasks`}),(0,B.jsx)(Ge,{value:`automations`,children:`Automations`}),(0,B.jsx)(Ge,{value:`goals`,children:`Goals`})]}),(0,B.jsx)(Ke,{value:`tasks`,children:(0,B.jsx)(Je,{})}),(0,B.jsx)(Ke,{value:`automations`,children:(0,B.jsx)(Ye,{})}),(0,B.jsx)(Ke,{value:`goals`,children:(0,B.jsx)(R,{})})]})]})}export{Xe as Work};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(t){var n,r,i=``;if(typeof t==`string`||typeof t==`number`)i+=t;else if(typeof t==`object`)if(Array.isArray(t)){var a=t.length;for(n=0;n<a;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=` `),i+=r)}else for(r in t)t[r]&&(i&&(i+=` `),i+=r);return i}function t(){for(var t,n,r=0,i=``,a=arguments.length;r<a;r++)(t=arguments[r])&&(n=e(t))&&(i&&(i+=` `),i+=n);return i}var n=class extends Error{status;code;constructor(e,t,n){super(n),this.name=`ApiError`,this.status=e,this.code=t}};async function r(e,t){let r=localStorage.getItem(`adam_api_key`),i={...t?.headers,...r?{"x-api-key":r}:{}};t?.body&&(i[`Content-Type`]??=`application/json`);let a=await fetch(e,{...t,headers:i});if(!a.ok){let e=`UNKNOWN_ERROR`,t=a.statusText;try{let n=await a.json();e=n.code??e,t=n.message??t}catch{}throw new n(a.status,e,t)}if(a.status!==204)return a.json()}var i=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},a=(e,t)=>({classGroupId:e,validator:t}),o=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),s=`-`,c=[],l=`arbitrary..`,u=e=>{let t=p(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return f(e);let n=e.split(s);return d(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],a=n[e];return t?a?i(a,t):t:a||c}return n[e]||c}}},d=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=d(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(s):e.slice(t).join(s),c=a.length;for(let e=0;e<c;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},f=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?l+r:void 0})(),p=e=>{let{theme:t,classGroups:n}=e;return m(n,t)},m=(e,t)=>{let n=o();for(let r in e){let i=e[r];h(i,n,r,t)}return n},h=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];g(i,t,n,r)}},g=(e,t,n,r)=>{if(typeof e==`string`){_(e,t,n);return}if(typeof e==`function`){v(e,t,n,r);return}y(e,t,n,r)},_=(e,t,n)=>{let r=e===``?t:b(t,e);r.classGroupId=n},v=(e,t,n,r)=>{if(x(e)){h(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(a(n,e))},y=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];h(o,b(t,a),n,r)}},b=(e,t)=>{let n=e,r=t.split(s),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=o(),n.nextPart.set(t,i)),n=i}return n},x=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,S=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},C=`!`,w=`:`,T=[],E=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),ee=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===w){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(C)?(c=s.slice(0,-1),l=!0):s.startsWith(C)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return E(t,l,c,u)};if(t){let e=t+w,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):E(T,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},D=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},te=e=>({cache:S(e.cacheSize),parseClassName:ee(e),sortModifiers:D(e),...u(e)}),ne=/\s+/,O=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(ne),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+C:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},k=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=A(n))&&(i&&(i+=` `),i+=r);return i},A=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=A(e[r]))&&(n&&(n+=` `),n+=t);return n},j=(e,...t)=>{let n,r,i,a,o=o=>(n=te(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=O(e,n);return i(e,a),a};return a=o,(...e)=>a(k(...e))},M=[],N=e=>{let t=t=>t[e]||M;return t.isThemeGetter=!0,t},P=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,F=/^\((?:(\w[\w-]*):)?(.+)\)$/i,re=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ie=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,L=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,R=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,z=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,B=e=>re.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),H=e=>!!e&&Number.isInteger(Number(e)),ae=e=>e.endsWith(`%`)&&V(e.slice(0,-1)),U=e=>ie.test(e),oe=()=>!0,se=e=>I.test(e)&&!L.test(e),W=()=>!1,ce=e=>R.test(e),G=e=>z.test(e),le=e=>!K(e)&&!Y(e),ue=e=>Z(e,Ce,W),K=e=>P.test(e),q=e=>Z(e,we,se),de=e=>Z(e,Te,V),fe=e=>Z(e,De,oe),pe=e=>Z(e,Ee,W),me=e=>Z(e,$,W),he=e=>Z(e,Se,G),J=e=>Z(e,Oe,ce),Y=e=>F.test(e),X=e=>Q(e,we),ge=e=>Q(e,Ee),_e=e=>Q(e,$),ve=e=>Q(e,Ce),ye=e=>Q(e,Se),be=e=>Q(e,Oe,!0),xe=e=>Q(e,De,!0),Z=(e,t,n)=>{let r=P.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Q=(e,t,n=!1)=>{let r=F.exec(e);return r?r[1]?t(r[1]):n:!1},$=e=>e===`position`||e===`percentage`,Se=e=>e===`image`||e===`url`,Ce=e=>e===`length`||e===`size`||e===`bg-size`,we=e=>e===`length`,Te=e=>e===`number`,Ee=e=>e===`family-name`,De=e=>e===`number`||e===`weight`,Oe=e=>e===`shadow`,ke=j(()=>{let e=N(`color`),t=N(`font`),n=N(`text`),r=N(`font-weight`),i=N(`tracking`),a=N(`leading`),o=N(`breakpoint`),s=N(`container`),c=N(`spacing`),l=N(`radius`),u=N(`shadow`),d=N(`inset-shadow`),f=N(`text-shadow`),p=N(`drop-shadow`),m=N(`blur`),h=N(`perspective`),g=N(`aspect`),_=N(`ease`),v=N(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,K],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,K,c],T=()=>[B,`full`,`auto`,...w()],E=()=>[H,`none`,`subgrid`,Y,K],ee=()=>[`auto`,{span:[`full`,H,Y,K]},H,Y,K],D=()=>[H,`auto`,Y,K],te=()=>[`auto`,`min`,`max`,`fr`,Y,K],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],O=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],k=()=>[`auto`,...w()],A=()=>[B,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],j=()=>[B,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],M=()=>[B,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,Y,K],F=()=>[...b(),_e,me,{position:[Y,K]}],re=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,ve,ue,{size:[Y,K]}],I=()=>[ae,X,q],L=()=>[``,`none`,`full`,l,Y,K],R=()=>[``,V,X,q],z=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],W=()=>[V,ae,_e,me],ce=()=>[``,`none`,m,Y,K],G=()=>[`none`,V,Y,K],Z=()=>[`none`,V,Y,K],Q=()=>[V,Y,K],$=()=>[B,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[U],breakpoint:[U],color:[oe],container:[U],"drop-shadow":[U],ease:[`in`,`out`,`in-out`],font:[le],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[U],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[U],shadow:[U],spacing:[`px`,V],text:[U],"text-shadow":[U],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,B,K,Y,g]}],container:[`container`],columns:[{columns:[V,K,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[H,`auto`,Y,K]}],basis:[{basis:[B,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[V,B,`auto`,`initial`,`none`,K]}],grow:[{grow:[``,V,Y,K]}],shrink:[{shrink:[``,V,Y,K]}],order:[{order:[H,`first`,`last`,`none`,Y,K]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...O(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...O()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...O(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...O(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...O(),`baseline`]}],"place-self":[{"place-self":[`auto`,...O()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:A()}],"inline-size":[{inline:[`auto`,...j()]}],"min-inline-size":[{"min-inline":[`auto`,...j()]}],"max-inline-size":[{"max-inline":[`none`,...j()]}],"block-size":[{block:[`auto`,...M()]}],"min-block-size":[{"min-block":[`auto`,...M()]}],"max-block-size":[{"max-block":[`none`,...M()]}],w:[{w:[s,`screen`,...A()]}],"min-w":[{"min-w":[s,`screen`,`none`,...A()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...A()]}],h:[{h:[`screen`,`lh`,...A()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...A()]}],"max-h":[{"max-h":[`screen`,`lh`,...A()]}],"font-size":[{text:[`base`,n,X,q]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,xe,fe]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,ae,K]}],"font-family":[{font:[ge,pe,t]}],"font-features":[{"font-features":[K]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,K]}],"line-clamp":[{"line-clamp":[V,`none`,Y,de]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,K]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,K]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...z(),`wavy`]}],"text-decoration-thickness":[{decoration:[V,`from-font`,`auto`,Y,q]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[V,`auto`,Y,K]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,K]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,K]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:re()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},H,Y,K],radial:[``,Y,K],conic:[H,Y,K]},ye,he]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...z(),`hidden`,`none`]}],"divide-style":[{divide:[...z(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...z(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[V,Y,K]}],"outline-w":[{outline:[``,V,X,q]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,be,J]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,be,J]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[V,q]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,be,J]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[V,Y,K]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Y,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:re()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,K]}],filter:[{filter:[``,`none`,Y,K]}],blur:[{blur:ce()}],brightness:[{brightness:[V,Y,K]}],contrast:[{contrast:[V,Y,K]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,be,J]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,V,Y,K]}],"hue-rotate":[{"hue-rotate":[V,Y,K]}],invert:[{invert:[``,V,Y,K]}],saturate:[{saturate:[V,Y,K]}],sepia:[{sepia:[``,V,Y,K]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,K]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[V,Y,K]}],"backdrop-contrast":[{"backdrop-contrast":[V,Y,K]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,V,Y,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,Y,K]}],"backdrop-invert":[{"backdrop-invert":[``,V,Y,K]}],"backdrop-opacity":[{"backdrop-opacity":[V,Y,K]}],"backdrop-saturate":[{"backdrop-saturate":[V,Y,K]}],"backdrop-sepia":[{"backdrop-sepia":[``,V,Y,K]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,K]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[V,`initial`,Y,K]}],ease:[{ease:[`linear`,`initial`,_,Y,K]}],delay:[{delay:[V,Y,K]}],animate:[{animate:[`none`,v,Y,K]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,K]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:G()}],"rotate-x":[{"rotate-x":G()}],"rotate-y":[{"rotate-y":G()}],"rotate-z":[{"rotate-z":G()}],scale:[{scale:Z()}],"scale-x":[{"scale-x":Z()}],"scale-y":[{"scale-y":Z()}],"scale-z":[{"scale-z":Z()}],"scale-3d":[`scale-3d`],skew:[{skew:Q()}],"skew-x":[{"skew-x":Q()}],"skew-y":[{"skew-y":Q()}],transform:[{transform:[Y,K,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:$()}],"translate-x":[{"translate-x":$()}],"translate-y":[{"translate-y":$()}],"translate-z":[{"translate-z":$()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,K]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,K]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[V,X,q,de]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Ae(...e){return ke(t(e))}var je=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Me=t,Ne=(e,t)=>n=>{if(t?.variants==null)return Me(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=je(t)||je(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Me(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)};export{t as i,Ae as n,r,Ne as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let t=Math.floor((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}var t;function n(e){t=e===`system`?void 0:e}function r(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,...t?{timeZone:t}:{}})}function i(e){if(e<1e3)return`${e}ms`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}function a(e){return e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function o(e,t){return e.length<=t?e:e.slice(0,t-1)+`…`}export{e as a,n as i,r as n,o,i as r,a as t};
|