@rubytech/create-sitedesk-code 0.1.508 → 0.1.509
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/dist/index.js +53 -0
- package/package.json +1 -1
- package/payload/platform/docs/superpowers/plans/2026-07-26-task-1926-portal-push-concurrency-guard.md +482 -0
- package/payload/platform/docs/superpowers/specs/2026-07-26-task-1926-portal-push-concurrency-guard-design.md +200 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +11 -6
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +6 -0
- package/payload/platform/plugins/cloudflare/bin/portal-index-push.mjs +68 -28
- package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-index-push.test.ts +271 -29
- package/payload/platform/plugins/cloudflare/skills/data-portal/schema.sql +5 -4
- package/payload/platform/plugins/docs/references/admin-ui.md +10 -5
- package/payload/platform/scripts/__tests__/check-brand-cache.test.sh +231 -0
- package/payload/platform/scripts/check-brand-cache.sh +138 -0
- package/payload/server/maxy-edge.js +15 -10
- package/payload/server/public/activity.html +5 -5
- package/payload/server/public/agents.html +4 -4
- package/payload/server/public/assets/{AdminLoginScreens-DKeCt1uf.js → AdminLoginScreens-8Jk7hnWH.js} +1 -1
- package/payload/server/public/assets/{AdminShell-HeELCCjJ.js → AdminShell-BMPEWNZk.js} +1 -1
- package/payload/server/public/assets/{activity-BEIDAxDA.js → activity-ByWYF5dC.js} +1 -1
- package/payload/server/public/assets/admin-CnUWbKcx.js +1 -0
- package/payload/server/public/assets/agents-C0rTfrYd.js +1 -0
- package/payload/server/public/assets/{browser-GkVTGqlb.js → browser-4tTaem8N.js} +1 -1
- package/payload/server/public/assets/{calendar-CSqJeFEg.js → calendar-BEjnkKG1.js} +1 -1
- package/payload/server/public/assets/chat-DBgzjDIE.js +1 -0
- package/payload/server/public/assets/chevron-left-DqYv3oFh.js +1 -0
- package/payload/server/public/assets/chevron-right-CQfPGsFb.js +1 -0
- package/payload/server/public/assets/clock-Dn6FHB51.js +1 -0
- package/payload/server/public/assets/data-D_e6Vdfd.js +1 -0
- package/payload/server/public/assets/{file-text-DiscM2pP.js → file-text-DMKw3nIk.js} +1 -1
- package/payload/server/public/assets/{graph-CRP5DM8C.js → graph-C3vW8lvw.js} +1 -1
- package/payload/server/public/assets/{graph-labels-Du-6KoBE.js → graph-labels-BZgd0L6n.js} +1 -1
- package/payload/server/public/assets/{maximize-2-D-H_uIV-.js → maximize-2-la3IBA3M.js} +1 -1
- package/payload/server/public/assets/{operator-D5rA76YY.js → operator-RRRdqoRQ.js} +1 -1
- package/payload/server/public/assets/{page-CHK1415C.js → page-BWFHRIAH.js} +1 -1
- package/payload/server/public/assets/{page-DZE3H_n4.js → page-DC11gesX.js} +1 -1
- package/payload/server/public/assets/{public-DFHXVkdD.js → public-DQbbLHQN.js} +1 -1
- package/payload/server/public/assets/{rotate-ccw-CesEJsuO.js → rotate-ccw-OQD5si8N.js} +1 -1
- package/payload/server/public/assets/{routines-DYMYY_r8.js → routines-asrBGZUR.js} +1 -1
- package/payload/server/public/assets/{skills-67jtJ16D.js → skills-D4ECwoxa.js} +1 -1
- package/payload/server/public/assets/{tasks-D2C2a-uk.js → tasks-U3QdbUsO.js} +1 -1
- package/payload/server/public/assets/{time-entry-format-BixTGQAd.js → time-entry-format-BgdTKgYr.js} +1 -1
- package/payload/server/public/assets/{triangle-alert-Co9RWb9q.js → triangle-alert-Ck_3VhT9.js} +1 -1
- package/payload/server/public/assets/{useCopyFeedback-7zwf9_w4.js → useCopyFeedback-BdUwyNpa.js} +1 -1
- package/payload/server/public/assets/{useSubAccountSwitcher-DE4v5_Fz.css → useSubAccountSwitcher-DOWQXDT8.css} +1 -1
- package/payload/server/public/assets/{useVoiceRecorder-CZDDiwMD.js → useVoiceRecorder-ChnBrzbZ.js} +1 -1
- package/payload/server/public/assets/{wrench-CjQqdj4P.js → wrench-Cpee3C3J.js} +1 -1
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +7 -7
- package/payload/server/public/chat.html +13 -13
- package/payload/server/public/data.html +11 -11
- package/payload/server/public/graph.html +9 -9
- package/payload/server/public/index.html +14 -14
- package/payload/server/public/operator.html +14 -14
- package/payload/server/public/public.html +13 -13
- package/payload/server/public/routines.html +6 -6
- package/payload/server/public/skills.html +5 -5
- package/payload/server/public/tasks.html +6 -6
- package/payload/server/server.js +364 -283
- package/payload/server/public/assets/admin-C0-WU1sf.js +0 -1
- package/payload/server/public/assets/agents-DjUvMFTj.js +0 -1
- package/payload/server/public/assets/chat-C0Ps84U5.js +0 -1
- package/payload/server/public/assets/chevron-left-DQ2uNlu9.js +0 -1
- package/payload/server/public/assets/chevron-right-C4QCiRGD.js +0 -1
- package/payload/server/public/assets/clock-BEeQ7JxX.js +0 -1
- package/payload/server/public/assets/data-CGuNfym7.js +0 -1
- /package/payload/server/public/assets/{useSubAccountSwitcher-Bg72hdQ8.js → useSubAccountSwitcher-CJKjEPNN.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CltuBf4Z.js";import{B as t,D as n,K as r,V as i,W as a,a as o,l as s,m as c,p as l,s as u,v as d}from"./useSubAccountSwitcher-Bg72hdQ8.js";import{n as f,t as p}from"./AdminLoginScreens-DKeCt1uf.js";import{s as m}from"./useVoiceRecorder-CZDDiwMD.js";import{a as h,b as g,f as _,t as v,y as ee}from"./AdminShell-HeELCCjJ.js";import{a as y,i as b,n as x,r as te}from"./page-CHK1415C.js";import{t as S}from"./chevron-left-DQ2uNlu9.js";import{t as C}from"./chevron-right-C4QCiRGD.js";import{t as w}from"./file-text-DiscM2pP.js";import"./graph-labels-Du-6KoBE.js";var T=a(),E=e(r(),1),D=t();function O({onOpen:e}){return(0,D.jsx)(`footer`,{className:`admin-footer`,children:(0,D.jsxs)(`div`,{className:`powered-by`,role:`button`,tabIndex:0,onClick:e,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},"aria-label":`Powered by Claude Code — show details`,children:[(0,D.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`powered-by-icon`}),(0,D.jsx)(`span`,{children:`Powered by Claude Code`})]})})}function k({sessionId:e,projectDir:t,sessionKey:n,contactName:r,onBack:i}){return(0,D.jsxs)(`div`,{className:`wa-web`,children:[(0,D.jsxs)(`header`,{className:`wa-web-header`,children:[i&&(0,D.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:i,"aria-label":`Back`,children:(0,D.jsx)(S,{size:20})}),(0,D.jsx)(`span`,{className:`wa-web-avatar`,"aria-hidden":!0,children:(0,D.jsx)(y,{size:20})}),(0,D.jsx)(`div`,{className:`wa-web-titles`,children:(0,D.jsx)(`span`,{className:`wa-web-name`,children:r})})]}),(0,D.jsx)(`div`,{className:`wa-web-body`,children:(0,D.jsx)(m,{sessionId:e,projectDir:t,sessionKey:n,forceDeliveredOnly:!0})})]})}var A=6e4,j=60*A,M=24*j,N=A,P=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],F=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function I(e){return e<10?`0${e}`:String(e)}function L(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function R(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t))return`—`;let n=t-e;if(n<-N)return`—`;let r=n<0?0:n;if(r<A)return`just now`;if(r<j)return`${Math.floor(r/A)}m`;if(r<M)return`${Math.floor(r/j)}h`;let i=new Date(t),a=new Date(e),o=Math.round((L(i)-L(a))/M);if(o===1)return`yesterday`;if(o>=2&&o<=6)return F[a.getDay()];let s=I(a.getDate()),c=P[a.getMonth()];return a.getFullYear()===i.getFullYear()?`${s} ${c}`:`${s} ${c} ${a.getFullYear()}`}var z={whatsapp:`WhatsApp`,telegram:`Telegram`,webchat:`Web chat`};function B({variant:e=`row`,count:t=1}){return(0,D.jsx)(D.Fragment,{children:Array.from({length:t},(t,n)=>(0,D.jsx)(`span`,{className:`dashboard-skeleton dashboard-skeleton--${e}`,"data-testid":`dashboard-skeleton`,"aria-hidden":`true`},n))})}var V=6e4;function H(e){return e<12?`morning`:e<18?`afternoon`:`evening`}function U(e){return e&&e.trim().split(/\s+/)[0]||`there`}function W(e){if(!e)return`everything is running normally.`;let t=e.cpuPct,n=e.memUsedPct;return t!==null&&t>=.98||n!==null&&n>=.98?`system load is critical.`:t!==null&&t>=.9||n!==null&&n>=.9?`system load is high.`:`everything is running normally.`}function G(e){return e==null?`—`:`${Math.round(e*100)}%`}function K(e){return e.operatorName??e.whatsappName??e.senderId??e.title}function q(e,t){if(!e)return!1;let n=Date.parse(e);if(!Number.isFinite(n))return!1;let r=new Date(n),i=new Date(t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate()}function J(e){return e?e.replace(/^claude-/,``):null}function Y({cacheKey:e,userName:t,onSelectWhatsappConversation:r}){let a=c(e),[l,f]=(0,E.useState)(null),[p,m]=(0,E.useState)(null),[h,v]=(0,E.useState)(null),y=(0,E.useRef)(!1),[b,x]=(0,E.useState)(null),[S,T]=(0,E.useState)(null),[O,k]=(0,E.useState)(null),[A,j]=(0,E.useState)(null),[M,N]=(0,E.useState)(new Set),[P,F]=(0,E.useState)(()=>new Set),I=(0,E.useCallback)(e=>{F(t=>t.has(e)?t:new Set(t).add(e))},[]),L=Date.now(),Y=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!e)return;let t=!1;async function n(e,n,r,i){let o=Date.now();try{let s=await a(n);if(!s.ok)throw Error(`status ${s.status}`);let c=await s.json();t||i(r(c)),console.info(`[admin-ui] op=dashboard-fetch slice=${e} url=${n} outcome=ok ms=${Date.now()-o}`)}catch(t){console.error(`[admin-ui] dashboard-fetch-failed slice=${e} url=${n} ms=${Date.now()-o} reason=${t instanceof Error?t.message:String(t)}`)}finally{t||I(e)}}let r={"sidebar-sessions":()=>n(`sessions`,`/api/admin/sidebar-sessions`,e=>e.sessions??[],f),"conversations-all":()=>n(`conversations`,`/api/whatsapp-reader/conversations-all`,e=>e.conversations??[],m),"tasks-list":()=>n(`tasks`,`/api/admin/tasks-list`,e=>e,T),"sidebar-artefacts":()=>n(`artefacts`,`/api/admin/sidebar-artefacts`,e=>e.artefacts??[],k),skills:()=>n(`skills`,`/api/admin/skills`,e=>e.skills??[],j)};async function o(){if(Y.current)return;Y.current=!0;let e=Date.now();try{await Promise.all([...Object.values(r).map(e=>e()),n(`stats`,`/api/admin/system-stats`,e=>e,x)])}finally{Y.current=!1,console.info(`[admin-ui] op=dashboard-refresh-settled ms=${Date.now()-e}`)}}o();let s=null;try{s=new EventSource(i(`/api/admin/events`,e)),s.onmessage=e=>{if(document.visibilityState===`visible`)try{let{resource:t}=JSON.parse(e.data),n=t?r[t]:void 0;n&&n()}catch{}},s.onerror=()=>{console.error(`[admin-ui] dashboard-events stream error`)}}catch(e){console.error(`[admin-ui] dashboard-events unavailable reason=${e instanceof Error?e.message:String(e)}`)}let c=setInterval(()=>{document.visibilityState===`visible`&&o()},V),l=()=>{document.visibilityState===`visible`&&o()};return document.addEventListener(`visibilitychange`,l),()=>{t=!0,clearInterval(c),s?.close(),document.removeEventListener(`visibilitychange`,l)}},[e,a]);let X=(0,E.useMemo)(()=>(l??[]).filter(e=>!e.isSubagent),[l]),Z=(0,E.useMemo)(()=>X.filter(e=>e.live),[X]),ne=(0,E.useMemo)(()=>(p??[]).filter(e=>q(e.lastMessageAt,L)).length,[p,L]),re=S?.open.length??0,Q=(0,E.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.channel)??[];n.push(t),e.set(t.channel,n)}return[...e.entries()].map(([e,t])=>{let n=t.reduce((e,t)=>t.lastMessageAt&&(!e||Date.parse(t.lastMessageAt)>Date.parse(e.lastMessageAt??``))?t:e,null);return{channel:e,count:t.length,preview:n?K(n):``,rows:t}})},[p]);(0,E.useEffect)(()=>{y.current||Q.length!==0&&(y.current=!0,v(Q[0].channel))},[Q]);let ie=(0,E.useCallback)(async e=>{if(!M.has(e)){N(t=>new Set(t).add(e));try{let t=await a(`/api/admin/session-stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e})});if(!t.ok){console.error(`[admin-ui] dashboard-session-stop-failed sessionId=${e} status=${t.status}`);return}console.info(`[admin-ui] dashboard-session-stop sessionId=${e}`),f(t=>(t??[]).map(t=>t.sessionId===e?{...t,live:!1}:t))}catch(t){console.error(`[admin-ui] dashboard-session-stop-failed sessionId=${e} reason=${t instanceof Error?t.message:String(t)}`)}finally{N(t=>{let n=new Set(t);return n.delete(e),n})}}},[a,M]),ae=(0,E.useCallback)(t=>{if(!e||!t.downloadPath){console.error(`[admin-ui] dashboard-artefact-download-blocked id=${t.id} reason=${e?`not-downloadable`:`no-cache-key`}`);return}te(e,t.downloadPath,t.downloadRoot??`data`)},[e]),$=H(new Date(L).getHours());return(0,D.jsxs)(`div`,{className:`dashboard-home`,children:[(0,D.jsx)(`p`,{className:`dashboard-greeting`,children:P.has(`stats`)?`Good ${$}, ${U(t)} — ${W(b)}`:`Good ${$}, ${U(t)}`}),(0,D.jsxs)(`div`,{className:`dashboard-stats`,children:[(0,D.jsxs)(`div`,{className:`admin-stat-card dashboard-stat-card`,children:[(0,D.jsx)(`span`,{className:`dashboard-stat-label`,children:`Live sessions`}),P.has(`sessions`)?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`dashboard-stat-value`,children:Z.length}),(0,D.jsxs)(`span`,{className:`dashboard-stat-delta`,children:[`of `,X.length,` total`]})]}):(0,D.jsx)(B,{variant:`value`})]}),(0,D.jsxs)(`div`,{className:`admin-stat-card dashboard-stat-card`,children:[(0,D.jsx)(`span`,{className:`dashboard-stat-label`,children:`Messages today`}),P.has(`conversations`)?(0,D.jsx)(`span`,{className:`dashboard-stat-value`,children:ne}):(0,D.jsx)(B,{variant:`value`})]}),(0,D.jsxs)(`a`,{className:`admin-stat-card dashboard-stat-card dashboard-stat-card--link`,href:`/tasks`,children:[(0,D.jsx)(`span`,{className:`dashboard-stat-label`,children:`Open tasks`}),P.has(`tasks`)?(0,D.jsx)(`span`,{className:`dashboard-stat-value`,children:re}):(0,D.jsx)(B,{variant:`value`})]}),(0,D.jsxs)(`div`,{className:`admin-stat-card dashboard-stat-card`,children:[(0,D.jsx)(`span`,{className:`dashboard-stat-label`,children:`Host CPU`}),P.has(`stats`)?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`dashboard-stat-value`,children:G(b?.cpuPct??null)}),(0,D.jsxs)(`span`,{className:`dashboard-stat-delta`,children:[`RAM `,G(b?.memUsedPct??null)]})]}):(0,D.jsx)(B,{variant:`value`})]})]}),(0,D.jsxs)(`div`,{className:`dashboard-columns`,children:[(0,D.jsxs)(`div`,{className:`dashboard-col`,children:[(0,D.jsx)(`span`,{className:`admin-section-label dashboard-col-label`,children:`Live now`}),P.has(`sessions`)?Z.length===0?(0,D.jsx)(`div`,{className:`admin-card dashboard-empty`,children:`No live sessions right now.`}):Z.map(e=>{let t=[e.sessionId.slice(0,8),J(e.model),R(Date.parse(e.startedAt),L)].filter(Boolean).join(` · `);return(0,D.jsxs)(`div`,{className:`admin-card dashboard-live-card`,children:[(0,D.jsx)(`span`,{className:`admin-status-dot is-live`}),(0,D.jsxs)(`div`,{className:`dashboard-live-main`,children:[(0,D.jsx)(`span`,{className:`dashboard-live-name`,children:e.title}),(0,D.jsx)(`span`,{className:`dashboard-live-meta`,children:t})]}),(0,D.jsx)(`a`,{className:`admin-btn-cta dashboard-open-btn`,href:`/chat?session=${encodeURIComponent(e.sessionId)}`,children:`Open`}),(0,D.jsx)(`button`,{type:`button`,className:`dashboard-stop-btn`,"aria-label":`Stop ${e.title}`,disabled:M.has(e.sessionId),onClick:()=>void ie(e.sessionId),children:(0,D.jsx)(d,{size:12})})]},e.sessionId)}):(0,D.jsx)(B,{variant:`card`,count:2}),(0,D.jsx)(`span`,{className:`admin-section-label dashboard-col-label`,children:`Recent artefacts`}),(0,D.jsx)(`div`,{className:`admin-card dashboard-artefacts`,children:P.has(`artefacts`)?(O??[]).length===0?(0,D.jsx)(`div`,{className:`dashboard-empty`,children:`No recent artefacts.`}):(O??[]).slice(0,6).map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`admin-row dashboard-artefact-row`,onClick:()=>ae(e),children:[(0,D.jsx)(`span`,{className:`dashboard-artefact-icon`,children:e.kind===`agent-template`?(0,D.jsx)(g,{size:16}):(0,D.jsx)(w,{size:16})}),(0,D.jsx)(`div`,{className:`dashboard-artefact-body`,children:(0,D.jsx)(`span`,{className:`dashboard-artefact-name`,children:e.name})}),(0,D.jsx)(`span`,{className:`dashboard-artefact-time`,children:R(Date.parse(e.updatedAt),L)})]},e.id)):(0,D.jsx)(B,{count:3})}),(0,D.jsx)(`a`,{className:`admin-section-label dashboard-col-label dashboard-skills-label`,href:`/skills`,children:`Skills`}),(0,D.jsx)(`div`,{className:`admin-card dashboard-skills`,children:P.has(`skills`)?(A??[]).length===0?(0,D.jsx)(`div`,{className:`dashboard-empty`,children:`No skills yet.`}):(A??[]).map(e=>(0,D.jsxs)(`a`,{className:`admin-row dashboard-skill-row`,href:`/skills`,children:[(0,D.jsx)(`span`,{className:`dashboard-skill-icon`,children:(0,D.jsx)(_,{size:16})}),(0,D.jsxs)(`div`,{className:`dashboard-skill-body`,children:[(0,D.jsx)(`span`,{className:`dashboard-skill-name`,children:e.skill}),(0,D.jsx)(`span`,{className:`dashboard-skill-plugin`,children:e.plugin})]})]},`${e.plugin}/${e.skill}`)):(0,D.jsx)(B,{count:2})})]}),(0,D.jsxs)(`div`,{className:`dashboard-col`,children:[(0,D.jsx)(`span`,{className:`admin-section-label dashboard-col-label`,children:`Channels`}),P.has(`conversations`)?Q.length===0?(0,D.jsx)(`div`,{className:`admin-card dashboard-empty`,children:`No channel activity.`}):Q.map(e=>{let t=h===e.channel;return(0,D.jsxs)(`div`,{className:`admin-card dashboard-channel-card`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`dashboard-channel-head`,"aria-expanded":t,onClick:()=>v(t=>t===e.channel?null:e.channel),children:[(0,D.jsx)(`span`,{className:`dashboard-channel-glyph`,children:e.channel===`whatsapp`||e.channel===`telegram`?(0,D.jsx)(s,{channel:e.channel,size:16}):(0,D.jsx)(n,{size:16})}),(0,D.jsx)(`span`,{className:`dashboard-channel-name`,children:z[e.channel]??e.channel}),(0,D.jsx)(`span`,{className:`dashboard-channel-badge`,children:e.count}),(0,D.jsx)(`span`,{className:`dashboard-channel-chevron`,children:t?(0,D.jsx)(ee,{size:14}):(0,D.jsx)(C,{size:14})})]}),t?(0,D.jsx)(`div`,{className:`dashboard-channel-convs`,children:e.rows.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`admin-row dashboard-channel-conv-row`,onClick:()=>r(e),title:e.title,children:[(0,D.jsx)(`span`,{className:`dashboard-channel-conv-name`,children:o(e)}),(0,D.jsx)(`span`,{className:`dashboard-channel-conv-tag`,children:e.isHouse?`House`:`Client`}),e.lastMessageAt&&(0,D.jsx)(`span`,{className:`dashboard-channel-conv-time`,children:R(Date.parse(e.lastMessageAt),L)})]},u(e)))}):e.preview&&(0,D.jsx)(`span`,{className:`dashboard-channel-preview`,children:e.preview})]},e.channel)}):(0,D.jsx)(B,{variant:`card`,count:2})]})]})]})}function X(){let e=f(),[t,n]=(0,E.useState)(!1);(0,E.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let r=(0,E.useCallback)(async()=>{let t=e.claudeInfo!=null;if(n(!0),t){console.info(`[admin-ui] claude-info-open cached=true ms=0`);return}let r=Date.now();try{let t=await fetch(`/api/admin/claude-info`);if(t.ok){let n=await t.json();e.setClaudeInfo(n)}console.info(`[admin-ui] claude-info-open cached=false ms=${Date.now()-r}`)}catch(e){console.error(`[admin-ui] claude-info-fetch-failed ms=${Date.now()-r} error="${e instanceof Error?e.message:String(e)}"`)}},[e]),i=(0,E.useCallback)(({code:t,path:n})=>{console.warn(`[admin-auth] outcome=chat-tab-logout-on-401 code=${t} path=${n}`),e.handleLogout()},[e]);return e.appState===`chat`?(0,D.jsx)(l,{cacheKey:e.cacheKey,onSessionExpired:i,surface:`chat`,children:(0,D.jsx)(v,{cacheKey:e.cacheKey,businessName:e.businessName,sessionId:e.sessionId,onLogout:e.handleLogout,onDisconnect:e.handleDisconnect,disconnecting:e.disconnecting,claudeConnected:e.claudeConnected,onConnectClaude:()=>e.setAppState(`connect-claude`),userName:e.userName,userAvatar:e.userAvatar,role:e.role,footer:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(O,{onOpen:r}),(0,D.jsx)(h,{show:t,onClose:()=>n(!1),claudeInfo:e.claudeInfo,messages:[],sessionElapsed:0,sessionId:e.sessionId,cacheKey:e.cacheKey})]}),children:t=>(0,D.jsx)(D.Fragment,{children:t.dataOpen&&e.cacheKey?(0,D.jsx)(x,{cacheKey:e.cacheKey}):t.selectedWhatsapp&&e.cacheKey?t.selectedWhatsapp.source===`store`&&t.selectedWhatsapp.remoteJid&&t.selectedWhatsapp.accountId?(0,D.jsx)(b,{accountId:t.selectedWhatsapp.accountId,remoteJid:t.selectedWhatsapp.remoteJid,contactName:o(t.selectedWhatsapp),sessionKey:e.cacheKey,onBack:t.onClearWhatsapp},u(t.selectedWhatsapp)):(0,D.jsx)(k,{sessionId:t.selectedWhatsapp.sessionId,projectDir:t.selectedWhatsapp.projectDir,sessionKey:e.cacheKey,contactName:o(t.selectedWhatsapp),onBack:t.onClearWhatsapp},u(t.selectedWhatsapp)):(0,D.jsx)(Y,{cacheKey:e.cacheKey,userName:e.userName,onSelectWhatsappConversation:t.onSelectWhatsappConversation})})})}):(0,D.jsx)(p,{auth:e})}(0,T.createRoot)(document.getElementById(`root`)).render((0,D.jsx)(X,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CltuBf4Z.js";import{B as t,F as n,K as r,P as i,T as a,U as o,W as s,_ as c,g as l,p as u}from"./useSubAccountSwitcher-Bg72hdQ8.js";import{T as d,_ as f,b as p,t as m}from"./AdminShell-HeELCCjJ.js";var h=i(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),g=i(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),_=s(),v=e(r(),1),y=t(),b={read:`read`,write_local:`writes`,exec:`runs`,external:`sends`},x={read:`tool-chip-read`,write_local:`tool-chip-write_local`,exec:`tool-chip-exec`,external:`tool-chip-external`,unresolved:`tool-chip-unresolved`};function S({label:e,body:t}){return(0,y.jsxs)(`div`,{className:`agent-doc`,children:[(0,y.jsx)(`span`,{className:`agent-doc-label`,children:e}),(0,y.jsx)(`pre`,{className:`skill-body`,children:t.trim()||`Empty.`})]})}function C({summary:e,publicBaseUrl:t,accountId:n,adminFetch:r,onClose:i,onDeleted:o,onToggled:s}){let u=e.kind===`specialist`,d=e.origin===`shipped`,[m]=(0,v.useState)(n),[_,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(!0),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(!1),[M,N]=(0,v.useState)(!1),[P,F]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let t=!1;T(!0),D(null);let n=e.origin===`shipped`?`?origin=shipped`:e.kind===`specialist`&&e.plugin?`?plugin=${encodeURIComponent(e.plugin)}`:``;return r(`/api/admin/agents/${encodeURIComponent(e.slug)}${n}`).then(async e=>{if(!t){if(!e.ok)throw Error(`HTTP ${e.status}`);C((await e.json()).agent)}}).catch(e=>{t||D(e instanceof Error?e.message:`Failed to load`)}).finally(()=>{t||T(!1)}),()=>{t=!0}},[r,e.slug]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!A&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[A,i]);let I=(0,v.useCallback)(async()=>{j(!0),D(null);try{let t=await r(`/api/admin/agents/${encodeURIComponent(e.slug)}?accountId=${encodeURIComponent(m??``)}`,{method:`DELETE`,headers:{"content-type":`application/json`}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}o(e)}catch(e){D(e instanceof Error?e.message:`Delete failed`),j(!1),k(!1)}},[r,e,m,o]),L=(0,v.useCallback)(async()=>{let t=e.disabled?`enable`:`disable`;F(!0),D(null);try{let n=await r(`/api/admin/agents/${encodeURIComponent(e.slug)}/${t}?accountId=${encodeURIComponent(m??``)}`,{method:`POST`,headers:{"content-type":`application/json`}});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}s(),i()}catch(e){D(e instanceof Error?e.message:`${t} failed`),F(!1),N(!1)}},[r,e,m,s,i]),R=u?null:_,z=u?_:null;return(0,y.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{A||i()},children:(0,y.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Agent detail`,onClick:e=>e.stopPropagation(),children:[(0,y.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,y.jsxs)(`span`,{className:`cal-modal-kind`,children:[(0,y.jsx)(p,{size:13}),` `,u?`Specialist`:`Agent`]}),(0,y.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:i,"aria-label":`Close`,autoFocus:!0,disabled:A,children:(0,y.jsx)(l,{size:16})})]}),(0,y.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,y.jsx)(`div`,{className:`cal-modal-title`,children:e.displayName}),(0,y.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[!u&&(0,y.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,y.jsxs)(`span`,{children:[`/`,e.slug]}),e.risk&&(0,y.jsx)(`span`,{className:`agent-risk-badge agent-risk-${e.risk}`,children:e.risk===`green`?`Read only`:e.risk===`amber`?`Writes`:`Runs`}),e.disabled&&(0,y.jsx)(`span`,{className:`agent-kind-pill agent-disabled-pill`,children:`Disabled`})]}),e.unresolved.length>0&&(0,y.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,y.jsxs)(`span`,{children:[`Forced to Runs: no declared risk class for `,e.unresolved.join(`, `),`.`]})}),w&&(0,y.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,y.jsx)(a,{size:14,className:`spin`}),(0,y.jsx)(`span`,{children:`Loading…`})]}),R&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,y.jsxs)(`span`,{children:[R.status,R.model?` · ${R.model}`:``]})}),(0,y.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,y.jsxs)(`a`,{href:`${t}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`cal-link`,children:[(0,y.jsx)(f,{size:13}),` Open agent`]})}),R.present.identity&&(0,y.jsx)(S,{label:`Identity`,body:R.identity}),R.present.soul&&(0,y.jsx)(S,{label:`Soul`,body:R.soul}),R.present.knowledge&&(0,y.jsx)(S,{label:`Knowledge`,body:R.knowledge}),R.present.knowledgeSummary&&(0,y.jsx)(S,{label:`Knowledge summary`,body:R.knowledgeSummary}),R.knowledgeKeywords.length>0&&(0,y.jsxs)(`div`,{className:`skill-refs`,children:[(0,y.jsx)(`span`,{className:`skill-refs-label`,children:`Knowledge keywords`}),R.knowledgeKeywords.map(e=>(0,y.jsx)(`span`,{className:`skill-ref`,children:e},e))]})]}),z&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,y.jsxs)(`span`,{children:[e.plugin,z.model?` · ${z.model}`:``]})}),z.description&&(0,y.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,y.jsx)(`span`,{children:z.description})}),z.byTool.length>0&&(0,y.jsxs)(`div`,{className:`chip-refs`,children:[(0,y.jsxs)(`span`,{className:`skill-refs-label`,children:[`Tools (`,z.byTool.length,`)`,z.worstTool?` · worst: ${z.worstTool}`:``]}),(0,y.jsx)(`div`,{className:`chip-row`,children:z.byTool.map(({tool:e,risk:t})=>(0,y.jsx)(`span`,{"data-testid":`tool-chip-${e}`,className:`tool-chip ${x[t??`unresolved`]}`,title:t?`${e} — ${b[t]}`:`${e} — no declared risk class`,children:e},e))})]}),z.skills.length>0&&(0,y.jsxs)(`div`,{className:`chip-refs`,children:[(0,y.jsx)(`span`,{className:`skill-refs-label`,children:`Skills`}),(0,y.jsx)(`div`,{className:`chip-row`,children:z.skills.map(e=>(0,y.jsx)(`span`,{className:`tool-chip tool-chip-skill`,children:e},e))})]}),(0,y.jsx)(S,{label:`System prompt`,body:z.systemPrompt})]})]}),E&&(0,y.jsx)(`div`,{className:`cal-modal-error`,children:E}),(0,y.jsx)(`div`,{className:`cal-modal-actions`,children:d?M?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`cal-modal-confirm-text`,children:e.disabled?`Put this agent back in the dispatchable set?`:`Stop this agent being dispatched?`}),(0,y.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:L,disabled:P,children:[P?(0,y.jsx)(a,{size:14,className:`spin`}):e.disabled?(0,y.jsx)(g,{size:14}):(0,y.jsx)(h,{size:14}),e.disabled?` Enable`:` Disable`]}),(0,y.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>N(!1),disabled:P,children:`Cancel`})]}):(0,y.jsx)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>N(!0),disabled:P||w||!m,children:e.disabled?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(g,{size:14}),` Enable`]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h,{size:14}),` Disable`]})}):u?(0,y.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Edit in chat via agent-builder.`}):(0,y.jsxs)(y.Fragment,{children:[!O&&(0,y.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>k(!0),disabled:A||w||!m,children:[(0,y.jsx)(c,{size:14}),` Delete`]}),O&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this agent?`}),(0,y.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:I,disabled:A,children:[A?(0,y.jsx)(a,{size:14,className:`spin`}):(0,y.jsx)(c,{size:14}),` Delete`]}),(0,y.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>k(!1),disabled:A,children:`Cancel`})]})]})})]})})}var w=`maxy-admin-session-key`,T={green:`Read only`,amber:`Writes`,red:`Runs`},E={shipped:`Shipped`,specialist:`Specialist`,public:`Public`};function D(){let[e,t]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(void 0),[s,c]=(0,v.useState)(null),[l,f]=(0,v.useState)(void 0),[p,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(w)}catch{}if(!n){i(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(w)}catch{}window.location.href=`/`;return}if(r.ok)try{let e=await r.json();typeof e.businessName==`string`&&o(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),_(e.role??null),f(e.userName===void 0?null:e.userName),h(e.avatar??null)}catch{}t(n),i(!0)}}).catch(()=>{e||(t(n),i(!0))}),()=>{e=!0}},[]);let b=(0,v.useCallback)(()=>{try{sessionStorage.removeItem(w)}catch{}window.location.href=`/`},[]),[x,S]=(0,v.useState)(!1),C=(0,v.useCallback)(async()=>{S(!0);try{let e=await d();if(e){try{sessionStorage.removeItem(w)}catch{}window.location.href=`/`}return e}finally{S(!1)}},[]);return r?e?(0,y.jsx)(u,{cacheKey:e,surface:`agents`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=agents`);try{sessionStorage.removeItem(w)}catch{}window.location.href=`/`},children:(0,y.jsx)(m,{cacheKey:e,businessName:a,sessionId:s,onLogout:b,onDisconnect:C,disconnecting:x,userName:l,userAvatar:p,role:g,children:(0,y.jsx)(O,{cacheKey:e})})}):(0,y.jsx)(`div`,{className:`cal-page`,children:(0,y.jsxs)(`div`,{className:`cal-empty`,children:[(0,y.jsx)(`p`,{children:`You are not signed in.`}),(0,y.jsxs)(`p`,{children:[`Open the `,(0,y.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,y.jsx)(n,{surface:`gate`})}function O({cacheKey:e}){let{adminFetch:t,sessionRefetchNonce:r}=o({initialCacheKey:e,surface:`agents`}),[i,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(0),[u,d]=(0,v.useState)(0),[f,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),[w,D]=(0,v.useState)(null),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(``);(0,v.useEffect)(()=>{j(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]);let M=(0,v.useCallback)(()=>{let e=!1;return b(!0),D(null),t(`/api/admin/agents`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();s(Array.isArray(n.agents)?n.agents:[]),l(typeof n.skipped==`number`?n.skipped:0),d(typeof n.specialistsSkipped==`number`?n.specialistsSkipped:0),g(typeof n.accountId==`string`?n.accountId:null),m(n.riskSurfaceFailed===!0)}).catch(t=>{e||(D(t instanceof Error?t.message:`Failed to load`),s([]))}).finally(()=>{e||(b(!1),S(!0))}),()=>{e=!0}},[t]);(0,v.useEffect)(()=>M(),[M,r]);let N=(0,v.useCallback)(e=>{s(t=>t.filter(t=>t.slug!==e.slug)),k(null),M()},[M]);return x?(0,y.jsxs)(`div`,{className:`cal-page`,children:[(0,y.jsx)(`header`,{className:`cal-header`,children:(0,y.jsxs)(`div`,{className:`cal-nav`,children:[(0,y.jsxs)(`span`,{className:`cal-range-label`,children:[(0,y.jsx)(p,{size:16}),` Agents`]}),_&&(0,y.jsx)(a,{size:16,className:`spin`})]})}),(0,y.jsxs)(`div`,{className:`cal-body`,children:[w&&(0,y.jsxs)(`div`,{className:`cal-error`,children:[`Could not load agents: `,w]}),f&&(0,y.jsx)(`div`,{className:`cal-error`,children:`The plugin registry could not be read, so every agent below is shown at the highest risk regardless of the tools it declares. These badges are not derived.`}),c+u>0&&(0,y.jsxs)(`div`,{className:`cal-error`,children:[c+u,` agent`,c+u===1?``:`s`,` could not be read (malformed config or frontmatter).`]}),!w&&!_&&i.length===0&&(0,y.jsx)(`div`,{className:`cal-empty`,children:(0,y.jsx)(`p`,{children:`No agents yet. Ask in chat to create one.`})}),i.length>0&&(0,y.jsx)(`div`,{className:`routine-list`,children:i.map(e=>(0,y.jsxs)(`button`,{type:`button`,className:`routine-card`,onClick:()=>k(e),children:[(0,y.jsxs)(`span`,{className:`routine-card-title`,children:[e.displayName,e.risk&&(0,y.jsx)(`span`,{className:`agent-risk-badge agent-risk-${e.risk}`,"data-testid":`agent-risk-badge`,children:T[e.risk]}),(0,y.jsx)(`span`,{className:`agent-kind-pill agent-origin-${e.origin}`,children:E[e.origin]}),e.disabled&&(0,y.jsx)(`span`,{className:`agent-kind-pill agent-disabled-pill`,children:`Disabled`})]}),e.kind===`specialist`?(0,y.jsxs)(`span`,{className:`routine-card-sched`,children:[`/`,e.slug]}):(0,y.jsxs)(`span`,{className:`routine-card-sched`,children:[(0,y.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),` /`,e.slug]}),(0,y.jsx)(`span`,{className:`routine-card-meta`,children:e.origin===`public`?e.status:e.worstTool?`worst tool: ${e.worstTool}`:e.plugin})]},`${e.origin}:${e.slug}`))})]}),O&&(0,y.jsx)(C,{summary:O,publicBaseUrl:A,accountId:h,adminFetch:t,onClose:()=>k(null),onDeleted:N,onToggled:M})]}):(0,y.jsx)(n,{surface:`gate`})}(0,_.createRoot)(document.getElementById(`root`)).render((0,y.jsx)(D,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{B as e,W as t}from"./useSubAccountSwitcher-Bg72hdQ8.js";import"./useVoiceRecorder-CZDDiwMD.js";import"./AdminShell-HeELCCjJ.js";import{n}from"./page-DZE3H_n4.js";import"./useCopyFeedback-7zwf9_w4.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e}from"./useSubAccountSwitcher-Bg72hdQ8.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e}from"./useSubAccountSwitcher-Bg72hdQ8.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e}from"./useSubAccountSwitcher-Bg72hdQ8.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{B as e,W as t}from"./useSubAccountSwitcher-Bg72hdQ8.js";import"./useVoiceRecorder-CZDDiwMD.js";import{t as n}from"./page-CHK1415C.js";import"./graph-labels-Du-6KoBE.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
File without changes
|