@sentry/junior-dashboard 0.280.0 → 0.281.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/dist/app.js +23 -30
- package/dist/client-manifest.json +1 -1
- package/dist/index.js +23 -30
- package/dist/public/chunks/{AdminPage-YEKZOKH6.js → AdminPage-M5RBVZFN.js} +1 -1
- package/dist/public/chunks/{AutomationPage-5GS3IUAK.js → AutomationPage-WALCREDT.js} +1 -1
- package/dist/public/chunks/{AutomationRunsPage-IPYEZU4L.js → AutomationRunsPage-CV47E4UX.js} +1 -1
- package/dist/public/chunks/{AutomationsPage-HSAYPC3C.js → AutomationsPage-57L3AQVJ.js} +1 -1
- package/dist/public/chunks/{CodePage-IPFKXWFB.js → CodePage-XJUYMFJH.js} +1 -1
- package/dist/public/chunks/{ConnectionsPage-5XUEK6FS.js → ConnectionsPage-3QQAGYWF.js} +1 -1
- package/dist/public/chunks/{LocationDetailPage-27ETUGR6.js → LocationDetailPage-4IL5HQML.js} +1 -1
- package/dist/public/chunks/{LocationsPage-WOKMQAGM.js → LocationsPage-D2DUQAHJ.js} +1 -1
- package/dist/public/chunks/{PeoplePage-6YQLDOUL.js → PeoplePage-6F5GPQ7C.js} +1 -1
- package/dist/public/chunks/{PersonProfilePage-GYMAZFIK.js → PersonProfilePage-SPAYQPTD.js} +1 -1
- package/dist/public/chunks/{PersonalTokensPage-4BCR744B.js → PersonalTokensPage-SHAUJ74M.js} +1 -1
- package/dist/public/chunks/{PluginUserPage-IP6WL7MD.js → PluginUserPage-64FIWD7M.js} +1 -1
- package/dist/public/chunks/{RepositoryPage-TRD44LQ3.js → RepositoryPage-L7IHOXSN.js} +1 -1
- package/dist/public/chunks/{SettingsPage-4E3SLQ36.js → SettingsPage-U7WG4FHE.js} +1 -1
- package/dist/public/chunks/{SystemPage-C3XBKXKW.js → SystemPage-ZBC43OJH.js} +1 -1
- package/dist/public/chunks/{WorkspaceFormPage-2LS2X67Q.js → WorkspaceFormPage-3NVIIZ4P.js} +1 -1
- package/dist/public/chunks/{WorkspacesPage-5WB3CUTX.js → WorkspacesPage-G73HPBDD.js} +1 -1
- package/dist/public/chunks/{chunk-VFEBNOPX.js → chunk-2J3LGF5Q.js} +1 -1
- package/dist/public/chunks/chunk-2NNKHSZE.js +1 -0
- package/dist/public/chunks/chunk-4TQSTCIN.js +13 -0
- package/dist/public/chunks/chunk-64GPEGGE.js +1 -0
- package/dist/public/chunks/{chunk-WZVO3HG4.js → chunk-6FHY65EQ.js} +1 -1
- package/dist/public/chunks/{chunk-YYNMZ4WC.js → chunk-DEEO4D4N.js} +1 -1
- package/dist/public/chunks/{chunk-SDKV3OID.js → chunk-FSGVY7HB.js} +1 -1
- package/dist/public/chunks/chunk-GZBMHYYU.js +1 -0
- package/dist/public/chunks/{chunk-NQMDED2R.js → chunk-II4NXLSQ.js} +1 -1
- package/dist/public/chunks/{chunk-B6HGRBBX.js → chunk-ILH47V7O.js} +1 -1
- package/dist/public/chunks/{chunk-GRMX2HX6.js → chunk-JPL2NRWK.js} +1 -1
- package/dist/public/chunks/{chunk-NQOJAZFQ.js → chunk-JVJ5UWIK.js} +1 -1
- package/dist/public/chunks/{chunk-V5UDSIRA.js → chunk-K4TYMAA3.js} +1 -1
- package/dist/public/chunks/{chunk-EFEREKX4.js → chunk-KDUTK357.js} +1 -1
- package/dist/public/chunks/{chunk-RHIXHBS5.js → chunk-LZYAHJVQ.js} +1 -1
- package/dist/public/chunks/{chunk-5GZDBGAR.js → chunk-MKKFXRYO.js} +1 -1
- package/dist/public/chunks/{chunk-PEQNT5MO.js → chunk-NGQRNS3C.js} +1 -1
- package/dist/public/chunks/{chunk-IA6BJDKN.js → chunk-ONDKE72P.js} +1 -1
- package/dist/public/chunks/{chunk-WJ3OXMVX.js → chunk-PG7M7L24.js} +1 -1
- package/dist/public/chunks/{chunk-6GQL3EVJ.js → chunk-QQUFROWT.js} +1 -1
- package/dist/public/chunks/{chunk-UAH6DWNS.js → chunk-RB5FBDEY.js} +1 -1
- package/dist/public/chunks/{chunk-A2QWWA7O.js → chunk-RGXXD4DM.js} +1 -1
- package/dist/public/chunks/{chunk-AYXSBMWA.js → chunk-TC7TU4GK.js} +1 -1
- package/dist/public/chunks/chunk-WLIOZO3W.js +1 -0
- package/dist/public/chunks/{chunk-VXT3FIVL.js → chunk-XDUSY26N.js} +11 -11
- package/dist/public/client-4OAAOHF4.js +68 -0
- package/dist/tailwind.css +1 -1
- package/package.json +4 -4
- package/src/client/components/BottomSheet.tsx +1 -1
- package/src/client/components/DetailsPanel.tsx +2 -1
- package/src/client/conversations/ConversationBrief.tsx +129 -65
- package/src/client/conversations/ConversationDetails.tsx +13 -14
- package/src/client/conversations/ConversationEventLog.tsx +20 -97
- package/src/client/conversations/ConversationHeader.tsx +41 -26
- package/src/client/conversations/ConversationHeaderActions.tsx +3 -1
- package/src/client/conversations/ConversationLinkedWork.tsx +30 -10
- package/src/client/conversations/ConversationMeta.tsx +15 -15
- package/src/client/conversations/ConversationPage.tsx +31 -7
- package/src/client/conversations/ConversationTranscript.tsx +234 -186
- package/src/client/conversations/ConversationUsageBreakdown.tsx +142 -64
- package/src/client/conversations/DetailsList.tsx +7 -1
- package/src/client/conversations/PendingMailboxStack.tsx +88 -44
- package/src/client/conversations/TranscriptActivityGroup.tsx +7 -14
- package/src/client/conversations/TranscriptEventView.tsx +7 -3
- package/src/client/conversations/TranscriptReasoningView.tsx +4 -2
- package/src/client/conversations/TranscriptRows.tsx +37 -5
- package/src/client/conversations/TranscriptView.tsx +4 -0
- package/src/client/conversations/queries.ts +74 -43
- package/src/client/conversations/transcriptBottomPinning.ts +13 -5
- package/src/client/conversations/transcriptListRows.ts +215 -0
- package/src/client/conversations/virtualRows.ts +168 -0
- package/src/client/http.ts +6 -5
- package/src/client/sentry.ts +53 -3
- package/src/conversation-cache.ts +8 -10
- package/src/mock-reporting/fixtures.ts +0 -8
- package/dist/public/chunks/chunk-GO45RQDL.js +0 -1
- package/dist/public/chunks/chunk-N4AONKD3.js +0 -1
- package/dist/public/chunks/chunk-QNA7F7QB.js +0 -1
- package/dist/public/chunks/chunk-R4ORRE77.js +0 -1
- package/dist/public/chunks/chunk-Z2JPRGFT.js +0 -1
- package/dist/public/client-TYC7JKRE.js +0 -91
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N,b as w,c as H}from"./chunk-
|
|
1
|
+
import{a as N,b as w,c as H}from"./chunk-QQUFROWT.js";import{a as T,b as R}from"./chunk-ONDKE72P.js";import"./chunk-PG7M7L24.js";import"./chunk-SUX4QBVF.js";import"./chunk-K4TYMAA3.js";import{b as u}from"./chunk-5LNGNJ3P.js";import{a as C}from"./chunk-DEEO4D4N.js";import"./chunk-KDUTK357.js";import"./chunk-2BCS5AQL.js";import{a as p,b as g,c as y,e as m,f as o,g as s}from"./chunk-QOX5RMLM.js";import{e as l}from"./chunk-564V7YHG.js";import{d as b}from"./chunk-64GPEGGE.js";import"./chunk-ILH47V7O.js";import"./chunk-II4NXLSQ.js";import"./chunk-GMZIELFU.js";import"./chunk-4TQSTCIN.js";import{Ka as d}from"./chunk-XDUSY26N.js";import{a as f}from"./chunk-GOTQ4D6W.js";import{G as x,K as h,M as v,o as c}from"./chunk-6PHJZPWD.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-B5ZN3SWQ.js";import{a as L,b as n}from"./chunk-YPMUHXYT.js";import{c as i}from"./chunk-7SZRL6FY.js";var k=i(L(),1);var e=i(n(),1);function G(){let[r,t]=(0,k.useState)(30),a=b();return!a.data&&!a.error?(0,e.jsx)(C,{description:"Repositories and code changes created by Junior.",label:"Loading code activity",title:"Code",variant:"stats"}):(0,e.jsxs)(f,{children:[(0,e.jsx)(v,{description:"Repositories and code changes created by Junior.",onRangeChange:t,range:r,title:"Code"}),a.error?(0,e.jsx)(l,{children:"Code activity is unavailable. Try refreshing the dashboard."}):null,a.data?(0,e.jsx)(P,{data:a.data,range:r}):null]})}function P(r){let t=r.data;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(H,{summary:t.summary}),(0,e.jsx)(T,{bucketUnit:x(r.range),days:h({days:t.activityDays,hours:t.activityHours,sixHours:t.activitySixHours,range:r.range,emptySixHour:a=>({closed:0,created:0,date:a,merged:0})}),range:r.range}),(0,e.jsxs)(d,{as:"section",children:[(0,e.jsx)("div",{className:"border-b border-dashboard-border-subtle px-4 py-3 font-display text-lg text-dashboard-text",children:"Repositories"}),t.repositories.length===0?(0,e.jsx)("div",{className:"p-4",children:(0,e.jsx)(l,{children:"No code activity has been recorded yet."})}):(0,e.jsxs)(p,{className:"min-w-[36rem] table-fixed",children:[(0,e.jsxs)("colgroup",{children:[(0,e.jsx)("col",{}),(0,e.jsx)("col",{className:"w-28"}),(0,e.jsx)("col",{className:"w-28"}),(0,e.jsx)("col",{className:"w-28"})]}),(0,e.jsx)(g,{children:(0,e.jsxs)(m,{children:[(0,e.jsx)(o,{className:"px-4",children:"Repository"}),(0,e.jsx)(o,{className:"px-4 text-right",children:"Created"}),(0,e.jsx)(o,{className:"px-4 text-right",children:"Merge rate"}),(0,e.jsx)(o,{className:"px-4 text-right",children:"Median cost"})]})}),(0,e.jsx)(y,{children:t.repositories.map(a=>(0,e.jsxs)(m,{children:[(0,e.jsxs)(s,{className:"min-w-0 px-4 py-3",children:[(0,e.jsx)("div",{className:"truncate font-display text-sm text-dashboard-text",children:(0,e.jsx)(c,{className:"text-inherit no-underline hover:text-dashboard-accent-text",to:u(a.id),children:a.name})}),(0,e.jsx)("div",{className:"mt-1 truncate font-mono text-xs text-dashboard-text-muted",children:a.provider})]}),(0,e.jsx)(s,{className:"px-4 py-3 text-right font-sans tabular-nums",children:a.created}),(0,e.jsx)(s,{className:"px-4 py-3 text-right font-sans tabular-nums",children:N(a.mergeRate)}),(0,e.jsx)(s,{className:"px-4 py-3 text-right font-sans tabular-nums",children:w(a.medianCostUsd)})]},a.id))})]})]}),t.changes.length>0?(0,e.jsxs)(d,{as:"section",children:[(0,e.jsx)("div",{className:"border-b border-dashboard-border-subtle px-4 py-3 font-display text-lg text-dashboard-text",children:"Recent changes"}),(0,e.jsx)("div",{children:t.changes.map(a=>(0,e.jsx)(R,{change:a},a.id))})]}):null]})}export{G as CodePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as F}from"./chunk-XNR4RZEC.js";import{a as Q}from"./chunk-DZB4LPI6.js";import"./chunk-L2H3ZWZN.js";import"./chunk-MTBUV2GJ.js";import{d as v,g as h,i as c,
|
|
1
|
+
import{a as F}from"./chunk-XNR4RZEC.js";import{a as Q}from"./chunk-DZB4LPI6.js";import"./chunk-L2H3ZWZN.js";import"./chunk-MTBUV2GJ.js";import{d as v,g as h,i as c,r as S,u as k,v as w}from"./chunk-4TQSTCIN.js";import{Ka as E,qa as x,ra as N,sa as P}from"./chunk-XDUSY26N.js";import"./chunk-QPBLZSNX.js";import"./chunk-RHMZNAJX.js";import"./chunk-GOTQ4D6W.js";import{s as D}from"./chunk-6PHJZPWD.js";import{b as l}from"./chunk-CR2ICLSH.js";import{b as f,oc as C}from"./chunk-YPMUHXYT.js";import{c as g}from"./chunk-7SZRL6FY.js";var n=g(f(),1),I=["dashboard","connections"];function L(d){return`/api/connections/${encodeURIComponent(d)}`}function W(){let d=v(),s=h({queryKey:I,queryFn:({signal:e})=>w(x,"/api/connections",e),refetchOnWindowFocus:!0,retry:!1}),o=c({mutationFn:e=>S(N,L(e.provider),{}),onSuccess:({authorizationUrl:e},{popup:t})=>{if(!t){window.location.assign(e);return}t.closed||(t.opener=null,t.location.href=e)},onError:(e,{popup:t})=>{t?.close()}}),r=c({mutationFn:e=>k(P,L(e.provider)),onSuccess:(e,t)=>{d.setQueryData(I,b=>b&&{connections:b.connections.map(a=>a.provider===t.provider?{provider:a.provider,displayName:a.displayName,description:a.description,connected:!1}:a)})}}),p=s.data?.connections??[],u=o.isPending||r.isPending,i=o.isPending?o.variables?.provider:r.isPending?r.variables?.provider:void 0,m=!s.data&&s.isError,y=o.isError?"Could not start the connection. Try again.":r.isError?"Could not disconnect the account. Try again.":m?"Could not load identities. Try again.":void 0;return(0,n.jsxs)(Q,{description:(0,n.jsxs)(n.Fragment,{children:["Connect an account so ",D()," can act as you in conversations you start here."]}),title:"Identities",children:[y?(0,n.jsx)(F,{children:y}):null,m?null:(0,n.jsx)(E,{className:"mb-0",variant:"raised",children:s.isPending?(0,n.jsx)("p",{className:"m-0 p-5 text-sm text-dashboard-text-muted",children:"Loading identities\u2026"}):p.length===0?(0,n.jsx)("p",{className:"m-0 p-5 text-sm text-dashboard-text-muted",children:"No installed plugins support account connections."}):(0,n.jsx)("ul",{className:"m-0 list-none divide-y divide-dashboard-border-subtle p-0",children:p.map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-3 px-5 py-4",children:[(0,n.jsx)(C,{className:"shrink-0 text-dashboard-accent",size:16}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"m-0 truncate text-sm font-semibold",children:e.displayName}),(0,n.jsx)("p",{className:"mt-1 mb-0 line-clamp-2 break-words text-xs text-dashboard-text-muted",children:e.connected?e.account?(0,n.jsxs)(n.Fragment,{children:["Connected as"," ",e.account.url?(0,n.jsx)("a",{className:"text-dashboard-text",href:e.account.url,rel:"noreferrer",target:"_blank",children:e.account.label}):e.account.label]}):"Connected":e.description})]}),e.connected?(0,n.jsx)(l,{"aria-busy":i===e.provider,"aria-label":`Disconnect ${e.displayName}`,disabled:u,onClick:()=>{o.reset(),r.mutate(e)},variant:"danger",children:i===e.provider?"Disconnecting\u2026":"Disconnect"}):(0,n.jsx)(l,{"aria-busy":i===e.provider,"aria-label":`Connect ${e.displayName}`,disabled:u,onClick:()=>{r.reset();let t=window.open("about:blank","_blank");o.mutate({provider:e.provider,popup:t})},children:i===e.provider?"Connecting\u2026":"Connect"})]},e.provider))})})]})}export{W as ConnectionsPage};
|
package/dist/public/chunks/{LocationDetailPage-27ETUGR6.js → LocationDetailPage-4IL5HQML.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-UZ44J2LH.js";import{a as l}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-UZ44J2LH.js";import{a as l}from"./chunk-PG7M7L24.js";import{a as V}from"./chunk-SUX4QBVF.js";import{a as R,c as B,f as w,o as M,p as $,q as z,r as E,s as G,t as I,w as q,x as H}from"./chunk-K4TYMAA3.js";import{a as u}from"./chunk-TC7TU4GK.js";import"./chunk-UT6HZPGL.js";import{b as N}from"./chunk-J37MXUED.js";import"./chunk-TFJOEF3Q.js";import"./chunk-DEEO4D4N.js";import"./chunk-KDUTK357.js";import{e as f}from"./chunk-564V7YHG.js";import{r as A}from"./chunk-64GPEGGE.js";import"./chunk-ILH47V7O.js";import{K as S,b as p,g as D,r as s,s as P}from"./chunk-II4NXLSQ.js";import"./chunk-GMZIELFU.js";import"./chunk-4TQSTCIN.js";import{Ka as n}from"./chunk-XDUSY26N.js";import"./chunk-QPBLZSNX.js";import"./chunk-RHMZNAJX.js";import"./chunk-GOTQ4D6W.js";import{H as T,M as U,g as b,o as h}from"./chunk-6PHJZPWD.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-B5ZN3SWQ.js";import{Lc as L,Zb as x,b as m,bc as k,vb as g,xb as C}from"./chunk-YPMUHXYT.js";import{c}from"./chunk-7SZRL6FY.js";var t=c(m(),1);function j(o){let e=o.bucketUnit??"day",r=o.days.map(i=>i.conversations),v=Math.max(1,...r),d=E(r);return(0,t.jsxs)(n,{children:[(0,t.jsx)(O,{description:"Daily persisted conversations for this location.",title:"Conversation activity",trailing:(0,t.jsx)(V,{ariaLabel:"Conversation activity period",inline:!0,items:[{color:"var(--color-cyan-400)",key:"period",label:"90 days"}]})}),(0,t.jsx)("div",{className:"px-2 py-3 sm:px-4 sm:py-4",children:(0,t.jsx)(q,{className:"aspect-auto h-60 w-full",config:{},children:(0,t.jsxs)(w,{"aria-label":"Daily conversations for this location",data:o.days,margin:M,role:"img",children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"location-bars",x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:"var(--color-cyan-400)"}),(0,t.jsx)("stop",{offset:"100%",stopColor:"var(--color-amber-500)",stopOpacity:"0.65"})]})}),(0,t.jsx)(R,{strokeDasharray:"3 5",vertical:!1}),(0,t.jsx)(z,{maximum:v}),(0,t.jsx)($,{keys:o.days.map(i=>i.date)}),(0,t.jsx)(H,{content:(0,t.jsx)(I,{rows:i=>[["conversations",i.conversations],["active",i.active],["failed",i.failed]]})}),(0,t.jsx)(B,{dataKey:"conversations",fill:"url(#location-bars)",fillOpacity:.9,isAnimationActive:!1,maxBarSize:20,minPointSize:i=>i?2:0,radius:2}),(0,t.jsx)(G,{unit:T(e),average:d,format:P,stroke:"var(--color-cyan-400)"})]})})})]})}var a=c(m(),1);function fa(){let o=b(),e=A(o.locationId);return(0,a.jsx)(K,{data:e.data,error:e.error})}function K(o){return!o.data&&!o.error?(0,a.jsx)(u,{children:(0,a.jsx)(N,{label:"Loading location"})}):(0,a.jsxs)(u,{children:[o.error?(0,a.jsx)(n,{padding:"sm",children:(0,a.jsx)(f,{children:o.data?"Location telemetry refresh failed. Showing cached data.":"Location failed to load."})}):null,o.data?(0,a.jsx)(X,{detail:o.data}):null]})}function X(o){let e=o.detail;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(U,{description:`${e.provider} public ${e.kind} / ${e.providerDestinationId} / last active ${D(e.lastSeenAt)}`,title:e.label}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,a.jsx)(l,{detail:"Persisted conversations",icon:k,label:"Conversations",value:s(e.conversations)}),(0,a.jsx)(l,{detail:"Verified people seen here",icon:L,label:"People",value:s(e.actors.length)}),(0,a.jsx)(l,{detail:"Persisted model usage",icon:C,label:"Tokens",value:s(e.tokens??0)}),(0,a.jsx)(l,{detail:"Cumulative conversation runtime",icon:g,label:"Runtime",value:(0,a.jsx)(p,{value:e.durationMs})})]}),(0,a.jsx)(j,{days:e.activityDays}),(0,a.jsxs)(n,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 border-b border-dashboard-border-subtle px-4 py-4",children:[(0,a.jsx)("span",{className:"grid size-9 place-items-center rounded-md border border-dashboard-accent/15 bg-dashboard-accent/[0.06] text-dashboard-accent",children:(0,a.jsx)(x,{"aria-hidden":"true",size:16})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"m-0 font-sans text-xs font-medium text-dashboard-text-muted",children:"People seen here"}),(0,a.jsx)("p",{className:"mt-1 mb-0 font-mono text-xs text-dashboard-text-muted",children:"Verified contributors across persisted conversations."})]})]}),e.actors.length?(0,a.jsx)("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3",children:e.actors.slice(0,9).map((r,v)=>{let d=[r.actor.email,r.actor.slackUserId,r.actor.slackUserName,r.actor.fullName,v].join(":"),i=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"truncate font-display text-base font-medium text-dashboard-text",children:r.label}),(0,a.jsxs)("div",{className:"mt-1 font-mono text-xs text-dashboard-text-muted",children:[s(r.conversations)," conversations /"," ",(0,a.jsx)(p,{value:r.durationMs})]})]}),y="min-w-0 border-b border-r border-dashboard-border-subtle px-4 py-3.5 transition-colors hover:bg-dashboard-fill-soft";return r.actor.email?(0,a.jsx)(h,{className:`${y} text-inherit no-underline`,to:S(r.actor.email),children:i},d):(0,a.jsx)("div",{className:y,children:i},d)})}):(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)(f,{children:"No verified people have been recorded here."})})]})]})}export{fa as LocationDetailPage,K as LocationDetailPageContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as tt,b as et,c as at,d as ot,e as L}from"./chunk-UJD3MBMB.js";import{a as Z}from"./chunk-5ISD3QSC.js";import{a as C}from"./chunk-UZ44J2LH.js";import"./chunk-4UGZNVJM.js";import{a as f}from"./chunk-
|
|
1
|
+
import{a as tt,b as et,c as at,d as ot,e as L}from"./chunk-UJD3MBMB.js";import{a as Z}from"./chunk-5ISD3QSC.js";import{a as C}from"./chunk-UZ44J2LH.js";import"./chunk-4UGZNVJM.js";import{a as f}from"./chunk-PG7M7L24.js";import{a as Y}from"./chunk-SUX4QBVF.js";import{a as _,c as Q,f as j,o as G,p as V,q as W,t as X,w as F,x as J}from"./chunk-K4TYMAA3.js";import{a as I,b as O}from"./chunk-TC7TU4GK.js";import"./chunk-UT6HZPGL.js";import"./chunk-TFJOEF3Q.js";import"./chunk-DEEO4D4N.js";import"./chunk-KDUTK357.js";import{a as B}from"./chunk-H76B43OQ.js";import{e as g}from"./chunk-564V7YHG.js";import{q as N}from"./chunk-64GPEGGE.js";import"./chunk-ILH47V7O.js";import{M,b as h,g as w,r as l}from"./chunk-II4NXLSQ.js";import"./chunk-GMZIELFU.js";import"./chunk-MEHLQZDG.js";import"./chunk-4TQSTCIN.js";import{Ka as y}from"./chunk-XDUSY26N.js";import"./chunk-QPBLZSNX.js";import{b as E,c as q}from"./chunk-RHMZNAJX.js";import"./chunk-GOTQ4D6W.js";import{G as H,I as U,J as K,K as $,M as z,s as P}from"./chunk-6PHJZPWD.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import"./chunk-CR2ICLSH.js";import{Kb as R,Wb as p,_b as A,a as vt,b as u,bc as T,vb as D}from"./chunk-YPMUHXYT.js";import{c}from"./chunk-7SZRL6FY.js";var x=c(vt(),1);var r=c(u(),1),S=[{color:"var(--color-cyan-400)",dataKey:"publicConversations",key:"public",label:"public"},{color:"var(--color-amber-400)",dataKey:"privateConversations",key:"private",label:"private"}],bt=Object.fromEntries(S.map(t=>[t.key,{color:t.color,label:t.label}]));function it(t){let o=t.bucketUnit??"day",m=`Conversations per ${U(o)}`,d=Math.max(1,...t.days.flatMap(n=>[n.privateConversations,n.publicConversations]));return(0,r.jsxs)(y,{children:[(0,r.jsx)(C,{description:`${K(o)} public volume compared with private activity in aggregate.`,title:m,trailing:(0,r.jsx)(Y,{ariaLabel:"Conversation visibility legend",inline:!0,items:S})}),(0,r.jsx)("div",{className:"px-2 py-3 sm:px-4 sm:py-4",children:(0,r.jsx)(F,{className:"aspect-auto h-65 w-full",config:bt,children:(0,r.jsxs)(j,{"aria-label":`Public and private ${m.toLowerCase()}`,barGap:2,data:t.days,margin:G,role:"img",children:[(0,r.jsx)(_,{strokeDasharray:"3 5",vertical:!1}),(0,r.jsx)(W,{maximum:d}),(0,r.jsx)(V,{keys:t.days.map(n=>n.date)}),(0,r.jsx)(J,{content:(0,r.jsx)(X,{rows:n=>S.map(i=>[i.label,n[i.dataKey]])})}),S.map(n=>(0,r.jsx)(Q,{dataKey:n.dataKey,fill:`var(--color-${n.key})`,fillOpacity:.85,isAnimationActive:!1,maxBarSize:8,minPointSize:i=>i?2:0,radius:1.5},n.key))]})})})]})}var a=c(u(),1);function rt(t){return(0,a.jsxs)(y,{children:[(0,a.jsx)(C,{description:`${t.locations.length} of ${t.totalLocations} public locations`,title:"Public directory"}),(0,a.jsxs)(tt,{columnsClassName:"md:grid-cols-[minmax(14rem,1fr)_minmax(11rem,15rem)]",children:[(0,a.jsx)(B,{label:"Search locations",placeholder:"Search channel name...",value:t.query,onChange:t.onQueryChange}),(0,a.jsx)(Z,{ariaLabel:"Sort locations",onChange:o=>t.onSortChange(o),options:[{label:"Most conversations",value:"conversations"},{label:"Recently active",value:"recent"},{label:"Most tokens",value:"tokens"},{label:"Most runtime",value:"runtime"}],value:t.sort})]}),(0,a.jsx)(et,{ariaLabel:"Public location directory results",empty:t.locations.length===0?(0,a.jsx)(g,{children:"No public locations match this search."}):void 0,headers:["Location","Conversations","Tokens","Runtime"],loading:t.loading,children:t.locations.map(o=>(0,a.jsxs)(at,{to:M(o.id),children:[(0,a.jsx)(ot,{description:(0,a.jsxs)(a.Fragment,{children:["Last active ",w(o.lastSeenAt)]}),icon:(0,a.jsx)(R,{"aria-hidden":"true",size:16,strokeWidth:1.8}),iconClassName:"bg-dashboard-accent/[0.06] text-dashboard-accent group-hover:border-dashboard-accent/25",title:o.label}),(0,a.jsx)(L,{label:"Conversations",value:l(o.conversations)}),(0,a.jsx)(L,{label:"Tokens",value:l(o.tokens??0)}),(0,a.jsx)(L,{label:"Runtime",value:(0,a.jsx)(h,{value:o.durationMs})})]},o.id))})]})}var s=c(u(),1);function nt(t){return(0,s.jsx)(y,{className:"opacity-80",padding:"sm",children:(0,s.jsxs)("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 max-sm:grid-cols-[auto_minmax(0,1fr)]",children:[(0,s.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-md border border-dashboard-border bg-dashboard-fill-soft text-dashboard-text-muted",children:(0,s.jsx)(p,{"aria-hidden":"true",size:15})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"font-display text-base font-medium text-dashboard-text",children:"Private activity"}),(0,s.jsx)("div",{className:"mt-1 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:"DMs, private channels, and unknown visibility stay combined and unlinked."})]}),(0,s.jsxs)("div",{className:"text-right max-sm:col-start-2 max-sm:text-left",children:[(0,s.jsx)("div",{className:"font-display text-2xl font-light text-dashboard-text",children:l(t.item.conversations)}),(0,s.jsx)("div",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:"conversations"})]})]})})}var e=c(u(),1),ft=["conversations","recent","runtime","tokens"];function oe(){let t=N();return(0,e.jsx)(pt,{data:t.data,error:t.error})}function pt(t){let[o,m]=(0,x.useState)(90),[d,n]=q("sort","conversations",ft),i=(0,x.useDeferredValue)(d),[v,st,ct]=E();if(!t.data&&!t.error)return(0,e.jsx)(O,{description:"Public destinations and their conversation activity.",label:"Loading locations",title:"Locations",variant:"stats"});let lt=ht(t.data?.locations??[],ct,i),mt=t.data?$({days:t.data.activityDays,hours:t.data.activityHours,sixHours:t.data.activitySixHours,range:o,emptySixHour:b=>({date:b,privateConversations:0,publicConversations:0})}):[],dt=H(o),ut=t.data?.locations.reduce((b,k)=>b+k.conversations,0)??0,yt=t.data?.locations.reduce((b,k)=>b+k.durationMs,0)??0;return(0,e.jsxs)(I,{children:[(0,e.jsx)(z,{description:t.error&&!t.data?"Locations failed to load.":`See the public channels where ${P()} has been working and how busy they've been.`,onRangeChange:m,range:o,title:"Locations"}),t.error?(0,e.jsx)(y,{padding:"sm",children:(0,e.jsx)(g,{children:t.data?"Location telemetry refresh failed. Showing cached data.":"Location telemetry is unavailable. Try refreshing the dashboard."})}):null,t.data?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,e.jsx)(f,{detail:"Named public destinations",icon:A,label:"Public locations",value:l(t.data.locations.length)}),(0,e.jsx)(f,{detail:"Across public destinations",icon:T,label:"Conversations",value:l(ut)}),(0,e.jsx)(f,{detail:"Cumulative public runtime",icon:D,label:"Runtime",value:(0,e.jsx)(h,{value:yt})}),(0,e.jsx)(f,{detail:"Combined to preserve privacy",icon:p,label:"Private conversations",value:l(t.data.privateActivity.conversations)})]}),(0,e.jsx)(it,{bucketUnit:dt,days:mt}),(0,e.jsx)(rt,{loading:d!==i,locations:lt,onQueryChange:st,onSortChange:n,query:v,sort:d,totalLocations:t.data.locations.length}),t.data.privateActivity.conversations>0?(0,e.jsx)(nt,{item:t.data.privateActivity}):null]}):null]})}function ht(t,o,m){let d=o.trim().toLowerCase();return[...d?t.filter(i=>i.label.toLowerCase().includes(d)):t].sort((i,v)=>m==="conversations"?v.conversations-i.conversations:m==="runtime"?v.durationMs-i.durationMs:m==="tokens"?(v.tokens??0)-(i.tokens??0):Date.parse(v.lastSeenAt)-Date.parse(i.lastSeenAt))}export{oe as LocationsPage,pt as LocationsPageContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ye,b as fe,c as ge,d as ve,e as U}from"./chunk-UJD3MBMB.js";import{a as ue}from"./chunk-5ISD3QSC.js";import{a as R}from"./chunk-UZ44J2LH.js";import"./chunk-4UGZNVJM.js";import{a as C}from"./chunk-
|
|
1
|
+
import{a as ye,b as fe,c as ge,d as ve,e as U}from"./chunk-UJD3MBMB.js";import{a as ue}from"./chunk-5ISD3QSC.js";import{a as R}from"./chunk-UZ44J2LH.js";import"./chunk-4UGZNVJM.js";import{a as C}from"./chunk-PG7M7L24.js";import{a as me}from"./chunk-SUX4QBVF.js";import{a as te,b as oe,g as re,o as ae,p as ie,q as ne,r as se,s as le,t as ce,w as pe,x as de}from"./chunk-K4TYMAA3.js";import{a as Z,b as ee}from"./chunk-TC7TU4GK.js";import"./chunk-UT6HZPGL.js";import"./chunk-TFJOEF3Q.js";import"./chunk-DEEO4D4N.js";import"./chunk-KDUTK357.js";import{a as _}from"./chunk-H76B43OQ.js";import{e as b}from"./chunk-564V7YHG.js";import{l as O}from"./chunk-64GPEGGE.js";import"./chunk-ILH47V7O.js";import{K as z,a as I,r as A,s as Q,z as h}from"./chunk-II4NXLSQ.js";import"./chunk-GMZIELFU.js";import"./chunk-MEHLQZDG.js";import"./chunk-4TQSTCIN.js";import{Ka as f}from"./chunk-XDUSY26N.js";import"./chunk-QPBLZSNX.js";import{b as F,c as J}from"./chunk-RHMZNAJX.js";import"./chunk-GOTQ4D6W.js";import{F as D,G as j,H as K,I as V,K as X,M as Y,s as q}from"./chunk-6PHJZPWD.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import"./chunk-CR2ICLSH.js";import{Ic as W,Kc as H,Lc as B,Rc as G,Ta as $,a as ke,b as v,pb as E}from"./chunk-YPMUHXYT.js";import{c as y}from"./chunk-7SZRL6FY.js";var x=y(ke(),1);var o=y(v(),1);function he(e){let a=e.bucketUnit??"day",s=`Active people per ${V(a)}`,p=e.days.map(c=>c.activePeople),t=Math.max(1,...p),P=se(p),l=e.days.length>30;return(0,o.jsxs)(f,{children:[(0,o.jsx)(R,{description:"Distinct verified actors grouped by recorded conversation activity.",title:s,trailing:(0,o.jsx)(me,{ariaLabel:"People activity legend",inline:!0,items:[{color:"var(--color-amber-400)",key:"people",label:"people"}]})}),(0,o.jsx)("div",{className:"px-2 py-3 sm:px-4 sm:py-4",children:(0,o.jsx)(pe,{className:"aspect-auto h-65 w-full",config:{},children:(0,o.jsxs)(re,{"aria-label":s,data:e.days,margin:ae,role:"img",children:[(0,o.jsxs)("defs",{children:[(0,o.jsxs)("linearGradient",{id:"people-area",x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,o.jsx)("stop",{offset:"0%",stopColor:"var(--color-amber-500)",stopOpacity:"0.3"}),(0,o.jsx)("stop",{offset:"100%",stopColor:"var(--color-amber-500)",stopOpacity:"0"})]}),(0,o.jsxs)("linearGradient",{id:"people-line",x1:"0",x2:"1",y1:"0",y2:"0",children:[(0,o.jsx)("stop",{offset:"0%",stopColor:"var(--color-amber-500)"}),(0,o.jsx)("stop",{offset:"55%",stopColor:"var(--color-amber-400)"}),(0,o.jsx)("stop",{offset:"100%",stopColor:"var(--color-cyan-400)"})]})]}),(0,o.jsx)(te,{strokeDasharray:"3 5",vertical:!1}),(0,o.jsx)(ne,{maximum:t}),(0,o.jsx)(ie,{keys:e.days.map(c=>c.date)}),(0,o.jsx)(de,{content:(0,o.jsx)(ce,{rows:c=>[["active people",c.activePeople],["conversations",c.conversations]]})}),(0,o.jsx)(oe,{activeDot:{fill:"var(--color-amber-400)",r:5},dataKey:"activePeople",dot:{fill:"var(--color-amber-400)",fillOpacity:l?.35:.75,r:l?3:4,stroke:"none"},fill:"url(#people-area)",fillOpacity:1,isAnimationActive:!1,stroke:"url(#people-line)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,type:"linear"}),(0,o.jsx)(le,{unit:K(a),average:P,format:Q,stroke:"var(--color-amber-400)"})]})})})]})}var n=y(v(),1);function be(e){return e.actor.fullName??e.actor.slackUserName??e.actor.email}function Te(e){return be(e)===e.actor.email?void 0:e.actor.email}function Ne(e,a){return e<=0&&a>0?"unknown":I(e)}function N(e,a){return e.windows[a]}function S(e){return e.costUsd-e.priorCostUsd}function L(e){if(Math.abs(e)<.005)return"$0.00";let a=h({total:Math.abs(e)});return`${e>0?"+":"\u2212"}${a}`}function Ce(e,a,s,p){let t=a.trim().toLowerCase();return[...t?e.filter(l=>[l.actor.email,l.actor.fullName,l.actor.slackUserName].some(c=>c?.toLowerCase().includes(t))):e].sort((l,c)=>{let d=N(l,p),r=N(c,p);return s==="spend"?r.costUsd-d.costUsd||S(r)-S(d)||l.actor.email.localeCompare(c.actor.email):s==="spendDelta"?S(r)-S(d)||r.costUsd-d.costUsd||l.actor.email.localeCompare(c.actor.email):s==="conversations"?r.conversations-d.conversations||r.costUsd-d.costUsd:s==="runtime"?r.durationMs-d.durationMs||r.costUsd-d.costUsd:Date.parse(c.lastSeenAt)-Date.parse(l.lastSeenAt)})}function Se(e){return(0,n.jsxs)(f,{children:[(0,n.jsx)(R,{description:`${e.people.length} of ${e.totalPeople} people`,title:"People directory"}),(0,n.jsxs)(ye,{columnsClassName:"md:grid-cols-[minmax(14rem,1fr)_minmax(10rem,14rem)]",children:[(0,n.jsx)(_,{label:"Search people",placeholder:"Search name, email, Slack handle...",value:e.query,onChange:e.onQueryChange}),(0,n.jsx)(ue,{ariaLabel:"Sort people",onChange:a=>e.onSortChange(a),options:[{label:"Most spend",value:"spend"},{label:"Biggest spend increase",value:"spendDelta"},{label:"Most conversations",value:"conversations"},{label:"Recently active",value:"recent"},{label:"Most runtime",value:"runtime"}],value:e.sort})]}),(0,n.jsx)(fe,{ariaLabel:"People directory results",empty:e.people.length===0?(0,n.jsx)(b,{children:"No people match this search."}):void 0,headers:["Person","Conversations","Spend","Runtime"],loading:e.loading,children:e.people.map(a=>{let s=N(a,e.range),p=S(s);return(0,n.jsxs)(ge,{to:z(a.actor.email),children:[(0,n.jsx)(ve,{description:Te(a),icon:(0,n.jsx)(H,{"aria-hidden":"true",size:16,strokeWidth:1.8}),iconClassName:"bg-amber-500/[0.07] text-amber-300 group-hover:border-amber-500/25",title:be(a)}),(0,n.jsx)(U,{label:"Conversations",value:A(s.conversations)}),(0,n.jsx)(U,{label:"Spend",value:(0,n.jsxs)("span",{className:"inline-flex flex-col items-end gap-1",children:[(0,n.jsx)("span",{className:"whitespace-nowrap",children:h({total:s.costUsd})||"$0.00"}),(0,n.jsx)("span",{className:G("whitespace-nowrap font-mono text-2xs leading-none",Math.abs(p)<.005?"text-dashboard-text-muted":p>0?"text-amber-300/80":"text-cyan-300/75"),children:L(p)})]})}),(0,n.jsx)(U,{label:"Runtime",value:(0,n.jsx)("span",{className:"whitespace-nowrap",children:Ne(s.durationMs,s.conversations)})})]},a.actor.email)})})]})}var i=y(v(),1),Le=["spend","spendDelta","conversations","recent","runtime"];function Pe(e){return e.actor.fullName??e.actor.slackUserName??e.actor.email}function yt(){let e=O();return(0,i.jsx)(Me,{data:e.data,error:e.error})}function Me(e){let[a,s,p]=F(),[t,P]=(0,x.useState)(7),[l,c]=J("sort","spend",Le),d=(0,x.useDeferredValue)(l);if(!e.data&&!e.error)return(0,i.jsx)(ee,{description:"People, activity, and model spend.",label:"Loading people",title:"People",variant:"stats"});let r=e.data,we=r?X({days:r.activityDays,hours:r.activityHours,sixHours:r.activitySixHours,range:t,emptySixHour:m=>({activePeople:0,conversations:0,date:m})}):[],Ae=j(t),De=r?Ce(r.people,p,d,t):[],Re=r?.people.filter(m=>m.windows[t].conversations>0).length??0,Ue=r?.people.reduce((m,u)=>m+u.windows[t].costUsd,0)??0,w=r?.people.reduce((m,u)=>m?u.windows[t].costUsd>m.windows[t].costUsd?u:m:u,void 0),g=r?.people.reduce((m,u)=>{let M=u.windows[t].costUsd-u.windows[t].priorCostUsd;if(!m)return M>0?u:void 0;let xe=m.windows[t].costUsd-m.windows[t].priorCostUsd;return M>xe?u:m},void 0),k=w?.windows[t].costUsd??0,T=g?g.windows[t].costUsd-g.windows[t].priorCostUsd:0;return(0,i.jsxs)(Z,{children:[(0,i.jsx)(Y,{description:e.error?"People failed to load.":`Who used ${q()} in the ${D(t)}, and how spend changed from the prior period.`,onRangeChange:P,range:t,title:"People"}),e.error?(0,i.jsx)(f,{padding:"md",children:(0,i.jsx)(b,{children:"People telemetry is unavailable. Try refreshing the dashboard."})}):r?.people.length?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,i.jsx)(C,{detail:`People with activity in the ${D(t)}`,icon:B,label:"Active people",value:A(Re)}),(0,i.jsx)(C,{detail:`Estimated model cost in the ${D(t)}`,icon:E,label:"Model spend",value:h({total:Ue})||"$0.00"}),(0,i.jsx)(C,{detail:w&&k>0?Pe(w):"No spend in this range",icon:$,label:"Highest spend",value:w&&k>0?h({total:k})||"$0.00":"\u2014"}),(0,i.jsx)(C,{detail:g&&T>0?`${Pe(g)} vs prior period`:"No spend increases in this range",icon:W,label:"Biggest increase",value:g&&T>0?L(T):"\u2014"})]}),(0,i.jsx)(he,{bucketUnit:Ae,days:we}),(0,i.jsx)(Se,{loading:l!==d,onQueryChange:s,onSortChange:c,people:De,query:a,range:t,sort:l,totalPeople:r.people.length})]}):(0,i.jsx)(f,{padding:"md",children:(0,i.jsx)(b,{children:"No actor telemetry with trusted email."})})]})}export{yt as PeoplePage,Me as PeoplePageContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as oe,b as ie,c as ne}from"./chunk-PEQNT5MO.js";import"./chunk-H2ZU34CP.js";import{a as L}from"./chunk-4UGZNVJM.js";import{a as k,b as A}from"./chunk-LBELRO5P.js";import{b as $}from"./chunk-VFEBNOPX.js";import{a as re,b as ae}from"./chunk-IA6BJDKN.js";import{a as h}from"./chunk-WJ3OXMVX.js";import"./chunk-SUX4QBVF.js";import{u as te}from"./chunk-V5UDSIRA.js";import{b as j}from"./chunk-J37MXUED.js";import{a as N}from"./chunk-L2H3ZWZN.js";import"./chunk-LKW7MULF.js";import"./chunk-6FSJ3W2W.js";import"./chunk-2BCS5AQL.js";import"./chunk-QOX5RMLM.js";import"./chunk-H76B43OQ.js";import{e as P}from"./chunk-564V7YHG.js";import{m as W,n as V,o as Y}from"./chunk-QNA7F7QB.js";import"./chunk-B6HGRBBX.js";import{a as C,b as K,r as f,z as R}from"./chunk-NQMDED2R.js";import{i as Z,j as z,l as q,m as Q}from"./chunk-GMZIELFU.js";import"./chunk-MEHLQZDG.js";import"./chunk-GO45RQDL.js";import{Ja as y}from"./chunk-VXT3FIVL.js";import{a as ee}from"./chunk-GOTQ4D6W.js";import{G as w,K as D,M as X,g as U,o as E,s as J}from"./chunk-6PHJZPWD.js";import"./chunk-IZWTFLCC.js";import"./chunk-JAZABOBA.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import"./chunk-CR2ICLSH.js";import{Gc as F,Jb as I,Rb as B,Rc as x,Xa as O,a as _,b as v,bc as G,vb as H,xb as T}from"./chunk-YPMUHXYT.js";import{c as p}from"./chunk-7SZRL6FY.js";var ge=p(_(),1);var l=p(v(),1);function le(e){let r=Math.max(1,...e.days.map(i=>i.conversations)),a=[],o=e.days[0]?new Date(`${e.days[0].date}T00:00:00Z`).getUTCDay():0,m=[...Array.from({length:o},()=>null),...e.days];for(;m.length>0&&m.length%7!==0;)m.push(null);for(let i=0;i<m.length;i+=7){let u=m.slice(i,i+7);for(;u.length<7;)u.push(null);a.push(u)}a.length===0&&a.push([null,null,null,null,null,null,null]);let d=a.map((i,u)=>{let s=i.find(Boolean);if(!s)return"";let n=u>0?a[u-1]:void 0,S=n?[...n].reverse().find(Boolean):void 0;return S&&S.date.slice(0,7)===s.date.slice(0,7)?"":new Date(`${s.date}T00:00:00Z`).toLocaleString(void 0,{month:"short",timeZone:"UTC"})});return(0,l.jsx)("div",{className:"overflow-x-auto px-4 py-4",children:(0,l.jsxs)("div",{className:"min-w-[36rem]",children:[(0,l.jsx)("div",{"aria-hidden":"true",className:"mb-1 grid gap-1 text-xs font-semibold leading-none text-dashboard-text-muted",style:{gridTemplateColumns:`repeat(${a.length}, minmax(0.75rem, 1fr))`},children:d.map((i,u)=>(0,l.jsx)("div",{className:"h-3 overflow-visible",children:i},`${i}-${u}`))}),(0,l.jsx)("div",{"aria-label":`Daily ${J()} conversation activity`,className:"grid w-full grid-flow-col grid-rows-7 gap-1",role:"list",style:{gridTemplateColumns:`repeat(${a.length}, minmax(0.75rem, 1fr))`},children:a.flatMap((i,u)=>i.map((s,n)=>s?(0,l.jsxs)(Z,{children:[(0,l.jsx)(z,{render:(0,l.jsx)("span",{"aria-label":`${s.date}: ${s.conversations} conversations, ${se(s)}, ${R({total:s.costUsd??0})} spend, ${f(s.tokens??0)} tokens`,className:x("size-3 border border-dashboard-overlay outline-none focus-visible:ring-2 focus-visible:ring-dashboard-focus",pe(s.conversations,r)),role:"listitem",tabIndex:0})}),(0,l.jsxs)(q,{children:[(0,l.jsx)(Q,{children:ue(s.date)}),(0,l.jsx)(te,{rows:[["conversations",s.conversations],["runtime",se(s)],["spend",R({total:s.costUsd??0})],["tokens",f(s.tokens??0)]]})]})]},s.date):(0,l.jsx)("span",{"aria-hidden":"true",className:"size-3 border border-dashboard-overlay bg-dashboard-surface-raised"},`empty-${u}-${n}`)))}),(0,l.jsxs)("div",{className:"mt-3 flex items-center gap-1 text-xs font-semibold leading-none text-dashboard-text-muted",children:[(0,l.jsx)("span",{children:"Less"}),[0,1,2,3,4].map(i=>(0,l.jsx)("span",{"aria-hidden":"true",className:x("size-3 border border-dashboard-overlay",i===0&&"bg-dashboard-surface-hover",i===1&&"bg-[#133225] light:bg-[#9be9a8]",i===2&&"bg-[#176a4a] light:bg-[#40c463]",i===3&&"bg-[#22a06b] light:bg-[#30a14e]",i===4&&"bg-[#8bdc97] light:bg-[#216e39]")},i)),(0,l.jsx)("span",{children:"More"})]})]})})}function ue(e){return new Date(`${e}T00:00:00Z`).toLocaleDateString(void 0,{day:"numeric",month:"short",timeZone:"UTC",year:"numeric"})}function se(e){return e.durationMs<=0&&e.conversations>0?"unknown":C(e.durationMs)}function pe(e,r){if(e<=0)return"bg-dashboard-surface-hover";let a=e/r;return a>=.75?"bg-[#8bdc97] light:bg-[#216e39]":a>=.45?"bg-[#22a06b] light:bg-[#30a14e]":a>=.2?"bg-[#176a4a] light:bg-[#40c463]":"bg-[#133225] light:bg-[#9be9a8]"}var M=p(_(),1);var c=p(v(),1),fe=1440*60*1e3,be=[{label:"Open",value:"open"},{label:"Merged",value:"merged"},{label:"Closed",value:"closed"},{label:"All",value:""}],ve=[{label:"Any time",value:""},{label:"Last 24 hours",value:"1"},{label:"Last 7 days",value:"7"},{label:"Last 30 days",value:"30"},{label:"Last 90 days",value:"90"}];function de(e){let[r,a]=(0,M.useState)("open"),[o,m]=(0,M.useState)(""),d=o?Date.parse(e.generatedAt)-Number(o)*fe:void 0,i=e.changes.filter(n=>d===void 0||Date.parse(n.openedAt)>=d),u=i.filter(n=>!r||n.state===r),s=n=>n?i.filter(S=>S.state===n).length:i.length;return(0,c.jsxs)(y,{as:"section",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-4 border-b border-dashboard-border-subtle px-4 py-3",children:[(0,c.jsx)("div",{className:"font-display text-lg text-dashboard-text",children:"Recent changes"}),(0,c.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,c.jsx)($,{className:"w-36",label:"State",children:(0,c.jsx)(L,{"aria-label":"Filter changes by state",onChange:n=>a(n.currentTarget.value),value:r,children:be.map(n=>(0,c.jsxs)("option",{value:n.value,children:[n.label," (",s(n.value),")"]},n.value))})}),(0,c.jsx)($,{className:"w-36",label:"Opened",children:(0,c.jsx)(L,{"aria-label":"Filter changes by opened date",onChange:n=>m(n.currentTarget.value),value:o,children:ve.map(n=>(0,c.jsx)("option",{value:n.value,children:n.label},n.value))})})]})]}),u.length>0?(0,c.jsx)("div",{children:u.map(n=>(0,c.jsx)(ae,{change:n},n.id))}):(0,c.jsx)("div",{className:"p-4",children:(0,c.jsx)(P,{children:r&&i.length>0?`No ${r} changes. Set State to All to see ${i.length} more.`:"No changes match these filters."})})]})}var b=p(v(),1);function he(e){return e===void 0?"\u2014":`${Math.round(e*100)}%`}function ye(e){return C(e)||"\u2014"}function xe(e){return R(e===void 0?void 0:{total:e})||"\u2014"}function Ce(e){let r=e.summary;return e.changes.length>0||r.created+r.merged+r.closed>0||(r.costUsd??0)>0||e.activityDays.some(a=>a.created+a.merged+a.closed>0)}function me(e){if(!Ce(e.report))return null;let r=e.report.summary;return(0,b.jsxs)("section",{"aria-labelledby":"profile-code-title",className:"grid gap-4",children:[(0,b.jsx)(N,{id:"profile-code-title",title:"Code"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,b.jsx)(h,{detail:"In the last 30 days",icon:I,label:"Created",value:f(r.created)}),(0,b.jsx)(h,{detail:"Share of completed changes that merged",icon:B,label:"Merge rate",value:he(r.mergeRate)}),(0,b.jsx)(h,{detail:"Median time from open to merge in the last 30 days",icon:F,label:"Median merge time",value:ye(r.medianMergeTimeMs)}),(0,b.jsx)(h,{detail:"Conversation cost for changes opened in the last 30 days",icon:T,label:"Cost",value:xe(r.costUsd)})]}),(0,b.jsx)(re,{bucketUnit:w(e.range),days:D({days:e.report.activityDays,hours:e.report.activityHours,sixHours:e.report.activitySixHours,range:e.range,emptySixHour:a=>({closed:0,created:0,date:a,merged:0})}),range:e.range}),e.report.changes.length>0?(0,b.jsx)(de,{changes:e.report.changes,generatedAt:e.report.generatedAt}):null]})}var g=p(v(),1);function ce(e){return e.reports.length===0?null:(0,g.jsx)(g.Fragment,{children:e.reports.map(r=>(0,g.jsx)(Ne,{range:e.range,report:r},r.pluginName))})}function Ne(e){let r=e.report.title&&e.report.title!==e.report.pluginName?e.report.title:e.report.pluginName,a=e.report.metrics??[],o=e.report.widgets??[],m=e.report.recordSets??[];return!a.length&&!o.length&&!m.length?null:(0,g.jsxs)("section",{"aria-labelledby":`profile-plugin-${e.report.pluginName}-title`,className:"grid gap-4",children:[(0,g.jsx)(N,{id:`profile-plugin-${e.report.pluginName}-title`,title:r}),a.length?(0,g.jsx)("div",{className:x("grid gap-px overflow-hidden rounded-md border border-dashboard-border bg-dashboard-fill-hover",a.length===1?"grid-cols-1":"grid-cols-2",a.length===3?"lg:grid-cols-3":a.length===5?"lg:grid-cols-5":a.length>=4?"lg:grid-cols-4":void 0),children:a.map(d=>(0,g.jsxs)("div",{className:x("min-w-0 bg-dashboard-surface-panel px-4 py-4",a.length>1&&a.length%2===1&&"last:col-span-2 lg:last:col-span-1",Re(d.tone)),children:[(0,g.jsx)("div",{className:"truncate font-display text-2xl font-light leading-none text-dashboard-text",children:d.value}),(0,g.jsx)("div",{className:"mt-2 font-sans font-medium text-xs text-dashboard-text-muted",children:d.label})]},d.label))}):null,o.length?(0,g.jsx)("div",{className:x("grid gap-3",o.length>1?"lg:grid-cols-2":void 0),children:o.map(d=>(0,g.jsx)(ie,{range:e.range,widget:d},d.id))}):null,m.map(d=>(0,g.jsx)(ne,{recordSet:d},`${e.report.pluginName}:${d.title}`))]})}function Re(e){if(e==="danger")return"shadow-[inset_0_2px_0_rgba(251,113,133,0.65)]";if(e==="warning")return"shadow-[inset_0_2px_0_rgba(251,191,36,0.65)]";if(e==="good")return"shadow-[inset_0_2px_0_rgba(110,231,183,0.55)]"}var t=p(v(),1);function Se(e,r){return e<=0&&r>0?"unknown":C(e)}function yt(){let e=U(),r=e.email?decodeURIComponent(e.email):void 0,a=W(r),o=V(r),m=Y(r);return!a.data&&!a.error?(0,t.jsx)(j,{label:"Loading profile"}):(0,t.jsx)(ee,{children:a.data?(0,t.jsx)(Te,{code:m.data,codeError:!!m.error,codeLoading:m.isPending,pluginReports:o.data?.reports??[],pluginReportsError:!!o.error,pluginReportsLoading:o.isPending,profile:a.data}):(0,t.jsx)(y,{padding:"md",children:(0,t.jsx)(P,{children:"Profile failed to load."})})})}function Te(e){let[r,a]=(0,ge.useState)(30),o=e.profile,m=e.pluginReports??[],d=o.actor.fullName??o.actor.slackUserName??o.actor.email;return(0,t.jsxs)("div",{className:"grid min-w-0 gap-5",children:[(0,t.jsxs)(E,{className:"flex w-fit items-center gap-2 font-display text-sm font-medium text-dashboard-text-muted no-underline transition-colors hover:text-dashboard-text",to:"/system/people",children:[(0,t.jsx)(O,{"aria-hidden":"true",size:15,strokeWidth:1.8}),"Back to people"]}),(0,t.jsx)(X,{description:(0,t.jsxs)(t.Fragment,{children:[o.actor.email,o.actor.slackUserName?` / @${o.actor.slackUserName}`:""]}),onRangeChange:a,range:r,title:d}),(0,t.jsxs)("section",{className:"grid gap-4","aria-labelledby":"profile-metrics-title",children:[(0,t.jsx)(N,{id:"profile-metrics-title",title:"Usage over time"}),(0,t.jsx)(oe,{bucketUnit:w(r),days:D({days:o.activityDays,hours:o.activityHours,sixHours:o.activitySixHours,range:r,emptySixHour:i=>({active:0,conversations:0,date:i,durationMs:0,failed:0})})})]}),e.codeError?(0,t.jsx)(y,{className:"border-amber-300/10 bg-amber-300/[0.025]",padding:"sm",children:(0,t.jsx)("div",{className:"font-display text-sm font-medium text-dashboard-text-muted",children:"Code activity failed to load."})}):null,!e.codeLoading&&e.code?(0,t.jsx)(me,{range:r,report:e.code}):null,e.pluginReportsError?(0,t.jsx)(y,{className:"border-amber-300/10 bg-amber-300/[0.025]",padding:"sm",children:(0,t.jsx)("div",{className:"font-display text-sm font-medium text-dashboard-text-muted",children:"Plugin activity failed to load."})}):null,e.pluginReportsLoading?null:(0,t.jsx)(ce,{range:r,reports:m}),(0,t.jsxs)("div",{className:"grid min-w-0 gap-5 lg:grid-cols-[minmax(0,1fr)_19rem] lg:items-start",children:[(0,t.jsx)("aside",{className:"grid min-w-0 gap-4 lg:order-2",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3 lg:grid-cols-1",children:[(0,t.jsx)(h,{detail:"Across the complete conversation index",icon:G,label:"Conversations",value:f(o.totals.conversations)}),(0,t.jsx)(h,{detail:"Cumulative persisted conversation runtime",icon:H,label:"Runtime",value:(0,t.jsx)(K,{value:o.totals.durationMs})}),(0,t.jsx)(h,{detail:"Persisted model token usage",icon:T,label:"Tokens",value:f(o.totals.tokens??0)})]})}),(0,t.jsxs)("div",{className:"grid min-w-0 gap-5 lg:order-1",children:[(0,t.jsxs)(y,{as:"section",className:"mb-0",variant:"section",children:[(0,t.jsx)(k,{actions:(0,t.jsx)("div",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:"52 weeks"}),children:(0,t.jsx)(A,{children:"Activity"})}),(0,t.jsx)(le,{days:o.activityDays})]}),(0,t.jsx)(Pe,{items:o.surfaces,title:"Surfaces"})]})]})]})}function Pe(e){return e.items.length<=1?null:(0,t.jsxs)(y,{as:"section",className:"mb-0",variant:"section",children:[(0,t.jsx)(k,{children:(0,t.jsx)(A,{children:e.title})}),(0,t.jsx)("ol",{className:"m-0 list-none p-0",children:e.items.slice(0,6).map((r,a)=>(0,t.jsxs)("li",{className:"grid min-w-0 grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-3 border-b border-dashboard-border-subtle px-4 py-3 last:border-b-0",children:[(0,t.jsx)("div",{className:"font-mono text-xs leading-none text-dashboard-text-muted",children:a+1}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"truncate font-display text-base font-medium leading-tight text-dashboard-text",children:r.label}),(0,t.jsxs)("div",{className:"mt-1 truncate font-mono text-xs leading-tight text-dashboard-text-muted",children:[Se(r.durationMs,r.conversations),r.tokens?` / ${f(r.tokens)} tokens`:"",r.failed?` / ${f(r.failed)} errors`:""]})]}),(0,t.jsx)("div",{className:"font-display text-xl font-light leading-none text-dashboard-text",children:f(r.conversations)})]},r.label))})]})}export{yt as PersonProfilePage,Te as Profile};
|
|
1
|
+
import{a as oe,b as ie,c as ne}from"./chunk-NGQRNS3C.js";import"./chunk-H2ZU34CP.js";import{a as L}from"./chunk-4UGZNVJM.js";import{a as k,b as A}from"./chunk-LBELRO5P.js";import{b as $}from"./chunk-2J3LGF5Q.js";import{a as re,b as ae}from"./chunk-ONDKE72P.js";import{a as h}from"./chunk-PG7M7L24.js";import"./chunk-SUX4QBVF.js";import{u as te}from"./chunk-K4TYMAA3.js";import{b as j}from"./chunk-J37MXUED.js";import{a as N}from"./chunk-L2H3ZWZN.js";import"./chunk-LKW7MULF.js";import"./chunk-6FSJ3W2W.js";import"./chunk-2BCS5AQL.js";import"./chunk-QOX5RMLM.js";import"./chunk-H76B43OQ.js";import{e as P}from"./chunk-564V7YHG.js";import{m as W,n as V,o as Y}from"./chunk-64GPEGGE.js";import"./chunk-ILH47V7O.js";import{a as C,b as K,r as f,z as R}from"./chunk-II4NXLSQ.js";import{i as Z,j as z,l as q,m as Q}from"./chunk-GMZIELFU.js";import"./chunk-MEHLQZDG.js";import"./chunk-4TQSTCIN.js";import{Ka as y}from"./chunk-XDUSY26N.js";import{a as ee}from"./chunk-GOTQ4D6W.js";import{G as w,K as D,M as X,g as U,o as E,s as J}from"./chunk-6PHJZPWD.js";import"./chunk-IZWTFLCC.js";import"./chunk-JAZABOBA.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import"./chunk-CR2ICLSH.js";import{Gc as F,Jb as I,Rb as B,Rc as x,Xa as O,a as _,b as v,bc as G,vb as H,xb as T}from"./chunk-YPMUHXYT.js";import{c as p}from"./chunk-7SZRL6FY.js";var ge=p(_(),1);var l=p(v(),1);function le(e){let r=Math.max(1,...e.days.map(i=>i.conversations)),a=[],o=e.days[0]?new Date(`${e.days[0].date}T00:00:00Z`).getUTCDay():0,m=[...Array.from({length:o},()=>null),...e.days];for(;m.length>0&&m.length%7!==0;)m.push(null);for(let i=0;i<m.length;i+=7){let u=m.slice(i,i+7);for(;u.length<7;)u.push(null);a.push(u)}a.length===0&&a.push([null,null,null,null,null,null,null]);let d=a.map((i,u)=>{let s=i.find(Boolean);if(!s)return"";let n=u>0?a[u-1]:void 0,S=n?[...n].reverse().find(Boolean):void 0;return S&&S.date.slice(0,7)===s.date.slice(0,7)?"":new Date(`${s.date}T00:00:00Z`).toLocaleString(void 0,{month:"short",timeZone:"UTC"})});return(0,l.jsx)("div",{className:"overflow-x-auto px-4 py-4",children:(0,l.jsxs)("div",{className:"min-w-[36rem]",children:[(0,l.jsx)("div",{"aria-hidden":"true",className:"mb-1 grid gap-1 text-xs font-semibold leading-none text-dashboard-text-muted",style:{gridTemplateColumns:`repeat(${a.length}, minmax(0.75rem, 1fr))`},children:d.map((i,u)=>(0,l.jsx)("div",{className:"h-3 overflow-visible",children:i},`${i}-${u}`))}),(0,l.jsx)("div",{"aria-label":`Daily ${J()} conversation activity`,className:"grid w-full grid-flow-col grid-rows-7 gap-1",role:"list",style:{gridTemplateColumns:`repeat(${a.length}, minmax(0.75rem, 1fr))`},children:a.flatMap((i,u)=>i.map((s,n)=>s?(0,l.jsxs)(Z,{children:[(0,l.jsx)(z,{render:(0,l.jsx)("span",{"aria-label":`${s.date}: ${s.conversations} conversations, ${se(s)}, ${R({total:s.costUsd??0})} spend, ${f(s.tokens??0)} tokens`,className:x("size-3 border border-dashboard-overlay outline-none focus-visible:ring-2 focus-visible:ring-dashboard-focus",pe(s.conversations,r)),role:"listitem",tabIndex:0})}),(0,l.jsxs)(q,{children:[(0,l.jsx)(Q,{children:ue(s.date)}),(0,l.jsx)(te,{rows:[["conversations",s.conversations],["runtime",se(s)],["spend",R({total:s.costUsd??0})],["tokens",f(s.tokens??0)]]})]})]},s.date):(0,l.jsx)("span",{"aria-hidden":"true",className:"size-3 border border-dashboard-overlay bg-dashboard-surface-raised"},`empty-${u}-${n}`)))}),(0,l.jsxs)("div",{className:"mt-3 flex items-center gap-1 text-xs font-semibold leading-none text-dashboard-text-muted",children:[(0,l.jsx)("span",{children:"Less"}),[0,1,2,3,4].map(i=>(0,l.jsx)("span",{"aria-hidden":"true",className:x("size-3 border border-dashboard-overlay",i===0&&"bg-dashboard-surface-hover",i===1&&"bg-[#133225] light:bg-[#9be9a8]",i===2&&"bg-[#176a4a] light:bg-[#40c463]",i===3&&"bg-[#22a06b] light:bg-[#30a14e]",i===4&&"bg-[#8bdc97] light:bg-[#216e39]")},i)),(0,l.jsx)("span",{children:"More"})]})]})})}function ue(e){return new Date(`${e}T00:00:00Z`).toLocaleDateString(void 0,{day:"numeric",month:"short",timeZone:"UTC",year:"numeric"})}function se(e){return e.durationMs<=0&&e.conversations>0?"unknown":C(e.durationMs)}function pe(e,r){if(e<=0)return"bg-dashboard-surface-hover";let a=e/r;return a>=.75?"bg-[#8bdc97] light:bg-[#216e39]":a>=.45?"bg-[#22a06b] light:bg-[#30a14e]":a>=.2?"bg-[#176a4a] light:bg-[#40c463]":"bg-[#133225] light:bg-[#9be9a8]"}var M=p(_(),1);var c=p(v(),1),fe=1440*60*1e3,be=[{label:"Open",value:"open"},{label:"Merged",value:"merged"},{label:"Closed",value:"closed"},{label:"All",value:""}],ve=[{label:"Any time",value:""},{label:"Last 24 hours",value:"1"},{label:"Last 7 days",value:"7"},{label:"Last 30 days",value:"30"},{label:"Last 90 days",value:"90"}];function de(e){let[r,a]=(0,M.useState)("open"),[o,m]=(0,M.useState)(""),d=o?Date.parse(e.generatedAt)-Number(o)*fe:void 0,i=e.changes.filter(n=>d===void 0||Date.parse(n.openedAt)>=d),u=i.filter(n=>!r||n.state===r),s=n=>n?i.filter(S=>S.state===n).length:i.length;return(0,c.jsxs)(y,{as:"section",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-4 border-b border-dashboard-border-subtle px-4 py-3",children:[(0,c.jsx)("div",{className:"font-display text-lg text-dashboard-text",children:"Recent changes"}),(0,c.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,c.jsx)($,{className:"w-36",label:"State",children:(0,c.jsx)(L,{"aria-label":"Filter changes by state",onChange:n=>a(n.currentTarget.value),value:r,children:be.map(n=>(0,c.jsxs)("option",{value:n.value,children:[n.label," (",s(n.value),")"]},n.value))})}),(0,c.jsx)($,{className:"w-36",label:"Opened",children:(0,c.jsx)(L,{"aria-label":"Filter changes by opened date",onChange:n=>m(n.currentTarget.value),value:o,children:ve.map(n=>(0,c.jsx)("option",{value:n.value,children:n.label},n.value))})})]})]}),u.length>0?(0,c.jsx)("div",{children:u.map(n=>(0,c.jsx)(ae,{change:n},n.id))}):(0,c.jsx)("div",{className:"p-4",children:(0,c.jsx)(P,{children:r&&i.length>0?`No ${r} changes. Set State to All to see ${i.length} more.`:"No changes match these filters."})})]})}var b=p(v(),1);function he(e){return e===void 0?"\u2014":`${Math.round(e*100)}%`}function ye(e){return C(e)||"\u2014"}function xe(e){return R(e===void 0?void 0:{total:e})||"\u2014"}function Ce(e){let r=e.summary;return e.changes.length>0||r.created+r.merged+r.closed>0||(r.costUsd??0)>0||e.activityDays.some(a=>a.created+a.merged+a.closed>0)}function me(e){if(!Ce(e.report))return null;let r=e.report.summary;return(0,b.jsxs)("section",{"aria-labelledby":"profile-code-title",className:"grid gap-4",children:[(0,b.jsx)(N,{id:"profile-code-title",title:"Code"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,b.jsx)(h,{detail:"In the last 30 days",icon:I,label:"Created",value:f(r.created)}),(0,b.jsx)(h,{detail:"Share of completed changes that merged",icon:B,label:"Merge rate",value:he(r.mergeRate)}),(0,b.jsx)(h,{detail:"Median time from open to merge in the last 30 days",icon:F,label:"Median merge time",value:ye(r.medianMergeTimeMs)}),(0,b.jsx)(h,{detail:"Conversation cost for changes opened in the last 30 days",icon:T,label:"Cost",value:xe(r.costUsd)})]}),(0,b.jsx)(re,{bucketUnit:w(e.range),days:D({days:e.report.activityDays,hours:e.report.activityHours,sixHours:e.report.activitySixHours,range:e.range,emptySixHour:a=>({closed:0,created:0,date:a,merged:0})}),range:e.range}),e.report.changes.length>0?(0,b.jsx)(de,{changes:e.report.changes,generatedAt:e.report.generatedAt}):null]})}var g=p(v(),1);function ce(e){return e.reports.length===0?null:(0,g.jsx)(g.Fragment,{children:e.reports.map(r=>(0,g.jsx)(Ne,{range:e.range,report:r},r.pluginName))})}function Ne(e){let r=e.report.title&&e.report.title!==e.report.pluginName?e.report.title:e.report.pluginName,a=e.report.metrics??[],o=e.report.widgets??[],m=e.report.recordSets??[];return!a.length&&!o.length&&!m.length?null:(0,g.jsxs)("section",{"aria-labelledby":`profile-plugin-${e.report.pluginName}-title`,className:"grid gap-4",children:[(0,g.jsx)(N,{id:`profile-plugin-${e.report.pluginName}-title`,title:r}),a.length?(0,g.jsx)("div",{className:x("grid gap-px overflow-hidden rounded-md border border-dashboard-border bg-dashboard-fill-hover",a.length===1?"grid-cols-1":"grid-cols-2",a.length===3?"lg:grid-cols-3":a.length===5?"lg:grid-cols-5":a.length>=4?"lg:grid-cols-4":void 0),children:a.map(d=>(0,g.jsxs)("div",{className:x("min-w-0 bg-dashboard-surface-panel px-4 py-4",a.length>1&&a.length%2===1&&"last:col-span-2 lg:last:col-span-1",Re(d.tone)),children:[(0,g.jsx)("div",{className:"truncate font-display text-2xl font-light leading-none text-dashboard-text",children:d.value}),(0,g.jsx)("div",{className:"mt-2 font-sans font-medium text-xs text-dashboard-text-muted",children:d.label})]},d.label))}):null,o.length?(0,g.jsx)("div",{className:x("grid gap-3",o.length>1?"lg:grid-cols-2":void 0),children:o.map(d=>(0,g.jsx)(ie,{range:e.range,widget:d},d.id))}):null,m.map(d=>(0,g.jsx)(ne,{recordSet:d},`${e.report.pluginName}:${d.title}`))]})}function Re(e){if(e==="danger")return"shadow-[inset_0_2px_0_rgba(251,113,133,0.65)]";if(e==="warning")return"shadow-[inset_0_2px_0_rgba(251,191,36,0.65)]";if(e==="good")return"shadow-[inset_0_2px_0_rgba(110,231,183,0.55)]"}var t=p(v(),1);function Se(e,r){return e<=0&&r>0?"unknown":C(e)}function yt(){let e=U(),r=e.email?decodeURIComponent(e.email):void 0,a=W(r),o=V(r),m=Y(r);return!a.data&&!a.error?(0,t.jsx)(j,{label:"Loading profile"}):(0,t.jsx)(ee,{children:a.data?(0,t.jsx)(Te,{code:m.data,codeError:!!m.error,codeLoading:m.isPending,pluginReports:o.data?.reports??[],pluginReportsError:!!o.error,pluginReportsLoading:o.isPending,profile:a.data}):(0,t.jsx)(y,{padding:"md",children:(0,t.jsx)(P,{children:"Profile failed to load."})})})}function Te(e){let[r,a]=(0,ge.useState)(30),o=e.profile,m=e.pluginReports??[],d=o.actor.fullName??o.actor.slackUserName??o.actor.email;return(0,t.jsxs)("div",{className:"grid min-w-0 gap-5",children:[(0,t.jsxs)(E,{className:"flex w-fit items-center gap-2 font-display text-sm font-medium text-dashboard-text-muted no-underline transition-colors hover:text-dashboard-text",to:"/system/people",children:[(0,t.jsx)(O,{"aria-hidden":"true",size:15,strokeWidth:1.8}),"Back to people"]}),(0,t.jsx)(X,{description:(0,t.jsxs)(t.Fragment,{children:[o.actor.email,o.actor.slackUserName?` / @${o.actor.slackUserName}`:""]}),onRangeChange:a,range:r,title:d}),(0,t.jsxs)("section",{className:"grid gap-4","aria-labelledby":"profile-metrics-title",children:[(0,t.jsx)(N,{id:"profile-metrics-title",title:"Usage over time"}),(0,t.jsx)(oe,{bucketUnit:w(r),days:D({days:o.activityDays,hours:o.activityHours,sixHours:o.activitySixHours,range:r,emptySixHour:i=>({active:0,conversations:0,date:i,durationMs:0,failed:0})})})]}),e.codeError?(0,t.jsx)(y,{className:"border-amber-300/10 bg-amber-300/[0.025]",padding:"sm",children:(0,t.jsx)("div",{className:"font-display text-sm font-medium text-dashboard-text-muted",children:"Code activity failed to load."})}):null,!e.codeLoading&&e.code?(0,t.jsx)(me,{range:r,report:e.code}):null,e.pluginReportsError?(0,t.jsx)(y,{className:"border-amber-300/10 bg-amber-300/[0.025]",padding:"sm",children:(0,t.jsx)("div",{className:"font-display text-sm font-medium text-dashboard-text-muted",children:"Plugin activity failed to load."})}):null,e.pluginReportsLoading?null:(0,t.jsx)(ce,{range:r,reports:m}),(0,t.jsxs)("div",{className:"grid min-w-0 gap-5 lg:grid-cols-[minmax(0,1fr)_19rem] lg:items-start",children:[(0,t.jsx)("aside",{className:"grid min-w-0 gap-4 lg:order-2",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3 lg:grid-cols-1",children:[(0,t.jsx)(h,{detail:"Across the complete conversation index",icon:G,label:"Conversations",value:f(o.totals.conversations)}),(0,t.jsx)(h,{detail:"Cumulative persisted conversation runtime",icon:H,label:"Runtime",value:(0,t.jsx)(K,{value:o.totals.durationMs})}),(0,t.jsx)(h,{detail:"Persisted model token usage",icon:T,label:"Tokens",value:f(o.totals.tokens??0)})]})}),(0,t.jsxs)("div",{className:"grid min-w-0 gap-5 lg:order-1",children:[(0,t.jsxs)(y,{as:"section",className:"mb-0",variant:"section",children:[(0,t.jsx)(k,{actions:(0,t.jsx)("div",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:"52 weeks"}),children:(0,t.jsx)(A,{children:"Activity"})}),(0,t.jsx)(le,{days:o.activityDays})]}),(0,t.jsx)(Pe,{items:o.surfaces,title:"Surfaces"})]})]})]})}function Pe(e){return e.items.length<=1?null:(0,t.jsxs)(y,{as:"section",className:"mb-0",variant:"section",children:[(0,t.jsx)(k,{children:(0,t.jsx)(A,{children:e.title})}),(0,t.jsx)("ol",{className:"m-0 list-none p-0",children:e.items.slice(0,6).map((r,a)=>(0,t.jsxs)("li",{className:"grid min-w-0 grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-3 border-b border-dashboard-border-subtle px-4 py-3 last:border-b-0",children:[(0,t.jsx)("div",{className:"font-mono text-xs leading-none text-dashboard-text-muted",children:a+1}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"truncate font-display text-base font-medium leading-tight text-dashboard-text",children:r.label}),(0,t.jsxs)("div",{className:"mt-1 truncate font-mono text-xs leading-tight text-dashboard-text-muted",children:[Se(r.durationMs,r.conversations),r.tokens?` / ${f(r.tokens)} tokens`:"",r.failed?` / ${f(r.failed)} errors`:""]})]}),(0,t.jsx)("div",{className:"font-display text-xl font-light leading-none text-dashboard-text",children:f(r.conversations)})]},r.label))})]})}export{yt as PersonProfilePage,Te as Profile};
|
package/dist/public/chunks/{PersonalTokensPage-4BCR744B.js → PersonalTokensPage-SHAUJ74M.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./chunk-XNR4RZEC.js";import{a as B}from"./chunk-DZB4LPI6.js";import"./chunk-L2H3ZWZN.js";import{l as R}from"./chunk-MEHLQZDG.js";import"./chunk-MTBUV2GJ.js";import{d as v,g as C,i as g,
|
|
1
|
+
import{a as q}from"./chunk-XNR4RZEC.js";import{a as B}from"./chunk-DZB4LPI6.js";import"./chunk-L2H3ZWZN.js";import{l as R}from"./chunk-MEHLQZDG.js";import"./chunk-MTBUV2GJ.js";import{d as v,g as C,i as g,r as E,t as L,v as M}from"./chunk-4TQSTCIN.js";import{Ka as D,ya as w,za as A}from"./chunk-XDUSY26N.js";import"./chunk-QPBLZSNX.js";import"./chunk-RHMZNAJX.js";import"./chunk-GOTQ4D6W.js";import{s as Q}from"./chunk-6PHJZPWD.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import{b as i}from"./chunk-CR2ICLSH.js";import{Hc as S,Pb as I,a as z,b as N}from"./chunk-YPMUHXYT.js";import{c as f}from"./chunk-7SZRL6FY.js";var l=f(z(),1);var e=f(N(),1),d=["dashboard","personal-tokens"];function X(){let m=v(),c=(0,l.useRef)(!1),[u,y]=(0,l.useState)("Local agent"),o=()=>m.cancelQueries({exact:!0,queryKey:d}),n=C({queryKey:d,queryFn:({signal:t})=>M(w,"/api/personal-tokens",t),retry:!1}),a=g({gcTime:0,mutationFn:t=>E(A,"/api/personal-tokens",{name:t}),onMutate:()=>o(),onSuccess:async t=>{let{token:p,...r}=t;await o(),m.setQueryData(d,k=>({tokens:[r,...(k?.tokens??[]).filter(K=>K.id!==r.id)]}))},onSettled:()=>{c.current=!1}}),s=g({mutationFn:t=>L(`/api/personal-tokens/${encodeURIComponent(t.id)}`),onMutate:()=>o(),onSuccess:async(t,p)=>{await o(),m.setQueryData(d,r=>({tokens:(r?.tokens??[]).filter(k=>k.id!==p.id)})),a.data?.id===p.id&&a.reset()}}),b=a.data,x=n.data?.tokens??[],h=n.isPending,T=a.isPending||s.isPending,P=(a.isError?"Could not create the API token. Try again.":s.isError?"Could not revoke the API token. Try again.":void 0)??(!n.data&&n.isError?"Could not load API tokens. Try again.":void 0);return(0,e.jsxs)(B,{description:(0,e.jsxs)(e.Fragment,{children:["Use a token to read ",Q()," APIs from a local agent or script. Tokens expire after 90 days."]}),title:"API Tokens",children:[b?(0,e.jsxs)("div",{className:"rounded-md border border-emerald-400/40 bg-emerald-400/5 p-3",children:[(0,e.jsx)("p",{className:"mt-0 mb-2 text-sm font-semibold",children:"Copy this token now. It won't be shown again."}),(0,e.jsx)("code",{className:"block overflow-x-auto rounded-md bg-dashboard-ink p-2 text-xs text-emerald-300",children:b.token}),(0,e.jsx)(i,{className:"mt-3",onClick:()=>{a.reset(),y("Local agent")},children:"Create another token"})]}):(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(R,{"aria-label":"Token name",className:"min-w-0 flex-1",maxLength:80,onChange:t=>y(t.target.value),value:u}),(0,e.jsx)(i,{disabled:h||T||!u.trim(),onClick:()=>{c.current||(s.reset(),c.current=!0,a.mutate(u))},children:"Create token"})]}),P?(0,e.jsx)(q,{children:P}):null,(0,e.jsx)(D,{className:"mb-0",variant:"raised",children:h?(0,e.jsx)("p",{className:"m-0 p-5 text-sm text-dashboard-text-muted",children:"Loading API tokens\u2026"}):x.length===0?(0,e.jsx)("p",{className:"m-0 p-5 text-sm text-dashboard-text-muted",children:"No active API tokens."}):(0,e.jsx)("ul",{className:"m-0 list-none divide-y divide-dashboard-border-subtle p-0",children:x.map(t=>(0,e.jsxs)("li",{className:"flex items-center gap-3 px-5 py-4",children:[(0,e.jsx)(I,{className:"text-dashboard-accent",size:16}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("p",{className:"m-0 truncate text-sm font-semibold",children:t.name}),(0,e.jsxs)("p",{className:"mt-1 mb-0 text-xs text-dashboard-text-muted",children:["Ends in ",t.tokenSuffix," \xB7 Expires"," ",new Date(t.expiresAt).toLocaleDateString()]})]}),(0,e.jsx)(i,{"aria-label":`Revoke ${t.name}`,disabled:T,onClick:()=>{a.isError&&a.reset(),s.mutate(t)},size:"icon",variant:"danger",type:"button",children:(0,e.jsx)(S,{size:16})})]},t.id))})})]})}export{X as PersonalTokensPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ze}from"./chunk-SIOW7OOW.js";import{a as Xe}from"./chunk-SUX4QBVF.js";import{a as se,c as K,f as le,o as de,p as me,q as ce,r as We,s as Ye,t as ue,w as ge,x as he}from"./chunk-V5UDSIRA.js";import{b as Ve}from"./chunk-RHIXHBS5.js";import{a as Z,b as ee,c as te,d as ae,e as re,f as oe,g as ie}from"./chunk-5GZDBGAR.js";import{c as _e}from"./chunk-Z2JPRGFT.js";import"./chunk-NQOJAZFQ.js";import{b as Ke}from"./chunk-J37MXUED.js";import{a as q}from"./chunk-XNR4RZEC.js";import"./chunk-G5NWYJTV.js";import{l as Ce}from"./chunk-A2QWWA7O.js";import{a as X}from"./chunk-3Y3ICT6K.js";import"./chunk-TFJOEF3Q.js";import{b as I}from"./chunk-EFEREKX4.js";import"./chunk-QOX5RMLM.js";import{a as Y}from"./chunk-H76B43OQ.js";import{z as H}from"./chunk-NQMDED2R.js";import"./chunk-PXHLJIOT.js";import{i as Ee,j as Ie,l as He}from"./chunk-GMZIELFU.js";import"./chunk-MEHLQZDG.js";import"./chunk-MTBUV2GJ.js";import{d as we,g as G,i as Re,j as Se,p as Oe,r as z}from"./chunk-GO45RQDL.js";import{Ja as y,a as E,b as N,d as k,e as w,f as W,g as T,s as qe}from"./chunk-VXT3FIVL.js";import"./chunk-QPBLZSNX.js";import{a as Q,b as Ge}from"./chunk-RHMZNAJX.js";import{a as je}from"./chunk-GOTQ4D6W.js";import{G as Ne,H as Je,K as ne,M as O,d as B,f as Ae,g as F,k as A,q as Te}from"./chunk-6PHJZPWD.js";import"./chunk-T4M53QQT.js";import"./chunk-JAZABOBA.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import{b as ze}from"./chunk-CR2ICLSH.js";import{Bc as Be,Hc as V,Kc as Fe,Rc as L,Sc as Qe,a as j,ab as Le,b as C,cb as $e,db as xe,mb as ve,zb as Pe}from"./chunk-YPMUHXYT.js";import{c as b}from"./chunk-7SZRL6FY.js";var ke=b(j(),1);var S=b(j(),1);var fe=b(j(),1);function pe(e){let[a,o]=Te(),r=we(),c=(0,fe.useRef)(!1),l=a.get("filter")?.trim()??"",[u,h,p]=Ge(),v=Se({initialPageParam:void 0,queryKey:["dashboard","plugin-user-page",e.pluginName,e.id,l,p],queryFn:({pageParam:g,signal:D})=>{let U=new URLSearchParams;l&&U.set("filter",l),p&&U.set("q",p),g&&U.set("cursor",g);let J=U.toString();return z(qe,`/api/user-pages/${encodeURIComponent(e.pluginName)}/${encodeURIComponent(e.id)}${J?`?${J}`:""}`,D)},getNextPageParam:g=>g.nextCursor,placeholderData:g=>g,retry:!1}),M=(0,fe.useMemo)(()=>[...new Map((v.data?.pages??[]).flatMap(g=>g.records).map(g=>[g.id,g])).values()],[v.data?.pages]),i=Re({mutationFn:g=>Oe(g.href),onMutate:()=>({pluginName:e.pluginName}),onSuccess:async(g,D,U)=>{r.removeQueries({queryKey:["dashboard","plugin-user-page",U.pluginName,"record"]}),await r.invalidateQueries({queryKey:["dashboard","plugin-user-page",U.pluginName]})},onSettled:()=>{c.current=!1}});function d(g){c.current||(c.current=!0,i.mutate(g))}function m(g){let D=new URLSearchParams(a);g?D.set("filter",g):D.delete("filter"),o(D,{replace:!0})}return{action:i,content:v.data?.pages[0],filter:l,query:v,records:M,runAction:d,searchQuery:p,searchText:u,setFilter:m,setSearchText:h}}var tt=E().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),et=w({count:N().int().min(0),date:tt}).strict(),be=w({costUsd:N().finite().min(0),date:tt,events:N().int().min(0)}).strict(),bt=w({days:k(et).length(90),extractionDays:k(be).length(90),extractionHours:k(be).min(24).optional(),generatedAt:T.datetime(),hours:k(et).min(24).optional(),recallDays:k(be).length(90),recallHours:k(be).min(24).optional(),stats:w({active:N().int().min(0),automatic:N().int().min(0),createdThirtyDays:N().int().min(0),embedded:N().int().min(0),explicit:N().int().min(0),knowledge:N().int().min(0),preference:N().int().min(0),procedure:N().int().min(0)}).strict()}).strict();function at(){return G({queryFn:({signal:e})=>z(bt,"/api/plugins/memory/dashboard",e),queryKey:["dashboard","plugin-user-page","memory","summary"],retry:!1})}var ot=b(j(),1);var s=b(C(),1),yt=new Set(["Learned","Memory ID","Source","Type"]);function it(e){let{record:a}=e,[o,r]=(0,ot.useState)(!1),c=a?vt(a):"Memory details",l=a?.actions?.find(u=>u.tone==="danger");return(0,s.jsxs)(_e,{label:"Memory details",onClose:e.onClose,sheetTitle:c,title:(0,s.jsx)("h2",{className:"m-0 flex items-center gap-2 font-display text-base font-medium text-dashboard-text",children:(0,s.jsx)("span",{className:"truncate",children:c})}),children:[(0,s.jsxs)("div",{className:"grid h-full min-h-0 grid-rows-[minmax(0,1fr)_auto]",children:[(0,s.jsx)("div",{"aria-label":"Memory content",role:"region",tabIndex:0,className:"grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto overscroll-contain p-4 outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-dashboard-focus [overflow-wrap:anywhere]",children:a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid gap-3 text-sm leading-relaxed",children:[(0,s.jsx)(Ce,{text:a.title}),a.description?(0,s.jsx)(Ce,{text:a.description}):null]}),(0,s.jsx)(xt,{record:a})]}):(0,s.jsx)(I,{label:"Loading memory",variant:"panel"})}),a&&l?(0,s.jsx)("footer",{"aria-label":"Memory actions",className:"flex items-center gap-2 border-t border-dashboard-border bg-dashboard-bg-elevated p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:(0,s.jsxs)(Ee,{children:[(0,s.jsx)(Ie,{render:(0,s.jsx)(ze,{"aria-label":"Forget this memory",className:"min-h-11 min-w-11",disabled:e.forgetPending,onClick:()=>{l.confirmation?r(!0):e.onForget(l)},size:"icon",variant:"danger",children:(0,s.jsx)(V,{"aria-hidden":"true",size:16})})}),(0,s.jsx)(He,{size:"compact",children:"Forget this memory"})]})}):null]}),l?.confirmation&&a?(0,s.jsx)(Z,{onOpenChange:r,open:o,children:(0,s.jsxs)(ee,{children:[(0,s.jsx)(te,{children:l.confirmation}),(0,s.jsx)(ae,{children:a.title}),(0,s.jsxs)(re,{children:[(0,s.jsx)(ie,{children:"Cancel"}),(0,s.jsx)(oe,{onClick:()=>{r(!1),e.onForget(l)},variant:"danger",children:l.label})]})]})}):null]})}function xt(e){let{record:a}=e,o=ye(a,"Learned"),r=ye(a,"Source"),c=o==="Automatic"?`From a ${r??"past"} conversation`:o==="Explicit"?"Someone asked Junior":o?"Before origin tracking":void 0,l=ye(a,"Remembered"),u=(a.metadata??[]).filter(h=>!yt.has(h.label)&&!(h.label==="Observed"&&h.value===l));return(0,s.jsxs)("dl",{className:"m-0 grid min-w-0 gap-2 rounded-lg border border-dashboard-border-subtle bg-dashboard-surface-panel p-3 text-xs leading-snug",children:[c?(0,s.jsx)(rt,{label:"Learned",children:c}):null,u.map(h=>(0,s.jsx)(rt,{label:h.label,children:h.value},h.label))]})}function rt(e){return(0,s.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-4",children:[(0,s.jsx)("dt",{className:"shrink-0 text-dashboard-text-muted",children:e.label}),(0,s.jsx)("dd",{className:"m-0 min-w-0 break-words text-right tabular-nums text-dashboard-text",children:e.children})]})}function vt(e){return ye(e,"Type")??"Memory"}function ye(e,a){return e.metadata?.find(o=>o.label===a)?.value}var R=b(C(),1);function Pt(e){return[...new Set(e.toLowerCase().split(/[^a-z0-9_'-]+/).filter(a=>a.length>=2))]}function Ct(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nt(e){let a=Pt(e.query);if(a.length===0)return(0,R.jsx)(R.Fragment,{children:e.text});let o=new RegExp(`(${a.sort((r,c)=>c.length-r.length).map(Ct).join("|")})`,"gi");return(0,R.jsx)(R.Fragment,{children:e.text.split(o).map((r,c)=>c%2===1?(0,R.jsx)("mark",{className:"rounded-sm bg-amber-300/25 text-dashboard-text",children:r},c):r)})}var x=b(C(),1),Nt={count:{color:"var(--color-emerald-300)",label:"Memories"}};function st(e){let a=e.bucketUnit??"day",o=e.days,r=o.map(u=>u.count),c=Math.max(1,...r),l=r.some(u=>u>0);return(0,x.jsxs)(y,{className:"min-h-[17rem] p-4 sm:p-5",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("h2",{className:"m-0 font-display text-xl font-medium text-dashboard-text",children:"Activity over time"}),(0,x.jsx)("p",{className:"mt-1 mb-0 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:a==="hour"?"Memories created each hour.":a==="6hour"?"Memories created each 6 hours.":"Memories created each day."})]}),(0,x.jsxs)("div",{className:"relative mt-3 overflow-hidden",children:[(0,x.jsx)(ge,{className:"aspect-auto h-50 w-full",config:Nt,children:(0,x.jsxs)(le,{"aria-label":`Memories learned during the last ${e.range===1?"24 hours":`${e.range} days`}`,data:o,margin:de,role:"img",children:[(0,x.jsx)(se,{strokeDasharray:"3 5",vertical:!1}),(0,x.jsx)(ce,{maximum:c}),(0,x.jsx)(me,{keys:o.map(u=>u.date)}),(0,x.jsx)(he,{content:(0,x.jsx)(ue,{rows:u=>[["memories",u.count]]})}),(0,x.jsx)(K,{dataKey:"count",fill:"var(--color-count)",fillOpacity:.82,isAnimationActive:!1,maxBarSize:13})]})}),l?null:(0,x.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center pt-12 font-sans text-xs text-dashboard-text-muted",children:"No memories were learned in this period."})]})]})}var f=b(C(),1),Dt={extraction:{color:"var(--color-cyan-300)",label:"Extraction"},recall:{color:"var(--color-fuchsia-400)",label:"Recall"}};function _(e){return H({total:e})}function lt(e){let a=e.bucketUnit??"day",o=new Map(e.recallDays.map(i=>[i.date,i])),r=e.extractionDays.map(i=>{let d=o.get(i.date)??{costUsd:0,date:i.date,events:0};return{date:i.date,extraction:i,extractionCost:i.costUsd,recall:d,recallCost:d.costUsd}}),c=r.reduce((i,d)=>i+d.extraction.costUsd,0),l=r.reduce((i,d)=>i+d.recall.costUsd,0),u=c+l,h=r.reduce((i,d)=>i+d.extraction.events+d.recall.events,0),p=r.map(i=>i.extraction.costUsd+i.recall.costUsd),v=Math.max(.01,...p),M=We(p);return(0,f.jsxs)(y,{className:"min-h-[17rem] p-4 sm:p-5",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("h2",{className:"m-0 font-display text-xl font-medium text-dashboard-text",children:H({total:u})}),(0,f.jsxs)("p",{className:"mt-1 mb-0 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:["System-wide estimate across ",De(h)," spanning extraction and recall."]}),(0,f.jsx)(Xe,{ariaLabel:"Memory cost legend",items:[{color:"var(--color-cyan-300)",key:"extraction",label:"Extraction",value:H({total:c})},{color:"var(--color-fuchsia-400)",key:"recall",label:"Recall",value:H({total:l})}]})]}),(0,f.jsxs)("div",{className:"relative mt-4 overflow-hidden",children:[(0,f.jsx)(ge,{className:"aspect-auto h-50 w-full",config:Dt,children:(0,f.jsxs)(le,{"aria-label":`Memory extraction and recall cost during the last ${e.range===1?"24 hours":`${e.range} days`}`,data:r,margin:de,role:"img",children:[(0,f.jsx)(se,{strokeDasharray:"3 5",vertical:!1}),(0,f.jsx)(ce,{format:_,maximum:v}),(0,f.jsx)(me,{keys:r.map(i=>i.date)}),(0,f.jsx)(he,{content:(0,f.jsx)(ue,{rows:i=>[["extraction",`${_(i.extractionCost)} \xB7 ${De(i.extraction.events)}`],["recall",`${_(i.recallCost)} \xB7 ${De(i.recall.events)}`],["total",_(i.extractionCost+i.recallCost)]]})}),(0,f.jsx)(K,{dataKey:"extractionCost",fill:"var(--color-extraction)",fillOpacity:.82,isAnimationActive:!1,maxBarSize:13,stackId:"cost"}),(0,f.jsx)(K,{dataKey:"recallCost",fill:"var(--color-recall)",fillOpacity:.82,isAnimationActive:!1,maxBarSize:13,stackId:"cost"}),(0,f.jsx)(Ye,{unit:Je(a),average:M,format:_,stroke:"var(--color-slate-200)"})]})}),h===0?(0,f.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center pt-12 font-sans text-xs text-dashboard-text-muted",children:"No memory extraction or recall ran in this period."}):null]})]})}function De(e){return`${e.toLocaleString()} ${e===1?"run":"runs"}`}var Mt=w({content:E().min(1),createdAt:T.datetime(),expiresAt:T.datetime().optional(),id:E().min(1),kind:W(["preference","procedure","knowledge"]),observedAt:T.datetime(),origin:W(["automatic","explicit","other"]),sourcePlatform:W(["local","slack","web"])}).strict();function dt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Me(e){return new Intl.DateTimeFormat("en-US",{dateStyle:"medium",timeStyle:"short",timeZone:"UTC"}).format(new Date(e))}function Ut(e){let a=e.origin==="automatic"?"Automatic":e.origin==="explicit"?"Explicit":"Other";return{actions:[{confirmation:"Forget this memory for everyone?",href:`/api/plugins/memory/memories/${encodeURIComponent(e.id)}`,label:"Forget",method:"DELETE",tone:"danger"}],id:e.id,metadata:[{label:"Type",value:dt(e.kind)},{label:"Learned",value:a},{label:"Source",value:dt(e.sourcePlatform)},{label:"Remembered",value:Me(e.createdAt)},{label:"Observed",value:Me(e.observedAt)},{label:"Expires",value:e.expiresAt?Me(e.expiresAt):"Never"}],title:e.content}}function mt(e){return G({enabled:!!e,queryFn:async({signal:a})=>Ut(await z(Mt,`/api/plugins/memory/memories/${encodeURIComponent(e)}`,a)),queryKey:["dashboard","plugin-user-page","memory","record",e],retry:!1})}var t=b(C(),1),ut="grid-cols-1 sm:grid-cols-[minmax(0,1fr)_7rem_9rem]";function gt(e){let[a,o]=(0,S.useState)(30),r=B(),{memoryId:c}=F(),l="/memories",u=`${l}/library`,h=r.pathname===l,p=r.pathname===u||!!c;return!h&&!p?(0,t.jsx)(A,{replace:!0,to:l}):(0,t.jsx)(Ve,{children:h?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O,{description:e.page.description,onRangeChange:o,range:a,title:e.page.label}),(0,t.jsx)(kt,{range:a})]}):(0,t.jsx)(wt,{libraryPath:u,page:e.page})})}function kt(e){let a=at();return a.error?(0,t.jsxs)(y,{className:"flex items-center gap-3 border-rose-300/20 p-5 text-sm text-rose-200",children:[(0,t.jsx)(ve,{"aria-hidden":"true",size:18}),"Memory history is temporarily unavailable."]}):a.data?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("section",{className:"grid gap-4 xl:grid-cols-2",children:[(0,t.jsx)(st,{bucketUnit:Ne(e.range),days:ne({days:a.data.days,hours:a.data.hours,range:e.range,emptySixHour:o=>({count:0,date:o})}),range:e.range}),(0,t.jsx)(lt,{bucketUnit:Ne(e.range),extractionDays:ne({days:a.data.extractionDays,hours:a.data.extractionHours,range:e.range,emptySixHour:o=>({costUsd:0,date:o,events:0})}),range:e.range,recallDays:ne({days:a.data.recallDays,hours:a.data.recallHours,range:e.range,emptySixHour:o=>({costUsd:0,date:o,events:0})})})]}),(0,t.jsx)(St,{data:a.data}),(0,t.jsxs)("section",{className:"grid gap-4 md:grid-cols-2",children:[(0,t.jsx)(At,{data:a.data}),(0,t.jsx)(Tt,{data:a.data})]})]}):(0,t.jsx)(I,{className:"gap-6 sm:gap-8",label:"Loading memory history",variant:"overview"})}function wt(e){let{action:a,content:o,query:r,records:c,runAction:l,searchQuery:u,searchText:h,setSearchText:p}=pe(e.page),v=Ae(),M=B(),{memoryId:i}=F(),d=(0,S.useRef)(null),m=mt(i),g=m.data??c.find(P=>P.id===i),D=P=>Q(P,M.search),U=()=>{let P=i?d.current?.querySelector(`button[data-memory-id="${CSS.escape(i)}"]`):void 0;v(D(e.libraryPath)),(P??d.current)?.focus()},J=P=>{v(D(e.libraryPath)),d.current?.focus(),l(P)};(0,S.useEffect)(()=>{i&&a.reset()},[i]),(0,S.useEffect)(()=>{!i||g||m.isFetching||m.isPending||(m.isError||m.isFetched)&&v(Q(e.libraryPath,M.search),{replace:!0})},[M.search,i,m.isError,m.isFetched,m.isFetching,m.isPending,v,e.libraryPath,g]);let ht=!r.data&&!r.error;return(0,t.jsxs)("div",{className:L("grid h-full min-h-0 min-w-0",i&&"xl:grid-cols-[minmax(0,1fr)_25rem]"),children:[(0,t.jsx)("div",{"aria-label":"Memories list",className:"min-h-0 overflow-y-auto overscroll-contain outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-dashboard-focus",ref:d,role:"region",tabIndex:0,children:(0,t.jsxs)(je,{className:"gap-6 sm:gap-8",children:[(0,t.jsx)(O,{description:e.page.description,title:e.page.label}),(0,t.jsxs)("section",{className:"grid gap-4","aria-labelledby":"memory-library-title",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[(0,t.jsx)("div",{children:(0,t.jsx)("h2",{className:"m-0 font-display text-xl font-medium tracking-[-0.02em] text-dashboard-text",id:"memory-library-title",children:u?"Search results":"What Junior remembers"})}),o?.searchPlaceholder?(0,t.jsx)(Y,{className:"w-full max-w-md sm:w-auto",label:o.searchPlaceholder,onChange:p,placeholder:o.searchPlaceholder,size:"default",value:h}):null]}),ht?(0,t.jsx)(I,{label:"Loading memories",variant:"panel"}):r.error?(0,t.jsxs)(y,{className:"flex items-center gap-3 border-rose-300/20 p-5 text-sm text-rose-200",children:[(0,t.jsx)(ve,{"aria-hidden":"true",size:18}),r.error.message]}):c.length===0?(0,t.jsx)(y,{className:"grid min-h-56 place-items-center p-8 text-center",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(Pe,{"aria-hidden":"true",className:"mx-auto text-dashboard-text-muted",size:26}),(0,t.jsx)("p",{className:"mt-4 mb-0 text-sm text-dashboard-text-muted",children:o?.emptyText??"No memories yet."})]})}):(0,t.jsxs)("div",{className:"grid gap-3",children:[(0,t.jsxs)(y,{padding:"none",children:[(0,t.jsx)(Rt,{}),c.map((P,ft)=>(0,t.jsx)(zt,{first:ft===0,onSelect:()=>v(D(i===P.id?e.libraryPath:`/memories/${encodeURIComponent(P.id)}`)),record:P,searchQuery:u,selected:P.id===i},P.id))]}),(0,t.jsx)(X,{className:"mt-2",hasMore:!r.isPlaceholderData&&!!r.hasNextPage,loading:r.isFetchingNextPage,onLoadMore:()=>{r.fetchNextPage()}}),a.error?(0,t.jsx)(q,{className:"text-center",children:"Could not complete this action. Try again."}):null]})]})]})}),i?(0,t.jsx)(it,{forgetPending:a.isPending,onClose:U,onForget:J,record:g},i):null]})}function Rt(){return(0,t.jsxs)("div",{className:L("hidden items-center gap-3 border-b border-dashboard-border px-4 py-2.5 text-left font-sans font-medium text-xs text-dashboard-text-muted sm:grid",ut),role:"row",children:[(0,t.jsx)("div",{children:"Memory"}),(0,t.jsx)("div",{children:"Type"}),(0,t.jsx)("div",{children:"Learned"})]})}function St(e){let{stats:a}=e.data,o=[{detail:"shared across the workspace",label:"Total active",tone:"text-dashboard-accent-text",value:a.active.toLocaleString("en-US")},{detail:"in the last 30 days",label:"Added \xB7 30d",value:`+${a.createdThirtyDays.toLocaleString("en-US")}`}];return(0,t.jsx)("section",{"aria-label":"Memory summary",className:"grid grid-cols-2 gap-px border-y border-dashboard-border-subtle bg-dashboard-fill-hover",children:o.map(r=>(0,t.jsxs)("div",{className:"bg-dashboard-bg px-4 py-4 sm:px-5",children:[(0,t.jsx)("div",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:r.label}),(0,t.jsx)("div",{className:L("mt-2 font-display text-3xl font-light tracking-[-0.04em] text-dashboard-text",r.tone),children:r.value}),(0,t.jsx)("div",{className:"mt-1 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:r.detail})]},r.label))})}function At(e){let{stats:a}=e.data;return(0,t.jsxs)(y,{className:"p-5 sm:p-6",children:[(0,t.jsx)("h2",{className:"m-0 font-display text-xl font-medium text-dashboard-text",children:"What Junior remembers"}),(0,t.jsxs)("div",{className:"mt-5 grid gap-px overflow-hidden rounded-md border border-dashboard-border-subtle bg-dashboard-fill-hover",children:[(0,t.jsx)($,{detail:"How people like to work",icon:Fe,label:"Preferences",value:a.preference}),(0,t.jsx)($,{detail:"How work should get done",icon:Pe,label:"Procedures",value:a.procedure}),(0,t.jsx)($,{detail:"Facts and durable context",icon:xe,label:"Knowledge",value:a.knowledge})]})]})}function Tt(e){let{stats:a}=e.data,o=Math.max(0,a.active-a.automatic-a.explicit);return(0,t.jsxs)(y,{className:"p-5 sm:p-6",children:[(0,t.jsx)("h2",{className:"m-0 font-display text-xl font-medium text-dashboard-text",children:"How they got here"}),(0,t.jsx)("p",{className:"mt-1 mb-0 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:"Same totals, split by how they were written."}),(0,t.jsxs)("div",{className:"mt-5 grid gap-px overflow-hidden rounded-md border border-dashboard-border-subtle bg-dashboard-fill-hover",children:[(0,t.jsx)($,{detail:"Passive extraction after runs",icon:Be,label:"Learned by Junior",value:a.automatic}),(0,t.jsx)($,{detail:"Someone asked to remember it",icon:Le,label:"Saved explicitly",value:a.explicit}),(0,t.jsx)($,{detail:"Before origin tracking",icon:xe,label:"Older records",value:o})]})]})}function $(e){let a=e.icon;return(0,t.jsxs)("div",{className:"flex items-center gap-3 bg-dashboard-bg-elevated px-3 py-3",children:[(0,t.jsx)("div",{className:"grid size-9 shrink-0 place-items-center rounded-md border border-dashboard-border bg-dashboard-fill-soft text-dashboard-text-muted",children:(0,t.jsx)(a,{"aria-hidden":"true",size:15})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"font-display text-base font-medium text-dashboard-text",children:e.label}),(0,t.jsx)("div",{className:"mt-0.5 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:e.detail})]}),(0,t.jsx)("div",{className:"font-display text-2xl font-light text-dashboard-text",children:e.value.toLocaleString("en-US")})]})}function zt(e){let a=Ue(e.record,"Type"),o=Ue(e.record,"Remembered"),r=Ue(e.record,"Source");return(0,t.jsx)(Ze,{className:L("flex items-stretch",!e.first&&"border-t border-dashboard-border-subtle"),onSelect:e.onSelect,selected:e.selected,children:(0,t.jsxs)("button",{"aria-expanded":e.selected,"aria-label":`View memory details: ${e.record.title}`,"data-memory-id":e.record.id,className:L("grid min-w-0 flex-1 cursor-pointer items-center gap-3 border-0 bg-transparent px-4 py-3 text-left",ut),onClick:e.onSelect,type:"button",children:[(0,t.jsxs)("div",{className:"min-w-0 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:(0,t.jsx)("h3",{className:"m-0 truncate font-display text-base font-medium leading-snug text-dashboard-text",children:(0,t.jsx)(nt,{query:e.searchQuery,text:e.record.title})})}),(0,t.jsxs)("div",{className:"mt-1.5 truncate font-sans text-xs leading-relaxed text-dashboard-text-muted",children:["Source: ",r,(0,t.jsxs)("span",{className:"sm:hidden",children:[" ","\xB7 ",a," \xB7 ",ct(o)]})]})]}),(0,t.jsx)("span",{className:"hidden truncate font-mono text-xs text-dashboard-text-muted sm:block",children:a}),(0,t.jsx)("span",{className:"hidden truncate font-mono text-xs text-dashboard-text sm:block",children:ct(o)})]})})}function Ue(e,a){return e.metadata?.find(o=>o.label===a)?.value??"\u2014"}function ct(e){return e.split(",").slice(0,2).join(",")}var n=b(C(),1);function Wa(e){let a=e.pages.find(o=>o.pluginName==="memory"&&o.id==="memories");return a?(0,n.jsx)(gt,{page:a}):(0,n.jsx)(A,{replace:!0,to:"/"})}function Ya(e){let a=B(),{"*":o,pageId:r,pluginName:c}=F(),l=e.pages.find(u=>u.pluginName===c&&u.id===r);if(!l)return(0,n.jsx)(A,{replace:!0,to:"/"});if(l.pluginName==="memory"&&l.id==="memories"){let u=o?`/${o}`:"";return(0,n.jsx)(A,{replace:!0,to:Q(`/memories${u}`,a.search)})}return(0,n.jsx)(Lt,{page:l})}function Lt(e){let{action:a,content:o,query:r,records:c,runAction:l,searchText:u,setSearchText:h}=pe(e.page),[p,v]=(0,ke.useState)(),[M,i]=(0,ke.useState)(!1);return!r.data&&!r.error?(0,n.jsx)(Ke,{label:`Loading ${e.page.label}`}):(0,n.jsxs)("div",{className:`${Qe} px-4 py-8 md:px-8`,children:[(0,n.jsxs)("section",{className:"mx-auto grid w-full max-w-3xl gap-6",children:[(0,n.jsx)(O,{description:e.page.description,title:e.page.label}),o?.metrics?.length?(0,n.jsx)("section",{"aria-label":`${e.page.label} overview`,className:"grid gap-3 sm:grid-cols-2",children:o.metrics.map(d=>(0,n.jsxs)(y,{className:"p-4",children:[(0,n.jsx)("div",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:d.label}),(0,n.jsx)("div",{className:"mt-3 font-display text-2xl font-light text-dashboard-text",children:d.value}),d.detail?(0,n.jsx)("div",{className:"mt-1 font-mono text-xs text-dashboard-text-muted",children:d.detail}):null]},d.label))}):null,o?.searchPlaceholder?(0,n.jsx)(Y,{className:"w-full",label:o.searchPlaceholder,onChange:h,placeholder:o.searchPlaceholder,size:"default",value:u}):null,r.error?(0,n.jsx)(y,{padding:"md",children:(0,n.jsxs)(q,{children:["Could not load ",e.page.label.toLowerCase(),". Try again."]})}):c.length===0?(0,n.jsx)(y,{padding:"md",children:(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)("div",{className:"grid size-10 shrink-0 place-items-center rounded-md border border-dashboard-border bg-dashboard-fill-soft text-dashboard-text-muted",children:(0,n.jsx)($e,{"aria-hidden":"true",size:17})}),(0,n.jsx)("p",{className:"m-0 text-sm text-dashboard-text-muted",children:o?.emptyText??`No ${e.page.label.toLowerCase()}.`})]})}):(0,n.jsxs)("div",{className:"grid gap-3",children:[c.map(d=>(0,n.jsxs)(y,{padding:"md",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("h2",{className:"m-0 min-w-0 flex-1 font-display text-base font-medium text-dashboard-text",children:d.title}),d.actions?.map(m=>m.method==="GET"?(0,n.jsx)("a",{className:"shrink-0 rounded-md border border-dashboard-border-strong px-3 py-1.5 text-sm font-semibold text-dashboard-text no-underline transition-colors hover:bg-dashboard-fill-strong",href:m.href,children:m.label},`${m.method}:${m.href}`):(0,n.jsx)("button",{"aria-label":`${m.label}: ${d.title}`,className:`cursor-pointer border-0 bg-transparent p-1 text-dashboard-text-muted transition-colors ${m.tone==="danger"?"hover:text-rose-300":"hover:text-dashboard-text"}`,disabled:a.isPending,onClick:()=>{if(!m.confirmation){l(m);return}v({action:m,record:d}),i(!0)},title:m.label,type:"button",children:m.tone==="danger"?(0,n.jsx)(V,{"aria-hidden":"true",size:16}):m.label},`${m.method}:${m.href}`))]}),d.description?(0,n.jsx)("p",{className:"mt-2 mb-0 text-sm text-dashboard-text-muted",children:d.description}):null,d.metadata?.length?(0,n.jsx)("dl",{className:"mt-4 flex flex-wrap gap-x-6 gap-y-2",children:d.metadata.map(m=>(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:m.label}),(0,n.jsx)("dd",{className:"mt-1 ml-0 font-mono text-xs text-dashboard-text-muted",children:m.value})]},m.label))}):null]},d.id)),(0,n.jsx)(X,{hasMore:!r.isPlaceholderData&&!!r.hasNextPage,loading:r.isFetchingNextPage,onLoadMore:()=>{r.fetchNextPage()}}),a.error?(0,n.jsx)(q,{className:"text-center",children:"Could not complete this action. Try again."}):null]})]}),(0,n.jsx)(Z,{onOpenChange:i,open:M,children:(0,n.jsxs)(ee,{children:[(0,n.jsx)(te,{children:p?.action.confirmation}),(0,n.jsx)(ae,{children:p?.record.title}),(0,n.jsxs)(re,{children:[(0,n.jsx)(ie,{children:"Cancel"}),(0,n.jsx)(oe,{onClick:()=>{p&&l(p.action),i(!1)},variant:p?.action.tone==="danger"?"danger":"primary",children:p?.action.label})]})]})})]})}export{Wa as MemoryPermalinkRoute,Lt as PluginUserPage,Ya as PluginUserPageRoute};
|
|
1
|
+
import{a as Ze}from"./chunk-SIOW7OOW.js";import{a as Xe}from"./chunk-SUX4QBVF.js";import{a as se,c as K,f as le,o as de,p as me,q as ce,r as We,s as Ye,t as ue,w as ge,x as he}from"./chunk-K4TYMAA3.js";import{b as Ve}from"./chunk-LZYAHJVQ.js";import{a as Z,b as ee,c as te,d as ae,e as re,f as oe,g as ie}from"./chunk-MKKFXRYO.js";import{c as _e}from"./chunk-WLIOZO3W.js";import"./chunk-JVJ5UWIK.js";import{b as Ke}from"./chunk-J37MXUED.js";import{a as q}from"./chunk-XNR4RZEC.js";import"./chunk-G5NWYJTV.js";import{l as Ce}from"./chunk-RGXXD4DM.js";import{a as X}from"./chunk-3Y3ICT6K.js";import"./chunk-TFJOEF3Q.js";import{b as I}from"./chunk-KDUTK357.js";import"./chunk-QOX5RMLM.js";import{a as Y}from"./chunk-H76B43OQ.js";import{z as H}from"./chunk-II4NXLSQ.js";import"./chunk-PXHLJIOT.js";import{i as Ee,j as Ie,l as He}from"./chunk-GMZIELFU.js";import"./chunk-MEHLQZDG.js";import"./chunk-MTBUV2GJ.js";import{d as we,g as G,i as Re,j as Se,t as Oe,v as z}from"./chunk-4TQSTCIN.js";import{Ka as y,a as E,b as N,d as k,e as w,g as W,h as T,t as qe}from"./chunk-XDUSY26N.js";import"./chunk-QPBLZSNX.js";import{a as Q,b as Ge}from"./chunk-RHMZNAJX.js";import{a as je}from"./chunk-GOTQ4D6W.js";import{G as Ne,H as Je,K as ne,M as O,d as B,f as Ae,g as F,k as A,q as Te}from"./chunk-6PHJZPWD.js";import"./chunk-T4M53QQT.js";import"./chunk-JAZABOBA.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import{b as ze}from"./chunk-CR2ICLSH.js";import{Bc as Be,Hc as V,Kc as Fe,Rc as L,Sc as Qe,a as j,ab as Le,b as C,cb as $e,db as xe,mb as ve,zb as Pe}from"./chunk-YPMUHXYT.js";import{c as b}from"./chunk-7SZRL6FY.js";var ke=b(j(),1);var S=b(j(),1);var fe=b(j(),1);function pe(e){let[a,o]=Te(),r=we(),c=(0,fe.useRef)(!1),l=a.get("filter")?.trim()??"",[u,h,p]=Ge(),v=Se({initialPageParam:void 0,queryKey:["dashboard","plugin-user-page",e.pluginName,e.id,l,p],queryFn:({pageParam:g,signal:D})=>{let U=new URLSearchParams;l&&U.set("filter",l),p&&U.set("q",p),g&&U.set("cursor",g);let J=U.toString();return z(qe,`/api/user-pages/${encodeURIComponent(e.pluginName)}/${encodeURIComponent(e.id)}${J?`?${J}`:""}`,D)},getNextPageParam:g=>g.nextCursor,placeholderData:g=>g,retry:!1}),M=(0,fe.useMemo)(()=>[...new Map((v.data?.pages??[]).flatMap(g=>g.records).map(g=>[g.id,g])).values()],[v.data?.pages]),i=Re({mutationFn:g=>Oe(g.href),onMutate:()=>({pluginName:e.pluginName}),onSuccess:async(g,D,U)=>{r.removeQueries({queryKey:["dashboard","plugin-user-page",U.pluginName,"record"]}),await r.invalidateQueries({queryKey:["dashboard","plugin-user-page",U.pluginName]})},onSettled:()=>{c.current=!1}});function d(g){c.current||(c.current=!0,i.mutate(g))}function m(g){let D=new URLSearchParams(a);g?D.set("filter",g):D.delete("filter"),o(D,{replace:!0})}return{action:i,content:v.data?.pages[0],filter:l,query:v,records:M,runAction:d,searchQuery:p,searchText:u,setFilter:m,setSearchText:h}}var tt=E().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),et=w({count:N().int().min(0),date:tt}).strict(),be=w({costUsd:N().finite().min(0),date:tt,events:N().int().min(0)}).strict(),bt=w({days:k(et).length(90),extractionDays:k(be).length(90),extractionHours:k(be).min(24).optional(),generatedAt:T.datetime(),hours:k(et).min(24).optional(),recallDays:k(be).length(90),recallHours:k(be).min(24).optional(),stats:w({active:N().int().min(0),automatic:N().int().min(0),createdThirtyDays:N().int().min(0),embedded:N().int().min(0),explicit:N().int().min(0),knowledge:N().int().min(0),preference:N().int().min(0),procedure:N().int().min(0)}).strict()}).strict();function at(){return G({queryFn:({signal:e})=>z(bt,"/api/plugins/memory/dashboard",e),queryKey:["dashboard","plugin-user-page","memory","summary"],retry:!1})}var ot=b(j(),1);var s=b(C(),1),yt=new Set(["Learned","Memory ID","Source","Type"]);function it(e){let{record:a}=e,[o,r]=(0,ot.useState)(!1),c=a?vt(a):"Memory details",l=a?.actions?.find(u=>u.tone==="danger");return(0,s.jsxs)(_e,{label:"Memory details",onClose:e.onClose,sheetTitle:c,title:(0,s.jsx)("h2",{className:"m-0 flex items-center gap-2 font-display text-base font-medium text-dashboard-text",children:(0,s.jsx)("span",{className:"truncate",children:c})}),children:[(0,s.jsxs)("div",{className:"grid h-full min-h-0 grid-rows-[minmax(0,1fr)_auto]",children:[(0,s.jsx)("div",{"aria-label":"Memory content",role:"region",tabIndex:0,className:"grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto overscroll-contain p-4 outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-dashboard-focus [overflow-wrap:anywhere]",children:a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid gap-3 text-sm leading-relaxed",children:[(0,s.jsx)(Ce,{text:a.title}),a.description?(0,s.jsx)(Ce,{text:a.description}):null]}),(0,s.jsx)(xt,{record:a})]}):(0,s.jsx)(I,{label:"Loading memory",variant:"panel"})}),a&&l?(0,s.jsx)("footer",{"aria-label":"Memory actions",className:"flex items-center gap-2 border-t border-dashboard-border bg-dashboard-bg-elevated p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:(0,s.jsxs)(Ee,{children:[(0,s.jsx)(Ie,{render:(0,s.jsx)(ze,{"aria-label":"Forget this memory",className:"min-h-11 min-w-11",disabled:e.forgetPending,onClick:()=>{l.confirmation?r(!0):e.onForget(l)},size:"icon",variant:"danger",children:(0,s.jsx)(V,{"aria-hidden":"true",size:16})})}),(0,s.jsx)(He,{size:"compact",children:"Forget this memory"})]})}):null]}),l?.confirmation&&a?(0,s.jsx)(Z,{onOpenChange:r,open:o,children:(0,s.jsxs)(ee,{children:[(0,s.jsx)(te,{children:l.confirmation}),(0,s.jsx)(ae,{children:a.title}),(0,s.jsxs)(re,{children:[(0,s.jsx)(ie,{children:"Cancel"}),(0,s.jsx)(oe,{onClick:()=>{r(!1),e.onForget(l)},variant:"danger",children:l.label})]})]})}):null]})}function xt(e){let{record:a}=e,o=ye(a,"Learned"),r=ye(a,"Source"),c=o==="Automatic"?`From a ${r??"past"} conversation`:o==="Explicit"?"Someone asked Junior":o?"Before origin tracking":void 0,l=ye(a,"Remembered"),u=(a.metadata??[]).filter(h=>!yt.has(h.label)&&!(h.label==="Observed"&&h.value===l));return(0,s.jsxs)("dl",{className:"m-0 grid min-w-0 gap-2 rounded-lg border border-dashboard-border-subtle bg-dashboard-surface-panel p-3 text-xs leading-snug",children:[c?(0,s.jsx)(rt,{label:"Learned",children:c}):null,u.map(h=>(0,s.jsx)(rt,{label:h.label,children:h.value},h.label))]})}function rt(e){return(0,s.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-4",children:[(0,s.jsx)("dt",{className:"shrink-0 text-dashboard-text-muted",children:e.label}),(0,s.jsx)("dd",{className:"m-0 min-w-0 break-words text-right tabular-nums text-dashboard-text",children:e.children})]})}function vt(e){return ye(e,"Type")??"Memory"}function ye(e,a){return e.metadata?.find(o=>o.label===a)?.value}var R=b(C(),1);function Pt(e){return[...new Set(e.toLowerCase().split(/[^a-z0-9_'-]+/).filter(a=>a.length>=2))]}function Ct(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nt(e){let a=Pt(e.query);if(a.length===0)return(0,R.jsx)(R.Fragment,{children:e.text});let o=new RegExp(`(${a.sort((r,c)=>c.length-r.length).map(Ct).join("|")})`,"gi");return(0,R.jsx)(R.Fragment,{children:e.text.split(o).map((r,c)=>c%2===1?(0,R.jsx)("mark",{className:"rounded-sm bg-amber-300/25 text-dashboard-text",children:r},c):r)})}var x=b(C(),1),Nt={count:{color:"var(--color-emerald-300)",label:"Memories"}};function st(e){let a=e.bucketUnit??"day",o=e.days,r=o.map(u=>u.count),c=Math.max(1,...r),l=r.some(u=>u>0);return(0,x.jsxs)(y,{className:"min-h-[17rem] p-4 sm:p-5",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("h2",{className:"m-0 font-display text-xl font-medium text-dashboard-text",children:"Activity over time"}),(0,x.jsx)("p",{className:"mt-1 mb-0 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:a==="hour"?"Memories created each hour.":a==="6hour"?"Memories created each 6 hours.":"Memories created each day."})]}),(0,x.jsxs)("div",{className:"relative mt-3 overflow-hidden",children:[(0,x.jsx)(ge,{className:"aspect-auto h-50 w-full",config:Nt,children:(0,x.jsxs)(le,{"aria-label":`Memories learned during the last ${e.range===1?"24 hours":`${e.range} days`}`,data:o,margin:de,role:"img",children:[(0,x.jsx)(se,{strokeDasharray:"3 5",vertical:!1}),(0,x.jsx)(ce,{maximum:c}),(0,x.jsx)(me,{keys:o.map(u=>u.date)}),(0,x.jsx)(he,{content:(0,x.jsx)(ue,{rows:u=>[["memories",u.count]]})}),(0,x.jsx)(K,{dataKey:"count",fill:"var(--color-count)",fillOpacity:.82,isAnimationActive:!1,maxBarSize:13})]})}),l?null:(0,x.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center pt-12 font-sans text-xs text-dashboard-text-muted",children:"No memories were learned in this period."})]})]})}var f=b(C(),1),Dt={extraction:{color:"var(--color-cyan-300)",label:"Extraction"},recall:{color:"var(--color-fuchsia-400)",label:"Recall"}};function _(e){return H({total:e})}function lt(e){let a=e.bucketUnit??"day",o=new Map(e.recallDays.map(i=>[i.date,i])),r=e.extractionDays.map(i=>{let d=o.get(i.date)??{costUsd:0,date:i.date,events:0};return{date:i.date,extraction:i,extractionCost:i.costUsd,recall:d,recallCost:d.costUsd}}),c=r.reduce((i,d)=>i+d.extraction.costUsd,0),l=r.reduce((i,d)=>i+d.recall.costUsd,0),u=c+l,h=r.reduce((i,d)=>i+d.extraction.events+d.recall.events,0),p=r.map(i=>i.extraction.costUsd+i.recall.costUsd),v=Math.max(.01,...p),M=We(p);return(0,f.jsxs)(y,{className:"min-h-[17rem] p-4 sm:p-5",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("h2",{className:"m-0 font-display text-xl font-medium text-dashboard-text",children:H({total:u})}),(0,f.jsxs)("p",{className:"mt-1 mb-0 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:["System-wide estimate across ",De(h)," spanning extraction and recall."]}),(0,f.jsx)(Xe,{ariaLabel:"Memory cost legend",items:[{color:"var(--color-cyan-300)",key:"extraction",label:"Extraction",value:H({total:c})},{color:"var(--color-fuchsia-400)",key:"recall",label:"Recall",value:H({total:l})}]})]}),(0,f.jsxs)("div",{className:"relative mt-4 overflow-hidden",children:[(0,f.jsx)(ge,{className:"aspect-auto h-50 w-full",config:Dt,children:(0,f.jsxs)(le,{"aria-label":`Memory extraction and recall cost during the last ${e.range===1?"24 hours":`${e.range} days`}`,data:r,margin:de,role:"img",children:[(0,f.jsx)(se,{strokeDasharray:"3 5",vertical:!1}),(0,f.jsx)(ce,{format:_,maximum:v}),(0,f.jsx)(me,{keys:r.map(i=>i.date)}),(0,f.jsx)(he,{content:(0,f.jsx)(ue,{rows:i=>[["extraction",`${_(i.extractionCost)} \xB7 ${De(i.extraction.events)}`],["recall",`${_(i.recallCost)} \xB7 ${De(i.recall.events)}`],["total",_(i.extractionCost+i.recallCost)]]})}),(0,f.jsx)(K,{dataKey:"extractionCost",fill:"var(--color-extraction)",fillOpacity:.82,isAnimationActive:!1,maxBarSize:13,stackId:"cost"}),(0,f.jsx)(K,{dataKey:"recallCost",fill:"var(--color-recall)",fillOpacity:.82,isAnimationActive:!1,maxBarSize:13,stackId:"cost"}),(0,f.jsx)(Ye,{unit:Je(a),average:M,format:_,stroke:"var(--color-slate-200)"})]})}),h===0?(0,f.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center pt-12 font-sans text-xs text-dashboard-text-muted",children:"No memory extraction or recall ran in this period."}):null]})]})}function De(e){return`${e.toLocaleString()} ${e===1?"run":"runs"}`}var Mt=w({content:E().min(1),createdAt:T.datetime(),expiresAt:T.datetime().optional(),id:E().min(1),kind:W(["preference","procedure","knowledge"]),observedAt:T.datetime(),origin:W(["automatic","explicit","other"]),sourcePlatform:W(["local","slack","web"])}).strict();function dt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Me(e){return new Intl.DateTimeFormat("en-US",{dateStyle:"medium",timeStyle:"short",timeZone:"UTC"}).format(new Date(e))}function Ut(e){let a=e.origin==="automatic"?"Automatic":e.origin==="explicit"?"Explicit":"Other";return{actions:[{confirmation:"Forget this memory for everyone?",href:`/api/plugins/memory/memories/${encodeURIComponent(e.id)}`,label:"Forget",method:"DELETE",tone:"danger"}],id:e.id,metadata:[{label:"Type",value:dt(e.kind)},{label:"Learned",value:a},{label:"Source",value:dt(e.sourcePlatform)},{label:"Remembered",value:Me(e.createdAt)},{label:"Observed",value:Me(e.observedAt)},{label:"Expires",value:e.expiresAt?Me(e.expiresAt):"Never"}],title:e.content}}function mt(e){return G({enabled:!!e,queryFn:async({signal:a})=>Ut(await z(Mt,`/api/plugins/memory/memories/${encodeURIComponent(e)}`,a)),queryKey:["dashboard","plugin-user-page","memory","record",e],retry:!1})}var t=b(C(),1),ut="grid-cols-1 sm:grid-cols-[minmax(0,1fr)_7rem_9rem]";function gt(e){let[a,o]=(0,S.useState)(30),r=B(),{memoryId:c}=F(),l="/memories",u=`${l}/library`,h=r.pathname===l,p=r.pathname===u||!!c;return!h&&!p?(0,t.jsx)(A,{replace:!0,to:l}):(0,t.jsx)(Ve,{children:h?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O,{description:e.page.description,onRangeChange:o,range:a,title:e.page.label}),(0,t.jsx)(kt,{range:a})]}):(0,t.jsx)(wt,{libraryPath:u,page:e.page})})}function kt(e){let a=at();return a.error?(0,t.jsxs)(y,{className:"flex items-center gap-3 border-rose-300/20 p-5 text-sm text-rose-200",children:[(0,t.jsx)(ve,{"aria-hidden":"true",size:18}),"Memory history is temporarily unavailable."]}):a.data?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("section",{className:"grid gap-4 xl:grid-cols-2",children:[(0,t.jsx)(st,{bucketUnit:Ne(e.range),days:ne({days:a.data.days,hours:a.data.hours,range:e.range,emptySixHour:o=>({count:0,date:o})}),range:e.range}),(0,t.jsx)(lt,{bucketUnit:Ne(e.range),extractionDays:ne({days:a.data.extractionDays,hours:a.data.extractionHours,range:e.range,emptySixHour:o=>({costUsd:0,date:o,events:0})}),range:e.range,recallDays:ne({days:a.data.recallDays,hours:a.data.recallHours,range:e.range,emptySixHour:o=>({costUsd:0,date:o,events:0})})})]}),(0,t.jsx)(St,{data:a.data}),(0,t.jsxs)("section",{className:"grid gap-4 md:grid-cols-2",children:[(0,t.jsx)(At,{data:a.data}),(0,t.jsx)(Tt,{data:a.data})]})]}):(0,t.jsx)(I,{className:"gap-6 sm:gap-8",label:"Loading memory history",variant:"overview"})}function wt(e){let{action:a,content:o,query:r,records:c,runAction:l,searchQuery:u,searchText:h,setSearchText:p}=pe(e.page),v=Ae(),M=B(),{memoryId:i}=F(),d=(0,S.useRef)(null),m=mt(i),g=m.data??c.find(P=>P.id===i),D=P=>Q(P,M.search),U=()=>{let P=i?d.current?.querySelector(`button[data-memory-id="${CSS.escape(i)}"]`):void 0;v(D(e.libraryPath)),(P??d.current)?.focus()},J=P=>{v(D(e.libraryPath)),d.current?.focus(),l(P)};(0,S.useEffect)(()=>{i&&a.reset()},[i]),(0,S.useEffect)(()=>{!i||g||m.isFetching||m.isPending||(m.isError||m.isFetched)&&v(Q(e.libraryPath,M.search),{replace:!0})},[M.search,i,m.isError,m.isFetched,m.isFetching,m.isPending,v,e.libraryPath,g]);let ht=!r.data&&!r.error;return(0,t.jsxs)("div",{className:L("grid h-full min-h-0 min-w-0",i&&"xl:grid-cols-[minmax(0,1fr)_25rem]"),children:[(0,t.jsx)("div",{"aria-label":"Memories list",className:"min-h-0 overflow-y-auto overscroll-contain outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-dashboard-focus",ref:d,role:"region",tabIndex:0,children:(0,t.jsxs)(je,{className:"gap-6 sm:gap-8",children:[(0,t.jsx)(O,{description:e.page.description,title:e.page.label}),(0,t.jsxs)("section",{className:"grid gap-4","aria-labelledby":"memory-library-title",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[(0,t.jsx)("div",{children:(0,t.jsx)("h2",{className:"m-0 font-display text-xl font-medium tracking-[-0.02em] text-dashboard-text",id:"memory-library-title",children:u?"Search results":"What Junior remembers"})}),o?.searchPlaceholder?(0,t.jsx)(Y,{className:"w-full max-w-md sm:w-auto",label:o.searchPlaceholder,onChange:p,placeholder:o.searchPlaceholder,size:"default",value:h}):null]}),ht?(0,t.jsx)(I,{label:"Loading memories",variant:"panel"}):r.error?(0,t.jsxs)(y,{className:"flex items-center gap-3 border-rose-300/20 p-5 text-sm text-rose-200",children:[(0,t.jsx)(ve,{"aria-hidden":"true",size:18}),r.error.message]}):c.length===0?(0,t.jsx)(y,{className:"grid min-h-56 place-items-center p-8 text-center",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(Pe,{"aria-hidden":"true",className:"mx-auto text-dashboard-text-muted",size:26}),(0,t.jsx)("p",{className:"mt-4 mb-0 text-sm text-dashboard-text-muted",children:o?.emptyText??"No memories yet."})]})}):(0,t.jsxs)("div",{className:"grid gap-3",children:[(0,t.jsxs)(y,{padding:"none",children:[(0,t.jsx)(Rt,{}),c.map((P,ft)=>(0,t.jsx)(zt,{first:ft===0,onSelect:()=>v(D(i===P.id?e.libraryPath:`/memories/${encodeURIComponent(P.id)}`)),record:P,searchQuery:u,selected:P.id===i},P.id))]}),(0,t.jsx)(X,{className:"mt-2",hasMore:!r.isPlaceholderData&&!!r.hasNextPage,loading:r.isFetchingNextPage,onLoadMore:()=>{r.fetchNextPage()}}),a.error?(0,t.jsx)(q,{className:"text-center",children:"Could not complete this action. Try again."}):null]})]})]})}),i?(0,t.jsx)(it,{forgetPending:a.isPending,onClose:U,onForget:J,record:g},i):null]})}function Rt(){return(0,t.jsxs)("div",{className:L("hidden items-center gap-3 border-b border-dashboard-border px-4 py-2.5 text-left font-sans font-medium text-xs text-dashboard-text-muted sm:grid",ut),role:"row",children:[(0,t.jsx)("div",{children:"Memory"}),(0,t.jsx)("div",{children:"Type"}),(0,t.jsx)("div",{children:"Learned"})]})}function St(e){let{stats:a}=e.data,o=[{detail:"shared across the workspace",label:"Total active",tone:"text-dashboard-accent-text",value:a.active.toLocaleString("en-US")},{detail:"in the last 30 days",label:"Added \xB7 30d",value:`+${a.createdThirtyDays.toLocaleString("en-US")}`}];return(0,t.jsx)("section",{"aria-label":"Memory summary",className:"grid grid-cols-2 gap-px border-y border-dashboard-border-subtle bg-dashboard-fill-hover",children:o.map(r=>(0,t.jsxs)("div",{className:"bg-dashboard-bg px-4 py-4 sm:px-5",children:[(0,t.jsx)("div",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:r.label}),(0,t.jsx)("div",{className:L("mt-2 font-display text-3xl font-light tracking-[-0.04em] text-dashboard-text",r.tone),children:r.value}),(0,t.jsx)("div",{className:"mt-1 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:r.detail})]},r.label))})}function At(e){let{stats:a}=e.data;return(0,t.jsxs)(y,{className:"p-5 sm:p-6",children:[(0,t.jsx)("h2",{className:"m-0 font-display text-xl font-medium text-dashboard-text",children:"What Junior remembers"}),(0,t.jsxs)("div",{className:"mt-5 grid gap-px overflow-hidden rounded-md border border-dashboard-border-subtle bg-dashboard-fill-hover",children:[(0,t.jsx)($,{detail:"How people like to work",icon:Fe,label:"Preferences",value:a.preference}),(0,t.jsx)($,{detail:"How work should get done",icon:Pe,label:"Procedures",value:a.procedure}),(0,t.jsx)($,{detail:"Facts and durable context",icon:xe,label:"Knowledge",value:a.knowledge})]})]})}function Tt(e){let{stats:a}=e.data,o=Math.max(0,a.active-a.automatic-a.explicit);return(0,t.jsxs)(y,{className:"p-5 sm:p-6",children:[(0,t.jsx)("h2",{className:"m-0 font-display text-xl font-medium text-dashboard-text",children:"How they got here"}),(0,t.jsx)("p",{className:"mt-1 mb-0 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:"Same totals, split by how they were written."}),(0,t.jsxs)("div",{className:"mt-5 grid gap-px overflow-hidden rounded-md border border-dashboard-border-subtle bg-dashboard-fill-hover",children:[(0,t.jsx)($,{detail:"Passive extraction after runs",icon:Be,label:"Learned by Junior",value:a.automatic}),(0,t.jsx)($,{detail:"Someone asked to remember it",icon:Le,label:"Saved explicitly",value:a.explicit}),(0,t.jsx)($,{detail:"Before origin tracking",icon:xe,label:"Older records",value:o})]})]})}function $(e){let a=e.icon;return(0,t.jsxs)("div",{className:"flex items-center gap-3 bg-dashboard-bg-elevated px-3 py-3",children:[(0,t.jsx)("div",{className:"grid size-9 shrink-0 place-items-center rounded-md border border-dashboard-border bg-dashboard-fill-soft text-dashboard-text-muted",children:(0,t.jsx)(a,{"aria-hidden":"true",size:15})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"font-display text-base font-medium text-dashboard-text",children:e.label}),(0,t.jsx)("div",{className:"mt-0.5 font-sans text-xs leading-relaxed text-dashboard-text-muted",children:e.detail})]}),(0,t.jsx)("div",{className:"font-display text-2xl font-light text-dashboard-text",children:e.value.toLocaleString("en-US")})]})}function zt(e){let a=Ue(e.record,"Type"),o=Ue(e.record,"Remembered"),r=Ue(e.record,"Source");return(0,t.jsx)(Ze,{className:L("flex items-stretch",!e.first&&"border-t border-dashboard-border-subtle"),onSelect:e.onSelect,selected:e.selected,children:(0,t.jsxs)("button",{"aria-expanded":e.selected,"aria-label":`View memory details: ${e.record.title}`,"data-memory-id":e.record.id,className:L("grid min-w-0 flex-1 cursor-pointer items-center gap-3 border-0 bg-transparent px-4 py-3 text-left",ut),onClick:e.onSelect,type:"button",children:[(0,t.jsxs)("div",{className:"min-w-0 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:(0,t.jsx)("h3",{className:"m-0 truncate font-display text-base font-medium leading-snug text-dashboard-text",children:(0,t.jsx)(nt,{query:e.searchQuery,text:e.record.title})})}),(0,t.jsxs)("div",{className:"mt-1.5 truncate font-sans text-xs leading-relaxed text-dashboard-text-muted",children:["Source: ",r,(0,t.jsxs)("span",{className:"sm:hidden",children:[" ","\xB7 ",a," \xB7 ",ct(o)]})]})]}),(0,t.jsx)("span",{className:"hidden truncate font-mono text-xs text-dashboard-text-muted sm:block",children:a}),(0,t.jsx)("span",{className:"hidden truncate font-mono text-xs text-dashboard-text sm:block",children:ct(o)})]})})}function Ue(e,a){return e.metadata?.find(o=>o.label===a)?.value??"\u2014"}function ct(e){return e.split(",").slice(0,2).join(",")}var n=b(C(),1);function Wa(e){let a=e.pages.find(o=>o.pluginName==="memory"&&o.id==="memories");return a?(0,n.jsx)(gt,{page:a}):(0,n.jsx)(A,{replace:!0,to:"/"})}function Ya(e){let a=B(),{"*":o,pageId:r,pluginName:c}=F(),l=e.pages.find(u=>u.pluginName===c&&u.id===r);if(!l)return(0,n.jsx)(A,{replace:!0,to:"/"});if(l.pluginName==="memory"&&l.id==="memories"){let u=o?`/${o}`:"";return(0,n.jsx)(A,{replace:!0,to:Q(`/memories${u}`,a.search)})}return(0,n.jsx)(Lt,{page:l})}function Lt(e){let{action:a,content:o,query:r,records:c,runAction:l,searchText:u,setSearchText:h}=pe(e.page),[p,v]=(0,ke.useState)(),[M,i]=(0,ke.useState)(!1);return!r.data&&!r.error?(0,n.jsx)(Ke,{label:`Loading ${e.page.label}`}):(0,n.jsxs)("div",{className:`${Qe} px-4 py-8 md:px-8`,children:[(0,n.jsxs)("section",{className:"mx-auto grid w-full max-w-3xl gap-6",children:[(0,n.jsx)(O,{description:e.page.description,title:e.page.label}),o?.metrics?.length?(0,n.jsx)("section",{"aria-label":`${e.page.label} overview`,className:"grid gap-3 sm:grid-cols-2",children:o.metrics.map(d=>(0,n.jsxs)(y,{className:"p-4",children:[(0,n.jsx)("div",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:d.label}),(0,n.jsx)("div",{className:"mt-3 font-display text-2xl font-light text-dashboard-text",children:d.value}),d.detail?(0,n.jsx)("div",{className:"mt-1 font-mono text-xs text-dashboard-text-muted",children:d.detail}):null]},d.label))}):null,o?.searchPlaceholder?(0,n.jsx)(Y,{className:"w-full",label:o.searchPlaceholder,onChange:h,placeholder:o.searchPlaceholder,size:"default",value:u}):null,r.error?(0,n.jsx)(y,{padding:"md",children:(0,n.jsxs)(q,{children:["Could not load ",e.page.label.toLowerCase(),". Try again."]})}):c.length===0?(0,n.jsx)(y,{padding:"md",children:(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)("div",{className:"grid size-10 shrink-0 place-items-center rounded-md border border-dashboard-border bg-dashboard-fill-soft text-dashboard-text-muted",children:(0,n.jsx)($e,{"aria-hidden":"true",size:17})}),(0,n.jsx)("p",{className:"m-0 text-sm text-dashboard-text-muted",children:o?.emptyText??`No ${e.page.label.toLowerCase()}.`})]})}):(0,n.jsxs)("div",{className:"grid gap-3",children:[c.map(d=>(0,n.jsxs)(y,{padding:"md",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("h2",{className:"m-0 min-w-0 flex-1 font-display text-base font-medium text-dashboard-text",children:d.title}),d.actions?.map(m=>m.method==="GET"?(0,n.jsx)("a",{className:"shrink-0 rounded-md border border-dashboard-border-strong px-3 py-1.5 text-sm font-semibold text-dashboard-text no-underline transition-colors hover:bg-dashboard-fill-strong",href:m.href,children:m.label},`${m.method}:${m.href}`):(0,n.jsx)("button",{"aria-label":`${m.label}: ${d.title}`,className:`cursor-pointer border-0 bg-transparent p-1 text-dashboard-text-muted transition-colors ${m.tone==="danger"?"hover:text-rose-300":"hover:text-dashboard-text"}`,disabled:a.isPending,onClick:()=>{if(!m.confirmation){l(m);return}v({action:m,record:d}),i(!0)},title:m.label,type:"button",children:m.tone==="danger"?(0,n.jsx)(V,{"aria-hidden":"true",size:16}):m.label},`${m.method}:${m.href}`))]}),d.description?(0,n.jsx)("p",{className:"mt-2 mb-0 text-sm text-dashboard-text-muted",children:d.description}):null,d.metadata?.length?(0,n.jsx)("dl",{className:"mt-4 flex flex-wrap gap-x-6 gap-y-2",children:d.metadata.map(m=>(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:m.label}),(0,n.jsx)("dd",{className:"mt-1 ml-0 font-mono text-xs text-dashboard-text-muted",children:m.value})]},m.label))}):null]},d.id)),(0,n.jsx)(X,{hasMore:!r.isPlaceholderData&&!!r.hasNextPage,loading:r.isFetchingNextPage,onLoadMore:()=>{r.fetchNextPage()}}),a.error?(0,n.jsx)(q,{className:"text-center",children:"Could not complete this action. Try again."}):null]})]}),(0,n.jsx)(Z,{onOpenChange:i,open:M,children:(0,n.jsxs)(ee,{children:[(0,n.jsx)(te,{children:p?.action.confirmation}),(0,n.jsx)(ae,{children:p?.record.title}),(0,n.jsxs)(re,{children:[(0,n.jsx)(ie,{children:"Cancel"}),(0,n.jsx)(oe,{onClick:()=>{p&&l(p.action),i(!1)},variant:p?.action.tone==="danger"?"danger":"primary",children:p?.action.label})]})]})})]})}export{Wa as MemoryPermalinkRoute,Lt as PluginUserPage,Ya as PluginUserPageRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as me}from"./chunk-
|
|
1
|
+
import{c as me}from"./chunk-QQUFROWT.js";import{a as le,b as ce}from"./chunk-LBELRO5P.js";import{c as de}from"./chunk-2J3LGF5Q.js";import{a as N,b as S}from"./chunk-ONDKE72P.js";import"./chunk-PG7M7L24.js";import"./chunk-SUX4QBVF.js";import"./chunk-K4TYMAA3.js";import{F as Y,L as ee,M as te,O as oe,g as X}from"./chunk-GZBMHYYU.js";import{h as K}from"./chunk-2NNKHSZE.js";import{a as M}from"./chunk-5ZA674OU.js";import"./chunk-FVX42XAD.js";import"./chunk-RGXXD4DM.js";import{b as P,c as I,d as D}from"./chunk-3Y3ICT6K.js";import{b as h}from"./chunk-5LNGNJ3P.js";import{j as se}from"./chunk-TFJOEF3Q.js";import{a as ne}from"./chunk-DEEO4D4N.js";import"./chunk-KDUTK357.js";import"./chunk-LKW7MULF.js";import"./chunk-6FSJ3W2W.js";import"./chunk-2BCS5AQL.js";import"./chunk-QOX5RMLM.js";import{a as A}from"./chunk-H76B43OQ.js";import{e as v}from"./chunk-564V7YHG.js";import{e as V,f as R}from"./chunk-64GPEGGE.js";import"./chunk-ILH47V7O.js";import{F as Z,H as J,I as j,N as G,R as w,e as q,g as Q}from"./chunk-II4NXLSQ.js";import"./chunk-PXHLJIOT.js";import"./chunk-GMZIELFU.js";import"./chunk-MEHLQZDG.js";import"./chunk-MTBUV2GJ.js";import"./chunk-4TQSTCIN.js";import{Ka as T}from"./chunk-XDUSY26N.js";import"./chunk-QPBLZSNX.js";import"./chunk-RHMZNAJX.js";import{a as E}from"./chunk-GOTQ4D6W.js";import{G as x,K as ae,L as ie,M as re,g as B,o as y}from"./chunk-6PHJZPWD.js";import"./chunk-T4M53QQT.js";import"./chunk-IZWTFLCC.js";import"./chunk-JAZABOBA.js";import"./chunk-WRXMQB7X.js";import"./chunk-CQY6BYUB.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import{a as _}from"./chunk-CR2ICLSH.js";import{Cb as U,Rc as W,Tc as $,Xa as F,a as z,b as f}from"./chunk-YPMUHXYT.js";import{c as g}from"./chunk-7SZRL6FY.js";var fe=g(z(),1);var m=g(f(),1);function H(t){return(0,m.jsxs)(T,{as:"section",className:"mb-0",variant:"section",children:[(0,m.jsx)(le,{actions:t.viewAllTo?(0,m.jsx)(y,{className:"text-sm text-dashboard-text underline underline-offset-2",to:t.viewAllTo,children:"View all"}):void 0,children:(0,m.jsx)(ce,{children:t.title})}),t.children]})}function pe(t){let o=t.conversation,i=Z(o),r=J(o,{includeId:!1}),c=!!o.sidebarAnnotations?.length;return(0,m.jsxs)("div",{className:"relative min-w-0 border-b border-dashboard-border-subtle px-4 py-3 transition-colors last:border-b-0 hover:bg-dashboard-fill-soft",children:[(0,m.jsx)(y,{"aria-label":`Open ${i}`,className:"absolute inset-0 z-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-dashboard-focus",to:M(o.id)}),(0,m.jsxs)("div",{className:"pointer-events-none relative z-[1] grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2",children:[(0,m.jsx)("span",{className:"mt-1.5 grid size-3 shrink-0 place-items-center",children:(0,m.jsx)(ee,{finishedSinceSeen:!1,isPrivate:o.visibility==="private",status:j(o),waitingOnViewer:!1})}),(0,m.jsx)("div",{className:"min-w-0 truncate font-display text-sm text-dashboard-text",children:i}),(0,m.jsx)("span",{className:"whitespace-nowrap font-mono text-xs text-dashboard-text-muted",children:Q(o.lastSeenAt)}),(0,m.jsx)("div",{className:"col-start-2 col-end-4 mt-1 flex h-4 min-w-0 items-center gap-1.5 font-mono text-xs text-dashboard-text-muted",children:c?(0,m.jsx)(Y,{annotations:o.sidebarAnnotations}):r?(0,m.jsx)("span",{className:"truncate",children:r}):null})]})]})}function k(t,o){return ae({days:t.activityDays,hours:t.activityHours,sixHours:t.activitySixHours,range:o,emptySixHour:i=>({closed:0,created:0,date:i,merged:0})})}var d=g(z(),1);var a=g(f(),1),b=25,be=new Set;function ge(t){let[o,i]=(0,d.useState)(""),[r,c]=(0,d.useState)(1),s=oe(o.trim()),l=R(t.repositoryId,s),n=w(l.data?.conversations??[]),u=K();return(0,d.useEffect)(()=>{c(1)},[s]),(0,a.jsxs)("section",{"aria-label":"Conversations",className:"grid gap-3",children:[(0,a.jsx)(A,{className:"w-full sm:ml-auto sm:w-72",label:"Search conversations in this repository",onChange:i,placeholder:"Search conversations\u2026",value:o}),l.error?(0,a.jsx)(v,{children:"Conversations are unavailable. Try refreshing the dashboard."}):(0,a.jsx)(te,{conversations:P(X(n,u),r,b),emptyLabel:s?"No conversations match this search.":"No conversations are linked to this repository yet.",finishedConversationIds:be,loading:!l.data,timeZone:q(),waitingConversationIds:u}),(0,a.jsx)(D,{className:"pt-1",onPageChange:c,page:r,pageCount:I(n.length,b),pageSize:b,total:n.length})]})}function ue(t){let[o,i]=(0,d.useState)(""),[r,c]=(0,d.useState)(""),[s,l]=(0,d.useState)(1),n=t.data.changes,u=r.trim().toLowerCase(),C=n.filter(p=>(!o||p.state===o)&&(!u||p.title?.toLowerCase().includes(u)||`#${p.number}`.includes(u))),L=p=>n.filter(he=>he.state===p).length;return(0,d.useEffect)(()=>{l(1)},[o,u]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N,{bucketUnit:x(t.range),days:k(t.data,t.range),range:t.range}),(0,a.jsxs)("section",{"aria-label":"Changes",className:"grid gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[(0,a.jsx)(de,{ariaLabel:"Change state",items:[{count:n.length,label:"All",value:""},{count:L("open"),label:"Open",value:"open"},{count:L("merged"),label:"Merged",value:"merged"},{count:L("closed"),label:"Closed",value:"closed"}],onChange:i,value:o}),(0,a.jsx)(A,{className:"w-full max-w-md sm:w-auto",label:"Search changes",onChange:c,placeholder:"Title or number",value:r})]}),(0,a.jsx)(T,{children:C.length===0?(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)(v,{children:"No changes match these filters."})}):P(C,s,b).map(p=>(0,a.jsx)(S,{change:p},p.id))}),(0,a.jsx)(D,{onPageChange:l,page:s,pageCount:I(C.length,b),pageSize:b,total:C.length})]})]})}var e=g(f(),1),ye=5,O="Conversations and code changes from Junior.",Ce=W("font-semibold",$);function gt(t){let i=B().repositoryId,[r,c]=(0,fe.useState)(30),s=V(i);if(!s.data&&!s.error)return(0,e.jsx)(ne,{description:O,label:"Loading repository",title:"Repository",variant:"stats"});let l=s.data;if(!l)return(0,e.jsxs)(E,{children:[(0,e.jsx)(ve,{}),(0,e.jsx)(v,{children:"This repository is unavailable. It may not have any code changes from Junior."})]});let n=l.repository;return(0,e.jsx)(se,{ariaLabel:"Repository navigation",items:[{end:!0,label:"Overview",to:h(n.id)},{label:"Conversations",to:h(n.id,"conversations")},{label:"Changes",to:h(n.id,"changes")}],children:(0,e.jsxs)(E,{children:[(0,e.jsx)(ve,{}),(0,e.jsx)(re,{actions:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(ie,{onChange:c,value:r}),n.url?(0,e.jsxs)(y,{className:_(),rel:"noopener noreferrer",target:"_blank",to:n.url,children:["Open repository",(0,e.jsx)(U,{"aria-hidden":"true",className:"size-3.5 shrink-0"})]}):null]}),description:(0,e.jsx)(Re,{data:l}),documentTitle:t.tab==="overview"?n.name:`${n.name} \xB7 ${t.tab==="changes"?"Changes":"Conversations"}`,title:n.name}),t.tab==="overview"?(0,e.jsx)(Te,{data:l,range:r}):null,t.tab==="conversations"?(0,e.jsx)(ge,{repositoryId:n.id}):null,t.tab==="changes"?(0,e.jsx)(ue,{data:l,range:r}):null]})})}function ve(){return(0,e.jsxs)(y,{className:"flex w-fit items-center gap-2 font-display text-sm font-medium text-dashboard-text-muted no-underline transition-colors hover:text-dashboard-text",to:"/code",children:[(0,e.jsx)(F,{"aria-hidden":"true",size:15,strokeWidth:1.8}),"Back to code"]})}function Re(t){let o=t.data.workspaces;return o.length===0?O:(0,e.jsxs)(e.Fragment,{children:[O," / Workspaces"," ",o.map((i,r)=>(0,e.jsxs)("span",{children:[r>0?", ":null,(0,e.jsx)(y,{className:Ce,to:G(i.id),children:i.name})]},i.id))]})}function Te(t){let o=t.data,i=R(o.repository.id),r=w(i.data?.conversations??[]).slice(0,ye),c=o.changes.slice(0,ye);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(me,{summary:o.summary}),(0,e.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,e.jsx)(H,{title:"Recent conversations",viewAllTo:h(o.repository.id,"conversations"),children:r.length>0?r.map(s=>(0,e.jsx)(pe,{conversation:s},s.id)):(0,e.jsx)("div",{className:"p-4",children:(0,e.jsx)(v,{children:i.error?"Conversations are unavailable. Try refreshing the dashboard.":i.data?"No conversations are linked to this repository yet.":"Loading conversations\u2026"})})}),(0,e.jsx)(H,{title:"Recent changes",viewAllTo:h(o.repository.id,"changes"),children:c.length>0?c.map(s=>(0,e.jsx)(S,{change:s},s.id)):(0,e.jsx)("div",{className:"p-4",children:(0,e.jsx)(v,{children:"No code changes are recorded yet."})})})]}),(0,e.jsx)(N,{bucketUnit:x(t.range),days:k(o,t.range),range:t.range})]})}export{gt as RepositoryPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U}from"./chunk-4UGZNVJM.js";import{a as _,c as Q}from"./chunk-
|
|
1
|
+
import{a as U}from"./chunk-4UGZNVJM.js";import{a as _,c as Q}from"./chunk-JPL2NRWK.js";import{a as F,b as R,c as G}from"./chunk-HCLRG2EC.js";import{a as y,b as C,c as N,e as M}from"./chunk-PQPAPPEI.js";import{a as p}from"./chunk-XNR4RZEC.js";import{a as q}from"./chunk-DZB4LPI6.js";import"./chunk-L2H3ZWZN.js";import{G as O}from"./chunk-2NNKHSZE.js";import{a as T,b as A}from"./chunk-ILH47V7O.js";import"./chunk-II4NXLSQ.js";import{l as L}from"./chunk-MEHLQZDG.js";import"./chunk-MTBUV2GJ.js";import{d as f,g as I,i as v,p as k,q as D,s as z,v as H}from"./chunk-4TQSTCIN.js";import{H as S,I as P,Ka as u}from"./chunk-XDUSY26N.js";import"./chunk-QPBLZSNX.js";import"./chunk-RHMZNAJX.js";import"./chunk-GOTQ4D6W.js";import"./chunk-6PHJZPWD.js";import"./chunk-JAZABOBA.js";import"./chunk-CQY6BYUB.js";import"./chunk-VC6IS564.js";import"./chunk-B5ZN3SWQ.js";import{b}from"./chunk-CR2ICLSH.js";import{a as $,b as x}from"./chunk-YPMUHXYT.js";import{c as g}from"./chunk-7SZRL6FY.js";var h=g($(),1);var a=g(x(),1),J=["dashboard","core"],w=[1,6,24,72,T];function W(t){return t===0?"No done conversations to archive.":t===1?"Archived 1 conversation.":`Archived ${t} conversations.`}function X(t){if(t%24!==0)return t===1?"1 hour":`${t} hours`;let o=t/24;return o===7?"1 week":o===1?"1 day":`${o} days`}function B({identity:t}){let o=f(),i=v({mutationFn:s=>D(A,"/api/me",s),onSuccess:s=>{o.setQueryData(J,r=>r&&{...r,me:s})}}),m=Q(),n=t.autoArchiveDefault??!1,l=t.autoArchiveGraceHours??24,c=w.includes(l)?w:[...w,l].sort((s,r)=>s-r);return(0,a.jsxs)(u,{className:"mt-6 mb-0",padding:"md",variant:"raised",children:[(0,a.jsx)("h2",{className:"m-0 text-lg font-bold",children:"Conversations"}),(0,a.jsxs)("label",{className:"mt-4 flex cursor-pointer items-start gap-3",children:[(0,a.jsx)(F,{checked:n,className:"mt-0.5",disabled:i.isPending,onCheckedChange:s=>i.mutate({autoArchiveDefault:s})}),(0,a.jsxs)("span",{className:"grid gap-0.5",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Auto-archive conversations when done"}),(0,a.jsx)("span",{className:"text-xs text-dashboard-text-muted",children:"Archive a conversation for you when all of its linked work, such as pull requests, is merged or closed and nobody replies during the wait time. You can change this for each conversation in its details."})]})]}),(0,a.jsxs)(y,{className:"mt-5 max-w-xs",children:[(0,a.jsx)(C,{htmlFor:"auto-archive-grace",children:"Wait time"}),(0,a.jsx)(U,{"aria-describedby":"auto-archive-grace-help",disabled:i.isPending,id:"auto-archive-grace",onChange:s=>i.mutate({autoArchiveGraceHours:Number(s.target.value)}),value:l,children:c.map(s=>(0,a.jsx)("option",{value:s,children:X(s)},s))}),(0,a.jsx)(N,{id:"auto-archive-grace-help",children:"How long finished work and the conversation stay quiet before archive."})]}),i.isError?(0,a.jsx)(p,{className:"mt-3",children:"Could not save this setting. Try again."}):null,(0,a.jsxs)("div",{className:"mt-5 grid gap-1.5",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsx)(b,{disabled:m.isPending,onClick:()=>m.mutate(),type:"button",children:m.isPending?"Archiving\u2026":"Archive done now"}),m.isSuccess?(0,a.jsx)("p",{className:"m-0 text-sm text-dashboard-text-muted",role:"status",children:W(m.data.archived)}):null,m.isError?(0,a.jsx)(p,{children:"Could not archive conversations. Try again."}):null]}),(0,a.jsx)("p",{className:"m-0 text-xs text-dashboard-text-muted",children:"Archive every done conversation once, without the wait time. Skips conversations where you turned auto-archive off."})]})]})}var e=g(x(),1),Y=["dashboard","core"],K=["dashboard","user-customization"],V="/api/user-customization";function we({identity:t}){let o=f(),[i,m]=(0,h.useState)(t.user.name??"");(0,h.useEffect)(()=>{m(t.user.name??"")},[t.user.name]);let n=v({mutationFn:d=>D(A,"/api/me",{displayName:d}),onSuccess:d=>{o.setQueryData(Y,E=>E&&{...E,me:d}),m(d.user.name??"")}}),l=t.user.name?.trim()??"",c=i.trim(),s=c.length>0&&c.length<=80&&c!==l&&!n.isPending;function r(d){d.preventDefault(),s&&n.mutate(c)}return(0,e.jsxs)(q,{description:"Manage your profile and preferences.",title:"General",children:[(0,e.jsx)("form",{onSubmit:r,children:(0,e.jsxs)(u,{className:"mb-0",padding:"md",variant:"raised",children:[(0,e.jsx)("h2",{className:"m-0 text-lg font-bold",children:"Profile"}),(0,e.jsxs)(y,{className:"mt-5",children:[(0,e.jsx)(C,{htmlFor:"display-name",children:"Display name"}),(0,e.jsx)(L,{autoComplete:"name",id:"display-name",maxLength:80,onChange:d=>{m(d.target.value),(n.isError||n.isSuccess)&&n.reset()},value:i}),(0,e.jsx)(N,{id:"display-name-help",children:"Your display name is shown with your conversations and activity."})]}),(0,e.jsxs)("div",{className:"mt-5 flex items-center gap-3",children:[(0,e.jsx)(b,{disabled:!s,type:"submit",children:n.isPending?"Saving\u2026":"Save changes"}),n.isSuccess?(0,e.jsx)("p",{className:"m-0 text-sm text-emerald-300",children:"Changes saved."}):null,n.isError?(0,e.jsx)(p,{children:"Could not save your display name. Try again."}):null]})]})}),(0,e.jsx)(j,{}),(0,e.jsx)(ee,{}),(0,e.jsx)(B,{identity:t}),(0,e.jsx)(te,{})]})}var Z=[{description:"Open at the first new message, below a \u201CNew\u201D line.",label:"Where I left off",value:"unread"},{description:"Always open at the newest message.",label:"Latest message",value:"latest"}];function j(){let[t,o]=O();return(0,e.jsx)(u,{className:"mt-6 mb-0",padding:"md",variant:"raised",children:(0,e.jsxs)("fieldset",{className:"m-0 min-w-0 border-0 p-0",children:[(0,e.jsx)("legend",{className:"m-0 p-0 text-lg font-bold",children:"Open conversations at"}),(0,e.jsx)("p",{className:"mt-1 mb-4 text-sm text-dashboard-text-muted",children:"Junior keeps your place in each conversation on all your devices. This choice applies to this browser."}),(0,e.jsx)(R,{"aria-label":"Open conversations at",className:"grid gap-3",onValueChange:o,value:t,children:Z.map(i=>(0,e.jsxs)("label",{className:"flex cursor-pointer items-start gap-3",children:[(0,e.jsx)(G,{className:"mt-0.5",value:i.value}),(0,e.jsxs)("span",{className:"grid gap-0.5",children:[(0,e.jsx)("span",{className:"text-sm font-medium",children:i.label}),(0,e.jsx)("span",{className:"text-xs text-dashboard-text-muted",children:i.description})]})]},i.value))})]})})}function ee(){let[t,o]=_();return(0,e.jsxs)(u,{className:"mt-6 mb-0",padding:"md",variant:"raised",children:[(0,e.jsx)("h2",{className:"m-0 text-lg font-bold",children:"Message box"}),(0,e.jsxs)("label",{className:"mt-4 flex cursor-pointer items-start gap-3",children:[(0,e.jsx)(F,{checked:t,className:"mt-0.5",onCheckedChange:o}),(0,e.jsxs)("span",{className:"grid gap-0.5",children:[(0,e.jsx)("span",{className:"text-sm font-medium",children:"Autocorrect"}),(0,e.jsx)("span",{className:"text-xs text-dashboard-text-muted",children:"Let your keyboard correct spelling and capitalize sentences as you type. This can change ids, paths, and code. This choice applies to this browser."})]})]})]})}function te(){let t=f(),[o,i]=(0,h.useState)(""),m=I({queryKey:K,queryFn:({signal:r})=>H(P,V,r),retry:!1}),n=m.data?.customization;(0,h.useEffect)(()=>{n!==void 0&&i(n)},[n]);let l=v({mutationFn:r=>z(P,V,{customization:r}),onSuccess:r=>{t.setQueryData(K,r)}});if(m.error instanceof k&&m.error.status===404)return null;if(n===void 0)return m.isError?(0,e.jsx)(p,{children:"Could not load your customization."}):null;let c=o.trim()!==n&&o.trim().length<=S&&!l.isPending;function s(r){r.preventDefault(),c&&l.mutate(o.trim())}return(0,e.jsx)("form",{onSubmit:s,children:(0,e.jsxs)(u,{className:"mb-0",padding:"md",variant:"raised",children:[(0,e.jsx)("h2",{className:"m-0 text-lg font-bold",children:"Customization"}),(0,e.jsxs)(y,{className:"mt-5",children:[(0,e.jsx)(C,{htmlFor:"user-customization",children:"How should replies to you change?"}),(0,e.jsx)(M,{id:"user-customization",maxLength:S,onChange:r=>{i(r.target.value),(l.isError||l.isSuccess)&&l.reset()},placeholder:"Keep replies short and simple.",value:o}),(0,e.jsxs)(N,{children:["Added to each message you send. Do not put secrets here. (",o.trim().length,"/",S,")"]})]}),(0,e.jsxs)("div",{className:"mt-5 flex items-center gap-3",children:[(0,e.jsx)(b,{disabled:!c,type:"submit",children:l.isPending?"Saving\u2026":"Save customization"}),l.isSuccess?(0,e.jsx)("p",{className:"m-0 text-sm text-emerald-300",children:"Changes saved."}):null,l.isError?(0,e.jsx)(p,{children:"Could not save your customization. Try again."}):null]})]})})}export{we as SettingsPage};
|