adam-agent-server 1.3.0 → 1.4.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 +22 -9
- package/dist/App-JGH6G5US.js +13 -0
- package/dist/adam-tools-KTLBI4PA.js +1 -0
- package/dist/{approval-handler-RIJO3OBO.js → approval-handler-JZSXM4AD.js} +1 -1
- package/dist/audit-manager-BPJEAX22.js +1 -0
- package/dist/bree-engine-CRK73AI4.js +1 -0
- package/dist/{channels-LUJ7GTSP.js → channels-PUOPR5Y2.js} +1 -1
- package/dist/channels-WMTZJAO4.js +1 -0
- package/dist/{chunk-7IXLL673.js → chunk-24GTCFEV.js} +1 -1
- package/dist/{chunk-DBUEHITK.js → chunk-3567PCEJ.js} +1 -1
- package/dist/{chunk-4MJF77RD.js → chunk-4VHBKJD5.js} +3 -2
- package/dist/{chunk-AKPLOO2V.js → chunk-6THDALGC.js} +1 -1
- package/dist/{chunk-IZGTTLTG.js → chunk-7BSWC62F.js} +1 -1
- package/dist/{chunk-WTRM5VO7.js → chunk-CKIVKM5T.js} +2 -2
- package/dist/chunk-DBI36EGR.js +83 -0
- package/dist/{chunk-4NW2DNDZ.js → chunk-DMZM7RU6.js} +1 -1
- package/dist/{chunk-NUTUI5KM.js → chunk-EZGMA3VV.js} +1 -1
- package/dist/{chunk-AZBNUSM2.js → chunk-GYHOPV4Q.js} +1 -1
- package/dist/chunk-HQ66TFYI.js +12 -0
- package/dist/{chunk-YPOTHL7X.js → chunk-HYDCXE5K.js} +1 -1
- package/dist/{chunk-ZQYKT5UY.js → chunk-I5IUTZA3.js} +1 -1
- package/dist/{chunk-XTHP5JMO.js → chunk-I67UMGJM.js} +1 -1
- package/dist/chunk-J3NIPZ73.js +8 -0
- package/dist/{chunk-TKDT7EQO.js → chunk-JKPSEMUZ.js} +1 -1
- package/dist/{chunk-CLHSPXZ6.js → chunk-KO5AFX5U.js} +1 -1
- package/dist/chunk-KOWFPY2J.js +1 -0
- package/dist/{chunk-NDP6LWXX.js → chunk-L4Y3GR6W.js} +1 -1
- package/dist/{chunk-NLD7WK3R.js → chunk-NOUSHXGX.js} +1 -1
- package/dist/{chunk-P6KWAGAY.js → chunk-NZEDILAK.js} +1 -1
- package/dist/{chunk-WKS7QVIX.js → chunk-QQWRV23T.js} +1 -1
- package/dist/{chunk-TCHBOWQ5.js → chunk-RUY23IJK.js} +1 -1
- package/dist/{chunk-IKUBP3SY.js → chunk-T7GEINGZ.js} +2 -2
- package/dist/chunk-WRETNOC3.js +99 -0
- package/dist/{chunk-JZNBFZ7W.js → chunk-XAMLLKKA.js} +1 -1
- package/dist/{chunk-4LSIHSCO.js → chunk-XF4IERYF.js} +1 -1
- package/dist/{chunk-HFN7Y3IM.js → chunk-YHH3QMLL.js} +1 -1
- package/dist/{chunk-7CJGPCSJ.js → chunk-ZRUVORAJ.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{config-HR4MBTIS.js → config-CBNOT66B.js} +1 -1
- package/dist/{db-6KUGCGVR.js → db-XQUI4IBL.js} +1 -1
- package/dist/{delivery-log-7DJJTPXL.js → delivery-log-T56ZYDWO.js} +1 -1
- package/dist/engine-7DFJOADQ.js +1 -0
- package/dist/{evolution-audit-I2ITWAEC.js → evolution-audit-JZ2U7J4C.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/learner-4EO7ZKK4.js +1 -0
- package/dist/{memories-HBBW44MG.js → memories-EKREXLT6.js} +1 -1
- package/dist/{memory-extractor-XO2HJ22Y.js → memory-extractor-JO7OHBZP.js} +2 -2
- package/dist/memory-service-Y3HVQYHM.js +1 -0
- package/dist/outbound-gateway-U5LP54JG.js +1 -0
- package/dist/role-presets-HWZHXBBA.js +1 -0
- package/dist/roles-3AEHVOEW.js +1 -0
- package/dist/{session-manager-JICVE4CO.js → session-manager-PWJLU6KZ.js} +1 -1
- package/dist/{task-templates-NC7XIZIC.js → task-templates-ED2UCUPE.js} +1 -1
- package/dist/workflow-executor-XFTTJQNE.js +1 -0
- package/package.json +2 -2
- package/web/dist/assets/AlertDialog-r3y6IhpW.js +51 -0
- package/web/dist/assets/Button-BjXgrQ95.js +1 -0
- package/web/dist/assets/Card-C153tGfJ.js +1 -0
- package/web/dist/assets/ChannelDetail-C2uAZv1u.js +1 -0
- package/web/dist/assets/Channels-C62Qrg-n.js +12 -0
- package/web/dist/assets/Chat-kH2owmB_.js +1 -0
- package/web/dist/assets/Dashboard-BhD8SpFb.js +1 -0
- package/web/dist/assets/EmptyState-CXwJFCDQ.js +1 -0
- package/web/dist/assets/EnvVarEditor-GSapLD96.js +1 -0
- package/web/dist/assets/Evolution-BO5hysLD.js +6 -0
- package/web/dist/assets/GoalDetail-cxa8OvEi.js +1 -0
- package/web/dist/assets/Goals-Dz3qqp_l.js +1 -0
- package/web/dist/assets/Logs-Ckp3-hYV.js +1 -0
- package/web/dist/assets/Memories-DEuSRoP3.js +1 -0
- package/web/dist/assets/NotFound-Bvn39vSk.js +1 -0
- package/web/dist/assets/PageHeader-BMvN0xiB.js +1 -0
- package/web/dist/assets/Plugins-CRym22JF.js +1 -0
- package/web/dist/assets/RoleDetail-BWMjP9aZ.js +33 -0
- package/web/dist/assets/Roles-DD7NBDku.js +1 -0
- package/web/dist/assets/SectionHeader-CiCj3Is0.js +1 -0
- package/web/dist/assets/Settings-BlU19KuR.js +1 -0
- package/web/dist/assets/Strategies-CJ_q94-v.js +1 -0
- package/web/dist/assets/Switch-CoUUy5jr.js +1 -0
- package/web/dist/assets/Table-CaFJieh_.js +1 -0
- package/web/dist/assets/TaskDetail-DVrjU-E6.js +2 -0
- package/web/dist/assets/Work-BMl61RRi.js +1 -0
- package/web/dist/assets/dist-Bdqp1ixJ.js +1 -0
- package/web/dist/assets/index-DcXMQByM.css +2 -0
- package/web/dist/assets/index-pF--tN9F.js +2 -0
- package/web/dist/assets/ui-B_uMx2Fy.js +1 -0
- package/web/dist/assets/useIsMobileLayout-Bwrm84kJ.js +1 -0
- package/web/dist/assets/vendor-icons-BlMaTTx3.js +1 -0
- package/web/dist/assets/{vendor-react-DLRtONKt.js → vendor-react-7e01TWy7.js} +2 -2
- package/web/dist/assets/vendor-state-Bj70wnRm.js +1 -0
- package/web/dist/index.html +8 -6
- package/dist/App-3OBJDI2C.js +0 -9
- package/dist/adam-tools-4LZYFB6J.js +0 -1
- package/dist/audit-manager-6FFPXID3.js +0 -1
- package/dist/bree-engine-2NOTIBAZ.js +0 -1
- package/dist/channels-TSZLEU3L.js +0 -1
- package/dist/chunk-6NUHSHS5.js +0 -4
- package/dist/chunk-72VLUJ2S.js +0 -1
- package/dist/chunk-OTH4M5L3.js +0 -8
- package/dist/chunk-PVYEGQEG.js +0 -83
- package/dist/chunk-ZKMDHQJY.js +0 -104
- package/dist/engine-HJUE6I4I.js +0 -1
- package/dist/learner-CBPQZ3HL.js +0 -1
- package/dist/memory-service-HIFTKEW2.js +0 -1
- package/dist/outbound-gateway-GGFMU5JW.js +0 -1
- package/dist/role-presets-W452Y3RV.js +0 -1
- package/dist/roles-NYGWZMQI.js +0 -1
- package/dist/workflow-executor-QN4KP7B4.js +0 -1
- package/web/dist/assets/Card-4mOZntHG.js +0 -1
- package/web/dist/assets/ChannelDetail-DX4QnE8j.js +0 -1
- package/web/dist/assets/Channels-EXkNOQpB.js +0 -12
- package/web/dist/assets/Chat-Da-mCR0c.js +0 -1
- package/web/dist/assets/Dashboard-Bq6sEDdP.js +0 -1
- package/web/dist/assets/EmptyState-BlgMMAr-.js +0 -1
- package/web/dist/assets/EnvVarEditor-CNxXpVbD.js +0 -1
- package/web/dist/assets/Evolution-DPdmbooj.js +0 -6
- package/web/dist/assets/GoalDetail-BamCfVzS.js +0 -1
- package/web/dist/assets/Goals-CHPEg0RK.js +0 -1
- package/web/dist/assets/Logs-BHkBvH0T.js +0 -1
- package/web/dist/assets/Memories-BY2pJhVd.js +0 -1
- package/web/dist/assets/NotFound-CSjhzSGa.js +0 -1
- package/web/dist/assets/Plugins-C5xLM0BU.js +0 -1
- package/web/dist/assets/RoleDetail-Dnp-W14x.js +0 -33
- package/web/dist/assets/Roles-BVOVoHvc.js +0 -1
- package/web/dist/assets/Settings-eBHvn6s_.js +0 -1
- package/web/dist/assets/Strategies-BbFbLKBJ.js +0 -1
- package/web/dist/assets/Switch-Q-inggPs.js +0 -1
- package/web/dist/assets/Table-BxbnOSbq.js +0 -1
- package/web/dist/assets/TaskDetail-BEjZ1gco.js +0 -2
- package/web/dist/assets/Work-CF2iLs8i.js +0 -1
- package/web/dist/assets/dist-HyCSN_hp.js +0 -1
- package/web/dist/assets/index-CaHdOfAc.js +0 -52
- package/web/dist/assets/index-D0SvKqKc.css +0 -2
- package/web/dist/assets/vendor-icons-CkI4-NxL.js +0 -1
- package/web/dist/assets/vendor-state-B_-GdGNJ.js +0 -1
- /package/web/dist/assets/{format-DvtQjPZn.js → format-CHfBBLog.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as l,e as D,f as S,g as $}from"./chunk-YHH3QMLL.js";import{b as h}from"./chunk-6THDALGC.js";import{b as u}from"./chunk-XAMLLKKA.js";import{e as R,g as T,j as C}from"./chunk-24GTCFEV.js";import{k,m as x,q as N}from"./chunk-J3NIPZ73.js";import"./chunk-QQWRV23T.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import{c as d,h as y}from"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";y();var w=d("agent");function I(n){let o=l(n);if(!o){w.debug({taskId:n},"No plan found for task, skipping review");return}let i=h(n,1e3),s=o.plan.steps,a=i.filter(e=>e.type==="tool_result"||e.type==="permission_denied").map(e=>({toolName:e.toolName??"unknown",output:e.content,planStepIndex:e.planStepIndex,permissionDenied:e.type==="permission_denied"})),t=[],r=new Set(a.map(e=>e.planStepIndex).filter(e=>e!==void 0));for(let e of s)r.has(e.index)||t.push({stepIndex:e.index,planned:e.description,actual:"Not executed",deviationType:"skipped"});let c=a.filter(e=>e.planStepIndex===void 0);for(let e of c)t.push({stepIndex:-1,planned:"",actual:`${e.toolName}: ${e.output.slice(0,200)}`,deviationType:"added"});let b=a.filter(e=>e.permissionDenied);for(let e of b)t.push({stepIndex:e.planStepIndex??-1,planned:e.planStepIndex!==void 0?s.find(E=>E.index===e.planStepIndex)?.description??"Unknown":"",actual:`PERMISSION DENIED: ${e.toolName}`,deviationType:"failed"});let p=s.length,m=a.length,g=p>0?Math.max(0,1-t.filter(e=>e.deviationType!=="added").length/p):1,v={stepsPlanned:p,stepsExecuted:m,deviations:t,overallAccuracy:g};return S(o.id,v),w.info({taskId:n,planId:o.id,stepsPlanned:p,stepsExecuted:m,deviationCount:t.length,accuracy:g},"Deviation report generated"),v}function P(n){return n.deviations.filter(i=>i.deviationType==="failed"||i.deviationType==="skipped").length===0&&n.overallAccuracy>=.7}N();C();y();var f=d("agent");function L(n,o){let i=[],a=u(n)?.prompt.slice(0,100)??"unknown task";P(o)&&i.push(`[+] Task "${a}" completed successfully with ${o.overallAccuracy*100}% plan accuracy (${o.stepsExecuted} steps). [sourceTaskId:${n}]`);for(let t of o.deviations)switch(t.deviationType){case"skipped":i.push(`[-] Planned step "${t.planned}" was skipped during "${a}". Consider if this step is necessary for similar tasks. [sourceTaskId:${n}]`);break;case"failed":i.push(`[-] Step failed: "${t.actual}" during "${a}". Check permissions and tool availability. [sourceTaskId:${n}]`);break;case"added":i.push(`[~] Unplanned action: "${t.actual}" during "${a}". Consider adding to plan for similar tasks. [sourceTaskId:${n}]`);break;case"modified":i.push(`[~] Step modified: planned "${t.planned}" but did "${t.actual}" during "${a}". [sourceTaskId:${n}]`);break}return i}async function z(n){let o=l(n);if(!o){f.debug({taskId:n},"No plan for task, skipping review/learn");return}let i=I(n);if(!i)return;let s=L(n,i);if(s.length===0)return;$(o.id,s);let a=u(n);if(a?.roleId){let t=k(a.roleId);if(t){let r=[...t.learnedRules,...s];x(a.roleId,{learnedRules:r});let c=R(t.name);T(c,{...t,learnedRules:r}),f.info({roleId:a.roleId,newRulesCount:s.length},"Role learnedRules updated and CLAUDE.md written")}}D(o.id,"completed"),f.info({taskId:n,planId:o.id,rulesExtracted:s.length,accuracy:i.overallAccuracy},"Task review and learning completed")}export{L as extractRulesFromDeviation,z as processTaskReview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-7BSWC62F.js";import"./chunk-J3NIPZ73.js";import"./chunk-QQWRV23T.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";export{o as DEFAULT_HYBRID_CONFIG,k as DEFAULT_SCORING_WEIGHTS,l as calculateRecency,m as calculateSmallvilleScore,p as cleanupMemories,f as countMemoriesByRole,a as createMemory,j as deleteMemory,b as getMemory,n as getRoleScoringWeights,g as listMemoriesByRole,e as markSuperseded,i as searchByBM25,h as searchByVector,q as searchHybrid,c as updateMemory,d as updateMemoryRetrievalCount};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as w}from"./chunk-5V36ACKZ.js";import{b as g}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-5V36ACKZ.js";import{b as g}from"./chunk-6THDALGC.js";import{a as v}from"./chunk-HYDCXE5K.js";import{a as p}from"./chunk-2CMR5AG7.js";import{a as l,g as h}from"./chunk-7BSWC62F.js";import"./chunk-J3NIPZ73.js";import"./chunk-QQWRV23T.js";import{b as u,d as M}from"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import{c as y,h as b}from"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";b();M();import{v4 as $}from"uuid";var x=y("manager"),d=150,C=50;function N(e){return u().prepare("SELECT importance_trigger_curr FROM roles WHERE id = ?").get(e)?.importance_trigger_curr??d}function f(e,t){u().prepare("UPDATE roles SET importance_trigger_curr = ? WHERE id = ?").run(t,e)}function _(e,t){let r=N(e)-t;return f(e,r),r<=0}async function S(e){let t=h(e,C,0);if(t.length===0){f(e,d);return}let r=`Based on these recent experiences, what are the key insights and patterns?
|
|
2
2
|
|
|
3
3
|
${t.slice(0,20).map((c,m)=>`${m+1}. [${c.type}] (importance: ${c.importance}) ${c.content}`).join(`
|
|
4
4
|
`)}
|
|
5
5
|
|
|
6
|
-
Provide 1-3 high-level insights.`,o;try{o=(await w(r,"You are an agent self-reflection system. Analyze the experiences and produce concise, actionable insights. Respond with 1-3 high-level insights, each on its own line.")).trim()||E(t)}catch{o=E(t)}let i;try{i=await p(o)}catch{}let a=o.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(c=>c.length>2),s={id:$(),roleId:e,type:"reflection",content:o,embedding:i,keywords:[...new Set(a)].slice(0,20),importance:5,sourceType:"reflection",evidence:t.slice(0,10).map(c=>c.id),createdAt:Date.now(),lastAccessed:Date.now(),retrievedCount:0,tier:"semantic"};l(s);try{let{markSuperseded:c}=await import("./memories-
|
|
6
|
+
Provide 1-3 high-level insights.`,o;try{o=(await w(r,"You are an agent self-reflection system. Analyze the experiences and produce concise, actionable insights. Respond with 1-3 high-level insights, each on its own line.")).trim()||E(t)}catch{o=E(t)}let i;try{i=await p(o)}catch{}let a=o.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(c=>c.length>2),s={id:$(),roleId:e,type:"reflection",content:o,embedding:i,keywords:[...new Set(a)].slice(0,20),importance:5,sourceType:"reflection",evidence:t.slice(0,10).map(c=>c.id),createdAt:Date.now(),lastAccessed:Date.now(),retrievedCount:0,tier:"semantic"};l(s);try{let{markSuperseded:c}=await import("./memories-EKREXLT6.js"),m=t.slice(0,10).map(T=>T.id);c(m,s.id)}catch{}try{v({timestamp:Date.now(),oldRules:"",newRules:o,diff:o,roleId:e,source:"reflection"})}catch{}f(e,d),x.info({roleId:e,preview:o.slice(0,100)},"Generated reflection")}function E(e){let t=e.filter(i=>i.type==="event"),n=t.filter(i=>i.content.includes("Error")||i.content.includes("failed")),r=t.filter(i=>i.content.includes("Modified file")),o=[];return r.length>0&&o.push(`Made ${r.length} file modifications in recent tasks.`),n.length>0&&o.push(`Encountered ${n.length} errors.`),t.length>0&&o.push(`Total ${t.length} significant events observed.`),o.length>0?`Reflection: ${o.join(" ")}`:"Reflection: No significant patterns observed in recent activity."}async function R(e,t){_(e,t)&&await S(e)}import{v4 as A}from"uuid";function L(e){let t=e.toolName,n=e.toolOutput||e.content;if(t==="Write"||t==="Edit")return{content:`Modified file via ${t}: ${n.slice(0,400)}`,importance:4,type:"event"};if(t==="Bash"){let r=e.toolInput?.command?.slice(0,100)||"Bash";return n.includes("FAIL")||n.includes("error:")||n.includes("Error:")?{content:`Command failed: ${r} ${n.slice(0,300)}`,importance:4,type:"event"}:n.includes("success")||n.includes("done")||n.includes("OK")?{content:`Command succeeded: ${r}`,importance:2,type:"event"}:{content:`Executed: ${r}`,importance:1,type:"event"}}return t==="Read"?{content:`Read file: ${e.toolInput?.file_path||e.toolInput?.path||"unknown"}`,importance:1,type:"thought"}:t==="Glob"||t==="Grep"?{content:`Searched: ${t} - ${e.toolInput?.pattern||"query"}`,importance:2,type:"thought"}:null}function F(e){let t=g(e,500,0),n=[];for(let r of t)if((r.type==="tool_result"||r.type==="tool_call")&&r.toolName){let o=L(r);o&&n.push(o)}else r.type==="error"&&n.push({content:`Error occurred: ${r.content.slice(0,400)}`,importance:4,type:"event"});return{facts:n}}function k(e){let t=e.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(n=>n.length>2);return[...new Set(t)].slice(0,20)}async function V(e,t){let n=!1;try{let{searchByBM25:i}=await import("./memories-EKREXLT6.js");n=i(t,e,5).filter(s=>s.sourceTaskId===e).some(s=>s.type==="thought")}catch{}let{facts:r}=F(e),o=0;for(let i of r){if(n&&i.importance<=2)continue;let a=i.content.slice(0,500),s;try{s=await p(a)}catch{}let c=k(a),m={id:A(),roleId:t,type:i.type,content:a,embedding:s,keywords:c,importance:i.importance,sourceType:"task_complete",sourceTaskId:e,createdAt:Date.now(),lastAccessed:Date.now(),retrievedCount:0,tier:"episodic"};l(m),o++,await R(t,i.importance)}return o}export{F as extractKeyFacts,V as processTaskCompletion};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk-NZEDILAK.js";import"./chunk-2CMR5AG7.js";import"./chunk-7BSWC62F.js";import"./chunk-J3NIPZ73.js";import"./chunk-QQWRV23T.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";export{b as getRelevantMemoryContext,a as queryMemory,c as queryMemoryByTier};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk-CKIVKM5T.js";import"./chunk-KO5AFX5U.js";import"./chunk-EZGMA3VV.js";import"./chunk-L7JP7DUO.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";export{a as OutboundGateway,b as getOutboundGateway,c as isRecentlySent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-DMZM7RU6.js";import"./chunk-24GTCFEV.js";import"./chunk-J3NIPZ73.js";import"./chunk-QQWRV23T.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";export{a as CHAT_MANAGER_ROLE_ID,b as initializeDefaultRoles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as a,j as b,k as c,l as d,m as e,n as f,o as g,q as h}from"./chunk-J3NIPZ73.js";import"./chunk-QQWRV23T.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";h();export{b as createRole,g as deleteRole,c as getRole,d as getRoleByName,f as listRoles,e as updateRole,a as validateAdditionalDirectories};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-JKPSEMUZ.js";import"./chunk-GYHOPV4Q.js";import"./chunk-I5IUTZA3.js";import"./chunk-L7JP7DUO.js";import"./chunk-2CMR5AG7.js";import"./chunk-7BSWC62F.js";import"./chunk-7K4AQBDD.js";import"./chunk-UQJZU3R5.js";import"./chunk-7IFLU3CY.js";import"./chunk-GSMC3VUM.js";import"./chunk-J3NIPZ73.js";import"./chunk-QQWRV23T.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import"./chunk-INNDBLZE.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 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk-T7GEINGZ.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";export{a as createTaskTemplate,g as deleteTaskTemplate,f as disableTaskTemplate,e as enableTaskTemplate,b as getTaskTemplate,d as listTaskTemplates,c as updateTaskTemplate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as a}from"./chunk-I67UMGJM.js";import"./chunk-YHVFZB6Q.js";import"./chunk-XAMLLKKA.js";import"./chunk-CKIVKM5T.js";import"./chunk-KO5AFX5U.js";import"./chunk-EZGMA3VV.js";import"./chunk-L7JP7DUO.js";import"./chunk-7K4AQBDD.js";import"./chunk-UQJZU3R5.js";import"./chunk-7IFLU3CY.js";import"./chunk-GSMC3VUM.js";import"./chunk-J3NIPZ73.js";import"./chunk-QQWRV23T.js";import"./chunk-4VHBKJD5.js";import"./chunk-WBAPIPST.js";import"./chunk-INNDBLZE.js";import"./chunk-FCV2DPZQ.js";export{a as WorkflowExecutor};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adam-agent-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Goal-driven AI agent orchestration server with Role+Skill model, real-time streaming, and multi-channel delivery",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"build:all": "tsup && cd web && pnpm build",
|
|
69
69
|
"dev": "tsx watch src/index.ts",
|
|
70
70
|
"start": "node dist/index.js",
|
|
71
|
-
"test": "
|
|
71
|
+
"test": "node scripts/run-vitest-groups.mjs",
|
|
72
72
|
"test:watch": "vitest",
|
|
73
73
|
"test:coverage": "vitest run --coverage",
|
|
74
74
|
"test:e2e": "vitest run src/__tests__/e2e/",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{st as t}from"./vendor-icons-BlMaTTx3.js";import{h as n,t as r}from"./vendor-react-7e01TWy7.js";import{i}from"./dist-Bdqp1ixJ.js";import{i as a,n as o,r as s}from"./Button-BjXgrQ95.js";typeof window<`u`&&window.document&&window.document.createElement;function c(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var l=e(t(),1),u=r();function d(e,t){let n=l.createContext(t),r=e=>{let{children:t,...r}=e,i=l.useMemo(()=>r,Object.values(r));return(0,u.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=l.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function f(e,t=[]){let n=[];function r(t,r){let i=l.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=l.useMemo(()=>o,Object.values(o));return(0,u.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=l.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>l.createContext(e));return function(n){let r=n?.[e]||t;return l.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,p(i,...t)]}function p(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function m(e){let t=h(e),n=l.forwardRef((e,n)=>{let{children:r,...i}=e,a=l.Children.toArray(r),o=a.find(v);if(o){let e=o.props.children,r=a.map(t=>t===o?l.Children.count(e)>1?l.Children.only(null):l.isValidElement(e)?e.props.children:null:t);return(0,u.jsx)(t,{...i,ref:n,children:l.isValidElement(e)?l.cloneElement(e,void 0,r):null})}return(0,u.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function h(e){let t=l.forwardRef((e,t)=>{let{children:n,...r}=e;if(l.isValidElement(n)){let e=b(n),i=y(r,n.props);return n.type!==l.Fragment&&(i.ref=t?s(t,e):e),l.cloneElement(n,i)}return l.Children.count(n)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var g=Symbol(`radix.slottable`);function _(e){let t=({children:e})=>(0,u.jsx)(u.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=g,t}function v(e){return l.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===g}function y(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function b(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var x=e(n(),1),S=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=m(`Primitive.${t}`),r=l.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,u.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function C(e,t){e&&x.flushSync(()=>e.dispatchEvent(t))}function w(e){let t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...e)=>t.current?.(...e),[])}function ee(e,t=globalThis?.document){let n=w(e);l.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var T=`DismissableLayer`,te=`dismissableLayer.update`,ne=`dismissableLayer.pointerDownOutside`,re=`dismissableLayer.focusOutside`,ie,ae=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),oe=l.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:d,...f}=e,p=l.useContext(ae),[m,h]=l.useState(null),g=m?.ownerDocument??globalThis?.document,[,_]=l.useState({}),v=a(t,e=>h(e)),y=Array.from(p.layers),[b]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),x=y.indexOf(b),C=m?y.indexOf(m):-1,w=p.layersWithOutsidePointerEventsDisabled.size>0,T=C>=x,ne=le(e=>{let t=e.target,n=[...p.branches].some(e=>e.contains(t));!T||n||(i?.(e),s?.(e),e.defaultPrevented||d?.())},g),re=ue(e=>{let t=e.target;[...p.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||d?.())},g);return ee(e=>{C===p.layers.size-1&&(r?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))},g),l.useEffect(()=>{if(m)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(ie=g.body.style.pointerEvents,g.body.style.pointerEvents=`none`),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),de(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=ie)}},[m,g,n,p]),l.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),de())},[m,p]),l.useEffect(()=>{let e=()=>_({});return document.addEventListener(te,e),()=>document.removeEventListener(te,e)},[]),(0,u.jsx)(S.div,{...f,ref:v,style:{pointerEvents:w?T?`auto`:`none`:void 0,...e.style},onFocusCapture:c(e.onFocusCapture,re.onFocusCapture),onBlurCapture:c(e.onBlurCapture,re.onBlurCapture),onPointerDownCapture:c(e.onPointerDownCapture,ne.onPointerDownCapture)})});oe.displayName=T;var se=`DismissableLayerBranch`,ce=l.forwardRef((e,t)=>{let n=l.useContext(ae),r=l.useRef(null),i=a(t,r);return l.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,u.jsx)(S.div,{...e,ref:i})});ce.displayName=se;function le(e,t=globalThis?.document){let n=w(e),r=l.useRef(!1),i=l.useRef(()=>{});return l.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){fe(ne,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ue(e,t=globalThis?.document){let n=w(e),r=l.useRef(!1);return l.useEffect(()=>{let e=e=>{e.target&&!r.current&&fe(re,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function de(){let e=new CustomEvent(te);document.dispatchEvent(e)}function fe(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?C(i,a):i.dispatchEvent(a)}var E=globalThis?.document?l.useLayoutEffect:()=>{},pe=l.useId||(()=>void 0),me=0;function D(e){let[t,n]=l.useState(pe());return E(()=>{e||n(e=>e??String(me++))},[e]),e||(t?`radix-${t}`:``)}var he=`Portal`,ge=l.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=l.useState(!1);E(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?x.createPortal((0,u.jsx)(S.div,{...r,ref:t}),o):null});ge.displayName=he;function _e(e,t){return l.useReducer((e,n)=>t[e][n]??e,e)}var O=e=>{let{present:t,children:n}=e,r=ve(t),i=typeof n==`function`?n({present:r.isPresent}):l.Children.only(n),o=a(r.ref,ye(i));return typeof n==`function`||r.isPresent?l.cloneElement(i,{ref:o}):null};O.displayName=`Presence`;function ve(e){let[t,n]=l.useState(),r=l.useRef(null),i=l.useRef(e),a=l.useRef(`none`),[o,s]=_e(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return l.useEffect(()=>{let e=k(r.current);a.current=o===`mounted`?e:`none`},[o]),E(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=k(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),E(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=k(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=k(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:l.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function k(e){return e?.animationName||`none`}function ye(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var be=l.useInsertionEffect||E;function xe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Se({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=l.useRef(e!==void 0);l.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,l.useCallback(t=>{if(s){let n=Ce(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Se({defaultProp:e,onChange:t}){let[n,r]=l.useState(e),i=l.useRef(n),a=l.useRef(t);return be(()=>{a.current=t},[t]),l.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ce(e){return typeof e==`function`}var we=`focusScope.autoFocusOnMount`,A=`focusScope.autoFocusOnUnmount`,Te={bubbles:!1,cancelable:!0},Ee=`FocusScope`,De=l.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[c,d]=l.useState(null),f=w(i),p=w(o),m=l.useRef(null),h=a(t,e=>d(e)),g=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;c.contains(t)?m.current=t:j(m.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(c.contains(t)||j(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&j(c)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused]),l.useEffect(()=>{if(c){Pe.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(we,Te);c.addEventListener(we,f),c.dispatchEvent(t),t.defaultPrevented||(Oe(Le(Ae(c)),{select:!0}),document.activeElement===e&&j(c))}return()=>{c.removeEventListener(we,f),setTimeout(()=>{let t=new CustomEvent(A,Te);c.addEventListener(A,p),c.dispatchEvent(t),t.defaultPrevented||j(e??document.body,{select:!0}),c.removeEventListener(A,p),Pe.remove(g)},0)}}},[c,f,p,g]);let _=l.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=ke(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&j(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&j(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,u.jsx)(S.div,{tabIndex:-1,...s,ref:h,onKeyDown:_})});De.displayName=Ee;function Oe(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(j(r,{select:t}),document.activeElement!==n)return}function ke(e){let t=Ae(e);return[je(t,e),je(t.reverse(),e)]}function Ae(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function je(e,t){for(let n of e)if(!Me(n,{upTo:t}))return n}function Me(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Ne(e){return e instanceof HTMLInputElement&&`select`in e}function j(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ne(e)&&t&&e.select()}}var Pe=Fe();function Fe(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Ie(e,t),e.unshift(t)},remove(t){e=Ie(e,t),e[0]?.resume()}}}function Ie(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Le(e){return e.filter(e=>e.tagName!==`A`)}var M=0;function Re(){l.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ze()),document.body.insertAdjacentElement(`beforeend`,e[1]??ze()),M++,()=>{M===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),M--}},[])}function ze(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var N=function(){return N=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},N.apply(this,arguments)};function Be(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ve(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var P=`right-scroll-bar-position`,F=`width-before-scroll-bar`,He=`with-scroll-bars-hidden`,Ue=`--removed-body-scroll-bar-size`;function I(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function We(e,t){var n=(0,l.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ge=typeof window<`u`?l.useLayoutEffect:l.useEffect,Ke=new WeakMap;function qe(e,t){var n=We(t||null,function(t){return e.forEach(function(e){return I(e,t)})});return Ge(function(){var t=Ke.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||I(e,null)}),i.forEach(function(e){r.has(e)||I(e,a)})}Ke.set(n,e)},[e]),n}function Je(e){return e}function Ye(e,t){t===void 0&&(t=Je);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Xe(e){e===void 0&&(e={});var t=Ye(null);return t.options=N({async:!0,ssr:!1},e),t}var Ze=function(e){var t=e.sideCar,n=Be(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return l.createElement(r,N({},n))};Ze.isSideCarExport=!0;function Qe(e,t){return e.useMedium(t),Ze}var $e=Xe(),L=function(){},R=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:L,onWheelCapture:L,onTouchMoveCapture:L}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Be(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=qe([n,t]),w=N(N({},x),i);return l.createElement(l.Fragment,null,d&&l.createElement(S,{sideCar:$e,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?l.cloneElement(l.Children.only(s),N(N({},w),{ref:C})):l.createElement(y,N({},w,{className:c,ref:C}),s))});R.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},R.classNames={fullWidth:F,zeroRight:P};var et,tt=function(){if(et)return et;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function nt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=tt();return t&&e.setAttribute(`nonce`,t),e}function rt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function it(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var at=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nt())&&(rt(t,n),it(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ot=function(){var e=at();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},st=function(){var e=ot();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ct={left:0,top:0,right:0,gap:0},z=function(e){return parseInt(e||``,10)||0},lt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[z(n),z(r),z(i)]},ut=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ct;var t=lt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},dt=st(),B=`data-scroll-locked`,ft=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
|
+
.${He} {
|
|
3
|
+
overflow: hidden ${r};
|
|
4
|
+
padding-right: ${s}px ${r};
|
|
5
|
+
}
|
|
6
|
+
body[${B}] {
|
|
7
|
+
overflow: hidden ${r};
|
|
8
|
+
overscroll-behavior: contain;
|
|
9
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
10
|
+
padding-left: ${i}px;
|
|
11
|
+
padding-top: ${a}px;
|
|
12
|
+
padding-right: ${o}px;
|
|
13
|
+
margin-left:0;
|
|
14
|
+
margin-top:0;
|
|
15
|
+
margin-right: ${s}px ${r};
|
|
16
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.${P} {
|
|
20
|
+
right: ${s}px ${r};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.${F} {
|
|
24
|
+
margin-right: ${s}px ${r};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.${P} .${P} {
|
|
28
|
+
right: 0 ${r};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.${F} .${F} {
|
|
32
|
+
margin-right: 0 ${r};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
body[${B}] {
|
|
36
|
+
${Ue}: ${s}px;
|
|
37
|
+
}
|
|
38
|
+
`},pt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},mt=function(){l.useEffect(function(){return document.body.setAttribute(B,(pt()+1).toString()),function(){var e=pt()-1;e<=0?document.body.removeAttribute(B):document.body.setAttribute(B,e.toString())}},[])},ht=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;mt();var a=l.useMemo(function(){return ut(i)},[i]);return l.createElement(dt,{styles:ft(a,!t,i,n?``:`!important`)})},gt=!1;if(typeof window<`u`)try{var V=Object.defineProperty({},`passive`,{get:function(){return gt=!0,!0}});window.addEventListener(`test`,V,V),window.removeEventListener(`test`,V,V)}catch{gt=!1}var H=gt?{passive:!1}:!1,_t=function(e){return e.tagName===`TEXTAREA`},vt=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!_t(e)&&n[t]===`visible`)},yt=function(e){return vt(e,`overflowY`)},bt=function(e){return vt(e,`overflowX`)},xt=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),wt(e,r)){var i=Tt(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},St=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Ct=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},wt=function(e,t){return e===`v`?yt(t):bt(t)},Tt=function(e,t){return e===`v`?St(t):Ct(t)},Et=function(e,t){return e===`h`&&t===`rtl`?-1:1},Dt=function(e,t,n,r,i){var a=Et(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Tt(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&wt(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},U=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ot=function(e){return[e.deltaX,e.deltaY]},kt=function(e){return e&&`current`in e?e.current:e},At=function(e,t){return e[0]===t[0]&&e[1]===t[1]},jt=function(e){return`
|
|
39
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
40
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
41
|
+
`},Mt=0,W=[];function Nt(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),i=l.useState(Mt++)[0],a=l.useState(st)[0],o=l.useRef(e);l.useEffect(function(){o.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ve([e.lockRef.current],(e.shards||[]).map(kt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=l.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=U(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=xt(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=xt(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Dt(h,t,e,h===`h`?s:c,!0)},[]),c=l.useCallback(function(e){var n=e;if(!(!W.length||W[W.length-1]!==a)){var r=`deltaY`in n?Ot(n):U(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&At(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(kt).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=l.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Pt(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=l.useCallback(function(e){n.current=U(e),r.current=void 0},[]),f=l.useCallback(function(t){u(t.type,Ot(t),t.target,s(t,e.lockRef.current))},[]),p=l.useCallback(function(t){u(t.type,U(t),t.target,s(t,e.lockRef.current))},[]);l.useEffect(function(){return W.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,H),document.addEventListener(`touchmove`,c,H),document.addEventListener(`touchstart`,d,H),function(){W=W.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,H),document.removeEventListener(`touchmove`,c,H),document.removeEventListener(`touchstart`,d,H)}},[]);var m=e.removeScrollBar,h=e.inert;return l.createElement(l.Fragment,null,h?l.createElement(a,{styles:jt(i)}):null,m?l.createElement(ht,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Pt(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Ft=Qe($e,Nt),It=l.forwardRef(function(e,t){return l.createElement(R,N({},e,{ref:t,sideCar:Ft}))});It.classNames=R.classNames;var Lt=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},G=new WeakMap,K=new WeakMap,q={},Rt=0,zt=function(e){return e&&(e.host||zt(e.parentNode))},Bt=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=zt(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Vt=function(e,t,n,r){var i=Bt(t,Array.isArray(e)?e:[e]);q[n]||(q[n]=new WeakMap);var a=q[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(G.get(e)||0)+1,l=(a.get(e)||0)+1;G.set(e,c),a.set(e,l),o.push(e),c===1&&i&&K.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Rt++,function(){o.forEach(function(e){var t=G.get(e)-1,i=a.get(e)-1;G.set(e,t),a.set(e,i),t||(K.has(e)||e.removeAttribute(r),K.delete(e)),i||e.removeAttribute(n)}),Rt--,Rt||(G=new WeakMap,G=new WeakMap,K=new WeakMap,q={})}},Ht=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Lt(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Vt(r,i,n,`aria-hidden`)):function(){return null}},J=`Dialog`,[Ut,Wt]=f(J),[Gt,Y]=Ut(J),Kt=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=l.useRef(null),c=l.useRef(null),[d,f]=xe({prop:r,defaultProp:i??!1,onChange:a,caller:J});return(0,u.jsx)(Gt,{scope:t,triggerRef:s,contentRef:c,contentId:D(),titleId:D(),descriptionId:D(),open:d,onOpenChange:f,onOpenToggle:l.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};Kt.displayName=J;var qt=`DialogTrigger`,Jt=l.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Y(qt,n),o=a(t,i.triggerRef);return(0,u.jsx)(S.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":pn(i.open),...r,ref:o,onClick:c(e.onClick,i.onOpenToggle)})});Jt.displayName=qt;var Yt=`DialogPortal`,[Xt,Zt]=Ut(Yt,{forceMount:void 0}),Qt=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Y(Yt,t);return(0,u.jsx)(Xt,{scope:t,forceMount:n,children:l.Children.map(r,e=>(0,u.jsx)(O,{present:n||a.open,children:(0,u.jsx)(ge,{asChild:!0,container:i,children:e})}))})};Qt.displayName=Yt;var X=`DialogOverlay`,$t=l.forwardRef((e,t)=>{let n=Zt(X,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Y(X,e.__scopeDialog);return a.modal?(0,u.jsx)(O,{present:r||a.open,children:(0,u.jsx)(tn,{...i,ref:t})}):null});$t.displayName=X;var en=m(`DialogOverlay.RemoveScroll`),tn=l.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Y(X,n);return(0,u.jsx)(It,{as:en,allowPinchZoom:!0,shards:[i.contentRef],children:(0,u.jsx)(S.div,{"data-state":pn(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Z=`DialogContent`,nn=l.forwardRef((e,t)=>{let n=Zt(Z,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Y(Z,e.__scopeDialog);return(0,u.jsx)(O,{present:r||a.open,children:a.modal?(0,u.jsx)(rn,{...i,ref:t}):(0,u.jsx)(an,{...i,ref:t})})});nn.displayName=Z;var rn=l.forwardRef((e,t)=>{let n=Y(Z,e.__scopeDialog),r=l.useRef(null),i=a(t,n.contentRef,r);return l.useEffect(()=>{let e=r.current;if(e)return Ht(e)},[]),(0,u.jsx)(on,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault())})}),an=l.forwardRef((e,t)=>{let n=Y(Z,e.__scopeDialog),r=l.useRef(!1),i=l.useRef(!1);return(0,u.jsx)(on,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),on=l.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,c=Y(Z,n),d=l.useRef(null),f=a(t,d);return Re(),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(De,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:(0,u.jsx)(oe,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":pn(c.open),...s,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_n,{titleId:c.titleId}),(0,u.jsx)(yn,{contentRef:d,descriptionId:c.descriptionId})]})]})}),sn=`DialogTitle`,cn=l.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Y(sn,n);return(0,u.jsx)(S.h2,{id:i.titleId,...r,ref:t})});cn.displayName=sn;var ln=`DialogDescription`,un=l.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Y(ln,n);return(0,u.jsx)(S.p,{id:i.descriptionId,...r,ref:t})});un.displayName=ln;var dn=`DialogClose`,fn=l.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Y(dn,n);return(0,u.jsx)(S.button,{type:`button`,...r,ref:t,onClick:c(e.onClick,()=>i.onOpenChange(!1))})});fn.displayName=dn;function pn(e){return e?`open`:`closed`}var mn=`DialogTitleWarning`,[hn,gn]=d(mn,{contentName:Z,titleName:sn,docsSlug:`dialog`}),_n=({titleId:e})=>{let t=gn(mn),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
42
|
+
|
|
43
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
44
|
+
|
|
45
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return l.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},vn=`DialogDescriptionWarning`,yn=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gn(vn).contentName}}.`;return l.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},bn=Kt,xn=Jt,Sn=Qt,Cn=$t,wn=nn,Tn=cn,En=un,Dn=fn,On=`AlertDialog`,[kn,An]=f(On,[Wt]),Q=Wt(),jn=e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,u.jsx)(bn,{...r,...n,modal:!0})};jn.displayName=On;var Mn=`AlertDialogTrigger`,Nn=l.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,u.jsx)(xn,{...i,...r,ref:t})});Nn.displayName=Mn;var Pn=`AlertDialogPortal`,Fn=e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,u.jsx)(Sn,{...r,...n})};Fn.displayName=Pn;var In=`AlertDialogOverlay`,Ln=l.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,u.jsx)(Cn,{...i,...r,ref:t})});Ln.displayName=In;var $=`AlertDialogContent`,[Rn,zn]=kn($),Bn=_(`AlertDialogContent`),Vn=l.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,o=Q(n),s=l.useRef(null),d=a(t,s),f=l.useRef(null);return(0,u.jsx)(hn,{contentName:$,titleName:Hn,docsSlug:`alert-dialog`,children:(0,u.jsx)(Rn,{scope:n,cancelRef:f,children:(0,u.jsxs)(wn,{role:`alertdialog`,...o,...i,ref:d,onOpenAutoFocus:c(i.onOpenAutoFocus,e=>{e.preventDefault(),f.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,u.jsx)(Bn,{children:r}),(0,u.jsx)(Xn,{contentRef:s})]})})})});Vn.displayName=$;var Hn=`AlertDialogTitle`,Un=l.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,u.jsx)(Tn,{...i,...r,ref:t})});Un.displayName=Hn;var Wn=`AlertDialogDescription`,Gn=l.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,u.jsx)(En,{...i,...r,ref:t})});Gn.displayName=Wn;var Kn=`AlertDialogAction`,qn=l.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,u.jsx)(Dn,{...i,...r,ref:t})});qn.displayName=Kn;var Jn=`AlertDialogCancel`,Yn=l.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=zn(Jn,n),o=Q(n),s=a(t,i);return(0,u.jsx)(Dn,{...o,...r,ref:s})});Yn.displayName=Jn;var Xn=({contentRef:e})=>{let t=`\`${$}\` requires a description for the component to be accessible for screen reader users.
|
|
46
|
+
|
|
47
|
+
You can add a description to the \`${$}\` by passing a \`${Wn}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
48
|
+
|
|
49
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${$}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
50
|
+
|
|
51
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return l.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Zn=jn,Qn=Nn,$n=Fn,er=Ln,tr=Vn,nr=qn,rr=Yn,ir=Un,ar=Gn,or=Zn,sr=Qn,cr=$n,lr=l.forwardRef(({className:e,...t},n)=>(0,u.jsx)(er,{ref:n,className:i(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));lr.displayName=er.displayName;var ur=l.forwardRef(({className:e,...t},n)=>(0,u.jsxs)(cr,{children:[(0,u.jsx)(lr,{}),(0,u.jsx)(tr,{ref:n,className:i(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-[var(--app-border)] bg-[var(--app-panel)] p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));ur.displayName=tr.displayName;var dr=({className:e,...t})=>(0,u.jsx)(`div`,{className:i(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});dr.displayName=`AlertDialogHeader`;var fr=({className:e,...t})=>(0,u.jsx)(`div`,{className:i(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});fr.displayName=`AlertDialogFooter`;var pr=l.forwardRef(({className:e,...t},n)=>(0,u.jsx)(ir,{ref:n,className:i(`text-lg font-semibold text-[var(--app-text)]`,e),...t}));pr.displayName=ir.displayName;var mr=l.forwardRef(({className:e,...t},n)=>(0,u.jsx)(ar,{ref:n,className:i(`text-sm text-[var(--app-text-muted)]`,e),...t}));mr.displayName=ar.displayName;var hr=l.forwardRef(({className:e,...t},n)=>(0,u.jsx)(nr,{ref:n,className:i(o(),e),...t}));hr.displayName=nr.displayName;var gr=l.forwardRef(({className:e,...t},n)=>(0,u.jsx)(rr,{ref:n,className:i(o({variant:`ghost`}),`mt-2 sm:mt-0`,e),...t}));gr.displayName=rr.displayName;export{S as _,mr as a,f as b,pr as c,O as d,ge as f,w as g,oe as h,ur as i,sr as l,E as m,hr as n,fr as o,D as p,gr as r,dr as s,or as t,xe as u,m as v,c as x,_ as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{st as t}from"./vendor-icons-BlMaTTx3.js";import{t as n}from"./vendor-react-7e01TWy7.js";import{i as r,t as i}from"./dist-Bdqp1ixJ.js";var a=e(t(),1);function o(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function s(...e){return t=>{let n=!1,r=e.map(e=>{let r=o(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():o(e[t],null)}}}}function c(...e){return a.useCallback(s(...e),e)}var l=n(),u=Symbol.for(`react.lazy`),d=a.use;function f(e){return typeof e==`object`&&!!e&&`then`in e}function p(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===u&&`_payload`in e&&f(e._payload)}function m(e){let t=g(e),n=a.forwardRef((e,n)=>{let{children:r,...i}=e;p(r)&&typeof d==`function`&&(r=d(r._payload));let o=a.Children.toArray(r),s=o.find(v);if(s){let e=s.props.children,r=o.map(t=>t===s?a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null:t);return(0,l.jsx)(t,{...i,ref:n,children:a.isValidElement(e)?a.cloneElement(e,void 0,r):null})}return(0,l.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var h=m(`Slot`);function g(e){let t=a.forwardRef((e,t)=>{let{children:n,...r}=e;if(p(n)&&typeof d==`function`&&(n=d(n._payload)),a.isValidElement(n)){let e=b(n),i=y(r,n.props);return n.type!==a.Fragment&&(i.ref=t?s(t,e):e),a.cloneElement(n,i)}return a.Children.count(n)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _=Symbol(`radix.slottable`);function v(e){return a.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===_}function y(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function b(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var x=i(`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium transition-[background-color,border-color,color,box-shadow] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--app-canvas)] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-[var(--app-accent)] text-white shadow-[var(--app-shadow-accent)] hover:bg-[var(--app-accent-strong)] hover:shadow-[var(--app-shadow-lg)]`,secondary:`border border-[var(--app-border)] bg-white/[0.06] text-[var(--app-text)] hover:border-[var(--app-border-strong)] hover:bg-white/[0.1]`,destructive:`bg-[var(--app-danger)] text-white shadow-[var(--app-shadow-danger)] hover:bg-[var(--app-danger-strong)]`,ghost:`text-[var(--app-text-muted)] hover:text-[var(--app-text)] hover:bg-white/[0.06]`,outline:`border border-[var(--app-border)] bg-transparent text-[var(--app-text)] hover:border-[var(--app-border-strong)] hover:bg-white/[0.04]`,link:`text-[var(--app-accent-strong)] underline-offset-4 hover:underline`},size:{default:`px-3.5 py-1.5`,sm:`px-3 py-1.5 text-xs`,lg:`px-5 py-2.5`,icon:`h-8 w-8`}},defaultVariants:{variant:`default`,size:`default`}}),S=a.forwardRef(({className:e,variant:t,size:n,asChild:i=!1,...a},o)=>(0,l.jsx)(i?h:`button`,{className:r(x({variant:t,size:n,className:e})),ref:o,...a}));S.displayName=`Button`;export{c as i,x as n,s as r,S as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{st as t}from"./vendor-icons-BlMaTTx3.js";import{t as n}from"./vendor-react-7e01TWy7.js";import{i as r}from"./dist-Bdqp1ixJ.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,padding:t=!0,...n},i)=>(0,a.jsx)(`div`,{ref:i,className:r(`surface-panel rounded-xl text-[var(--app-text)]`,t&&`p-4`,e),...n}));o.displayName=`Card`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`mb-4 flex items-start justify-between gap-3`,e),...t}));s.displayName=`CardHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`h3`,{ref:n,className:r(`text-base font-semibold text-[var(--app-text)]`,e),...t}));c.displayName=`CardTitle`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`p`,{ref:n,className:r(`text-sm leading-6 text-[var(--app-text-muted)]`,e),...t}));l.displayName=`CardDescription`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`space-y-3`,e),...t}));u.displayName=`CardContent`;var d=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`flex items-center pt-3`,e),...t}));d.displayName=`CardFooter`;export{c as i,l as n,s as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,I as n,K as r,S as i,it as a,st as o}from"./vendor-icons-BlMaTTx3.js";import{f as s,r as c,t as l}from"./vendor-react-7e01TWy7.js";import{n as u}from"./dist-Bdqp1ixJ.js";import{t as d}from"./index-pF--tN9F.js";import{i as f,r as p,t as m}from"./Card-C153tGfJ.js";import{t as h}from"./PageHeader-BMvN0xiB.js";import{t as g}from"./SectionHeader-CiCj3Is0.js";import{n as _}from"./format-CHfBBLog.js";var v=e(o(),1),y=l();function b(){let{id:e}=s(),[o,l]=(0,v.useState)(null),[b,S]=(0,v.useState)([]),[C,w]=(0,v.useState)([]),[T,E]=(0,v.useState)(null);if((0,v.useEffect)(()=>{e&&((async()=>{try{l((await u(`/channels/${e}`)).channel),E(null)}catch(e){E(e instanceof Error?e.message:`Failed to load channel`)}})(),u(`/delivery-rules`).then(t=>S(t.filter(t=>t.target.type===`channel`&&t.target.channelId===e))).catch(()=>S([])),u(`/delivery-rules`).then(async t=>{let n=t.filter(t=>t.target.type===`channel`&&t.target.channelId===e),r=[];for(let e of n.slice(0,3))try{let t=await u(`/delivery-rules/${e.id}/log`);r.push(...t.log??[])}catch{}r.sort((e,t)=>t.createdAt-e.createdAt),w(r.slice(0,20))}).catch(()=>w([])))},[e]),T)return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(c,{to:`/channels`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Channels`]}),(0,y.jsx)(m,{className:`text-center text-[var(--app-danger)]`,children:T})]});if(!o)return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(c,{to:`/channels`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Channels`]}),(0,y.jsx)(m,{className:`text-center text-[var(--app-text-subtle)]`,children:`Loading...`})]});let D=e=>e===`connected`?`success`:e===`connecting`?`warning`:e===`error`?`destructive`:`secondary`,O=e=>{switch(e){case`wechat`:return`WeChat`;case`telegram`:return`Telegram`;case`slack`:return`Slack`;case`discord`:return`Discord`;default:return e.charAt(0).toUpperCase()+e.slice(1)}},k={...o.config};for(let e of[`botToken`,`apiKey`,`secret`,`password`,`token`])e in k&&(k[e]=`********`);return(0,y.jsxs)(`div`,{className:`space-y-5`,children:[(0,y.jsxs)(c,{to:`/channels`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Channels`]}),(0,y.jsx)(h,{eyebrow:`Channel`,title:o.name,compact:!0,description:`Connectivity, delivery policy, and recent outbound activity.`,metrics:[{label:`Status`,value:(0,y.jsx)(d,{variant:D(o.status),children:o.status})},{label:`Platform`,value:O(o.platform)},{label:`Enabled`,value:o.enabled?`Yes`:`No`},{label:`Messages`,value:o.messageCount}]}),(0,y.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Channel ID`}),(0,y.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-[var(--app-text)]`,children:o.id})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Linked role`}),(0,y.jsx)(`p`,{className:`mt-2 text-sm font-medium text-[var(--app-text)]`,children:o.linkedRoleId?`${o.linkedRoleId.slice(0,8)}...`:`None`})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Delivery rules`}),(0,y.jsx)(`p`,{className:`mt-2 text-2xl font-semibold text-[var(--app-text)]`,children:b.length})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Recent delivery events`}),(0,y.jsx)(`p`,{className:`mt-2 text-2xl font-semibold text-[var(--app-text)]`,children:C.length})]})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,y.jsx)(x,{icon:r,label:`Created`,value:_(o.createdAt),mono:!0}),(0,y.jsx)(x,{icon:t,label:`Messages`,value:String(o.messageCount),mono:!0}),o.lastMessageAt&&(0,y.jsx)(x,{icon:r,label:`Last Message`,value:_(o.lastMessageAt),mono:!0}),o.linkedRoleId&&(0,y.jsx)(x,{icon:i,label:`Linked Role`,value:o.linkedRoleId.slice(0,8)+`...`,mono:!0})]}),(0,y.jsx)(g,{title:`Configuration`,compact:!0,description:`Raw config stays available below, but status and traffic stay first.`}),(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsx)(f,{children:`Configuration`})}),Object.keys(k).length>0&&(0,y.jsx)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:Object.entries(k).slice(0,6).map(([e,t])=>(0,y.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 px-3 py-2`,children:[(0,y.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:e}),(0,y.jsx)(`p`,{className:`mt-1 truncate text-sm text-[var(--app-text)]`,children:String(t)})]},e))}),(0,y.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap rounded-md bg-[var(--app-panel-elevated)] p-3 font-mono text-xs text-[var(--app-text)]`,children:JSON.stringify(k,null,2)})]}),(0,y.jsx)(g,{title:`Delivery Activity`,compact:!0,description:`Rules and log entries stay grouped as one operational block.`}),b.length>0&&(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,y.jsx)(n,{size:14}),` Delivery Rules (`,b.length,`)`]})}),(0,y.jsx)(`div`,{className:`space-y-2`,children:b.map(e=>(0,y.jsxs)(`div`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)]/50 p-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(d,{variant:`outline`,children:e.eventType}),e.enabled?(0,y.jsx)(d,{variant:`success`,children:`active`}):(0,y.jsx)(d,{variant:`secondary`,children:`disabled`}),(0,y.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`max `,e.maxPerMinute,`/min`]})]}),(0,y.jsxs)(`p`,{className:`mt-1 text-xs text-[var(--app-text-muted)] font-mono`,children:[`Rule: `,e.id]})]},e.id))})]}),C.length>0&&(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,y.jsx)(t,{size:14}),` Delivery Log (`,C.length,`)`]})}),(0,y.jsx)(`div`,{className:`space-y-2`,children:C.slice(0,10).map(e=>(0,y.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--app-border)] p-2`,children:[(0,y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,y.jsx)(`span`,{className:`text-sm text-[var(--app-text)] font-mono`,children:e.taskId.slice(0,8)}),(0,y.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:_(e.createdAt)})]}),(0,y.jsx)(d,{variant:e.status===`delivered`?`default`:e.status===`failed`?`destructive`:`outline`,children:e.status})]},e.id))})]})]})}function x({icon:e,label:t,value:n,mono:r}){return(0,y.jsxs)(m,{className:`flex flex-col gap-1`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[var(--app-text-subtle)]`,children:[(0,y.jsx)(e,{size:12}),(0,y.jsx)(`span`,{className:`text-xs`,children:t})]}),(0,y.jsx)(`span`,{className:`text-sm text-[var(--app-text)] truncate ${r?`font-mono text-xs`:``}`,children:n})]})}export{b as ChannelDetail};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{C as t,D as n,S as r,T as i,o as a,st as o,t as s,x as c,y as l}from"./vendor-icons-BlMaTTx3.js";import{t as u}from"./vendor-react-7e01TWy7.js";import{n as d}from"./dist-Bdqp1ixJ.js";import{t as f}from"./Button-BjXgrQ95.js";import{t as p}from"./index-pF--tN9F.js";import{i as m,r as h,t as g}from"./Card-C153tGfJ.js";import{t as _}from"./PageHeader-BMvN0xiB.js";import{t as v}from"./SectionHeader-CiCj3Is0.js";import{t as y}from"./EmptyState-CXwJFCDQ.js";import{t as b}from"./ui-B_uMx2Fy.js";var x=e(o(),1),S=u(),C=[`telegram`,`slack`,`discord`,`openclaw`,`wechat`,`whatsapp`],w={telegram:`{
|
|
2
|
+
"botToken": ""
|
|
3
|
+
}`,slack:`{
|
|
4
|
+
"botToken": "",
|
|
5
|
+
"signingSecret": ""
|
|
6
|
+
}`,discord:`{
|
|
7
|
+
"botToken": ""
|
|
8
|
+
}`,openclaw:`{
|
|
9
|
+
"gatewayUrl": "ws://127.0.0.1:18789"
|
|
10
|
+
}`,wechat:`{
|
|
11
|
+
"baseUrl": "https://ilinkai.weixin.qq.com"
|
|
12
|
+
}`,whatsapp:`{}`},T=e=>{switch(e){case`connected`:return`success`;case`connecting`:return`warning`;case`degraded`:return`warning`;case`error`:return`destructive`;default:return`secondary`}};function E({initial:e,onSubmit:t,onCancel:n}){let[r,i]=(0,x.useState)(e?.name??``),[a,o]=(0,x.useState)(e?.platform??`telegram`),[c,l]=(0,x.useState)(e?.config?JSON.stringify(e.config,null,2):w[e?.platform??`telegram`]??`{}`),[u,d]=(0,x.useState)(e?.enabled??!0),[p,h]=(0,x.useState)(``);function _(e){if(e.preventDefault(),!r.trim()){h(`Name is required`);return}let n;try{n=JSON.parse(c)}catch{h(`Invalid JSON in config`);return}h(``),t({name:r.trim(),platform:a,config:n,enabled:u})}return(0,S.jsx)(g,{children:(0,S.jsxs)(`form`,{onSubmit:_,className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsx)(m,{className:`text-[var(--app-text)]`,children:e?`Edit Channel`:`New Channel`}),(0,S.jsx)(f,{variant:`ghost`,size:`icon`,type:`button`,onClick:n,children:(0,S.jsx)(s,{size:14})})]}),p&&(0,S.jsx)(`div`,{className:`text-xs text-[var(--app-danger)]`,children:p}),(0,S.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Name`}),(0,S.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`My Telegram Bot`,className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Platform`}),(0,S.jsx)(`select`,{value:a,onChange:t=>{o(t.target.value),e||l(w[t.target.value]??`{}`)},className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,children:C.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Config (JSON)`}),(0,S.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:4,className:`resize-none rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 font-mono text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,id:`ch-enabled`,checked:u,onChange:e=>d(e.target.checked),className:`rounded border-[var(--app-border)] bg-[var(--app-panel-elevated)]`}),(0,S.jsx)(`label`,{htmlFor:`ch-enabled`,className:`text-xs text-[var(--app-text-muted)]`,children:`Enabled`})]}),!e&&a===`wechat`&&(0,S.jsx)(`div`,{className:`rounded bg-[var(--app-accent-soft-bg)] border border-[var(--app-accent-soft-border)] px-3 py-2 text-xs text-[var(--app-accent)]`,children:`Creating a WeChat channel will start a QR code scan. Have your WeChat app ready.`}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(f,{type:`submit`,size:`sm`,children:e?`Save`:a===`wechat`&&!e?`Create & Connect`:`Create`}),(0,S.jsx)(f,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,children:`Cancel`})]})]})})}function D({channelId:e,onClose:t}){let[n,r]=(0,x.useState)([]),[i,a]=(0,x.useState)(!0);return(0,x.useEffect)(()=>{(async()=>{try{r((await d(`/channels/${e}/messages`)).messages)}catch{}a(!1)})()},[e]),(0,S.jsxs)(g,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,S.jsx)(m,{children:`Channel Messages`}),(0,S.jsx)(f,{variant:`ghost`,size:`icon`,onClick:t,children:(0,S.jsx)(s,{size:14})})]}),i?(0,S.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Loading...`}):n.length===0?(0,S.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`No messages yet`}):(0,S.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-2`,children:n.map(e=>(0,S.jsxs)(`div`,{className:`rounded bg-[var(--app-panel-elevated)]/50 px-3 py-2 text-xs`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:e.role===`user`?`text-[var(--app-accent)]`:`text-[var(--app-success)]`,children:e.role}),(0,S.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:new Date(e.createdAt).toLocaleTimeString()})]}),(0,S.jsx)(`div`,{className:`mt-1 text-[var(--app-text)]`,children:e.content})]},e.id))})]})}function O(){let[e,o]=(0,x.useState)([]),[s,u]=(0,x.useState)(!0),[C,w]=(0,x.useState)(!1),[O,k]=(0,x.useState)(null),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1);(0,x.useEffect)(()=>{I()},[]);async function I(){try{o((await d(`/channels`)).channels)}catch{}u(!1)}async function L(e){try{let t=await d(`/channels`,{method:`POST`,body:JSON.stringify(e)});w(!1),I(),e.platform===`wechat`&&t.channel?.id&&z(t.channel.id)}catch{}}async function R(e){if(O)try{await d(`/channels/${O.id}`,{method:`PATCH`,body:JSON.stringify(e)}),k(null),I()}catch{}}async function z(t){if(e.find(e=>e.id===t)?.platform===`wechat`)try{let e=await d(`/channels/${t}/wechat/qr-start`,{method:`POST`});if(e.qrcodeUrl&&e.sessionKey){N({channelId:t,qrcodeUrl:e.qrcodeUrl,sessionKey:e.sessionKey}),F(!0);try{(await d(`/channels/${t}/wechat/qr-wait`,{method:`POST`,body:JSON.stringify({sessionKey:e.sessionKey,timeoutMs:12e4})})).connected&&I()}catch{}N(null),F(!1)}}catch{}else try{await d(`/channels/${t}/connect`,{method:`POST`}),I()}catch{}}async function B(e){try{await d(`/channels/${e}/disconnect`,{method:`POST`}),I()}catch{}}async function V(e){try{await d(`/channels/${e}`,{method:`DELETE`}),o(t=>t.filter(t=>t.id!==e))}catch{}}return s?(0,S.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,S.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):(0,S.jsxs)(`div`,{className:`space-y-6`,children:[(0,S.jsx)(_,{eyebrow:`Delivery`,title:`Channels`,description:`Connection status, volume, and edit access for every delivery endpoint.`,metrics:[{label:`Connected`,value:e.filter(e=>e.status===`connected`).length},{label:`Enabled`,value:e.filter(e=>e.enabled).length},{label:`Messages`,value:e.reduce((e,t)=>e+t.messageCount,0)}],compact:!0,actions:(0,S.jsxs)(f,{size:`sm`,onClick:()=>{w(!0),k(null)},children:[(0,S.jsx)(c,{size:14}),`Add Channel`]})}),(0,S.jsx)(v,{title:`Endpoints`,description:`Connect, disconnect, edit, inspect messages, or add a new endpoint.`,compact:!0,action:(0,S.jsxs)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[e.length,` channel`,e.length===1?``:`s`]})}),C&&!O&&(0,S.jsx)(E,{onSubmit:L,onCancel:()=>w(!1)}),O&&(0,S.jsx)(E,{initial:O,onSubmit:R,onCancel:()=>k(null)}),A&&(0,S.jsx)(D,{channelId:A,onClose:()=>j(null)}),M&&(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,S.jsxs)(g,{className:`max-w-sm text-center`,children:[(0,S.jsx)(m,{className:`mb-3 text-[var(--app-text)]`,children:`Scan QR Code with WeChat`}),(0,S.jsx)(`img`,{src:`https://api.qrserver.com/v1/create-qr-code/?size=256x256&data=${encodeURIComponent(M.qrcodeUrl)}`,alt:`WeChat QR Code`,className:`mx-auto h-64 w-64 rounded bg-white p-2`}),(0,S.jsx)(`p`,{className:`mt-3 text-xs text-[var(--app-text-muted)]`,children:P?`Waiting for scan...`:`Open WeChat and scan the QR code`}),(0,S.jsx)(`a`,{href:M.qrcodeUrl,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 block text-[10px] text-[var(--app-accent)] hover:text-[var(--app-accent)] truncate max-w-[280px] mx-auto`,children:M.qrcodeUrl}),(0,S.jsx)(f,{variant:`ghost`,size:`sm`,className:`mt-3`,onClick:()=>{N(null),F(!1)},children:`Cancel`})]})}),e.length===0&&!C?(0,S.jsx)(g,{children:(0,S.jsx)(y,{icon:(0,S.jsx)(l,{size:b.hero}),title:`No channels`,description:`Add a channel to connect Adam to messaging platforms like Telegram, Slack, or Discord.`})}):(0,S.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,S.jsxs)(g,{children:[(0,S.jsxs)(h,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(l,{size:16,className:`text-[var(--app-text-muted)]`}),(0,S.jsx)(m,{className:`text-[var(--app-text)]`,children:e.name})]}),(0,S.jsx)(p,{variant:T(e.status),children:e.status})]}),(0,S.jsxs)(`div`,{className:`space-y-2 text-xs text-[var(--app-text-muted)]`,children:[(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{children:`Platform`}),(0,S.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.platform})]}),(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{children:`Messages`}),(0,S.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.messageCount})]}),(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{children:`Enabled`}),(0,S.jsx)(`span`,{className:e.enabled?`text-[var(--app-success)]`:`text-[var(--app-text-subtle)]`,children:e.enabled?`Yes`:`No`})]})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-[var(--app-border)] pt-3`,children:[e.status===`connected`?(0,S.jsxs)(f,{variant:`secondary`,size:`sm`,onClick:()=>void B(e.id),children:[(0,S.jsx)(t,{size:12}),` Disconnect`]}):(0,S.jsxs)(f,{variant:`secondary`,size:`sm`,onClick:()=>void z(e.id),children:[(0,S.jsx)(r,{size:12}),` Connect`]}),(0,S.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>{k(e),w(!1)},children:(0,S.jsx)(i,{size:12})}),(0,S.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>j(e.id),children:(0,S.jsx)(n,{size:12})}),(0,S.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>void V(e.id),children:(0,S.jsx)(a,{size:12})})]})]},e.id))})]})}export{O as Channels};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{O as t,_ as n,at as r,d as i,k as a,m as o,o as s,q as c,st as l,t as u,u as d,x as f}from"./vendor-icons-BlMaTTx3.js";import{t as p}from"./vendor-react-7e01TWy7.js";import{a as m,n as h}from"./dist-Bdqp1ixJ.js";import{t as g}from"./Button-BjXgrQ95.js";import{n as _}from"./vendor-state-Bj70wnRm.js";import{t as v}from"./PageHeader-BMvN0xiB.js";import{a as y}from"./format-CHfBBLog.js";import{t as b}from"./EmptyState-CXwJFCDQ.js";import{t as x}from"./ui-B_uMx2Fy.js";import{t as S}from"./useIsMobileLayout-Bwrm84kJ.js";var C=e(l(),1),w=_((e,t)=>({sessions:[],activeSessionId:null,messages:[],loading:!1,sending:!1,_chatWs:null,_chatWsReconnectDelay:1e3,fetchSessions:async()=>{try{e({sessions:(await h(`/chat/sessions`)).sessions})}catch{}},fetchMessages:async t=>{e({loading:!0});try{e({messages:(await h(`/chat/sessions/${t}`)).messages,loading:!1})}catch{e({messages:[],loading:!1})}},sendMessage:async n=>{if(t().sending)return null;e({sending:!0});try{let r=await h(`/chat/messages`,{method:`POST`,body:JSON.stringify({content:n,source:{type:`web`},sessionId:t().activeSessionId??void 0})});return e({activeSessionId:r.sessionId,sending:!1}),t().fetchSessions(),r}catch{return e({sending:!1}),null}},createSession:async()=>{try{let t=await h(`/chat/sessions`,{method:`POST`,body:JSON.stringify({source:{type:`web`}})});return e(e=>({sessions:[t.session,...e.sessions],activeSessionId:t.session.id,messages:[]})),t.session}catch{return null}},archiveSession:async t=>{try{await h(`/chat/sessions/${t}/archive`,{method:`POST`}),e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,status:`archived`}:e),activeSessionId:e.activeSessionId===t?null:e.activeSessionId,messages:e.activeSessionId===t?[]:e.messages}))}catch{}},restoreSession:async t=>{try{await h(`/chat/sessions/${t}/restore`,{method:`POST`}),e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,status:`active`}:e)}))}catch{}},deleteSession:async t=>{try{await h(`/chat/sessions/${t}`,{method:`DELETE`}),e(e=>({sessions:e.sessions.filter(e=>e.id!==t),activeSessionId:e.activeSessionId===t?null:e.activeSessionId,messages:e.activeSessionId===t?[]:e.messages}))}catch{}},setActiveSession:n=>{e({activeSessionId:n,messages:[]}),n&&t().fetchMessages(n)},connectChatStream:()=>{let n=t()._chatWs;if(n&&n.readyState<=1)return;let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=localStorage.getItem(`adam_api_key`),a=new URL(`${r}//${window.location.host}/chat/stream`);i&&a.searchParams.set(`api_key`,i);let o=new WebSocket(a.toString());o.onopen=()=>{e({_chatWs:o,_chatWsReconnectDelay:1e3})},o.onclose=()=>{let n=t()._chatWsReconnectDelay;e({_chatWs:null,_chatWsReconnectDelay:Math.min(n*2,1e4)}),setTimeout(()=>{t().connectChatStream()},n)},o.onerror=()=>{o.close()},o.onmessage=n=>{try{let r=JSON.parse(n.data);if(r.type===`chat_message`&&r.message){let n=r.message,{activeSessionId:i,messages:a}=t();if(n.sessionId!==i||a.some(e=>e.id===n.id))return;e(e=>({messages:[...e.messages,n]}))}else r.type===`session_created`&&t().fetchSessions()}catch{}},e({_chatWs:o})},disconnectChatStream:()=>{let n=t()._chatWs;n&&(n.onclose=null,n.onerror=null,n.onmessage=null,n.close(),e({_chatWs:null}))}})),T=p();function E({message:e}){let t=e.role===`user`,n=t?`You`:e.taskId?`Adam · execution`:`Adam`;return(0,T.jsx)(`div`,{className:m(`flex`,t?`justify-end`:`justify-start`),children:(0,T.jsxs)(`div`,{className:m(`max-w-[85%] rounded-lg px-4 py-3 text-sm leading-7 shadow-[var(--app-shadow-md)]`,t?`surface-accent text-white`:`surface-panel text-[var(--app-text)]`),children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-[11px] uppercase tracking-[0.16em]`,children:[(0,T.jsx)(`span`,{className:t?`text-white/70`:`text-[var(--app-kicker)]`,children:n}),(0,T.jsx)(`span`,{className:t?`text-white/45`:`text-[var(--app-text-subtle)]`,children:y(typeof e.createdAt==`number`?e.createdAt:new Date(e.createdAt).getTime())})]}),(0,T.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:e.content})]})})}function D({onSend:e,disabled:t,placeholder:n=`Type a message...`,starterActions:r=[],showStarterActions:i=!0,compact:a=!1}){let[s,c]=(0,C.useState)(``),l=(0,C.useRef)(null),u=()=>{let n=s.trim();!n||t||(e(n),c(``),l.current&&(l.current.style.height=`auto`))},d=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),u())},f=()=>{let e=l.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)};return(0,T.jsxs)(`div`,{className:a?`rounded-xl border border-[var(--app-border)] bg-white/[0.03] p-3`:`surface-panel-elevated rounded-xl p-3`,children:[i&&r.length>0?(0,T.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-2`,children:r.map(e=>(0,T.jsx)(`button`,{type:`button`,onClick:()=>{c(e.value),requestAnimationFrame(()=>l.current?.focus())},className:`rounded-full border border-[var(--app-border)] bg-white/[0.04] px-3 py-1.5 text-xs font-medium text-[var(--app-text-muted)] transition-colors hover:border-[var(--app-border-strong)] hover:text-[var(--app-text)]`,children:e.label},e.label))}):null,(0,T.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,T.jsx)(`textarea`,{ref:l,value:s,onChange:e=>{c(e.target.value),f()},onKeyDown:d,placeholder:n,disabled:t,rows:1,className:`min-h-12 flex-1 resize-none rounded-lg border border-[var(--app-border)] bg-white/[0.04] px-4 py-3 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-border-strong)] focus:outline-none focus:ring-1 focus:ring-[var(--app-accent)] disabled:opacity-50`}),(0,T.jsxs)(g,{onClick:u,disabled:t||!s.trim(),size:`default`,"aria-label":`Send message`,children:[(0,T.jsx)(o,{size:16}),`Send`]})]}),(0,T.jsx)(`div`,{className:`mt-2 text-xs text-[var(--app-text-subtle)]`,children:`Enter to send; Shift+Enter for a new line.`})]})}function O({session:e,isActive:t,onSelect:i,onArchive:a,onRestore:o,onDelete:c}){let l=e.status===`archived`,u=(e,t)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),t())};return(0,T.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},className:m(`group flex w-full flex-col gap-1 rounded-lg border px-3 py-3 text-left transition-colors`,t?`border-[var(--app-border-strong)] bg-white/[0.08] text-[var(--app-text)]`:`border-transparent text-[var(--app-text-muted)] hover:border-[var(--app-border)] hover:bg-white/[0.04] hover:text-[var(--app-text)]`,l&&`opacity-60`),"aria-label":e.title??e.id.slice(0,8),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title??e.id.slice(0,8)}),(0,T.jsxs)(`div`,{className:m(`flex gap-0.5 transition-opacity`,t?`opacity-100`:`opacity-100 lg:opacity-0 lg:group-hover:opacity-100 lg:group-focus-within:opacity-100`),children:[l?(0,T.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-[var(--app-text-subtle)] hover:text-[var(--app-success)]`,onClick:e=>{e.stopPropagation(),o()},onKeyDown:e=>u(e,o),title:`Restore session`,"aria-label":`Restore session`,children:(0,T.jsx)(n,{size:x.xs})}):(0,T.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-[var(--app-text-subtle)] hover:text-[var(--app-warning)]`,onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>u(e,a),title:`Archive session`,"aria-label":`Archive session`,children:(0,T.jsx)(r,{size:x.xs})}),(0,T.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-[var(--app-text-subtle)] hover:text-[var(--app-danger)]`,onClick:e=>{e.stopPropagation(),c()},onKeyDown:e=>u(e,c),title:`Delete session`,"aria-label":`Delete session`,children:(0,T.jsx)(s,{size:x.xs})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-[var(--app-text-subtle)]`,children:[(0,T.jsxs)(`span`,{children:[e.messageCount,` turns`]}),(0,T.jsx)(`span`,{children:y(e.lastActiveAt)}),l&&(0,T.jsx)(`span`,{className:`rounded-full border border-[var(--app-border)] bg-white/[0.04] px-1.5 py-0.5 text-[9px] uppercase tracking-[0.16em]`,children:`archived`})]})]})}function k({sessions:e,activeSessionId:t,onSelectSession:n,onNewSession:r,onArchiveSession:i,onRestoreSession:a,onDeleteSession:o,onClose:s}){let{recentSessions:c,earlierSessions:l,archivedSessions:u,activeSessions:d}=(0,C.useMemo)(()=>{let t=Date.now(),n=1440*60*1e3,r=e.filter(e=>e.status===`active`);return{recentSessions:r.filter(e=>t-e.lastActiveAt<n),earlierSessions:r.filter(e=>t-e.lastActiveAt>=n),archivedSessions:e.filter(e=>e.status===`archived`),activeSessions:r}},[e]);return(0,T.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[var(--app-border)] px-4 py-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-section-label`,children:`Sessions`}),(0,T.jsx)(`p`,{className:`mt-1 text-xs text-[var(--app-text-subtle)]`,children:`Switch context or reopen archived work.`})]}),(0,T.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:r,"aria-label":`New session`,children:[(0,T.jsx)(f,{size:14}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:`New`})]})]}),(0,T.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[d.length===0&&u.length===0&&(0,T.jsx)(`div`,{className:`px-2 py-6 text-center text-xs text-[var(--app-text-subtle)]`,children:`No sessions yet`}),c.length>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`mb-2 px-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-[var(--app-text-subtle)]`,children:`Today`}),(0,T.jsx)(`div`,{className:`space-y-1`,children:c.map(e=>(0,T.jsx)(O,{session:e,isActive:e.id===t,onSelect:()=>{n(e.id),s?.()},onArchive:()=>i(e.id),onRestore:()=>a(e.id),onDelete:()=>o(e.id)},e.id))})]}),l.length>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`mb-2 mt-4 px-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-[var(--app-text-subtle)]`,children:`Earlier`}),(0,T.jsx)(`div`,{className:`space-y-1`,children:l.map(e=>(0,T.jsx)(O,{session:e,isActive:e.id===t,onSelect:()=>{n(e.id),s?.()},onArchive:()=>i(e.id),onRestore:()=>a(e.id),onDelete:()=>o(e.id)},e.id))})]}),u.length>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`mb-2 mt-4 px-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-[var(--app-text-subtle)]`,children:`Archived`}),(0,T.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>(0,T.jsx)(O,{session:e,isActive:e.id===t,onSelect:()=>{n(e.id),s?.()},onArchive:()=>i(e.id),onRestore:()=>a(e.id),onDelete:()=>o(e.id)},e.id))})]})]})]})}var A=[{label:`Debug a failure`,value:`Review the most recent failed task and explain the next fix.`},{label:`Summarize status`,value:`Summarize the current system status, blockers, and active work.`},{label:`Plan a task`,value:`Break down the next implementation task into a concrete execution plan.`}];function j(){let e=w(e=>e.sessions),n=w(e=>e.activeSessionId),r=w(e=>e.messages),o=w(e=>e.sending),s=w(e=>e.fetchSessions),l=w(e=>e.sendMessage),p=w(e=>e.createSession),m=w(e=>e.archiveSession),h=w(e=>e.restoreSession),_=w(e=>e.deleteSession),y=w(e=>e.setActiveSession),O=w(e=>e.connectChatStream),j=w(e=>e.disconnectChatStream),N=(0,C.useRef)(null),[P,F]=(0,C.useState)(!1),I=S(1024),L=e.filter(e=>e.status===`active`),R=e.filter(e=>e.status===`archived`),z=e.length>0,B=r.length>0,V=e.find(e=>e.id===n)??null;(0,C.useEffect)(()=>{s()},[s]),(0,C.useEffect)(()=>(O(),()=>j()),[O,j]),(0,C.useEffect)(()=>{N.current?.scrollIntoView?.({behavior:`smooth`})},[r]),(0,C.useEffect)(()=>{I||F(!1)},[I]),(0,C.useEffect)(()=>{if(n||e.length===0)return;let t=[...e].filter(e=>e.status===`active`).sort((e,t)=>t.lastActiveAt-e.lastActiveAt)[0]??[...e].sort((e,t)=>t.lastActiveAt-e.lastActiveAt)[0];t&&y(t.id)},[n,e,y]);let H=async e=>{await l(e)};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-5`,children:[(0,T.jsx)(v,{title:`Chat`,description:z?`Resume the latest session, inspect context, and keep the composer in view.`:`Start the first session and use Adam as the working surface for review, debugging, and planning.`,compact:!0,className:`px-4 py-3 lg:px-4 lg:py-3`,actions:(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsxs)(g,{variant:`secondary`,size:`sm`,onClick:()=>void p(),children:[(0,T.jsx)(f,{size:14}),`New Session`]}),(0,T.jsxs)(g,{variant:`secondary`,size:`sm`,className:`lg:hidden`,onClick:()=>F(!0),"aria-label":`Manage sessions`,children:[(0,T.jsx)(a,{size:16}),`Sessions`]})]})}),P?(0,T.jsxs)(`div`,{className:`fixed inset-0 z-40 lg:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":`Session manager`,children:[(0,T.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:()=>F(!1)}),(0,T.jsxs)(`div`,{className:`relative z-50 h-full w-full max-w-sm border-r border-[var(--app-border)] bg-[var(--app-canvas)] shadow-[var(--app-shadow-lg)]`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[var(--app-border)] px-4 py-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-section-label`,children:`Sessions`}),(0,T.jsx)(`p`,{className:`mt-1 text-xs text-[var(--app-text-subtle)]`,children:`Switch, archive, restore, or start a new conversation.`})]}),(0,T.jsx)(g,{variant:`ghost`,size:`icon`,onClick:()=>F(!1),"aria-label":`Close session manager`,children:(0,T.jsx)(u,{size:16})})]}),(0,T.jsx)(k,{sessions:e,activeSessionId:n,onSelectSession:y,onNewSession:()=>{p(),F(!1)},onArchiveSession:e=>void m(e),onRestoreSession:e=>void h(e),onDeleteSession:e=>void _(e),onClose:()=>F(!1)})]})]}):null,(0,T.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden rounded-xl border border-[var(--app-border)] bg-[color-mix(in_oklch,var(--app-canvas)_88%,transparent)] shadow-[var(--app-shadow-lg)]`,children:[(0,T.jsx)(`div`,{className:`hidden w-72 flex-shrink-0 border-r border-[var(--app-border)] bg-[color-mix(in_oklch,var(--app-canvas)_90%,transparent)] lg:block`,children:(0,T.jsx)(k,{sessions:e,activeSessionId:n,onSelectSession:y,onNewSession:()=>void p(),onArchiveSession:e=>void m(e),onRestoreSession:e=>void h(e),onDeleteSession:e=>void _(e)})}),(0,T.jsxs)(`div`,{className:`flex flex-1 flex-col`,children:[(0,T.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4 lg:px-6`,children:B?(0,T.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-3`,children:[r.map(e=>(0,T.jsx)(E,{message:e},e.id)),(0,T.jsx)(`div`,{ref:N})]}):z?(0,T.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-4xl items-start`,children:(0,T.jsxs)(`div`,{className:`surface-panel-muted flex w-full flex-col gap-4 rounded-xl p-5`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(`p`,{className:`text-kicker`,children:`Working Surface`}),(0,T.jsx)(`h2`,{className:`text-xl font-semibold text-[var(--app-text)]`,children:V?`Session ${V.title??V.id.slice(0,8)}`:`Pick a session to continue`}),(0,T.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-[var(--app-text-muted)]`,children:V?`This session has no loaded transcript yet. Continue here or start a new thread without leaving the page.`:`Archived history exists, but no session is active. Select one from the rail or start a new conversation.`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-[var(--app-text-subtle)]`,children:[(0,T.jsxs)(`span`,{children:[L.length,` active`]}),(0,T.jsxs)(`span`,{children:[R.length,` archived`]})]})]}),(0,T.jsx)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:A.map(e=>(0,T.jsxs)(`button`,{type:`button`,onClick:()=>void H(e.value),className:`rounded-xl border border-[var(--app-border)] bg-white/[0.03] p-4 text-left transition-colors hover:border-[var(--app-border-strong)] hover:bg-white/[0.05]`,children:[(0,T.jsx)(`div`,{className:`text-sm font-semibold text-[var(--app-text)]`,children:e.label}),(0,T.jsx)(`div`,{className:`mt-1 text-sm leading-6 text-[var(--app-text-muted)]`,children:e.value})]},e.label))})]})}):(0,T.jsx)(b,{icon:(0,T.jsx)(t,{size:x.hero}),title:`Start a conversation with Adam`,description:`Use the starter prompts below to inspect recent work, diagnose failures, or create an execution plan.`,className:`h-full min-h-[24rem]`,action:(0,T.jsxs)(`div`,{className:`grid gap-3 text-left sm:grid-cols-3`,children:[(0,T.jsx)(M,{icon:i,title:`Inspect live status`,description:`Summarize active work, risk, and recent changes.`}),(0,T.jsx)(M,{icon:d,title:`Dig into a task`,description:`Review recent execution output and the next concrete step.`}),(0,T.jsx)(M,{icon:c,title:`Recover context`,description:`Continue from the latest session without losing history.`})]})})}),(0,T.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-4 pb-4 lg:px-6`,children:(0,T.jsx)(D,{onSend:H,disabled:o,starterActions:A,showStarterActions:!z&&!B,compact:z})})]})]})]})}function M({icon:e,title:t,description:n}){return(0,T.jsxs)(`div`,{className:`surface-panel-muted rounded-lg p-4`,children:[(0,T.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white/[0.05] text-[var(--app-kicker)]`,children:(0,T.jsx)(e,{size:x.lg})}),(0,T.jsx)(`div`,{className:`text-sm font-semibold text-[var(--app-text)]`,children:t}),(0,T.jsx)(`div`,{className:`mt-1 text-sm leading-6 text-[var(--app-text-muted)]`,children:n})]})}export{j as Chat};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{J as t,M as n,X as r,Z as i,ot as a,st as o}from"./vendor-icons-BlMaTTx3.js";import{r as s,t as c}from"./vendor-react-7e01TWy7.js";import{t as l}from"./vendor-state-Bj70wnRm.js";import{n as u,r as d,t as f}from"./index-pF--tN9F.js";import{i as p,n as m,r as h,t as g}from"./Card-C153tGfJ.js";import{t as _}from"./PageHeader-BMvN0xiB.js";import{t as v}from"./SectionHeader-CiCj3Is0.js";import{a as y,o as b,t as x}from"./format-CHfBBLog.js";var S=e(o(),1),C=c();function w(){let{tasks:e,goals:o,roles:c,stats:w,readiness:D,executionPool:O}=d(l(e=>({tasks:e.tasks,goals:e.goals,roles:e.roles,stats:e.stats,readiness:e.readiness,executionPool:e.executionPool}))),k=d(e=>e.fetchTasks),A=d(e=>e.fetchGoals),j=d(e=>e.fetchRoles),M=d(e=>e.fetchExecutionPool);(0,S.useEffect)(()=>{k(),A(),j(),M();let e=setInterval(()=>{k(),M()},5e3);return()=>clearInterval(e)},[k,A,j,M]);let N=e.filter(e=>e.status===`running`).length,P=e.filter(e=>e.status===`queued`||e.status===`pending`).length,F=e.filter(e=>e.status===`failed`).length,I=(0,S.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]),L=(0,S.useMemo)(()=>I.slice(0,4),[I]),R=(0,S.useMemo)(()=>I.find(e=>e.status===`failed`)||I.find(e=>e.status===`running`)||I[0],[I]),z=(0,S.useMemo)(()=>D?Object.entries(D.checks):[],[D]),B=(0,S.useMemo)(()=>z.filter(([,e])=>e).length,[z]),V=R?.roleId?c.find(e=>e.id===R.roleId)?.name??R.roleId.slice(0,8):`Unassigned`,H=R?`/tasks/${R.id}`:`/work`,U=R?`Open task`:`Open work`,W=R?R.status===`failed`?`Review the failed task before queueing more work.`:R.status===`running`?`Track this active run and its next result.`:`Use the latest completed run as the starting point for follow-up work.`:`Queue work, review recent runs, or launch an automation.`,G=R?R.status===`failed`?`surface-critical`:R.status===`running`?`surface-accent`:`surface-panel-elevated`:`surface-panel-muted`,K=G===`surface-critical`?`critical`:G===`surface-accent`?`accent`:`neutral`,q=K===`accent`||K===`critical`,J=q?`text-white`:`text-[var(--app-text)]`,Y=q?`text-white/70`:`text-[var(--app-text-subtle)]`,X=q?`text-white/76`:`text-[var(--app-text-muted)]`;return(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsx)(_,{title:`Dashboard`,description:`Queue health, execution readiness, and the next task that needs attention.`,metrics:[{label:`Server`,value:D?.status===`ready`?`Ready`:`Attention`},{label:`Running`,value:w.activeTasks||N},{label:`Queued`,value:w.queuedTasks||P},{label:`Goals`,value:o.length},{label:`Execution Pool`,value:`${O.active}/${O.max} | ${O.queued} queued`}],compact:!0,className:`px-4 py-3 lg:px-4 lg:py-3`,actions:D?(0,C.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:(0,C.jsx)(f,{variant:D.status===`ready`?`success`:`destructive`,children:D.status===`ready`?`Server Ready`:`Not Ready`})}):null}),(0,C.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-2`,children:[(0,C.jsxs)(g,{className:`${G} self-start ${q?`text-white`:``}`,children:[(0,C.jsxs)(h,{className:`mb-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`text-kicker ${Y}`,children:`Current Focus`}),(0,C.jsx)(p,{className:`mt-2 ${J}`,children:R?b(R.prompt,92):`No active blockers`})]}),R?(0,C.jsx)(f,{variant:u(R.status),children:R.status}):null]}),(0,C.jsx)(m,{className:X,children:W}),(0,C.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[repeat(3,minmax(0,1fr))_auto]`,children:[(0,C.jsx)(E,{tone:K,label:`Created`,value:R?y(R.createdAt):`Idle`}),(0,C.jsx)(E,{tone:K,label:`Cost`,value:R?.costUsd==null?`No cost`:x(R.costUsd)}),(0,C.jsx)(E,{tone:K,label:`Role`,value:V}),(0,C.jsx)(s,{to:H,className:`inline-flex items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${q?`border-white/20 bg-white/10 text-white hover:bg-white/14`:`border-[var(--app-border)] bg-white/[0.05] text-[var(--app-text)] hover:border-[var(--app-border-strong)]`}`,children:U})]})]}),(0,C.jsxs)(g,{className:`surface-panel-elevated self-start`,children:[(0,C.jsx)(v,{title:`System Checks`,description:`${B}/${z.length||0} checks passing`,compact:!0}),D?(0,C.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:Object.entries(D.checks).map(([e,n])=>(0,C.jsxs)(`div`,{className:`surface-panel-muted flex items-center justify-between rounded-lg px-3 py-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(t,{size:10,className:n?`fill-[var(--app-success)] text-[var(--app-success)]`:`fill-[var(--app-danger)] text-[var(--app-danger)]`}),(0,C.jsx)(`span`,{className:`text-sm capitalize text-[var(--app-text)]`,children:e})]}),(0,C.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:n?`healthy`:`attention`})]},e))}):(0,C.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Loading...`})]})]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,role:`region`,"aria-label":`Server statistics`,children:[(0,C.jsx)(T,{icon:n,label:`Active Tasks`,value:w.activeTasks||N,color:`text-[var(--app-accent)]`}),(()=>{let e=c.filter(e=>e.status===`active`).length,t=c.length,n=c.filter(e=>e.status===`probation`).length,r=c.filter(e=>e.status===`retired`).length,i=[n>0?`${n} probation`:``,r>0?`${r} retired`:``].filter(Boolean).join(` · `);return(0,C.jsx)(T,{icon:a,label:`Role Health`,value:i?`${e}/${t} | ${i}`:`${e}/${t}`,color:r>0?`text-[var(--app-danger)]`:n>0?`text-[var(--app-warning)]`:`text-[var(--app-success)]`})})(),(0,C.jsx)(T,{icon:i,label:`Failed`,value:F,color:`text-[var(--app-danger)]`}),(0,C.jsx)(T,{icon:r,label:`Cost Today`,value:x(w.totalCostToday),color:`text-[var(--app-accent-strong)]`})]}),(0,C.jsxs)(g,{padding:!1,children:[(0,C.jsx)(`div`,{className:`px-4 pt-4`,children:(0,C.jsx)(v,{title:`Recent Tasks`,description:`Latest executions across the control plane.`,action:(0,C.jsx)(s,{to:`/work`,className:`text-sm font-medium text-[var(--app-accent-strong)] hover:underline`,children:`View all`})})}),(0,C.jsx)(`div`,{className:`mt-4 space-y-3 px-4 pb-4`,children:L.length===0?(0,C.jsx)(`div`,{className:`surface-panel-muted rounded-lg px-4 py-6 text-sm text-[var(--app-text-subtle)]`,children:`No tasks yet`}):L.map(e=>(0,C.jsxs)(s,{to:`/tasks/${e.id}`,className:`surface-panel-muted flex flex-col gap-3 rounded-lg px-4 py-4 transition-colors hover:border-[var(--app-border-strong)] hover:bg-white/[0.05] lg:flex-row lg:items-start lg:justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(f,{variant:u(e.status),children:e.status}),(0,C.jsx)(`span`,{className:`font-mono text-xs text-[var(--app-text-subtle)]`,children:e.id.slice(0,8)}),e.roleId?(0,C.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`role `,e.roleId.slice(0,12)]}):null]}),(0,C.jsx)(`div`,{className:`text-sm font-medium text-[var(--app-text)]`,children:b(e.prompt,128)})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 text-xs text-[var(--app-text-subtle)]`,children:[(0,C.jsx)(`span`,{children:y(e.createdAt)}),(0,C.jsx)(`span`,{children:e.costUsd==null?`no cost`:x(e.costUsd)})]})]},e.id))})]})]})}function T({icon:e,label:t,value:n,color:r}){return(0,C.jsxs)(g,{className:`surface-panel-muted flex items-center gap-3`,children:[(0,C.jsx)(`div`,{className:`rounded-lg bg-white/[0.05] p-3 ${r}`,children:(0,C.jsx)(e,{size:16})}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-xl font-semibold text-[var(--app-text)]`,children:n}),(0,C.jsx)(`div`,{className:`text-xs uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:t})]})]})}function E({label:e,value:t,tone:n=`accent`}){let r=n===`accent`||n===`critical`;return(0,C.jsxs)(`div`,{className:r?`rounded-lg border border-white/12 bg-black/10 px-3 py-3`:`surface-focus-metric rounded-lg px-3 py-3`,children:[(0,C.jsx)(`div`,{className:r?`text-[10px] uppercase tracking-[0.16em] text-white/62`:`text-[10px] uppercase tracking-[0.16em] text-[var(--app-text-subtle)]`,children:e}),(0,C.jsx)(`div`,{className:r?`mt-1 text-lg font-semibold text-white`:`mt-1 text-lg font-semibold text-[var(--app-text)]`,children:t})]})}export{w as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./vendor-react-7e01TWy7.js";import{i as t}from"./dist-Bdqp1ixJ.js";var n=e();function r({icon:e,title:r,description:i,action:a,compact:o=!1,className:s}){return(0,n.jsxs)(`div`,{className:t(`surface-panel-muted flex flex-col items-center justify-center rounded-xl text-center`,o?`px-5 py-6`:`px-6 py-10`,s),children:[e&&(0,n.jsx)(`div`,{className:t(`text-[var(--app-text-subtle)]`,o?`mb-3`:`mb-4`),children:e}),(0,n.jsx)(`h3`,{className:`text-base font-semibold text-[var(--app-text)]`,children:r}),i&&(0,n.jsx)(`p`,{className:t(`max-w-md text-sm text-[var(--app-text-muted)]`,o?`mt-1.5 leading-5`:`mt-2 leading-6`),children:i}),a&&(0,n.jsx)(`div`,{className:t(o?`mt-3`:`mt-4`),children:a})]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{H as t,V as n,a as r,o as i,st as a,x as o}from"./vendor-icons-BlMaTTx3.js";import{t as s}from"./vendor-react-7e01TWy7.js";import{i as c,n as l}from"./dist-Bdqp1ixJ.js";import{t as u}from"./Button-BjXgrQ95.js";import{i as d}from"./index-pF--tN9F.js";import{i as f,r as p,t as m}from"./Card-C153tGfJ.js";import{t as h}from"./ui-B_uMx2Fy.js";var g=e(a(),1),_=s(),v=g.forwardRef(({className:e,type:t,...n},r)=>(0,_.jsx)(`input`,{type:t,className:c(`flex h-8 w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));v.displayName=`Input`;var y=/^[A-Za-z_][A-Za-z0-9_]*$/,b=/key|token|secret|password|credential/i;function x({envVars:e,onSave:a,mode:s,roleId:c,title:x=`Environment Variables`}){let[S,C]=(0,g.useState)([]),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(new Set),[O,k]=(0,g.useState)([]),[A,j]=(0,g.useState)(!1);(0,g.useEffect)(()=>{C(Object.entries(e??{}).map(([e,t])=>({key:e,value:t,isNew:!1})))},[e]);let M=(0,g.useCallback)(async()=>{try{let e=await l(s===`global`?`/config/env-diff`:`/roles/${c}/env-diff`);k(s===`global`?e.diffs.filter(e=>e.configPath?.startsWith(`defaults.env.`)):e.diffs),j(e.envFileExists)}catch{}},[s,c]);(0,g.useEffect)(()=>{M()},[M]);let N=()=>{let t=Object.fromEntries(S.filter(e=>e.key.trim()).map(e=>[e.key,e.value]));return JSON.stringify(t)!==JSON.stringify(e)},P=()=>{C(e=>[...e,{key:``,value:``,isNew:!0}])},F=e=>{C(t=>t.filter((t,n)=>n!==e))},I=(e,t,n)=>{C(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))},L=e=>{D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},R=()=>{let e=new Set;for(let t of S){let n=t.key.trim();if(n){if(!y.test(n))return`Invalid key format: "${n}"`;if(n.startsWith(`ANTHROPIC_`))return`ANTHROPIC_* keys are managed in the Anthropic section`;if(e.has(n))return`Duplicate key: "${n}"`;e.add(n)}}return e.size>100?`Maximum 100 environment variables`:null},z=async()=>{let e=R();if(e){d.error(e);return}T(!0);try{let e={};for(let t of S){let n=t.key.trim();n&&(e[n]=t.value)}s===`global`?await l(`/config/env`,{method:`PUT`,body:JSON.stringify(e)}):await l(`/roles/${c}`,{method:`PATCH`,body:JSON.stringify({envVars:e})}),d.success(`Environment variables saved`),a(),M()}catch(e){d.error(e instanceof Error?e.message:`Failed to save`)}finally{T(!1)}},B=async()=>{try{await l(s===`global`?`/config/sync-to-env`:`/roles/${c}/sync-to-env`,{method:`POST`}),d.success(`Synced DB to .env`),M()}catch(e){d.error(e instanceof Error?e.message:`Sync failed`)}},V=async()=>{try{await l(s===`global`?`/config/load-from-env`:`/roles/${c}/load-from-env`,{method:`POST`}),d.success(`Loaded .env to DB`),a(),M()}catch(e){d.error(e instanceof Error?e.message:`Load failed`)}};return(0,_.jsxs)(m,{children:[(0,_.jsxs)(p,{children:[(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsx)(f,{className:`text-sm`,children:x}),(0,_.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,_.jsxs)(u,{variant:`ghost`,size:`sm`,onClick:P,children:[(0,_.jsx)(o,{size:h.sm}),`Add`]}),N()&&(0,_.jsx)(u,{size:`sm`,onClick:()=>void z(),disabled:w,children:w?`Saving...`:`Save`})]})]}),s===`global`&&(0,_.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] mt-1`,children:`ANTHROPIC_* variables are managed in the Anthropic section above.`})]}),O.length>0&&A&&(0,_.jsx)(`div`,{className:`mx-4 mb-3 rounded border border-[var(--app-warning-soft-border)] bg-[var(--app-warning-soft-bg)] p-3`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,_.jsx)(r,{size:14,className:`text-[var(--app-warning)]`}),(0,_.jsxs)(`span`,{className:`text-xs text-[var(--app-warning)]`,children:[`.env and DB differ on `,O.length,` key(s): `,O.map(e=>e.envKey).join(`, `)]})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-end`,children:[(0,_.jsx)(u,{variant:`ghost`,size:`sm`,className:`text-xs`,onClick:()=>void B(),children:`DB → .env`}),(0,_.jsx)(u,{variant:`ghost`,size:`sm`,className:`text-xs`,onClick:()=>void V(),children:`.env → DB`})]})]})}),(0,_.jsxs)(`div`,{className:`px-4 pb-4 space-y-2`,children:[S.length===0&&(0,_.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] py-2`,children:`No environment variables configured.`}),S.map((e,r)=>{let a=b.test(e.key),o=E.has(e.key)||e.isNew;return(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center`,children:[(0,_.jsx)(v,{className:`w-full font-mono text-xs md:w-48`,placeholder:`KEY_NAME`,value:e.key,onChange:e=>I(r,`key`,e.target.value)}),(0,_.jsx)(`span`,{className:`hidden text-[var(--app-text-subtle)] md:inline`,children:`=`}),(0,_.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,_.jsx)(v,{className:`font-mono text-xs pr-8`,type:a&&!o?`password`:`text`,placeholder:`value`,value:e.value,onChange:e=>I(r,`value`,e.target.value)}),a&&(0,_.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`,onClick:()=>L(e.key),children:o?(0,_.jsx)(t,{size:12}):(0,_.jsx)(n,{size:12})})]}),(0,_.jsx)(u,{variant:`ghost`,size:`sm`,className:`self-end text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)] md:self-auto`,onClick:()=>F(r),children:(0,_.jsx)(i,{size:14})})]},r)})]})]})}export{x as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{R as t,st as n,v as r}from"./vendor-icons-BlMaTTx3.js";import{t as i}from"./vendor-react-7e01TWy7.js";import{n as a}from"./dist-Bdqp1ixJ.js";import{t as o}from"./Button-BjXgrQ95.js";import{r as s,t as c}from"./index-pF--tN9F.js";import{t as l}from"./Card-C153tGfJ.js";import{t as u}from"./PageHeader-BMvN0xiB.js";import{a as d}from"./format-CHfBBLog.js";import{t as f}from"./EmptyState-CXwJFCDQ.js";var p=e(n(),1),m=i();function h(){let e=s(e=>e.roles),n=s(e=>e.fetchRoles),[i,h]=(0,p.useState)([]),[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(`all`);(0,p.useEffect)(()=>{n()},[n]);let b=(0,p.useCallback)(async()=>{_(!0);try{let e=new URLSearchParams({limit:`50`});v!==`all`&&e.set(`roleId`,v),h(await a(`/evolution-audit?${e}`))}catch{h([])}finally{_(!1)}},[v]);(0,p.useEffect)(()=>{b()},[b]);let x=t=>t?e.find(e=>e.id===t)?.name??t.slice(0,8):`System`;return(0,m.jsxs)(`div`,{className:`space-y-5`,children:[(0,m.jsx)(u,{eyebrow:`Learning`,title:`Evolution Audit`,compact:!0,description:`Rule mutations and diagnostic reports across roles.`,metrics:[{label:`Visible`,value:i.length},{label:`Role Filter`,value:v===`all`?`All`:x(v)},{label:`Catalog`,value:e.length}],actions:(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsxs)(`select`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:v,onChange:e=>y(e.target.value),children:[(0,m.jsx)(`option`,{value:`all`,children:`All roles`}),e.map(e=>(0,m.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,m.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:(0,m.jsx)(r,{size:14})})]})}),(0,m.jsx)(l,{children:g?(0,m.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,m.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):i.length===0?(0,m.jsx)(f,{icon:(0,m.jsx)(t,{size:32}),title:`No evolution records`,description:`Evolution occurs when roles accumulate enough task experience.`,className:`py-8`}):(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[i.length,` records`]}),i.map(e=>(0,m.jsxs)(`div`,{className:`rounded border border-[var(--app-border)] p-3`,children:[(0,m.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,m.jsx)(c,{variant:`info`,children:x(e.roleId)}),(0,m.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:d(e.timestamp)}),e.triggerTaskId&&(0,m.jsxs)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:[`triggered by task `,e.triggerTaskId.slice(0,8)]})]}),e.diff.includes(`--- Diagnostic Report ---`)?(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsxs)(`div`,{className:`rounded bg-[var(--app-canvas)] p-2`,children:[(0,m.jsx)(`p`,{className:`mb-1 text-[10px] font-medium text-[var(--app-text-muted)]`,children:`Diagnostic Report`}),(0,m.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs text-[var(--app-text-muted)]`,children:e.diff.split(`--- Rules Diff ---`)[0]?.replace(`--- Diagnostic Report ---
|
|
2
|
+
`,``).trim()})]}),(0,m.jsxs)(`div`,{className:`rounded bg-[var(--app-canvas)] p-2`,children:[(0,m.jsx)(`p`,{className:`mb-1 text-[10px] font-medium text-[var(--app-text-muted)]`,children:`Rules Changes`}),(0,m.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap font-mono text-xs`,children:(e.diff.split(`--- Rules Diff ---`)[1]??``).trim().split(`
|
|
3
|
+
`).map((e,t)=>(0,m.jsxs)(`span`,{className:e.startsWith(`+`)?`text-[var(--app-success)]`:e.startsWith(`-`)?`text-[var(--app-danger)]`:`text-[var(--app-text-muted)]`,children:[e,`
|
|
4
|
+
`]},t))})]})]}):(0,m.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap rounded bg-[var(--app-canvas)] p-2 font-mono text-xs`,children:e.diff.split(`
|
|
5
|
+
`).map((e,t)=>(0,m.jsxs)(`span`,{className:e.startsWith(`+`)?`text-[var(--app-success)]`:e.startsWith(`-`)?`text-[var(--app-danger)]`:`text-[var(--app-text-muted)]`,children:[e,`
|
|
6
|
+
`]},t))})]},e.id))]})})]})}export{h as Evolution};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{F as t,G as n,K as r,c as i,it as a,st as o}from"./vendor-icons-BlMaTTx3.js";import{f as s,r as c,t as l}from"./vendor-react-7e01TWy7.js";import{n as u}from"./dist-Bdqp1ixJ.js";import{t as d}from"./index-pF--tN9F.js";import{i as f,r as p,t as m}from"./Card-C153tGfJ.js";import{t as h}from"./PageHeader-BMvN0xiB.js";import{t as g}from"./SectionHeader-CiCj3Is0.js";import{n as _}from"./format-CHfBBLog.js";var v=e(o(),1),y=l();function b(){let{id:e}=s(),[o,l]=(0,v.useState)(null),[b,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(null);if((0,v.useEffect)(()=>{e&&(async()=>{try{let t=await u(`/goals/${e}`);l(t.goal),w(null);try{S((await u(`/strategies?role=${t.goal.roleId}`)).strategies??[])}catch{}}catch(e){w(e instanceof Error?e.message:`Failed to load goal`)}})()},[e]),C)return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Goals`]}),(0,y.jsx)(m,{className:`text-center text-[var(--app-danger)]`,children:C})]});if(!o)return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Goals`]}),(0,y.jsx)(m,{className:`text-center text-[var(--app-text-subtle)]`,children:`Loading...`})]});let T=o.targetValue>0?Math.min(100,o.currentValue/o.targetValue*100):0,E=o.deadline>0&&o.deadline<Date.now()&&o.status!==`completed`;return(0,y.jsxs)(`div`,{className:`space-y-5`,children:[(0,y.jsxs)(c,{to:`/goals`,className:`flex items-center gap-1.5 text-sm text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,children:[(0,y.jsx)(a,{size:14}),` Back to Goals`]}),(0,y.jsx)(h,{eyebrow:`Goal`,title:o.name,compact:!0,description:o.description||`Progress, delivery targets, and strategy support before raw metrics.`,metrics:[{label:`Status`,value:(0,y.jsx)(d,{variant:(e=>e===`completed`?`success`:e===`executing`||e===`evaluating`?`warning`:e===`failed`?`destructive`:`secondary`)(o.status),children:o.status})},{label:`Role`,value:o.roleId},{label:`Metric`,value:o.metricType},{label:`Progress`,value:`${T.toFixed(1)}%`}]}),(0,y.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Goal ID`}),(0,y.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-[var(--app-text)]`,children:o.id})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Current delta`}),(0,y.jsx)(`p`,{className:`mt-2 text-2xl font-semibold text-[var(--app-text)]`,children:Math.max(o.targetValue-o.currentValue,0)})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Strategies in play`}),(0,y.jsx)(`p`,{className:`mt-2 text-2xl font-semibold text-[var(--app-text)]`,children:b.length})]}),(0,y.jsxs)(m,{className:`surface-panel-muted`,children:[(0,y.jsx)(`p`,{className:`text-section-label`,children:`Deadline state`}),(0,y.jsx)(`p`,{className:`mt-2 text-sm font-medium ${E?`text-[var(--app-danger-soft-text)]`:`text-[var(--app-text)]`}`,children:E?`Overdue`:`On track`})]})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,y.jsx)(x,{icon:i,label:`Progress`,value:`${o.currentValue} / ${o.targetValue}`}),(0,y.jsx)(x,{icon:r,label:E?`Overdue`:`Deadline`,value:_(o.deadline),mono:!0}),(0,y.jsx)(x,{icon:n,label:`Budget`,value:`$${o.budgetUsd.toFixed(2)}`}),(0,y.jsx)(x,{icon:t,label:`Created`,value:_(o.createdAt),mono:!0})]}),(0,y.jsx)(g,{title:`Progress`,compact:!0,description:`Completion first, then delivery targets and strategy support.`}),(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsx)(f,{children:`Progress`})}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`flex-1 h-3 rounded-full bg-[var(--app-panel-muted)] overflow-hidden`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full transition-[width] ${E?`bg-[var(--app-danger)]`:`bg-[var(--app-accent)]`}`,style:{width:`${T}%`}})}),(0,y.jsxs)(`span`,{className:`text-sm text-[var(--app-text)] font-mono`,children:[T.toFixed(1),`%`]})]}),(0,y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between text-xs text-[var(--app-text-subtle)]`,children:[(0,y.jsxs)(`span`,{children:[o.currentValue,` current`]}),(0,y.jsxs)(`span`,{children:[o.targetValue,` target`]})]})]}),(o.deliverTo??[]).length>0&&(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsx)(f,{children:`Delivery Targets`})}),(0,y.jsx)(`div`,{className:`space-y-1.5`,children:(o.deliverTo??[]).map((e,t)=>(0,y.jsx)(`div`,{className:`flex items-center gap-2 text-sm text-[var(--app-text)]`,children:e.type===`channel`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{variant:`outline`,children:`Channel`}),(0,y.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,y.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{variant:`outline`,children:`Session`}),(0,y.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Chat session`})]})},t))})]}),b.length>0&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(g,{title:`Strategy Support`,compact:!0,description:`Strategy candidates already associated with the goal's role.`}),(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:(0,y.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,y.jsx)(t,{size:14}),` Strategies (`,b.length,`)`]})}),(0,y.jsx)(`div`,{className:`space-y-2`,children:b.map(e=>(0,y.jsxs)(`div`,{className:`flex items-center justify-between text-sm border-b border-[var(--app-border)] pb-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.name}),(0,y.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:e.taskType})]}),(0,y.jsxs)(d,{variant:`outline`,children:[e.trialCount,` trials`]})]},e.id))})]})]})]})}function x({icon:e,label:t,value:n,mono:r}){return(0,y.jsxs)(m,{className:`flex flex-col gap-1`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[var(--app-text-subtle)]`,children:[(0,y.jsx)(e,{size:12}),(0,y.jsx)(`span`,{className:`text-xs`,children:t})]}),(0,y.jsx)(`span`,{className:`text-sm text-[var(--app-text)] truncate ${r?`font-mono text-xs`:``}`,children:n})]})}export{b as GoalDetail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{E as t,T as n,c as r,o as i,st as a,t as o,v as s,w as c,x as l}from"./vendor-icons-BlMaTTx3.js";import{t as u}from"./vendor-react-7e01TWy7.js";import{n as d}from"./dist-Bdqp1ixJ.js";import{a as f,c as p,i as m,l as ee,n as te,o as h,r as g,s as _,t as v}from"./AlertDialog-r3y6IhpW.js";import{t as y}from"./Button-BjXgrQ95.js";import{i as b,n as ne,r as x,t as S}from"./index-pF--tN9F.js";import{i as C,r as re,t as w}from"./Card-C153tGfJ.js";import{t as T}from"./PageHeader-BMvN0xiB.js";import{n as E,t as D}from"./format-CHfBBLog.js";import{t as O}from"./EmptyState-CXwJFCDQ.js";var k=e(a(),1),A=u();function j({value:e,onChange:t,label:n=`Delivery Targets`}){let[r,i]=(0,k.useState)([]),[a,o]=(0,k.useState)(!1);(0,k.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,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:n}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>o(!a),className:`mt-1 w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-left text-sm text-[var(--app-text)] hover:border-[var(--app-border-strong)] focus:border-[var(--app-accent)] focus:outline-none`,children:l===0?`Default (current session)`:`${l} channel${l>1?`s`:``} selected`}),a&&(0,A.jsxs)(`div`,{className:`absolute z-10 mt-1 w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] py-1 shadow-lg`,children:[r.length===0?(0,A.jsx)(`div`,{className:`px-3 py-2 text-xs text-[var(--app-text-subtle)]`,children:`No active channel conversations. Start a chat on WeChat/Telegram first.`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`px-3 py-1 text-xs text-[var(--app-text-subtle)]`,children:`Channel conversations`}),r.map(e=>(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 px-3 py-1.5 text-xs text-[var(--app-text)] hover:bg-[var(--app-panel-muted)]`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:s(e.channelId,e.chatId),onChange:()=>c(e.channelId,e.chatId),className:`rounded border-[var(--app-border-strong)] bg-[var(--app-panel-muted)]`}),(0,A.jsx)(`span`,{className:`truncate font-medium`,children:e.channelName}),(0,A.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`(`,e.platform,`)`]})]},`${e.channelId}:${e.chatId}`))]}),l>0&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>{t([]),o(!1)},className:`mt-1 w-full border-t border-[var(--app-border)] px-3 py-1 text-left text-xs text-[var(--app-danger)] hover:bg-[var(--app-panel-muted)]`,children:`Clear all`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:`w-full border-t border-[var(--app-border)] px-3 py-1 text-left text-xs text-[var(--app-text-subtle)] hover:bg-[var(--app-panel-muted)]`,children:`Done`})]})]})}var M={active:`paused`,paused:`active`,completed:`active`,failed:`active`},N={active:(0,A.jsx)(t,{size:12}),paused:(0,A.jsx)(c,{size:12}),completed:(0,A.jsx)(s,{size:12}),failed:(0,A.jsx)(s,{size:12})};function P(){let e=x(e=>e.goals),t=x(e=>e.fetchGoals),a=x(e=>e.updateGoal),u=x(e=>e.deleteGoal),[P,F]=(0,k.useState)(!1),[I,L]=(0,k.useState)(``),[R,z]=(0,k.useState)(!1),[B,V]=(0,k.useState)(null),[H,U]=(0,k.useState)(null),[W,G]=(0,k.useState)(``),[K,q]=(0,k.useState)(``),[J,Y]=(0,k.useState)([]),[X,Z]=(0,k.useState)([]),[Q,ie]=(0,k.useState)([]),[$,ae]=(0,k.useState)([]),oe=e.filter(e=>e.status===`active`).length,se=e.filter(e=>e.status===`paused`).length,ce=e.filter(e=>e.status===`completed`).length;(0,k.useEffect)(()=>{t();let e=setInterval(()=>void t(),1e4);return()=>clearInterval(e)},[t]);let le=async()=>{if(I.trim()){z(!0),V(null);try{await d(`/goals`,{method:`POST`,body:JSON.stringify({input:I.trim(),deliverTo:Q.length>0?Q:void 0,reportTo:$.length>0?$:void 0})}),L(``),F(!1),t()}catch(e){V(e instanceof Error?e.message:`Failed to create goal`)}finally{z(!1)}}};return(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsx)(T,{eyebrow:`Operations`,title:`Goals`,compact:!0,description:`Long-running outcomes, budgets, and delivery targets.`,metrics:[{label:`Active`,value:oe},{label:`Paused`,value:se},{label:`Completed`,value:ce}],actions:(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsx)(y,{variant:`ghost`,size:`sm`,onClick:()=>void t(),children:(0,A.jsx)(s,{size:14})}),(0,A.jsxs)(y,{size:`sm`,onClick:()=>F(!P),children:[(0,A.jsx)(l,{size:14}),`New Goal`]})]})}),P&&(0,A.jsxs)(w,{className:`space-y-3`,children:[(0,A.jsx)(`textarea`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-2 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Describe your goal in natural language...`,rows:3,value:I,onChange:e=>L(e.target.value)}),(0,A.jsx)(j,{value:Q,onChange:ie,label:`Deliver To (results)`}),(0,A.jsx)(j,{value:$,onChange:ae,label:`Report To (status)`}),B&&(0,A.jsx)(`p`,{className:`text-xs text-[var(--app-danger)]`,children:B}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsx)(y,{onClick:()=>void le(),disabled:R||!I.trim(),children:R?`Creating...`:`Create`}),(0,A.jsx)(y,{variant:`ghost`,onClick:()=>F(!1),children:`Cancel`})]})]}),e.length===0?(0,A.jsx)(O,{icon:(0,A.jsx)(r,{size:32}),title:`No goals`,description:`Create a goal to start goal-driven task orchestration`}):(0,A.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,r=new Date(e.deadline).getTime()<Date.now()&&e.status!==`completed`,s=H===e.id;return(0,A.jsxs)(w,{children:[(0,A.jsxs)(re,{children:[s?(0,A.jsx)(`input`,{className:`flex-1 rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:W,onChange:e=>G(e.target.value),autoFocus:!0}):(0,A.jsx)(C,{className:`max-w-full text-[var(--app-text)] text-sm font-medium truncate sm:max-w-[180px]`,children:e.name}),(0,A.jsx)(S,{variant:ne(e.status),children:e.status})]}),s?(0,A.jsx)(`textarea`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none mb-3`,placeholder:`Description...`,rows:2,value:K,onChange:e=>q(e.target.value)}):e.description?(0,A.jsx)(`p`,{className:`text-xs text-[var(--app-text-muted)] mb-3 line-clamp-2`,children:e.description}):null,s&&(0,A.jsxs)(`div`,{className:`mb-3 space-y-2`,children:[(0,A.jsx)(j,{value:J,onChange:Y,label:`Deliver To (results)`}),(0,A.jsx)(j,{value:X,onChange:Z,label:`Report To (status)`})]}),(0,A.jsxs)(`div`,{className:`mb-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,A.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Progress`}),(0,A.jsxs)(`span`,{className:`font-mono text-xs text-[var(--app-text)]`,children:[t,`%`]})]}),(0,A.jsx)(`div`,{className:`h-1.5 rounded-full bg-[var(--app-panel-elevated)]`,children:(0,A.jsx)(`div`,{className:`h-full rounded-full transition-[width] ${t>=100?`bg-[var(--app-success)]`:`bg-[var(--app-accent)]`}`,style:{width:`${t}%`}})}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,A.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--app-text-subtle)]`,children:[e.currentValue,` / `,e.targetValue]}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--app-text-subtle)]`,children:e.metricType})]})]}),(0,A.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,A.jsxs)(`div`,{className:`flex justify-between`,children:[(0,A.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Role`}),(0,A.jsx)(S,{variant:`muted`,className:`text-[10px]`,children:e.roleId})]}),(0,A.jsxs)(`div`,{className:`flex justify-between`,children:[(0,A.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Budget`}),(0,A.jsx)(`span`,{className:`font-mono text-[var(--app-text)]`,children:D(e.budgetUsd)})]}),(0,A.jsxs)(`div`,{className:`flex justify-between`,children:[(0,A.jsx)(`span`,{className:`text-[var(--app-text-subtle)] ${r?`text-[var(--app-danger)]`:``}`,children:`Deadline`}),(0,A.jsx)(`span`,{className:`text-[var(--app-text)] ${r?`text-[var(--app-danger)]`:``}`,children:E(e.deadline)})]}),(0,A.jsxs)(`div`,{className:`flex justify-between`,children:[(0,A.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Created`}),(0,A.jsx)(`span`,{className:`text-[var(--app-text-muted)]`,children:E(e.createdAt)})]})]}),(0,A.jsx)(`div`,{className:`flex items-center gap-1 mt-3 pt-3 border-t border-[var(--app-border)]`,children:s?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(y,{size:`sm`,variant:`ghost`,onClick:async()=>{try{await a(e.id,{name:W,description:K,deliverTo:J,reportTo:X}),U(null),b.success(`Goal updated`)}catch(e){b.error(e instanceof Error?e.message:`Failed to update`)}},children:`Save`}),(0,A.jsx)(y,{size:`sm`,variant:`ghost`,onClick:()=>U(null),children:(0,A.jsx)(o,{size:14})})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(y,{size:`sm`,variant:`ghost`,title:`Edit`,onClick:()=>{U(e.id),G(e.name),q(e.description??``),Y(e.deliverTo??[]),Z(e.reportTo??[])},children:(0,A.jsx)(n,{size:14})}),(0,A.jsxs)(y,{size:`sm`,variant:`ghost`,title:`Change to ${M[e.status]}`,onClick:async()=>{try{await a(e.id,{status:M[e.status]}),b.success(`Status changed to ${M[e.status]}`)}catch(e){b.error(e instanceof Error?e.message:`Failed to update status`)}},children:[N[e.status]??(0,A.jsx)(c,{size:12}),(0,A.jsx)(`span`,{className:`text-xs`,children:M[e.status]})]}),(0,A.jsx)(`div`,{className:`ml-auto`,children:(0,A.jsxs)(v,{children:[(0,A.jsx)(ee,{asChild:!0,children:(0,A.jsx)(y,{size:`sm`,variant:`ghost`,title:`Delete`,className:`text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,children:(0,A.jsx)(i,{size:14})})}),(0,A.jsxs)(m,{children:[(0,A.jsxs)(_,{children:[(0,A.jsx)(p,{children:`Delete goal`}),(0,A.jsxs)(f,{children:[`This will permanently delete "`,e.name,`". This action cannot be undone.`]})]}),(0,A.jsxs)(h,{children:[(0,A.jsx)(g,{children:`Cancel`}),(0,A.jsx)(te,{className:`bg-[var(--app-danger)] hover:bg-[var(--app-danger-strong)]`,onClick:async()=>{try{await u(e.id),b.success(`Goal deleted`)}catch(e){b.error(e instanceof Error?e.message:`Failed to delete`)}},children:`Delete`})]})]})]})})]})})]},e.id)})})]})}export{P as Goals,j as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{E as t,U as n,s as r,st as i,w as a}from"./vendor-icons-BlMaTTx3.js";import{t as o}from"./vendor-react-7e01TWy7.js";import{t as s}from"./Button-BjXgrQ95.js";import{r as c}from"./index-pF--tN9F.js";import{t as l}from"./Card-C153tGfJ.js";import{t as u}from"./PageHeader-BMvN0xiB.js";import{t as d}from"./EmptyState-CXwJFCDQ.js";import{t as f}from"./ui-B_uMx2Fy.js";var p=e(i(),1),m=o(),h={debug:`text-[var(--app-text-subtle)]`,info:`text-[var(--app-accent)]`,warn:`text-[var(--app-warning)]`,error:`text-[var(--app-danger)]`},g={adam:`text-[var(--app-log-adam)]`,manager:`text-[var(--app-log-manager)]`,worker:`text-[var(--app-success)]`,scheduler:`text-[var(--app-log-scheduler)]`,api:`text-[var(--app-accent)]`,ws:`text-[var(--app-log-ws)]`,store:`text-[var(--app-log-store)]`,embedding:`text-[var(--app-log-embedding)]`},_=[`adam`,`manager`,`worker`,`scheduler`,`api`,`ws`,`store`,`embedding`],v=[`debug`,`info`,`warn`,`error`];function y(){let e=c(e=>e.logs),i=(0,p.useRef)(null),[o,y]=(0,p.useState)(!0),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),T=(0,p.useMemo)(()=>e.filter(e=>!(x&&e.level!==x||C&&e.component!==C)),[e,x,C]);return(0,p.useEffect)(()=>{o&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[T,o]),(0,m.jsxs)(`div`,{className:`flex h-full flex-col gap-5`,children:[(0,m.jsx)(u,{title:`Logs`,compact:!0,description:`Backend events with inline filters and a stable reading surface.`,metrics:[{label:`Visible`,value:T.length},{label:`Total`,value:e.length},{label:`Mode`,value:o?`Live`:`Paused`}],className:`px-4 py-3 lg:px-4 lg:py-3`,actions:(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>y(!o),title:o?`Pause auto-scroll`:`Resume auto-scroll`,children:o?(0,m.jsx)(t,{size:f.sm}):(0,m.jsx)(a,{size:f.sm})}),(0,m.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>{c.setState({logs:[]})},title:`Clear logs`,children:(0,m.jsx)(n,{size:f.sm})})]})}),(0,m.jsx)(l,{className:`surface-panel-muted py-3`,children:(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Level:`}),(0,m.jsxs)(`div`,{className:`flex gap-1`,children:[(0,m.jsx)(b,{active:x===null,onClick:()=>S(null),children:`All`}),v.map(e=>(0,m.jsx)(b,{active:x===e,onClick:()=>S(x===e?null:e),children:e},e))]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Component:`}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,m.jsx)(b,{active:C===null,onClick:()=>w(null),children:`All`}),_.map(e=>(0,m.jsx)(b,{active:C===e,onClick:()=>w(C===e?null:e),children:e},e))]})]})]})}),(0,m.jsx)(l,{padding:!1,className:`flex-1 min-h-0`,children:T.length===0?(0,m.jsx)(`div`,{className:`p-4`,children:(0,m.jsx)(d,{icon:(0,m.jsx)(r,{size:32}),title:`No log entries`,description:`Log events will appear here in real-time via WebSocket.`,compact:!0,className:`min-h-[10rem]`})}):(0,m.jsx)(`div`,{ref:i,className:`h-full max-h-[calc(100vh-280px)] overflow-y-auto p-3 font-mono text-xs leading-5`,children:T.map((e,t)=>{let n=new Date(e.timestamp).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3}),r=h[e.level]??`text-[var(--app-text-muted)]`,i=g[e.component]??`text-[var(--app-text-muted)]`;return(0,m.jsxs)(`div`,{className:`flex gap-2 hover:bg-[var(--app-panel-elevated)]/30 px-1 rounded`,children:[(0,m.jsx)(`span`,{className:`text-[var(--app-text-subtle)] shrink-0`,children:n}),(0,m.jsx)(`span`,{className:`w-12 shrink-0 uppercase ${r}`,children:e.level.padEnd(5)}),(0,m.jsxs)(`span`,{className:`w-20 shrink-0 ${i}`,children:[`[`,e.component,`]`]}),(0,m.jsx)(`span`,{className:`text-[var(--app-text)] break-all`,children:e.msg})]},t)})})}),(0,m.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-[var(--app-text-subtle)]`,children:[(0,m.jsxs)(`span`,{children:[T.length,` entries `,T.length!==e.length&&`(${e.length} total)`]}),(0,m.jsx)(`span`,{children:o?`Following live feed`:`Scroll paused`})]})]})}function b({active:e,onClick:t,children:n}){return(0,m.jsx)(`button`,{onClick:t,className:`rounded px-2 py-0.5 text-xs transition-colors ${e?`bg-[var(--app-panel-muted)] text-[var(--app-text)]`:`text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`}`,children:n})}export{y as Logs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,nt as n,st as r,v as i}from"./vendor-icons-BlMaTTx3.js";import{t as a}from"./vendor-react-7e01TWy7.js";import{n as o}from"./dist-Bdqp1ixJ.js";import{t as s}from"./Button-BjXgrQ95.js";import{r as c,t as l}from"./index-pF--tN9F.js";import{t as u}from"./Card-C153tGfJ.js";import{t as d}from"./PageHeader-BMvN0xiB.js";import{t as f}from"./SectionHeader-CiCj3Is0.js";import{a as p}from"./format-CHfBBLog.js";import{t as m}from"./EmptyState-CXwJFCDQ.js";var h=e(r(),1),g=a();function _(){let e=c(e=>e.roles),r=c(e=>e.fetchRoles),[a,_]=(0,h.useState)(``),[v,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!1),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(!1),[E,D]=(0,h.useState)(`all`),[O,k]=(0,h.useState)(new Set);(0,h.useEffect)(()=>{r()},[r]),(0,h.useEffect)(()=>{!a&&e.length>0&&_(e[0].id)},[e,a]);let A=(0,h.useCallback)(async()=>{if(a){x(!0);try{y((await o(`/memories/${a}?limit=100`)).memories)}catch{y([])}finally{x(!1)}}},[a]);(0,h.useEffect)(()=>{a&&A()},[a,A]);let j=async()=>{if(!(!S.trim()||!a)){T(!0);try{y((await o(`/memories/query`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agentId:a,prompt:S.trim(),topK:20})})).memories)}catch{y([])}finally{T(!1)}}},M=()=>{C(``),A()},N=v.filter(e=>E===`high`?e.importance>3:E===`medium`?e.importance===3:E===`low`?e.importance<3:!0),P=e=>e>=4?`text-[var(--app-danger)]`:e===3?`text-[var(--app-warning)]`:`text-[var(--app-text-subtle)]`;return(0,g.jsxs)(`div`,{className:`space-y-5`,children:[(0,g.jsx)(d,{eyebrow:`Knowledge`,title:`Memories`,compact:!0,description:`What each role is retaining and how retrieval changes the visible recall set.`,metrics:[{label:`Role`,value:e.find(e=>e.id===a)?.name??`None`},{label:`Visible`,value:N.length},{label:`High Importance`,value:v.filter(e=>e.importance>3).length}],actions:(0,g.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void A(),children:(0,g.jsx)(i,{size:14})})}),(0,g.jsx)(f,{title:`Recall Controls`,compact:!0,description:`Switch role context, run a retrieval query, or narrow by importance.`}),(0,g.jsx)(u,{className:`surface-panel-muted`,children:(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,g.jsx)(`select`,{className:`rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:a,onChange:e=>_(e.target.value),children:e.map(e=>(0,g.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(`input`,{className:`w-64 rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] placeholder-slate-600 focus:border-[var(--app-accent)] focus:outline-none`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>e.key===`Enter`&&void j(),placeholder:`Search memories...`}),(0,g.jsx)(s,{size:`sm`,variant:`ghost`,onClick:()=>void j(),disabled:w,children:(0,g.jsx)(t,{size:14})}),S&&(0,g.jsx)(s,{size:`sm`,variant:`ghost`,onClick:M,children:`Clear`})]}),(0,g.jsx)(`div`,{className:`flex gap-1`,children:[`all`,`high`,`medium`,`low`].map(e=>(0,g.jsx)(`button`,{className:`rounded px-2 py-1 text-xs transition-colors ${E===e?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:bg-[var(--app-panel-muted)]`}`,onClick:()=>D(e),children:e},e))})]})}),(0,g.jsx)(u,{children:b||w?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,g.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):N.length===0?(0,g.jsx)(m,{icon:(0,g.jsx)(n,{size:32}),title:`No memories`,description:S?`No results for this query`:`This agent has no memories yet`,className:`py-8`}):(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsxs)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[N.length,` memories`]}),N.map(e=>(0,g.jsxs)(`div`,{className:`rounded border border-[var(--app-border)] p-3`,children:[(0,g.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,g.jsx)(l,{variant:e.type===`reflection`?`info`:e.type===`thought`?`warning`:`muted`,children:e.type}),(0,g.jsx)(l,{variant:`muted`,children:e.sourceType}),(0,g.jsx)(`span`,{className:`text-xs font-medium ${P(e.importance)}`,children:`*`.repeat(e.importance)}),e.score!=null&&(0,g.jsxs)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:[`score: `,e.score.toFixed(3)]})]}),(0,g.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-[var(--app-text)]`,children:e.content}),(0,g.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:e.keywords.map(e=>(0,g.jsx)(`span`,{className:`rounded bg-[var(--app-panel-elevated)] px-1.5 py-0.5 text-[10px] text-[var(--app-text-subtle)]`,children:e},e))}),e.type===`reflection`&&e.evidence&&e.evidence.length>0&&(0,g.jsxs)(`div`,{className:`mt-2`,children:[(0,g.jsxs)(`button`,{className:`text-[10px] text-[var(--app-accent)] hover:text-[var(--app-accent)]`,onClick:()=>k(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),children:[O.has(e.id)?`Hide`:`Show`,` evidence (`,e.evidence.length,` memories)`]}),O.has(e.id)&&(0,g.jsx)(`div`,{className:`mt-1.5 space-y-1 border-l-2 border-[var(--app-border)] pl-2`,children:e.evidence.map(e=>{let t=v.find(t=>t.id===e);return(0,g.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:t?t.content.slice(0,120)+(t.content.length>120?`...`:``):(0,g.jsxs)(`span`,{className:`italic`,children:[`Memory `,e.slice(0,8),` (not in current view)`]})},e)})})]}),(0,g.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-[var(--app-text-subtle)]`,children:[p(e.createdAt),` | accessed `,e.retrievedCount,`x | last: `,p(e.lastAccessed)]})]},e.id))]})})]})}export{_ as Memories};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./vendor-icons-BlMaTTx3.js";import{r as e,t}from"./vendor-react-7e01TWy7.js";var n=t();function r(){return(0,n.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 text-[var(--app-text-muted)]`,children:[(0,n.jsx)(`span`,{className:`text-6xl font-bold text-[var(--app-text-subtle)]`,children:`404`}),(0,n.jsx)(`p`,{className:`text-lg`,children:`Page not found`}),(0,n.jsx)(e,{to:`/`,className:`text-[var(--app-accent)] hover:text-[var(--app-accent)] underline`,children:`Back to Dashboard`})]})}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./vendor-react-7e01TWy7.js";import{i as t}from"./dist-Bdqp1ixJ.js";var n=e();function r({title:e,description:r,eyebrow:i,metrics:a,actions:o,compact:s=!1,className:c}){return(0,n.jsx)(`section`,{className:t(`surface-panel-elevated rounded-xl`,s?`px-4 py-4 lg:px-5 lg:py-5`:`px-5 py-5 lg:px-6 lg:py-6`,c),children:(0,n.jsxs)(`div`,{className:t(`flex flex-col lg:flex-row lg:justify-between`,s?`gap-3 lg:items-start`:`gap-4 lg:items-end`),children:[(0,n.jsxs)(`div`,{className:t(s?`space-y-1.5`:`space-y-2`),children:[i?(0,n.jsx)(`p`,{className:`text-kicker`,children:i}):null,(0,n.jsxs)(`div`,{className:t(s?`space-y-0.5`:`space-y-1`),children:[(0,n.jsx)(`h1`,{className:`text-title`,children:e}),r?(0,n.jsx)(`p`,{className:t(`max-w-2xl text-sm text-[var(--app-text-muted)]`,s?`leading-5`:`leading-6`),children:r}):null]}),a&&a.length>0?(0,n.jsx)(`div`,{className:t(`flex flex-wrap gap-x-4 gap-y-2 pt-1`,s?`pt-0.5`:`pt-1`),children:a.map(e=>(0,n.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,n.jsx)(`span`,{className:`block text-[10px] uppercase tracking-[0.18em] text-[var(--app-text-subtle)]`,children:e.label}),(0,n.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:e.value})]},e.label))}):null]}),o?(0,n.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 lg:w-auto lg:justify-end`,children:o}):null]})})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{$ as t,L as n,Q as r,W as i,b as a,h as o,j as s,l as c,o as l,st as u,t as ee,tt as te,v as ne,x as re}from"./vendor-icons-BlMaTTx3.js";import{t as d}from"./vendor-react-7e01TWy7.js";import{n as f}from"./dist-Bdqp1ixJ.js";import{t as p}from"./Button-BjXgrQ95.js";import{i as m,t as h}from"./index-pF--tN9F.js";import{t as g}from"./Card-C153tGfJ.js";import{t as ie}from"./PageHeader-BMvN0xiB.js";import{t as ae}from"./SectionHeader-CiCj3Is0.js";import{a as oe}from"./format-CHfBBLog.js";import{t as se}from"./EmptyState-CXwJFCDQ.js";import{t as _}from"./ui-B_uMx2Fy.js";import{t as ce}from"./useIsMobileLayout-Bwrm84kJ.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./Table-CaFJieh_.js";var w=e(u(),1),T=d();function E({manifest:e}){if(!e)return null;let t=[];return e.skills.length>0&&t.push({label:`Skill(${e.skills.length})`,variant:`info`}),e.agents.length>0&&t.push({label:`Agent(${e.agents.length})`,variant:`success`}),e.mcpServers.length>0&&t.push({label:`MCP(${e.mcpServers.length})`,variant:`warning`}),e.hooks.length>0&&t.push({label:`Hook(${e.hooks.length})`,variant:`default`}),e.lspServers.length>0&&t.push({label:`LSP(${e.lspServers.length})`,variant:`default`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>(0,T.jsx)(h,{variant:e.variant,children:e.label},e.label))})}function D({label:e,value:t}){return(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 px-3 py-2`,children:[(0,T.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:e}),(0,T.jsx)(`p`,{className:`mt-1 text-sm font-medium text-[var(--app-text)]`,children:t})]})}function O({plugin:e,roles:t,operatingId:n,onInstallToRole:r}){return e.manifest?(0,T.jsxs)(`div`,{className:`space-y-4 text-xs`,children:[e.manifest.description?(0,T.jsx)(`p`,{className:`text-[var(--app-text-muted)]`,children:e.manifest.description}):null,(0,T.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-4`,children:[(0,T.jsx)(D,{label:`Version`,value:e.version?`v${e.version}`:`—`}),(0,T.jsx)(D,{label:`Scope`,value:e.scope}),(0,T.jsx)(D,{label:`Capability Count`,value:e.manifest.skills.length+e.manifest.agents.length+e.manifest.mcpServers.length+e.manifest.hooks.length+e.manifest.lspServers.length}),(0,T.jsx)(D,{label:`Activation`,value:e.globalEnabled?`User On`:`User Off`})]}),(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 px-3 py-2`,children:[(0,T.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Install Path`}),(0,T.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-[var(--app-text-muted)]`,title:e.installPath,children:e.installPath})]}),(0,T.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[e.manifest.skills.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Skills`}),e.manifest.skills.map(e=>(0,T.jsxs)(`div`,{className:`inline-flex items-baseline gap-1 text-[var(--app-text-muted)]`,children:[(0,T.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.name}),e.description?(0,T.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`; `,e.description]}):null]},e.name))]}),e.manifest.agents.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Agents`}),e.manifest.agents.map(e=>(0,T.jsxs)(`div`,{className:`inline-flex items-baseline gap-1 text-[var(--app-text-muted)]`,children:[(0,T.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.name}),e.description?(0,T.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`; `,e.description]}):null]},e.name))]}),e.manifest.mcpServers.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`MCP Servers`}),e.manifest.mcpServers.map(e=>(0,T.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]}),e.manifest.hooks.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Hooks`}),e.manifest.hooks.map(e=>(0,T.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]}),e.manifest.lspServers.length>0&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`LSP Servers`}),e.manifest.lspServers.map(e=>(0,T.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]})]}),t.length>0&&e.scope===`user`?(0,T.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,T.jsx)(`p`,{className:`mb-2 text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Install to Role`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>(0,T.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-[10px]`,disabled:n===e.id,onClick:()=>void r(e.id,t.id,t.workspacePath),children:t.name},t.id))})]}):null]}):(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Loading manifest...`})}function k(){let[e,u]=(0,w.useState)([]),[d,D]=(0,w.useState)([]),[k,le]=(0,w.useState)([]),[ue,de]=(0,w.useState)(new Set),[fe,A]=(0,w.useState)(!0),[j,M]=(0,w.useState)(!1),[N,P]=(0,w.useState)(null),[F,pe]=(0,w.useState)(!1),[I,me]=(0,w.useState)(``),[L,R]=(0,w.useState)(null),[z,B]=(0,w.useState)(!1),[V,H]=(0,w.useState)(``),[U,he]=(0,w.useState)([]),[W,ge]=(0,w.useState)(!1),[G,_e]=(0,w.useState)(new Set),[K,q]=(0,w.useState)(`all`),[J,ve]=(0,w.useState)([]),ye=ce(),Y=(0,w.useCallback)(async()=>{A(!0);try{u((await f(`/plugins`)).plugins)}catch(e){m.error(e instanceof Error?e.message:`Failed to load plugins`)}finally{A(!1)}},[]),X=(0,w.useCallback)(async()=>{M(!0),P(null);try{let[e,t]=await Promise.all([f(`/plugins/marketplace`).catch(()=>({available:[],installed:[]})),f(`/plugins/marketplaces`)]);le(e.available),de(new Set(e.installed.map(e=>e.id))),D(t.sources)}catch(e){P(e instanceof Error?e.message:`Failed to load marketplace`)}finally{M(!1)}},[]),be=(0,w.useCallback)(async()=>{try{he((await f(`/plugins/stats?limit=20`)).stats)}catch{}},[]),Z=(0,w.useCallback)(async()=>{try{ve((await f(`/roles`)).roles)}catch{}},[]);(0,w.useEffect)(()=>{Y(),X(),Z()},[Y,X,Z]);let xe=async(e,t)=>{R(e);try{await f(`/plugins/${encodeURIComponent(e)}/${t?`enable`:`disable`}`,{method:`POST`}),m.success(`${e} ${t?`enabled`:`disabled`} globally`),u(n=>n.map(n=>n.id===e?{...n,globalEnabled:t}:n))}catch(e){m.error(e instanceof Error?e.message:`Failed to ${t?`enable`:`disable`} plugin`)}finally{R(null)}},Se=async e=>{R(e);try{await f(`/plugins/uninstall/${encodeURIComponent(e)}`,{method:`POST`}),m.success(`Plugin uninstalled`),await Promise.all([Y(),X()])}catch(e){m.error(e instanceof Error?e.message:`Uninstall failed`)}finally{R(null)}},Ce=async(e,t,n)=>{R(e);try{await f(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:`project`,cwd:n})});let r=J.find(e=>e.id===t)?.name??t;m.success(`Installed ${e.split(`@`)[0]} for ${r}`),await Y()}catch(e){m.error(e instanceof Error?e.message:`Install to role failed`)}finally{R(null)}},we=async()=>{if(V.trim())try{await f(`/plugins/install/${encodeURIComponent(V.trim())}`,{method:`POST`,body:JSON.stringify({})}),m.success(`Source added`),H(``),B(!1),await X()}catch(e){m.error(e instanceof Error?e.message:`Failed to add source`)}},Q=async(e,t=`user`,n)=>{R(e);try{await f(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:t,cwd:n})});let r=t===`project`&&n?`${e.split(`@`)[0]} for ${n.split(`/`).pop()}`:e.split(`@`)[0];m.success(`Installed ${r}`),await Promise.all([Y(),X()])}catch(e){m.error(e instanceof Error?e.message:`Install failed`)}finally{R(null)}},Te=e=>{_e(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},$=K===`all`?e:e.filter(e=>e.scope===K),Ee=I?k.filter(e=>e.name.toLowerCase().includes(I.toLowerCase())||e.description.toLowerCase().includes(I.toLowerCase())):k;return(0,T.jsxs)(`div`,{className:`space-y-5`,children:[(0,T.jsx)(ie,{eyebrow:`Capabilities`,title:`Plugins`,compact:!0,description:`Installed capabilities, scope, and activation.`,metrics:[{label:`Total`,value:e.length},{label:`Project Scope`,value:e.filter(e=>e.scope===`project`).length},{label:`Catalog`,value:k.length}],actions:(0,T.jsx)(p,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),children:(0,T.jsx)(ne,{size:14})})}),(0,T.jsx)(ae,{title:`Installed Plugins`,compact:!0,description:`Filter by scope, inspect manifests, and keep every activation path reachable from one place.`}),(0,T.jsxs)(g,{children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(n,{size:14,className:`text-[var(--app-text-muted)] flex-shrink-0`}),(0,T.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${K===`all`?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:bg-[var(--app-panel-muted)]`}`,onClick:()=>q(`all`),children:`All`}),(0,T.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${K===`user`?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:bg-[var(--app-panel-muted)]`}`,onClick:()=>q(`user`),children:`User`}),(0,T.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${K===`project`?`bg-[var(--app-accent)] text-white`:`bg-[var(--app-panel-elevated)] text-[var(--app-text-muted)] hover:bg-[var(--app-panel-muted)]`}`,onClick:()=>q(`project`),children:`Project`}),(0,T.jsx)(`span`,{className:`h-4 w-px bg-[var(--app-panel-muted)] mx-1`}),d.map(e=>(0,T.jsx)(h,{variant:`muted`,className:`text-xs`,children:e.name},e.name)),(0,T.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[j&&(0,T.jsx)(s,{size:12,className:`animate-spin text-[var(--app-text-subtle)]`}),j?null:(0,T.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>B(!z),children:z?(0,T.jsx)(ee,{size:12}):(0,T.jsx)(re,{size:12})})]})]}),z&&(0,T.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,T.jsx)(`input`,{className:`flex-1 rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:V,onChange:e=>H(e.target.value),placeholder:`https://github.com/org/marketplace-repo`,onKeyDown:e=>{e.key===`Enter`&&we()}}),(0,T.jsx)(p,{size:`sm`,onClick:()=>void we(),disabled:!V.trim(),children:`Add`})]})]}),fe?(0,T.jsx)(g,{children:(0,T.jsx)(`div`,{className:`py-8 text-center text-sm text-[var(--app-text-subtle)]`,children:`Loading...`})}):$.length===0?(0,T.jsx)(g,{children:(0,T.jsx)(se,{icon:(0,T.jsx)(a,{size:32}),title:`No plugins`,description:K===`all`?`No plugins installed. Browse the marketplace or install from a URL.`:`No ${K}-scope plugins installed.`,className:`py-8`})}):ye?(0,T.jsx)(`div`,{className:`space-y-3`,children:$.map((e,n)=>{let i=G.has(e.id),a=e.id.split(`@`)[0],o=L===e.id,c=e.projectPath?`${e.id}:${e.projectPath}`:`${e.id}:${n}`;return(0,T.jsxs)(g,{children:[(0,T.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,T.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`button`,{onClick:()=>Te(e.id),className:`text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`,children:i?(0,T.jsx)(t,{size:14}):(0,T.jsx)(r,{size:14})}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`truncate text-sm font-medium text-[var(--app-text)]`,children:a}),(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-muted)]`,children:e.version?`v${e.version}`:`—`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(h,{variant:e.scope===`user`?`info`:`warning`,children:e.scope}),(0,T.jsx)(h,{variant:e.globalEnabled?`success`:`destructive`,children:e.globalEnabled?`User On`:`User Off`})]}),e.scope===`project`&&e.projectPath?(0,T.jsx)(`p`,{className:`truncate text-[11px] text-[var(--app-text-subtle)]`,title:e.projectPath,children:e.projectPath}):null,(0,T.jsx)(E,{manifest:e.manifest})]})}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,disabled:o,onClick:()=>void xe(e.id,!e.globalEnabled),children:o?(0,T.jsx)(s,{size:_.xs,className:`animate-spin`}):e.globalEnabled?`Disable`:`Enable`}),(0,T.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-[var(--app-danger)]`,disabled:o,onClick:()=>void Se(e.id),children:(0,T.jsx)(l,{size:_.xs})})]}),i?(0,T.jsx)(`div`,{className:`mt-4 rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:(0,T.jsx)(O,{plugin:e,roles:J,operatingId:L,onInstallToRole:Ce})}):null]},c)})}):(0,T.jsx)(g,{padding:!1,children:(0,T.jsxs)(C,{children:[(0,T.jsx)(v,{children:(0,T.jsxs)(x,{children:[(0,T.jsx)(y,{className:`w-8`}),(0,T.jsx)(y,{children:`Name`}),(0,T.jsx)(y,{children:`Version`}),(0,T.jsx)(y,{children:`Scope`}),(0,T.jsx)(y,{children:`Type`}),(0,T.jsx)(y,{children:`Activation`}),(0,T.jsx)(y,{children:`Actions`})]})}),(0,T.jsx)(b,{children:$.map((e,n)=>{let i=G.has(e.id),a=e.id.split(`@`)[0],o=L===e.id,c=e.projectPath?`${e.id}:${e.projectPath}`:`${e.id}:${n}`;return(0,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(x,{className:`group`,children:[(0,T.jsx)(S,{children:(0,T.jsx)(`button`,{onClick:()=>Te(e.id),className:`text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`,children:i?(0,T.jsx)(t,{size:_.xs}):(0,T.jsx)(r,{size:_.xs})})}),(0,T.jsx)(S,{className:`font-medium text-[var(--app-text)]`,children:a}),(0,T.jsx)(S,{className:`text-xs text-[var(--app-text-muted)]`,children:e.version?`v${e.version}`:`—`}),(0,T.jsxs)(S,{children:[(0,T.jsx)(h,{variant:e.scope===`user`?`info`:`warning`,children:e.scope}),e.scope===`project`&&e.projectPath&&(0,T.jsx)(`div`,{className:`text-[10px] text-[var(--app-text-subtle)] truncate max-w-[120px]`,title:e.projectPath,children:e.projectPath.split(`/`).pop()})]}),(0,T.jsx)(S,{children:(0,T.jsx)(E,{manifest:e.manifest})}),(0,T.jsx)(S,{children:(0,T.jsx)(h,{variant:e.globalEnabled?`success`:`destructive`,children:e.globalEnabled?`User On`:`User Off`})}),(0,T.jsx)(S,{children:(0,T.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,disabled:o,onClick:()=>void xe(e.id,!e.globalEnabled),children:o?(0,T.jsx)(s,{size:_.xs,className:`animate-spin`}):e.globalEnabled?`Disable`:`Enable`}),(0,T.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs text-[var(--app-danger)]`,disabled:o,onClick:()=>void Se(e.id),children:(0,T.jsx)(l,{size:_.xs})})]})})]}),i&&(0,T.jsx)(x,{className:`bg-[var(--app-panel)]/50`,children:(0,T.jsx)(S,{colSpan:7,className:`px-6 py-3`,children:(0,T.jsx)(O,{plugin:e,roles:J,operatingId:L,onInstallToRole:Ce})})},`${e.id}-detail`)]},c)})})]})}),(0,T.jsxs)(g,{children:[(0,T.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-[var(--app-text)]`,onClick:()=>pe(!F),children:[(0,T.jsx)(c,{size:_.sm,className:`text-[var(--app-text-muted)]`}),`Marketplace (`,k.length,`)`,F?(0,T.jsx)(t,{size:_.xs,className:`ml-auto`}):(0,T.jsx)(r,{size:_.xs,className:`ml-auto`})]}),F&&(0,T.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,T.jsxs)(`div`,{className:`relative`,children:[(0,T.jsx)(o,{size:_.sm,className:`absolute left-2.5 top-2 text-[var(--app-text-subtle)]`}),(0,T.jsx)(`input`,{className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] pl-8 pr-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,value:I,onChange:e=>me(e.target.value),placeholder:`Search available plugins...`})]}),j?(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] text-center py-2`,children:`Loading marketplace...`}):N?(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-danger)] text-center py-2`,children:N}):Ee.length===0?(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] text-center py-2`,children:I?`No plugins match your search`:`No marketplace plugins available`}):(0,T.jsxs)(C,{children:[(0,T.jsx)(v,{children:(0,T.jsxs)(x,{children:[(0,T.jsx)(y,{children:`Name`}),(0,T.jsx)(y,{children:`Description`}),(0,T.jsx)(y,{children:`Source`}),(0,T.jsx)(y,{children:`Action`})]})}),(0,T.jsx)(b,{children:Ee.map(e=>{let n=ue.has(e.pluginId),r=L===e.pluginId;return(0,T.jsxs)(x,{children:[(0,T.jsx)(S,{className:`font-medium text-[var(--app-text)] text-xs`,children:e.name}),(0,T.jsx)(S,{className:`text-xs text-[var(--app-text-muted)] max-w-[300px] truncate`,title:e.description,children:e.description}),(0,T.jsx)(S,{children:(0,T.jsx)(h,{variant:`muted`,className:`text-[10px]`,children:e.marketplaceName})}),(0,T.jsx)(S,{children:n?(0,T.jsx)(h,{variant:`success`,className:`text-[10px]`,children:`Installed`}):(0,T.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:()=>void Q(e.pluginId),children:r?(0,T.jsx)(s,{size:_.xs,className:`animate-spin`}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(i,{size:_.xs}),` Install`]})}),J.length>0&&(0,T.jsxs)(`div`,{className:`relative group/install`,children:[(0,T.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1 text-xs text-[var(--app-text-subtle)]`,children:(0,T.jsx)(t,{size:_.xs})}),(0,T.jsx)(`div`,{className:`absolute right-0 top-full mt-1 z-10 hidden group-hover/install:block bg-[var(--app-panel-elevated)] border border-[var(--app-border)] rounded shadow-lg py-1 min-w-[140px]`,children:J.map(t=>(0,T.jsx)(`button`,{className:`block w-full text-left px-3 py-1 text-xs text-[var(--app-text)] hover:bg-[var(--app-panel-muted)]`,disabled:r,onClick:()=>void Q(e.pluginId,`project`,t.workspacePath),children:t.name},t.id))})]})]})})]},e.pluginId)})})]})]})]}),(0,T.jsxs)(g,{children:[(0,T.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-[var(--app-text)]`,onClick:()=>{!W&&U.length===0&&be(),ge(!W)},children:[(0,T.jsx)(te,{size:14,className:`text-[var(--app-text-muted)]`}),`Usage Stats`,W?(0,T.jsx)(t,{size:12,className:`ml-auto`}):(0,T.jsx)(r,{size:12,className:`ml-auto`})]}),W&&(0,T.jsx)(`div`,{className:`mt-3`,children:U.length===0?(0,T.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)] text-center py-2`,children:`No usage data yet`}):(0,T.jsxs)(C,{children:[(0,T.jsx)(v,{children:(0,T.jsxs)(x,{children:[(0,T.jsx)(y,{children:`Plugin`}),(0,T.jsx)(y,{children:`Usage Count`}),(0,T.jsx)(y,{children:`Last Used`})]})}),(0,T.jsx)(b,{children:U.map(e=>(0,T.jsxs)(x,{children:[(0,T.jsx)(S,{className:`font-medium text-[var(--app-text)] text-xs`,children:e.pluginName}),(0,T.jsx)(S,{className:`font-mono text-xs text-[var(--app-text-muted)]`,children:e.usageCount}),(0,T.jsx)(S,{className:`text-xs text-[var(--app-text-muted)]`,children:e.lastUsed?oe(e.lastUsed):`—`})]},e.pluginPath))})]})})]})]})}export{k as Plugins};
|