adam-agent-server 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -19
- package/dist/App-G2WZKRUH.js +9 -0
- package/dist/adam-tools-Q4BRKX3U.js +1 -0
- package/dist/approval-handler-D3J6NCMM.js +4 -0
- package/dist/bree-engine-SQMSKGAP.js +1 -0
- package/dist/channels-VEUBY2NZ.js +1 -0
- package/dist/channels-WFZAONF3.js +1 -0
- package/dist/{chunk-5GMYXCL3.js → chunk-2EP27EGS.js} +1 -1
- package/dist/chunk-2GXYBWLS.js +10 -0
- package/dist/chunk-2VKE7ONM.js +86 -0
- package/dist/{chunk-HMXDNPFE.js → chunk-5ASEAZCR.js} +1 -1
- package/dist/chunk-5JLMSNIW.js +1 -0
- package/dist/{chunk-MMIO6BCA.js → chunk-742NWPTQ.js} +3 -3
- package/dist/chunk-7SPKRIMZ.js +15 -0
- package/dist/chunk-AXMXXUPO.js +5 -0
- package/dist/{chunk-5AKFAMQL.js → chunk-B6S2AEOD.js} +1 -1
- package/dist/chunk-DT2LX4XI.js +49 -0
- package/dist/{chunk-VURJZLM6.js → chunk-EALDBELJ.js} +6 -3
- package/dist/{chunk-ZN5Q3YET.js → chunk-ETQ7KC73.js} +1 -1
- package/dist/chunk-FDWW245P.js +5 -0
- package/dist/chunk-FUGJMHY4.js +1 -0
- package/dist/chunk-FYDFMYUP.js +1 -0
- package/dist/chunk-HAWA62R2.js +26 -0
- package/dist/chunk-IXF3XBGX.js +5 -0
- package/dist/chunk-JXD6ZPV7.js +2 -0
- package/dist/chunk-KICPHTI2.js +5 -0
- package/dist/chunk-L7426WNY.js +7 -0
- package/dist/{chunk-WGRTN6TX.js → chunk-L7JP7DUO.js} +1 -1
- package/dist/chunk-NICRQZ7T.js +1 -0
- package/dist/{chunk-3HM54J2N.js → chunk-NSJAV7IH.js} +1 -1
- package/dist/{chunk-W6JITSZF.js → chunk-PCSZW2PE.js} +28 -11
- package/dist/{chunk-EJJDJY34.js → chunk-PQ7KPALO.js} +1 -1
- package/dist/{chunk-F2IS5LWD.js → chunk-SFUS33SO.js} +1 -1
- package/dist/chunk-T25NLVMY.js +1 -0
- package/dist/chunk-TN6H2WM2.js +19 -0
- package/dist/chunk-U36NBCR3.js +17 -0
- package/dist/chunk-UOTDT2KY.js +3 -0
- package/dist/chunk-VF6GJGD6.js +6 -0
- package/dist/chunk-WXN3PSVX.js +6 -0
- package/dist/chunk-WZOMGJSY.js +1 -0
- package/dist/{chunk-62PXAOD6.js → chunk-XNWZZYAV.js} +1 -1
- package/dist/cli.js +15 -13
- package/dist/config-WHXCZCI4.js +1 -0
- package/dist/config-Y4QWELO3.js +1 -0
- package/dist/{db-ZDEA7EUY.js → db-PNZ3UJOE.js} +1 -1
- package/dist/delivery-log-VYTYUFCK.js +1 -0
- package/dist/engine-V5MOGOLN.js +1 -0
- package/dist/{evolution-audit-MDA2ZVJW.js → evolution-audit-B7WKMOVR.js} +1 -1
- package/dist/{external-api-T7FFXVHL.js → external-api-XGEOKAWR.js} +1 -1
- package/dist/index.js +41 -63
- package/dist/learner-VMD5NQCD.js +1 -0
- package/dist/memories-EFQ4SFZG.js +1 -0
- package/dist/memory-extractor-GOISDQTO.js +6 -0
- package/dist/memory-service-BKLZIRK6.js +1 -0
- package/dist/monitor-K7CGTLA6.js +1 -0
- package/dist/outbound-gateway-FIPC4BZO.js +1 -0
- package/dist/role-presets-FN2RWUCP.js +1 -0
- package/dist/{roles-CMV5FMIA.js → roles-SG2YAR64.js} +1 -1
- package/dist/runtime-6UTYEONR.js +1 -0
- package/dist/server-bus-GEGVMSCA.js +1 -0
- package/dist/session-manager-45LFTPBA.js +1 -0
- package/dist/{task-templates-AKQB7RRB.js → task-templates-7LSQ6OST.js} +1 -1
- package/dist/token-estimator-HMPVGDCN.js +1 -0
- package/package.json +2 -2
- package/web/dist/assets/{Card-BpwkRtmi.js → Card-BecEmnPW.js} +1 -1
- package/web/dist/assets/{ChannelDetail-050qK78l.js → ChannelDetail-dZfZlLgQ.js} +1 -1
- package/web/dist/assets/{Channels-DA4gN6nU.js → Channels-Cw04c7YJ.js} +1 -1
- package/web/dist/assets/{Chat-LzhfKGQ5.js → Chat-D4PHqHPE.js} +1 -1
- package/web/dist/assets/Dashboard-BFewwmAg.js +1 -0
- package/web/dist/assets/{EmptyState-B08f3BH6.js → EmptyState-DBFJc4PL.js} +1 -1
- package/web/dist/assets/{Evolution-BwsOuVbZ.js → Evolution-DY1OC6Oc.js} +4 -1
- package/web/dist/assets/{GoalDetail-Zo16ZrYD.js → GoalDetail-DZIEpHs2.js} +1 -1
- package/web/dist/assets/Goals-COCCVLnp.js +1 -0
- package/web/dist/assets/{Logs-CYfQ9k_6.js → Logs-DsDeimLt.js} +1 -1
- package/web/dist/assets/Memories-D5IEEI1u.js +1 -0
- package/web/dist/assets/NotFound-Cidygwnn.js +1 -0
- package/web/dist/assets/{Plugins-DHgIfely.js → Plugins-DUwZVjPc.js} +1 -1
- package/web/dist/assets/RoleDetail-B-GKMfMG.js +33 -0
- package/web/dist/assets/{Roles-DGpN5Vm6.js → Roles-JeVjD0Ew.js} +1 -1
- package/web/dist/assets/Settings-CvEyZp5t.js +1 -0
- package/web/dist/assets/{Strategies-DBp2jYdi.js → Strategies-KAmpqrcQ.js} +1 -1
- package/web/dist/assets/{Switch-yk5-dsti.js → Switch-Jpdn6Yux.js} +1 -1
- package/web/dist/assets/{Table-DWR4p9xA.js → Table-tkJ-cuiE.js} +1 -1
- package/web/dist/assets/TaskDetail-C4NpqwNT.js +2 -0
- package/web/dist/assets/Work-DhaxNYnd.js +1 -0
- package/web/dist/assets/dist-HyCSN_hp.js +1 -0
- package/web/dist/assets/index-CfKqiQIe.js +52 -0
- package/web/dist/assets/index-LDFr0VVR.css +2 -0
- package/web/dist/assets/rolldown-runtime-Dw2cE7zH.js +1 -0
- package/web/dist/assets/vendor-icons-ZPvC5PUS.js +1 -0
- package/web/dist/assets/vendor-react--nRVf2Ep.js +12 -0
- package/web/dist/assets/{vendor-state-CRsbPXtF.js → vendor-state-CH64feAE.js} +1 -1
- package/web/dist/index.html +7 -7
- package/dist/App-23CRAK2P.js +0 -9
- package/dist/adam-tools-MKUMZWCR.js +0 -1
- package/dist/approval-handler-SBFVVFGH.js +0 -4
- package/dist/channels-CNLMTKHM.js +0 -1
- package/dist/channels-VNG7U6UQ.js +0 -1
- package/dist/chunk-37OAKNKA.js +0 -15
- package/dist/chunk-3OYRYMJW.js +0 -11
- package/dist/chunk-5BAD3NCT.js +0 -1
- package/dist/chunk-B3CVXD44.js +0 -104
- package/dist/chunk-CV3ROBUM.js +0 -1
- package/dist/chunk-FUBKGVWI.js +0 -8
- package/dist/chunk-J5YZQQTS.js +0 -3
- package/dist/chunk-Q3N5LVPZ.js +0 -5
- package/dist/chunk-QOPUUA7O.js +0 -1
- package/dist/chunk-TGQYM4TH.js +0 -6
- package/dist/chunk-TYR3QUCL.js +0 -23
- package/dist/config-42ZJPZDM.js +0 -1
- package/dist/delivery-log-7DQ36UGP.js +0 -1
- package/dist/engine-7VBPXTGK.js +0 -1
- package/dist/memories-BUNOVQVG.js +0 -1
- package/dist/role-presets-2X3VW75D.js +0 -1
- package/dist/runtime-772O2XKZ.js +0 -1
- package/dist/server-bus-N5LCY73J.js +0 -1
- package/dist/session-manager-KO4CR3W6.js +0 -1
- package/web/dist/assets/Dashboard-Bh32YC_E.js +0 -1
- package/web/dist/assets/Goals-BmfVadFN.js +0 -1
- package/web/dist/assets/Memories-CgSb60RC.js +0 -1
- package/web/dist/assets/RoleDetail-CNJkMSuz.js +0 -1
- package/web/dist/assets/Settings-PjFyeX8n.js +0 -1
- package/web/dist/assets/TaskDetail-DMg-JAbC.js +0 -2
- package/web/dist/assets/Work-BYgMw2qj.js +0 -1
- package/web/dist/assets/dist-jv3vbjrx.js +0 -1
- package/web/dist/assets/index-CWY8H-cU.js +0 -52
- package/web/dist/assets/index-OXMtvYRJ.css +0 -2
- package/web/dist/assets/rolldown-runtime-DF2fYuay.js +0 -1
- package/web/dist/assets/vendor-icons-DqHipOFA.js +0 -1
- package/web/dist/assets/vendor-react-C2hDj0vl.js +0 -11
package/dist/chunk-J5YZQQTS.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{b as v,k as T}from"./chunk-3OYRYMJW.js";import{a as C,b,c as p,d as P,e as _,f as x,g as M}from"./chunk-Q3N5LVPZ.js";import{b as D}from"./chunk-HMXDNPFE.js";import{d as I}from"./chunk-MMIO6BCA.js";import{a as y}from"./chunk-WGRTN6TX.js";import{c as S}from"./chunk-3DAK2XWP.js";function R(i,e,n){switch(e){case"wechat":return E(i);case"telegram":return i;case"slack":return $(i);case"webhook":return JSON.stringify({result:i,taskId:n,timestamp:new Date().toISOString()});default:return E(i)}}function E(i){return i.replace(/^#{1,6}\s+/gm,"").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/_(.+?)_/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,e=>e.replace(/```\w*\n?/g,"").trim()).replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\n{3,}/g,`
|
|
2
|
-
|
|
3
|
-
`).trim()}function $(i){return i.replace(/\*\*(.+?)\*\*/g,"*$1*").replace(/\[([^\]]+)\]\(([^)]+)\)/g,"<$2|$1>")}import{v4 as A}from"uuid";var l=S("admin"),w=new Map,h=new Set,u=null,g=null,d=null,k=class{constructor(){y.on("task_status_change",e=>{(e.newStatus==="completed"||e.newStatus==="failed")&&this.handleTaskStatusChange(e.taskId,e.newStatus).catch(n=>{l.error({taskId:e.taskId,error:n},"Delivery processing failed")})}),y.on("plan_approval_request",e=>{this.handlePlanApprovalRequest(e.taskId,e.planId,e.plan).catch(n=>{l.error({taskId:e.taskId,error:n},"Delivery processing failed (plan_approval)")})}),l.info("DeliveryEngine initialized")}async handlePlanApprovalRequest(e,n,r){let t=v(e),a=this.getSourceChannelForTask(e);if(a){let c=JSON.stringify(r).slice(0,500),{sendApprovalToChannel:f}=await import("./approval-handler-SBFVVFGH.js"),{getChannelManager:m}=await import("./channels-CNLMTKHM.js"),o=m();if(o){await f(a.channelId,a.chatId,n,e,c,o),l.info({taskId:e,planId:n,channelId:a.channelId},"Approval routed to source channel");return}}let s=`Plan approval requested for task ${e}: ${JSON.stringify(r).slice(0,500)}`;await this.matchAndDeliver("plan_approval_request",{templateId:t?.templateId,roleId:t?.roleId,prompt:t?.prompt,taskStatus:"pending"},s,e)}getSourceChannelForTask(e){try{let n=I(e);if(!n)return null;let r=D(n.sessionId);return!r||r.source.type!=="channel"||!r.source.channelId||!r.source.chatId?null:{channelId:r.source.channelId,chatId:r.source.chatId}}catch{return null}}async handleTaskStatusChange(e,n){let r=v(e);if(!r)return;let t={templateId:r.templateId,roleId:r.roleId,prompt:r.prompt,taskStatus:n},a=n==="completed"?"task_complete":"task_error",s=r.result??r.error??"";await this.matchAndDeliver(a,t,s,e)}async matchAndDeliver(e,n,r,t){let a=T(e,n);if(a.length!==0){l.debug({eventType:e,ruleCount:a.length,taskId:t},"Matched delivery rules");for(let s of a){if(!this.checkRateLimit(s)){l.warn({ruleId:s.id,maxPerMinute:s.maxPerMinute},"Delivery rate limit exceeded, skipping");continue}if(s.skipOriginChannel&&s.target.type==="channel"&&t&&this.isOriginChannel(t,s.target))continue;let c={id:A(),ruleId:s.id,taskId:t,status:"pending",target:s.target,content:r,attempts:0,createdAt:Date.now(),expiresAt:Date.now()+C};b(c),await this.attemptDelivery(c,s)}}}async attemptDeliveryPublic(e,n){return this.attemptDelivery(e,n)}async attemptDelivery(e,n){try{let r=!1;e.target.type==="channel"?r=await this.deliverToChannel(e.target,e.content,e.taskId):e.target.type==="webhook"&&(r=await this.deliverToWebhook(e.target,e.content,e.taskId)),r?(P(e.id),l.info({entryId:e.id,ruleId:n.id,targetType:e.target.type},"Delivery successful")):p(e.id,"failed","Delivery returned false")}catch(r){let t=r instanceof Error?r.message:String(r);p(e.id,"failed",t),l.warn({entryId:e.id,error:t},"Delivery attempt failed")}}async deliverToChannel(e,n,r){if(!e.channelId||!e.chatId)return!1;try{let{getChannelManager:t}=await import("./channels-CNLMTKHM.js"),a=t();if(!a)return!1;let{getChannel:s}=await import("./channels-VNG7U6UQ.js"),f=s(e.channelId)?.platform??"unknown",m=R(n,f,r),o=await a.sendMessage(e.channelId,e.chatId,{content:m});return o&&(h.add(o),setTimeout(()=>h.delete(o),300*1e3)),!0}catch(t){return l.error({channelId:e.channelId,error:t},"Channel delivery failed"),!1}}async deliverToWebhook(e,n,r){if(!e.webhookUrl)return!1;try{let t=JSON.stringify({result:n,taskId:r,timestamp:new Date().toISOString()});return(await fetch(e.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:t,signal:AbortSignal.timeout(1e4)})).ok}catch(t){return l.error({url:e.webhookUrl,error:t},"Webhook delivery failed"),!1}}checkRateLimit(e){let n=Date.now(),r=6e4,t=w.get(e.id);t||(t=[],w.set(e.id,t));let a=n-r;for(;t.length>0&&t[0]<a;)t.shift();return t.length>=e.maxPerMinute?!1:(t.push(n),!0)}isOriginChannel(e,n){try{if(n.type!=="channel"||!n.channelId)return!1;let r=I(e);if(!r)return!1;let t=D(r.sessionId);return t?t.source.type==="channel"&&t.source.channelId===n.channelId&&t.source.chatId===n.chatId:!1}catch{return!1}}async retryPending(){let e=_(50),n=x(50),r=[...e,...n];if(r.length!==0){l.debug({count:r.length},"Retrying pending/failed deliveries");for(let t of r){if(t.attempts>=3){p(t.id,"failed","Max retries (3) exceeded");continue}let a={id:t.ruleId,eventType:"*",matchCriteria:{},target:t.target,maxPerMinute:5,skipOriginChannel:!0,enabled:!0,createdAt:0};await this.attemptDelivery(t,a)}}}};function z(i){return h.has(i)}function G(){return d}function H(){d||(d=new k,u=setInterval(()=>{d?.retryPending().catch(i=>{l.error({error:i},"Delivery retry scan failed")})},6e4),g=setInterval(()=>{try{let i=M();i>0&&l.info({cleaned:i},"Expired delivery log entries cleaned up")}catch(i){l.error({error:i},"Delivery cleanup failed")}},36e5),l.info("DeliveryEngine started with retry (60s) and cleanup (1h) timers"))}function K(){u&&(clearInterval(u),u=null),g&&(clearInterval(g),g=null),d=null,w.clear(),h.clear(),l.info("DeliveryEngine stopped")}export{k as a,z as b,G as c,H as d,K as e};
|
package/dist/chunk-Q3N5LVPZ.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{b as r,d as n}from"./chunk-W6JITSZF.js";n();function a(e){return{id:e.id,ruleId:e.rule_id,taskId:e.task_id??void 0,status:e.status,target:JSON.parse(e.target),content:e.content,attempts:e.attempts,error:e.error??void 0,createdAt:e.created_at,deliveredAt:e.delivered_at??void 0,expiresAt:e.expires_at}}var d=1440*60*1e3;function l(e){r().prepare(`
|
|
2
|
-
INSERT INTO delivery_log (id, rule_id, task_id, status, target, content,
|
|
3
|
-
attempts, error, created_at, delivered_at, expires_at)
|
|
4
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
5
|
-
`).run(e.id,e.ruleId,e.taskId??null,e.status,JSON.stringify(e.target),e.content,e.attempts,e.error??null,e.createdAt,e.deliveredAt??null,e.expiresAt)}function u(e,t,i){r().prepare("UPDATE delivery_log SET status = ?, error = ?, attempts = attempts + 1 WHERE id = ?").run(t,i??null,e)}function p(e){r().prepare("UPDATE delivery_log SET status = 'delivered', delivered_at = ?, attempts = attempts + 1 WHERE id = ?").run(Date.now(),e)}function g(e=100){let t=r(),i=Date.now();return t.prepare("SELECT * FROM delivery_log WHERE status = 'pending' AND expires_at > ? ORDER BY created_at ASC LIMIT ?").all(i,e).map(a)}function c(e=100){let t=r(),i=Date.now();return t.prepare("SELECT * FROM delivery_log WHERE status = 'failed' AND expires_at > ? AND attempts < 3 ORDER BY created_at ASC LIMIT ?").all(i,e).map(a)}function v(){let e=r(),t=Date.now();return e.prepare("DELETE FROM delivery_log WHERE expires_at < ? AND status IN ('pending', 'failed')").run(t).changes}function E(e,t=50){return r().prepare("SELECT * FROM delivery_log WHERE rule_id = ? ORDER BY created_at DESC LIMIT ?").all(e,t).map(a)}export{d as a,l as b,u as c,p as d,g as e,c as f,v as g,E as h};
|
package/dist/chunk-QOPUUA7O.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as R,b as A,c as I,d as T,e as j,f as $}from"./chunk-HMXDNPFE.js";import{b as P,c as L}from"./chunk-MMIO6BCA.js";import{a as M}from"./chunk-WGRTN6TX.js";import{a as O}from"./chunk-TYR3QUCL.js";import{c as C}from"./chunk-CV3ROBUM.js";import{c as F}from"./chunk-3DAK2XWP.js";import{v4 as fe}from"uuid";import*as l from"fs";import*as d from"path";import{homedir as Q}from"os";var _=F("embedding"),D=null,U=!1;async function K(){if(U)throw new Error("onnxruntime-node native binding not available. Embedding disabled.");if(!D)try{D=await import("./dist-CDWBOTZS.js")}catch(e){throw U=!0,_.warn({error:e.message},"onnxruntime-node not available"),new Error("onnxruntime-node native binding not available. Embedding disabled.")}return D}var V=d.join(Q(),".adam","models"),W="all-MiniLM-L6-v2",X="model.onnx",Z="tokenizer.json",Y="https://huggingface.co/Xenova/all-MiniLM-L6-v2/resolve/main/onnx/model_quantized.onnx",ee="https://huggingface.co/Xenova/all-MiniLM-L6-v2/resolve/main/tokenizer.json",te=384,k=null,E=null;function N(){let e=d.join(V,W);return l.existsSync(e)||l.mkdirSync(e,{recursive:!0}),e}async function q(e,t){if(l.existsSync(t))return;_.info({file:d.basename(t)},"Downloading model file");let o=await fetch(e);if(!o.ok)throw new Error(`Failed to download ${e}: ${o.status}`);let n=Buffer.from(await o.arrayBuffer());l.writeFileSync(t,n),_.info({file:d.basename(t),sizeMb:(n.length/1024/1024).toFixed(1)},"Model file downloaded")}async function ne(){let e=N(),t=d.join(e,X),o=d.join(e,Z);return await q(Y,t),await q(ee,o),t}function oe(){if(E)return E;let e=d.join(N(),Z);if(!l.existsSync(e))throw new Error("Tokenizer not found. Run generateEmbedding first to download.");return E=JSON.parse(l.readFileSync(e,"utf-8")),E}function se(e,t=128){let n=oe().model.vocab,a=n["[CLS]"]??101,h=n["[SEP]"]??102,c=n["[UNK]"]??100,v=n["[PAD]"]??0,y=e.toLowerCase().replace(/[^\w\s\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff]/g," ").split(/\s+/).filter(Boolean),u=[a];for(let r of y){if(u.length>=t-1)break;if(n[r]!==void 0){u.push(n[r]);continue}let p=!1,s=r,S=!0;for(;s.length>0&&u.length<t-1;){let B=!1;for(let g=s.length;g>0;g--){let x=S?s.slice(0,g):`##${s.slice(0,g)}`;if(n[x]!==void 0){u.push(n[x]),s=s.slice(g),S=!1,B=!0,p=!0;break}}if(!B)if(s.length>=2){let g=s.slice(0,2),x=n[g]??n[`##${g}`]??c;u.push(x),s=s.slice(2),p=!0}else u.push(c),s=""}p||u.push(c)}u.push(h);let w=new BigInt64Array(t),f=new BigInt64Array(t),m=new BigInt64Array(t);for(let r=0;r<t;r++)r<u.length?(w[r]=BigInt(u[r]),f[r]=1n):(w[r]=BigInt(v),f[r]=0n),m[r]=0n;return{inputIds:w,attentionMask:f,tokenTypeIds:m}}async function re(){if(k)return k;let e=await K(),t=await ne();return k=await e.InferenceSession.create(t,{executionProviders:["cpu"]}),k}async function G(e){let t=await K(),o=await re(),{inputIds:n,attentionMask:a,tokenTypeIds:h}=se(e),c=n.length,v={input_ids:new t.Tensor("int64",n,[1,c]),attention_mask:new t.Tensor("int64",a,[1,c]),token_type_ids:new t.Tensor("int64",h,[1,c])},y=await o.run(v),w=(y.last_hidden_state??y[Object.keys(y)[0]]).data,f=te,m=new Float32Array(f),r=0;for(let s=0;s<c;s++)if(a[s]===1n){r++;for(let S=0;S<f;S++)m[S]+=w[s*f+S]}if(r>0)for(let s=0;s<f;s++)m[s]/=r;let p=0;for(let s=0;s<f;s++)p+=m[s]*m[s];if(p=Math.sqrt(p),p>0)for(let s=0;s<f;s++)m[s]/=p;return m}function ve(){let e=d.join(N(),X);return l.existsSync(e)}import{v4 as ie}from"uuid";function ae(e){if(e.length<20)return null;let t=e.trim();return t.length>300?{content:`User request: ${t.slice(0,280)}...`,importance:3,type:"thought"}:{content:`User request: ${t}`,importance:3,type:"thought"}}function ce(e){if(e.length<20)return null;let t=e.trim();return t.length>400?{content:`Assistant response: ${t.slice(0,370)}...`,importance:2,type:"event"}:{content:`Assistant response: ${t}`,importance:2,type:"event"}}function ue(e){let t=P(e,200,0),o=[];for(let n of t){let a=n.role==="user"?ae(n.content):ce(n.content);a&&o.push(a)}return{facts:o}}function le(e){let t=e.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(o=>o.length>2);return[...new Set(t)].slice(0,20)}async function J(e,t){let{facts:o}=ue(e),n=0;for(let a of o){let h=a.content.slice(0,500),c;try{c=await G(h)}catch{}let v=le(h),y={id:ie(),roleId:t,type:a.type,content:h,embedding:c,keywords:v,importance:a.importance,sourceType:"session_archive",createdAt:Date.now(),lastAccessed:Date.now(),retrievedCount:0};O(y),n++}return n}var i=new Map,b;function H(e){return`${e.type}:${e.channelId??""}:${e.chatId??""}`}function de(){i.clear();let e=T("active",1e3);for(let t of e)i.set(t.id,t)}function Ne(e,t){let o=Date.now(),n={id:fe(),status:"active",source:e,createdAt:o,lastActiveAt:o,messageCount:0};return R(n),i.set(n.id,n),M.emit({type:"session_created",session:n}),n}function ze(e){for(let o of i.values())if(H(o.source)===H(e))return o;let t=j(e);return t&&i.set(t.id,t),t}function me(e){let t=i.get(e);return t||A(e)}function pe(e){let t=Date.now();I(e,{status:"archived",archivedAt:t}),C().archiveExtractMemory&&A(e)&&J(e,"role-chat-manager").catch(()=>{}),i.delete(e),M.emit({type:"session_archived",sessionId:e})}function Be(e){I(e,{status:"active",archivedAt:void 0});let t=A(e);return t&&(i.set(t.id,t),M.emit({type:"session_restored",session:t})),t}function Fe(e){L(e),$(e),i.delete(e),M.emit({type:"session_deleted",sessionId:e})}function Pe(e){let t=Date.now();I(e,{lastActiveAt:t});let o=i.get(e);o&&(o.lastActiveAt=t)}function Le(e){let t=me(e);if(t){let o=t.messageCount+1;I(e,{messageCount:o});let n=i.get(e);n&&(n.messageCount=o)}}function Re(e){return T(e)}function ge(){let t=C().sessionTimeoutMinutes*60*1e3,o=Date.now();for(let n of i.values())if(o-n.lastActiveAt>t)try{pe(n.id)}catch{}}function he(e=6e4){z(),b=setInterval(ge,e)}function z(){b&&(clearInterval(b),b=void 0)}function je(){return b}function $e(){de(),he()}function Oe(){z(),i.clear()}function Ue(){z(),i.clear()}export{G as a,ve as b,de as c,Ne as d,ze as e,me as f,pe as g,Be as h,Fe as i,Pe as j,Le as k,Re as l,he as m,z as n,je as o,$e as p,Oe as q,Ue as r};
|
package/dist/chunk-TGQYM4TH.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{b as r,d as a}from"./chunk-W6JITSZF.js";a();function l(e){let n={type:e.trigger_type,cron:e.trigger_cron??void 0,event:e.trigger_event??void 0};return{id:e.id,name:e.name,description:e.description??void 0,trigger:n,steps:JSON.parse(e.steps),rolePreference:e.role_preference??void 0,config:e.config?JSON.parse(e.config):void 0,tags:e.tags?JSON.parse(e.tags):void 0,enabled:e.enabled===1,createdAt:e.created_at,updatedAt:e.updated_at??void 0,sourceSessionId:e.source_session_id??void 0,notifyTargets:e.notify_targets?JSON.parse(e.notify_targets):void 0,deliverTo:e.deliver_to?JSON.parse(e.deliver_to):void 0,goalIds:e.goal_ids?JSON.parse(e.goal_ids):void 0}}function u(e){r().prepare(`
|
|
2
|
-
INSERT INTO task_templates (id, name, description, trigger_type, trigger_cron,
|
|
3
|
-
trigger_event, steps, role_preference, config, tags, enabled, created_at, updated_at,
|
|
4
|
-
source_session_id, notify_targets, deliver_to, goal_ids)
|
|
5
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
6
|
-
`).run(e.id,e.name,e.description??null,e.trigger.type,e.trigger.cron??null,e.trigger.event??null,JSON.stringify(e.steps),e.rolePreference??null,e.config?JSON.stringify(e.config):null,e.tags?JSON.stringify(e.tags):null,e.enabled?1:0,e.createdAt??Date.now(),e.updatedAt??null,e.sourceSessionId??null,e.notifyTargets?JSON.stringify(e.notifyTargets):null,e.deliverTo?JSON.stringify(e.deliverTo):null,e.goalIds?JSON.stringify(e.goalIds):null)}function f(e){let t=r().prepare("SELECT * FROM task_templates WHERE id = ?").get(e);return t?l(t):void 0}function p(e,n){let t=r(),s=[],i=[];"name"in n&&(s.push("name = ?"),i.push(n.name)),"description"in n&&(s.push("description = ?"),i.push(n.description??null)),"trigger"in n&&n.trigger&&(s.push("trigger_type = ?"),i.push(n.trigger.type),s.push("trigger_cron = ?"),i.push(n.trigger.cron??null),s.push("trigger_event = ?"),i.push(n.trigger.event??null)),"steps"in n&&(s.push("steps = ?"),i.push(JSON.stringify(n.steps))),"rolePreference"in n&&(s.push("role_preference = ?"),i.push(n.rolePreference??null)),"config"in n&&(s.push("config = ?"),i.push(n.config?JSON.stringify(n.config):null)),"tags"in n&&(s.push("tags = ?"),i.push(n.tags?JSON.stringify(n.tags):null)),"enabled"in n&&(s.push("enabled = ?"),i.push(n.enabled?1:0)),"sourceSessionId"in n&&(s.push("source_session_id = ?"),i.push(n.sourceSessionId??null)),"notifyTargets"in n&&(s.push("notify_targets = ?"),i.push(n.notifyTargets?JSON.stringify(n.notifyTargets):null)),"deliverTo"in n&&(s.push("deliver_to = ?"),i.push(n.deliverTo?JSON.stringify(n.deliverTo):null)),"goalIds"in n&&(s.push("goal_ids = ?"),i.push(n.goalIds?JSON.stringify(n.goalIds):null)),s.length!==0&&(s.push("updated_at = ?"),i.push(Date.now()),i.push(e),t.prepare(`UPDATE task_templates SET ${s.join(", ")} WHERE id = ?`).run(...i))}function T(e=!1,n=100,t=0){let s=r(),i="SELECT * FROM task_templates",g=[];return e&&(i+=" WHERE enabled = 1"),i+=" ORDER BY created_at ASC LIMIT ? OFFSET ?",g.push(n,t),s.prepare(i).all(...g).map(l)}function c(e){r().prepare("UPDATE task_templates SET enabled = 1, updated_at = ? WHERE id = ?").run(Date.now(),e)}function _(e){r().prepare("UPDATE task_templates SET enabled = 0, updated_at = ? WHERE id = ?").run(Date.now(),e)}function h(e){r().prepare("DELETE FROM task_templates WHERE id = ?").run(e)}export{u as a,f as b,p as c,T as d,c as e,_ as f,h as g};
|
package/dist/chunk-TYR3QUCL.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{f as g,l as E}from"./chunk-62PXAOD6.js";import{b as a,d as f}from"./chunk-W6JITSZF.js";f();E();function l(e){return{id:e.id,roleId:e.role_id,type:e.type,content:e.content,embedding:e.embedding?new Float32Array(e.embedding.buffer,e.embedding.byteOffset,e.embedding.byteLength/4):void 0,keywords:e.keywords?JSON.parse(e.keywords):[],importance:e.importance,sourceType:e.source_type,sourceTaskId:e.source_task_id??void 0,evidence:e.evidence?JSON.parse(e.evidence):void 0,createdAt:e.created_at,lastAccessed:e.last_accessed,retrievedCount:e.retrieved_count}}function y(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}function v(e){a().prepare(`
|
|
2
|
-
INSERT INTO memories (id, role_id, type, content, embedding, keywords,
|
|
3
|
-
importance, source_type, source_task_id, evidence,
|
|
4
|
-
created_at, last_accessed, retrieved_count)
|
|
5
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
6
|
-
`).run(e.id,e.roleId,e.type,e.content,e.embedding?y(e.embedding):null,JSON.stringify(e.keywords),e.importance,e.sourceType,e.sourceTaskId??null,e.evidence?JSON.stringify(e.evidence):null,e.createdAt,e.lastAccessed,e.retrievedCount)}function C(e){let t=a().prepare("SELECT * FROM memories WHERE id = ?").get(e);return t?l(t):void 0}function W(e){a().prepare("UPDATE memories SET retrieved_count = retrieved_count + 1, last_accessed = ? WHERE id = ?").run(Date.now(),e)}function L(e){return a().prepare("SELECT COUNT(*) as count FROM memories WHERE role_id = ?").get(e).count}function A(e,r=100,t=0){return a().prepare("SELECT * FROM memories WHERE role_id = ? ORDER BY created_at DESC LIMIT ? OFFSET ?").all(e,r,t).map(l)}function R(e,r){let t=0,n=0,i=0;for(let o=0;o<e.length;o++)t+=e[o]*r[o],n+=e[o]*e[o],i+=r[o]*r[o];let d=Math.sqrt(n)*Math.sqrt(i);return d===0?0:t/d}function M(e,r,t){let n=a(),i=e?"SELECT * FROM memories WHERE role_id = ? AND embedding IS NOT NULL ORDER BY created_at DESC":"SELECT * FROM memories WHERE embedding IS NOT NULL ORDER BY created_at DESC";return(e?n.prepare(i).all(e):n.prepare(i).all()).map(c=>{let u=new Float32Array(c.embedding.buffer,c.embedding.byteOffset,c.embedding.byteLength/4);return{row:c,score:R(r,u)}}).sort((c,u)=>u.score-c.score).slice(0,t).map(c=>l(c.row))}function S(e,r,t){let n=a();return e?n.prepare(`
|
|
7
|
-
SELECT m.* FROM memories m
|
|
8
|
-
JOIN memories_fts fts ON m.rowid = fts.rowid
|
|
9
|
-
WHERE memories_fts MATCH ? AND m.role_id = ?
|
|
10
|
-
ORDER BY rank
|
|
11
|
-
LIMIT ?
|
|
12
|
-
`).all(r,e,t).map(l):n.prepare(`
|
|
13
|
-
SELECT m.* FROM memories m
|
|
14
|
-
JOIN memories_fts fts ON m.rowid = fts.rowid
|
|
15
|
-
WHERE memories_fts MATCH ?
|
|
16
|
-
ORDER BY rank
|
|
17
|
-
LIMIT ?
|
|
18
|
-
`).all(r,t).map(l)}function D(e){a().prepare("DELETE FROM memories WHERE id = ?").run(e)}var b={recency:.5,relevance:3,importance:2},_=.9;function T(e){let t=(Date.now()-e)/(1e3*60*60*24);return Math.min(1,Math.max(0,Math.pow(_,t)))}function F(e,r,t,n=b){let i=T(e),d=Math.min(1,Math.max(0,r)),o=t/5;return n.recency*i+n.relevance*d+n.importance*o}function H(e){return g(e)?.preferences?.scoringWeights??b}var h={vectorWeight:.6,bm25Weight:.4};function x(e,r=1e4,t=90){let n=a(),i=0,d=Date.now()-t*24*60*60*1e3,o=n.prepare("DELETE FROM memories WHERE role_id = ? AND created_at < ?").run(e,d);i+=o.changes;let c=n.prepare("SELECT COUNT(*) as cnt FROM memories WHERE role_id = ?").get(e);if(c.cnt>r){let u=c.cnt-r;n.prepare(`
|
|
19
|
-
DELETE FROM memories WHERE id IN (
|
|
20
|
-
SELECT id FROM memories WHERE role_id = ?
|
|
21
|
-
ORDER BY created_at ASC LIMIT ?
|
|
22
|
-
)
|
|
23
|
-
`).run(e,u),i+=u}return i}function w(e,r,t,n,i=h){let d=M(e,r,n*2),o=S(e,t,n*2),c=new Map;for(let s=0;s<d.length;s++){let m=d[s];c.set(m.id,{node:m,vectorScore:d.length>1?1-s/(d.length-1):1,bm25Score:0})}for(let s=0;s<o.length;s++){let m=c.get(o[s].id),p=o.length>1?1-s/(o.length-1):1;m?m.bm25Score=p:c.set(o[s].id,{node:o[s],vectorScore:0,bm25Score:p})}return Array.from(c.values()).map(({node:s,vectorScore:m,bm25Score:p})=>({node:s,score:i.vectorWeight*m+i.bm25Weight*p})).sort((s,m)=>m.score-s.score).slice(0,n).map(s=>s.node)}export{v as a,C as b,W as c,L as d,A as e,M as f,S as g,D as h,b as i,T as j,F as k,H as l,h as m,x as n,w as o};
|
package/dist/config-42ZJPZDM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as c,c as d}from"./chunk-CV3ROBUM.js";import{a}from"./chunk-ZN5Q3YET.js";import"./chunk-5BAD3NCT.js";import"./chunk-F2IS5LWD.js";import"./chunk-FCV2DPZQ.js";export{a as DEFAULT_CONFIG,d as getChatConfig,c as getDefaults,b as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h}from"./chunk-Q3N5LVPZ.js";import"./chunk-W6JITSZF.js";import"./chunk-F2IS5LWD.js";import"./chunk-FCV2DPZQ.js";export{a as TTL_MS,g as cleanupExpired,b as createDeliveryLog,h as getDeliveryLogByRule,f as getFailedDeliveries,e as getPendingDeliveries,d as markDelivered,c as updateDeliveryLogStatus};
|
package/dist/engine-7VBPXTGK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./chunk-J5YZQQTS.js";import"./chunk-3OYRYMJW.js";import"./chunk-Q3N5LVPZ.js";import"./chunk-HMXDNPFE.js";import"./chunk-MMIO6BCA.js";import"./chunk-WGRTN6TX.js";import"./chunk-W6JITSZF.js";import"./chunk-F2IS5LWD.js";import"./chunk-3DAK2XWP.js";import"./chunk-FCV2DPZQ.js";export{a as DeliveryEngine,c as getDeliveryEngine,d as initDeliveryEngine,b as isDeliveryMessage,e as stopDeliveryEngine};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-TYR3QUCL.js";import"./chunk-62PXAOD6.js";import"./chunk-W6JITSZF.js";import"./chunk-F2IS5LWD.js";import"./chunk-FCV2DPZQ.js";export{m as DEFAULT_HYBRID_CONFIG,i as DEFAULT_SCORING_WEIGHTS,j as calculateRecency,k as calculateSmallvilleScore,n as cleanupMemories,d as countMemoriesByRole,a as createMemory,h as deleteMemory,b as getMemory,l as getRoleScoringWeights,e as listMemoriesByRole,g as searchByBM25,f as searchByVector,o as searchHybrid,c as updateMemoryRetrievalCount};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-37OAKNKA.js";import"./chunk-FUBKGVWI.js";import"./chunk-62PXAOD6.js";import"./chunk-W6JITSZF.js";import"./chunk-F2IS5LWD.js";import"./chunk-3DAK2XWP.js";import"./chunk-FCV2DPZQ.js";export{a as CHAT_MANAGER_ROLE_ID,b as initializeDefaultRoles};
|
package/dist/runtime-772O2XKZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h}from"./chunk-5BAD3NCT.js";import"./chunk-FCV2DPZQ.js";export{a as MUTABLE_PATHS,b as RESTART_REQUIRED_PATHS,f as getNestedValue,d as getRuntimeConfig,c as initRuntimeConfig,g as isMutablePath,h as isRestartRequiredPath,e as updateMutableConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-WGRTN6TX.js";import"./chunk-FCV2DPZQ.js";export{a as serverBus};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,r as p}from"./chunk-QOPUUA7O.js";import"./chunk-HMXDNPFE.js";import"./chunk-MMIO6BCA.js";import"./chunk-WGRTN6TX.js";import"./chunk-TYR3QUCL.js";import"./chunk-CV3ROBUM.js";import"./chunk-ZN5Q3YET.js";import"./chunk-5BAD3NCT.js";import"./chunk-62PXAOD6.js";import"./chunk-W6JITSZF.js";import"./chunk-F2IS5LWD.js";import"./chunk-3DAK2XWP.js";import"./chunk-FCV2DPZQ.js";export{p as _resetForTest,e as archiveSession,b as createSession,g as deleteSession,c as getActiveSession,d as getSession,m as getTimeoutPollerInterval,i as incrementMessageCount,n as initSessionManager,j as listSessions,f as restoreSession,o as shutdownSessionManager,k as startTimeoutPoller,l as stopTimeoutPoller,h as touchSession,a as warmCache};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,2 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|