@shumai-one/shumai 0.3.2 → 0.3.3
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/bin/{chunk-dwswqq3g.js → chunk-0a0sdyta.js} +1 -1
- package/bin/{chunk-qmtvy2j4.js → chunk-0dcv6kpk.js} +2 -2
- package/bin/chunk-1cjgpspz.js +2 -0
- package/bin/chunk-1pgtq4rc.js +2 -0
- package/bin/chunk-1rsp4hc5.js +1 -0
- package/bin/{chunk-7eycsyk6.js → chunk-2475z7vk.js} +1 -1
- package/bin/chunk-25qj10ny.js +1 -0
- package/bin/{chunk-gn8snrnk.js → chunk-2fc5hk8r.js} +1 -1
- package/bin/{chunk-qc6dmzn0.js → chunk-2jvqhps9.js} +2 -2
- package/bin/{chunk-ve7v8wtv.js → chunk-3823qzr0.js} +2 -2
- package/bin/{chunk-zxpef55w.js → chunk-3g9g2c7h.js} +3 -3
- package/bin/chunk-3gcnj1eq.js +2 -0
- package/bin/chunk-41m51y08.js +2 -0
- package/bin/chunk-4g7h9qhr.js +8 -0
- package/bin/chunk-4v5ykazp.js +1 -0
- package/bin/{chunk-k20bhxed.js → chunk-525eypdk.js} +1 -1
- package/bin/{chunk-h2wsm7h3.js → chunk-57kgmgfs.js} +2 -2
- package/bin/{chunk-gvn079hy.js → chunk-5cm4vge8.js} +2 -2
- package/bin/{chunk-31mjcykb.js → chunk-5vwkfxy7.js} +2 -2
- package/bin/chunk-5x3vzer8.js +1 -0
- package/bin/chunk-67rr836p.js +3 -0
- package/bin/chunk-6jgq154r.js +2 -0
- package/bin/chunk-7436fyrg.js +2 -0
- package/bin/{chunk-s05f0v9t.js → chunk-749c09cw.js} +1 -1
- package/bin/{chunk-9p2d0mk1.js → chunk-7anqxx1z.js} +1 -1
- package/bin/{chunk-s7qpj715.js → chunk-7pjes19z.js} +2 -2
- package/bin/{chunk-f8cn9m28.js → chunk-7x7jtkh8.js} +1 -1
- package/bin/chunk-804ndet8.js +2 -0
- package/bin/chunk-8a75zqbz.js +2 -0
- package/bin/{chunk-tsncwscz.js → chunk-9a7a1p1j.js} +2 -2
- package/bin/chunk-9e99n265.js +12 -0
- package/bin/chunk-9g6vy76b.js +2 -0
- package/bin/{chunk-wap08p4j.js → chunk-9sdhdhv4.js} +2 -2
- package/bin/{chunk-g2dk56e7.js → chunk-9vgjhemh.js} +1 -1
- package/bin/{chunk-1dawjfk8.js → chunk-9zvteyz0.js} +2 -2
- package/bin/chunk-a8daqpfh.js +7 -0
- package/bin/{chunk-na2nympm.js → chunk-am1m29pv.js} +1 -1
- package/bin/{chunk-xawwxdq9.js → chunk-bd6x5ns9.js} +2 -2
- package/bin/{chunk-wr5byz6r.js → chunk-bn4ewsy8.js} +1 -1
- package/bin/{chunk-ss45w8ks.js → chunk-bw6wyw7k.js} +2 -2
- package/bin/{chunk-8e5zvy88.js → chunk-c0c88nje.js} +48 -48
- package/bin/chunk-c7rj0f5r.js +3 -0
- package/bin/chunk-cdqvg03f.js +3 -0
- package/bin/{chunk-zs9b0f3z.js → chunk-d3kpqay2.js} +2 -2
- package/bin/chunk-d6v81kjj.js +1 -0
- package/bin/chunk-dfcrtdk2.js +1 -0
- package/bin/chunk-eczsk2xd.js +62 -0
- package/bin/{chunk-yahb7wan.js → chunk-ey7vty63.js} +2 -2
- package/bin/{chunk-nzy3pjjm.js → chunk-fwqpq2sy.js} +2 -2
- package/bin/{chunk-vnfmh5ke.js → chunk-g097058z.js} +2 -2
- package/bin/{chunk-a76c5r3c.js → chunk-g224r7mc.js} +2 -2
- package/bin/chunk-g5e93f59.js +2 -0
- package/bin/chunk-g5xkj9p3.js +2 -0
- package/bin/chunk-gaemak59.js +4 -0
- package/bin/{chunk-hrzm70wg.js → chunk-gh4w2bdg.js} +1 -1
- package/bin/chunk-gpeyctxd.js +2 -0
- package/bin/{chunk-v2kfr8fx.js → chunk-gpmaaca1.js} +2 -2
- package/bin/{chunk-1d22tysv.js → chunk-h4a3ms2b.js} +2 -2
- package/bin/chunk-h73653yp.js +1 -0
- package/bin/chunk-hp139z0j.js +2 -0
- package/bin/chunk-hz6s7by4.js +11 -0
- package/bin/chunk-j4y8c864.js +1 -0
- package/bin/chunk-jkh04dka.js +8 -0
- package/bin/chunk-m268vcdm.js +2 -0
- package/bin/{chunk-vy24ncn2.js → chunk-m6sssvg3.js} +1 -1
- package/bin/chunk-mggfc9ya.js +2 -0
- package/bin/chunk-mhwp74hh.js +3 -0
- package/bin/{chunk-vgb8bzcg.js → chunk-mm810jv7.js} +2 -2
- package/bin/chunk-p1bcbtmg.js +3 -0
- package/bin/chunk-p86w1eaw.js +45 -0
- package/bin/{chunk-1nh6xgek.js → chunk-p8enen2a.js} +1 -1
- package/bin/chunk-pbb1tdwt.js +1 -0
- package/bin/chunk-pbfkw90e.js +1 -0
- package/bin/chunk-pdajhyqm.js +2 -0
- package/bin/{chunk-ph3e1bpp.js → chunk-pqxh0cg7.js} +2 -2
- package/bin/chunk-q8me9zev.js +1 -0
- package/bin/chunk-qshm5vcn.js +2 -0
- package/bin/chunk-qx2mzv89.js +2 -0
- package/bin/{chunk-amsb41z5.js → chunk-r5jmnsqj.js} +1 -1
- package/bin/{chunk-arpna31w.js → chunk-rt0pvhdf.js} +1 -1
- package/bin/{chunk-kgb16ggd.css → chunk-s10v4b01.css} +1 -1
- package/bin/{chunk-rrxjvewm.js → chunk-s1b5kf34.js} +2 -2
- package/bin/{chunk-ws07a9kv.js → chunk-t15a1vp6.js} +1 -1
- package/bin/{chunk-3rcc5s99.js → chunk-tc7q988r.js} +2 -2
- package/bin/chunk-ts9f4zqh.js +5 -0
- package/bin/chunk-tzmzqmcg.js +7 -0
- package/bin/chunk-v0xbr5e6.js +2 -0
- package/bin/{chunk-08mxv0sm.js → chunk-v0yhkcj5.js} +2 -2
- package/bin/{chunk-3t7mjvdv.js → chunk-v75fanse.js} +2 -2
- package/bin/chunk-va6hxm7n.js +3 -0
- package/bin/chunk-vf3bg920.js +3 -0
- package/bin/{chunk-ejfmxjw6.js → chunk-vg6mkdj1.js} +2 -2
- package/bin/{chunk-j0p1peav.js → chunk-wkth5xwr.js} +2 -2
- package/bin/chunk-wpntb95k.js +2 -0
- package/bin/{chunk-mahxw48e.js → chunk-wtzkfwmx.js} +2 -2
- package/bin/{chunk-hfp4hpca.js → chunk-x0r8dcq0.js} +2 -2
- package/bin/{chunk-etces6ff.js → chunk-xcbb21j9.js} +2 -2
- package/bin/{chunk-mcxsk75h.js → chunk-xgb533n0.js} +3 -3
- package/bin/{chunk-7jjc175m.js → chunk-xn9cpax1.js} +3 -3
- package/bin/{chunk-5vqan9c4.js → chunk-xsw3pb5p.js} +2 -2
- package/bin/chunk-yedr4r8a.js +2 -0
- package/bin/chunk-yfjn4qn2.js +1 -0
- package/bin/chunk-yfkcv10v.js +2 -0
- package/bin/{chunk-20y3wte3.js → chunk-yj6tmjsc.js} +2 -2
- package/bin/chunk-z9560a6e.js +1 -0
- package/bin/chunk-zgsy3k3h.js +3 -0
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +375 -338
- package/package.json +7 -7
- package/prisma/migrations/20260801065040_add_audit_log/migration.sql +33 -0
- package/prisma/migrations/20260805021613_add_asset_autofill_context/migration.sql +2 -0
- package/prisma/schema.prisma +25 -0
- package/bin/chunk-08dr94gp.js +0 -2
- package/bin/chunk-0t4z17qr.js +0 -2
- package/bin/chunk-2ynx0den.js +0 -8
- package/bin/chunk-31a3k77j.js +0 -2
- package/bin/chunk-3jdef7n4.js +0 -6
- package/bin/chunk-4ahve1nf.js +0 -2
- package/bin/chunk-4hdnrwh1.js +0 -1
- package/bin/chunk-4hdx2tv0.js +0 -2
- package/bin/chunk-4htdb0xp.js +0 -1
- package/bin/chunk-4p7xpfey.js +0 -2
- package/bin/chunk-5f81c951.js +0 -1
- package/bin/chunk-5zntjzxw.js +0 -3
- package/bin/chunk-6a2eb3b5.js +0 -3
- package/bin/chunk-6t3gdd7e.js +0 -2
- package/bin/chunk-7d5kep8c.js +0 -2
- package/bin/chunk-7kzqkp5z.js +0 -1
- package/bin/chunk-7sh6409h.js +0 -1
- package/bin/chunk-7y8dng8t.js +0 -2
- package/bin/chunk-8m6zg15c.js +0 -4
- package/bin/chunk-8qyke29r.js +0 -7
- package/bin/chunk-90et6bwm.js +0 -3
- package/bin/chunk-9c7fxjej.js +0 -2
- package/bin/chunk-a10tf0d8.js +0 -3
- package/bin/chunk-b10meywb.js +0 -2
- package/bin/chunk-b1e3tec3.js +0 -62
- package/bin/chunk-bdjhb77e.js +0 -2
- package/bin/chunk-beay9amy.js +0 -1
- package/bin/chunk-c3fvs0bv.js +0 -4
- package/bin/chunk-c5my1b3k.js +0 -7
- package/bin/chunk-d3s00sn0.js +0 -2
- package/bin/chunk-dhekxndw.js +0 -3
- package/bin/chunk-dwaj1yn4.js +0 -2
- package/bin/chunk-er1rb6yj.js +0 -1
- package/bin/chunk-etqpzc9e.js +0 -3
- package/bin/chunk-fdpjw17x.js +0 -7
- package/bin/chunk-gqh4ttjh.js +0 -3
- package/bin/chunk-hz31j0hk.js +0 -4
- package/bin/chunk-jm6bxtzt.js +0 -41
- package/bin/chunk-jstc7pka.js +0 -2
- package/bin/chunk-k0a35mg9.js +0 -2
- package/bin/chunk-k9w6mk9d.js +0 -3
- package/bin/chunk-m4py21f3.js +0 -2
- package/bin/chunk-mm1j72a8.js +0 -7
- package/bin/chunk-nr89225z.js +0 -2
- package/bin/chunk-nrf5r23d.js +0 -1
- package/bin/chunk-nt9tfjx6.js +0 -12
- package/bin/chunk-p396vw9h.js +0 -8
- package/bin/chunk-p9xfyqh1.js +0 -2
- package/bin/chunk-pj0fgb2x.js +0 -6
- package/bin/chunk-pp072ksj.js +0 -2
- package/bin/chunk-q5cdjzbv.js +0 -3
- package/bin/chunk-qn96vbke.js +0 -2
- package/bin/chunk-qvgc9e08.js +0 -3
- package/bin/chunk-s5rfya1p.js +0 -1
- package/bin/chunk-scsy69bp.js +0 -1
- package/bin/chunk-sf6fwvrs.js +0 -8
- package/bin/chunk-t2txvzkp.js +0 -3
- package/bin/chunk-td54rdfj.js +0 -8
- package/bin/chunk-vb9m47z9.js +0 -1
- package/bin/chunk-vf066xwh.js +0 -3
- package/bin/chunk-w3a50kz8.js +0 -3
- package/bin/chunk-w9w5301f.js +0 -4
- package/bin/chunk-wny0qagx.js +0 -3
- package/bin/chunk-wqhk76de.js +0 -14
- package/bin/chunk-wrz9e73c.js +0 -2
- package/bin/chunk-x5dcgk62.js +0 -6
- package/bin/chunk-xwmsxg5x.js +0 -1
- package/bin/chunk-y2nw8rbx.js +0 -4
- package/bin/chunk-y9ttm07y.js +0 -3
- package/bin/chunk-z0ej44ak.js +0 -3
- package/bin/chunk-zemgtnk0.js +0 -1
- package/bin/chunk-zg0vm233.js +0 -2
- package/bin/chunk-zhd2mkbr.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{s as
|
|
2
|
+
import{kd as a}from"./chunk-7x7jtkh8.js";var l=/"/g,n=/[\\'"]/g;class r extends a{visitOrAction(t){this.append("or "),this.append(t.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(t){return t.replace(l,'""')}sanitizeJSONPathMemberValue(t){return t.replace(n,(e)=>e==="\\"?"\\\\":e==="'"?"''":"\\\"")}visitDefaultInsertValue(t){this.append("null")}}class s{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}class p extends s{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(t,e){}async releaseMigrationLock(t,e){}}
|
|
3
|
+
export{s as yc,r as zc,p as Ac};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as q0}from"./chunk-fwqpq2sy.js";import{P as J0}from"./chunk-9g6vy76b.js";import{Q as K0,R as W0,S as Y0}from"./chunk-wpntb95k.js";import{Ja as H,Ka as S,La as C,Ma as w,Na as Y,Oa as Z}from"./chunk-7pjes19z.js";import{_a as k0}from"./chunk-1cjgpspz.js";import{uf as s}from"./chunk-ey7vty63.js";import{Vf as a}from"./chunk-9sdhdhv4.js";import{$f as i,Xf as T,Yf as I,Zf as o,_f as c}from"./chunk-vg6mkdj1.js";import{cg as q}from"./chunk-57kgmgfs.js";import"./chunk-9a7a1p1j.js";import{Ag as f,Bg as z,Bj as p,Cj as h0,Eg as E0,Fg as B,Gi as y0,Ig as m,Ji as M0,Sg as N0,_i as Q0,ch as y,cj as $0,fh as D0,mh as _0,nh as Q,rj as V0,tj as D,uh as f0,ui as x,vj as b,wj as A,xj as g,yg as t,yj as u}from"./chunk-eczsk2xd.js";import{Fk as l}from"./chunk-t15a1vp6.js";var L0=l(t(),1);var G0=l(t(),1);var j=l(t(),1);var O0=$0("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});var X0=j.createContext({size:"default",variant:"default",spacing:0});function p0({className:K,variant:J,size:X,spacing:W=0,children:E,...$}){return f(V0.Root,{"data-slot":"toggle-group","data-variant":J,"data-size":X,"data-spacing":W,style:{"--gap":W},className:D("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",K),...$,children:f(X0.Provider,{value:{variant:J,size:X,spacing:W},children:E})})}function F({className:K,children:J,variant:X,size:W,...E}){let $=j.useContext(X0);return f(V0.Item,{"data-slot":"toggle-group-item","data-variant":$.variant||X,"data-size":$.size||W,"data-spacing":$.spacing,className:D(O0({variant:$.variant||X,size:$.size||W}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",K),...E,children:J})}function R0({teamId:K}){let[J,X]=G0.useState("team"),[W,E]=G0.useState("1h"),{data:$,isLoading:M}=B({queryKey:["teams",K,"ai-usage",W,"team"],queryFn:async()=>{let G=await y.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:K},query:{timeframe:W}});if(!G.ok)throw Error("Failed to fetch team AI usage");return await G.json()},enabled:!!K&&J==="team"}),{data:n,isLoading:L}=B({queryKey:["teams",K,"members"],queryFn:async()=>{let G=await y.api.teams[":teamId"].members.$get({param:{teamId:K},query:{}});if(!G.ok)throw Error("Failed to fetch team members");return await G.json()},enabled:!!K&&J==="members"}),U=E0({queries:(n||[]).map((G)=>({queryKey:["teams",K,"ai-usage",W,G.id],queryFn:async()=>{let R=await y.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:K},query:{timeframe:W,userId:G.id}});if(!R.ok)throw Error(`Failed to fetch AI usage for member ${G.id}`);return await R.json()},enabled:!!K&&J==="members"}))}),k=L||U.some((G)=>G.isLoading),v=(G)=>{if(!G)return"U";let R=G.split(" ");if(R.length>1)return`${R[0][0]}${R[R.length-1][0]}`.toUpperCase();return G.substring(0,2).toUpperCase()},d=(G)=>{if(!G)return"";switch(G.toLowerCase()){case"owner":return p.owner();case"editor":return p.editor();case"reviewer":return p.reviewer();default:return G}},_=(G)=>(G??0).toLocaleString(),P=(G)=>`$${(G??0).toFixed(6)}`;return z(T,{className:"border-border/60 shadow-sm",children:[z(I,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[z("div",{children:[f(o,{className:"text-xl font-semibold tracking-tight",children:p.ai_usage()}),f(c,{className:"text-sm text-muted-foreground mt-1",children:p.ai_usage_description()})]}),z("div",{className:"flex flex-wrap items-center gap-3",children:[z(p0,{type:"single",value:J,onValueChange:(G)=>{if(G)X(G)},className:"border rounded-lg p-1 bg-muted/30",children:[f(F,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:p.team_view()}),f(F,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:p.members_view()})]}),z(p0,{type:"single",value:W,onValueChange:(G)=>{if(G)E(G)},className:"border rounded-lg p-1 bg-muted/30",children:[f(F,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),f(F,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),f(F,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),f(F,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),f(i,{children:J==="team"?M?f("div",{className:"flex h-48 items-center justify-center",children:f(Q,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):f("div",{className:"rounded-md border",children:z(H,{children:[f(S,{children:z(w,{children:[f(Y,{children:p.team()}),f(Y,{className:"text-right",children:p.input_tokens()}),f(Y,{className:"text-right",children:p.output_tokens()}),f(Y,{className:"text-right",children:p.cache_read_tokens()}),f(Y,{className:"text-right",children:p.total_tokens()}),f(Y,{className:"text-right",children:p.cost()})]})}),f(C,{children:z(w,{children:[f(Z,{className:"font-medium",children:p.team()}),f(Z,{className:"text-right",children:_($?.team?.inputTokens)}),f(Z,{className:"text-right",children:_($?.team?.outputTokens)}),f(Z,{className:"text-right",children:_($?.team?.cacheReadTokens)}),f(Z,{className:"text-right font-medium",children:_($?.team?.totalTokens)}),f(Z,{className:"text-right font-medium",children:P($?.team?.cost)})]})})]})}):k?f("div",{className:"flex h-48 items-center justify-center",children:f(Q,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):f("div",{className:"rounded-md border",children:z(H,{children:[f(S,{children:z(w,{children:[f(Y,{children:p.members()}),f(Y,{children:p.role()}),f(Y,{className:"text-right",children:p.input_tokens()}),f(Y,{className:"text-right",children:p.output_tokens()}),f(Y,{className:"text-right",children:p.cache_read_tokens()}),f(Y,{className:"text-right",children:p.total_tokens()}),f(Y,{className:"text-right",children:p.cost()})]})}),f(C,{children:(n||[]).map((G,R)=>{let N=U[R]?.data?.member;return z(w,{children:[f(Z,{children:z("div",{className:"flex items-center gap-3",children:[z(A,{className:"h-8 w-8 rounded-full",children:[G.image&&f(g,{src:G.image,alt:G.name,className:"object-cover"}),f(u,{className:"bg-primary/20 text-xs",children:v(G.name)})]}),z("div",{className:"flex flex-col",children:[f("span",{className:"text-sm font-medium leading-none",children:G.name}),f("span",{className:"text-xs text-muted-foreground mt-0.5",children:G.email})]})]})}),f(Z,{className:"text-xs text-muted-foreground",children:d(G.role)}),f(Z,{className:"text-right",children:_(N?.inputTokens)}),f(Z,{className:"text-right",children:_(N?.outputTokens)}),f(Z,{className:"text-right",children:_(N?.cacheReadTokens)}),f(Z,{className:"text-right font-medium",children:_(N?.totalTokens)}),f(Z,{className:"text-right font-medium",children:P(N?.cost)})]},G.id)})})]})})})]})}var e=l(t(),1);function w0({teamId:K}){let[J,X]=e.useState(null),{ref:W,inView:E}=s(),{data:$,isLoading:M,isError:n,fetchNextPage:L,hasNextPage:U,isFetchingNextPage:k}=m({queryKey:["teams",K,"agent-sessions"],queryFn:async({pageParam:_})=>{let P=await y.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:K},query:{first:"20",after:_?String(_):void 0}});if(!P.ok)throw Error("Failed to fetch agent sessions");return await P.json()},initialPageParam:"",getNextPageParam:(_)=>_.pageInfo.cursor||void 0,enabled:!!K});e.useEffect(()=>{if(E&&U&&!k)L()},[E,U,k,L]);let v=$?.pages.flatMap((_)=>_.data).filter((_)=>_.id!=="pending")||[],d=(_)=>{switch(_){case"comment":return f(q,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:p.session_type_comment()});case"chat":return f(q,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:p.session_type_chat()});case"naming":return f(q,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:p.session_type_naming()});default:return f(q,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:_})}};return z("div",{className:"space-y-6",children:[z(T,{className:"border border-border/50 shadow-xs",children:[f(I,{className:"pb-4",children:f("div",{className:"flex items-center justify-between",children:z("div",{children:[z(o,{className:"text-xl font-bold flex items-center gap-2",children:[f(x,{className:"w-5 h-5 text-violet-500"}),p.sessions()]}),f(c,{className:"mt-1 text-sm text-muted-foreground",children:p.sessions_description()})]})})}),f(i,{children:M?f("div",{className:"flex h-64 items-center justify-center",children:f(Q,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?f("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):v.length===0?z("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[f(x,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),f("p",{className:"text-base font-medium",children:p.no_sessions_found()})]}):z("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[z(H,{children:[f(S,{className:"bg-muted/40",children:z(w,{children:[f(Y,{children:p.session_name()}),f(Y,{children:p.creator()}),f(Y,{children:p.session_type()}),f(Y,{className:"text-right",children:p.create_time()})]})}),f(C,{children:v.map((_)=>z(w,{onClick:()=>X(_.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[f(Z,{className:"font-medium",children:z("div",{className:"flex flex-col",children:[f("span",{className:"text-sm font-semibold text-foreground",children:_.name||p.untitled_session()}),f("span",{className:"text-xs font-mono text-muted-foreground/70",children:_.id})]})}),f(Z,{children:z("div",{className:"flex items-center gap-2",children:[z(A,{className:"h-6 w-6",children:[f(g,{src:_.creator?.image||void 0}),f(u,{className:"text-[10px]",children:_.creator?.name?.[0]?.toUpperCase()||"?"})]}),f("span",{className:"text-sm text-foreground/90",children:_.creator?.name||"System / Agent"})]})}),f(Z,{children:d(_.type)}),f(Z,{className:"text-right text-xs text-muted-foreground",children:a(_.createdAt)})]},_.id))})]}),f("div",{ref:W,className:"py-4 flex justify-center",children:k&&f(Q,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),f(q0,{sessionId:J,open:!!J,onOpenChange:(_)=>{if(!_)X(null)}})]})}var r=l(t(),1);var H0=Object.values(k0);function P0({teamId:K}){let[J,X]=r.useState([]),[W,E]=r.useState([]),[$,M]=r.useState(""),{ref:n,inView:L}=s(),{data:U}=B({queryKey:["teams",K,"members"],queryFn:async()=>{let V=await y.api.teams[":teamId"].members.$get({param:{teamId:K},query:{}});if(!V.ok)return[];return await V.json()},enabled:!!K}),k=U||[],{data:v,isLoading:d,isError:_,fetchNextPage:P,hasNextPage:G,isFetchingNextPage:R}=m({queryKey:["teams",K,"audit-logs",J,W,$],queryFn:async({pageParam:V})=>{let O=await y.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:K},query:{first:"20",after:V?String(V):void 0,actions:J.length>0?J:void 0,userIds:W.length>0?W:void 0,itemId:$.trim()||void 0}});if(!O.ok)throw Error("Failed to fetch audit logs");return await O.json()},initialPageParam:"",getNextPageParam:(V)=>V.pageInfo.endCursor||void 0,enabled:!!K});r.useEffect(()=>{if(L&&G&&!R)P()},[L,G,R,P]);let N=v?.pages.flatMap((V)=>V.nodes)||[],Z0=v?.pages[0]?.total??0,U0=(V)=>{X((O)=>O.includes(V)?O.filter((h)=>h!==V):[...O,V])},v0=(V)=>{E((O)=>O.includes(V)?O.filter((h)=>h!==V):[...O,V])},F0=(V)=>{if(V.includes("delete")||V.includes("remove")||V.includes("revoke"))return f(q,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:V});if(V.includes("create")||V.includes("add"))return f(q,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:V});if(V.includes("update")||V.includes("reparent")||V.includes("copy"))return f(q,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:V});return f(q,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:V})},B0=new Map(k.map((V)=>[V.userId||V.id,V]));return f("div",{className:"space-y-6",children:z(T,{className:"border border-border/50 shadow-xs",children:[z(I,{className:"pb-4",children:[z("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[z("div",{children:[z(o,{className:"text-xl font-bold flex items-center gap-2",children:[f(f0,{className:"h-5 w-5 text-primary"}),p.audit_logs()]}),f(c,{className:"mt-1",children:p.audit_logs_description()})]}),Z0>0&&z(q,{variant:"secondary",className:"w-fit text-xs font-normal",children:[Z0," ",p.audit_logs()]})]}),z("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[z(K0,{children:[f(W0,{asChild:!0,children:z(b,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[f(_0,{className:"h-3.5 w-3.5"}),p.filter_by_action(),J.length>0&&f(q,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:J.length})]})}),z(Y0,{className:"w-64 p-2",align:"start",children:[f("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:p.select_actions()}),f("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:H0.map((V)=>z("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[f(J0,{checked:J.includes(V),onCheckedChange:()=>U0(V)}),f("span",{className:"font-mono",children:V})]},V))}),J.length>0&&f(b,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>X([]),children:"Clear Actions"})]})]}),z(K0,{children:[f(W0,{asChild:!0,children:z(b,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[f(_0,{className:"h-3.5 w-3.5"}),p.filter_by_user(),W.length>0&&f(q,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:W.length})]})}),z(Y0,{className:"w-64 p-2",align:"start",children:[f("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:p.select_users()}),f("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:k.map((V)=>{let O=V.userId||V.user?.id||V.id,h=V.user?.name||V.name||O,z0=V.user?.image||V.image;return z("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[f(J0,{checked:W.includes(O),onCheckedChange:()=>v0(O)}),z(A,{className:"h-5 w-5",children:[f(g,{src:z0||void 0}),f(u,{className:"text-[10px]",children:h.slice(0,2).toUpperCase()})]}),f("span",{className:"truncate",children:h})]},O)})}),W.length>0&&f(b,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>E([]),children:"Clear Users"})]})]}),z("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[f(y0,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),f(h0,{type:"text",placeholder:p.search_item_id(),value:$,onChange:(V)=>M(V.target.value),className:"pl-8 pr-8 h-9 text-xs"}),$&&f("button",{onClick:()=>M(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:f(Q0,{className:"h-4 w-4"})})]}),(J.length>0||W.length>0||$)&&f(b,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{X([]),E([]),M("")},children:"Clear all"})]})]}),z(i,{className:"p-0",children:[d?f("div",{className:"flex h-64 items-center justify-center",children:f(Q,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):_?f("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):N.length===0?f("div",{className:"p-12 text-center text-sm text-muted-foreground",children:p.no_audit_logs()}):z(H,{children:[f(S,{children:z(w,{className:"hover:bg-transparent border-b border-border/50",children:[f(Y,{className:"w-[180px] text-xs font-semibold",children:p.action()}),f(Y,{className:"w-[200px] text-xs font-semibold",children:p.user()}),f(Y,{className:"text-xs font-semibold",children:p.item_id()}),f(Y,{className:"text-xs font-semibold",children:p.project_id()}),f(Y,{className:"w-[160px] text-right text-xs font-semibold",children:p.timestamp()})]})}),f(C,{children:N.map((V)=>{let O=V.userId?B0.get(V.userId):null,h=O?.user?.name||O?.name||V.userId||"System",z0=O?.user?.image||O?.image;return z(w,{className:"hover:bg-muted/40 transition-colors",children:[f(Z,{className:"py-3 font-medium",children:F0(V.action)}),f(Z,{className:"py-3",children:z("div",{className:"flex items-center gap-2",children:[z(A,{className:"h-6 w-6",children:[f(g,{src:z0||void 0}),f(u,{className:"text-[10px]",children:h.slice(0,2).toUpperCase()})]}),f("span",{className:"text-xs font-medium text-foreground truncate max-w-[140px]",children:h})]})}),f(Z,{className:"py-3 text-xs font-mono text-muted-foreground",children:V.itemId||"-"}),f(Z,{className:"py-3 text-xs font-mono text-muted-foreground",children:V.projectId||"-"}),f(Z,{className:"py-3 text-right text-xs text-muted-foreground",children:a(V.createdAt)})]},V.id)})})]}),f("div",{ref:n,className:"py-4 flex justify-center",children:R&&f(Q,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function S0(){let{teamId:K}=C0.useParams(),[J,X]=L0.useState("audit-logs"),{data:W,isLoading:E}=B({queryKey:["teams",K,"me"],queryFn:async()=>{let $=await y.api.teams[":teamId"].me.$get({param:{teamId:K}});if(!$.ok)throw Error("Failed to fetch me");return await $.json()},enabled:!!K});if(E)return f("div",{className:"flex h-screen items-center justify-center",children:f(Q,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(W?.role?.toLowerCase()!=="owner")return z("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[f(M0,{className:"h-12 w-12 text-destructive mb-4"}),f("h2",{className:"text-xl font-bold tracking-tight mb-2",children:p.access_denied()}),f("p",{className:"text-sm text-muted-foreground max-w-md",children:p.only_owner_dashboard()})]});return f("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:z("div",{className:"flex flex-col md:flex-row h-full",children:[f("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:z("nav",{className:"p-4 space-y-1 mt-4",children:[f("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:p.dashboard()}),f("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:p.team_category()}),z("button",{onClick:()=>X("audit-logs"),className:D("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",J==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[f(f0,{className:"w-5 h-5"}),p.audit_logs(),J==="audit-logs"&&f("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),f("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:p.ai()}),z("button",{onClick:()=>X("ai-usage"),className:D("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",J==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[f(D0,{className:"w-5 h-5"}),p.usage(),J==="ai-usage"&&f("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),z("button",{onClick:()=>X("ai-sessions"),className:D("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",J==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[f(x,{className:"w-5 h-5"}),p.sessions(),J==="ai-sessions"&&f("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),f("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:z("div",{className:"max-w-6xl mx-auto space-y-8",children:[J==="audit-logs"&&f(P0,{teamId:K}),J==="ai-usage"&&f(R0,{teamId:K}),J==="ai-sessions"&&f(w0,{teamId:K})]})})]})})}var C0=N0("/teams/$teamId/dashboard")({component:S0});export{C0 as Route};
|