@shumai-one/shumai 0.3.6 → 0.3.7
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-gg1gwjtn.js → chunk-0jkqmbcx.js} +1 -1
- package/bin/{chunk-t5561vz5.js → chunk-0t8q76ac.js} +1 -1
- package/bin/chunk-0xern7e4.js +1 -0
- package/bin/{chunk-9p5n3m2z.js → chunk-0ycwr0kb.js} +1 -1
- package/bin/{chunk-55myfmhy.js → chunk-0yngn45x.js} +2 -2
- package/bin/{chunk-jtd7rydv.js → chunk-1khzycf9.js} +1 -1
- package/bin/{chunk-fwbrcfaq.js → chunk-1sqz0va1.js} +2 -2
- package/bin/{chunk-w4ycztv5.js → chunk-1xzc6z02.js} +1 -1
- package/bin/{chunk-y1t47c7f.js → chunk-2086rsb2.js} +1 -1
- package/bin/{chunk-5wrakb8p.js → chunk-260wywfb.js} +1 -1
- package/bin/{chunk-6edadcpn.js → chunk-2mqqghrz.js} +2 -2
- package/bin/{chunk-ghz19a7t.js → chunk-2xmsrq7f.js} +2 -2
- package/bin/{chunk-nh8azwsx.js → chunk-38g3s1f3.js} +2 -2
- package/bin/{chunk-0jesq6sm.js → chunk-3dx0p1ge.js} +1 -1
- package/bin/{chunk-ce50f746.js → chunk-3kqdgddm.js} +2 -2
- package/bin/{chunk-z0tbq08w.js → chunk-3xzgddev.js} +1 -1
- package/bin/{chunk-1b7shyfp.js → chunk-48nzw50r.js} +1 -1
- package/bin/{chunk-w16jgdfx.js → chunk-4bn9eb9h.js} +1 -1
- package/bin/chunk-4egayx81.js +2 -0
- package/bin/{chunk-ef5v7gta.js → chunk-4rbzswqs.js} +2 -2
- package/bin/{chunk-crdvxq38.js → chunk-503qq6sa.js} +2 -2
- package/bin/{chunk-d8bpqbdw.js → chunk-50keqtz9.js} +1 -1
- package/bin/{chunk-mmrtjcst.js → chunk-5gtew41y.js} +1 -1
- package/bin/chunk-60hpa5kf.js +3 -0
- package/bin/{chunk-4a9sdfyp.js → chunk-69tt1pvr.js} +2 -2
- package/bin/{chunk-rmm6y799.js → chunk-6fv38qdc.js} +2 -2
- package/bin/{chunk-vgr9db5g.js → chunk-6v39c8eg.js} +2 -2
- package/bin/{chunk-kaxwma6y.js → chunk-6zs49mef.js} +1 -1
- package/bin/{chunk-y8vw7zv1.js → chunk-7872prvg.js} +1 -1
- package/bin/{chunk-kk0gx8eg.js → chunk-7hnw6y6d.js} +2 -2
- package/bin/{chunk-47093mwk.js → chunk-7k3ccca6.js} +1 -1
- package/bin/chunk-815ezj20.js +1 -0
- package/bin/{chunk-ew4cxkcc.js → chunk-81tb4v5v.js} +2 -2
- package/bin/{chunk-ym47952x.js → chunk-83k0wa5k.js} +2 -2
- package/bin/{chunk-8js9m1j7.js → chunk-85eg9xqx.js} +1 -1
- package/bin/{chunk-vqgz25av.js → chunk-86aagej8.js} +1 -1
- package/bin/{chunk-f44d9fpd.js → chunk-87wqbn4g.js} +2 -2
- package/bin/chunk-8y1v9dm9.js +2 -0
- package/bin/{chunk-20wtz3kc.js → chunk-98j2z6he.js} +3 -3
- package/bin/chunk-9gq9782d.js +1 -0
- package/bin/{chunk-y0yrmcf3.js → chunk-9gzy30zm.js} +2 -2
- package/bin/{chunk-0sajh8fw.js → chunk-9nyhmtp9.js} +2 -2
- package/bin/{chunk-7b60a9sy.js → chunk-9s02m95j.js} +2 -2
- package/bin/{chunk-c9bpf8gp.js → chunk-9xhnmnnb.js} +2 -2
- package/bin/{chunk-hcvpb1hw.js → chunk-a0k1b4sq.js} +1 -1
- package/bin/{chunk-7fm1hznx.js → chunk-af6wbhkv.js} +2 -2
- package/bin/{chunk-sx7kparv.js → chunk-b3jh3hf1.js} +2 -2
- package/bin/{chunk-74zstxav.js → chunk-b8v7jvkb.js} +2 -2
- package/bin/{chunk-9tnfhrnh.js → chunk-bancgvrc.js} +2 -2
- package/bin/{chunk-a5fw02xq.js → chunk-br5xkaf7.js} +3 -3
- package/bin/chunk-bv88se28.css +1 -0
- package/bin/{chunk-nh31ma8d.js → chunk-cqq8e3hc.js} +2 -2
- package/bin/{chunk-mgbqjbfc.js → chunk-dej1gq35.js} +1 -1
- package/bin/{chunk-mhj0pqq3.js → chunk-dv1zpd2p.js} +2 -2
- package/bin/{chunk-0jr6q4j4.js → chunk-eetrc0j1.js} +2 -2
- package/bin/{chunk-6awkqp09.js → chunk-esrtafz0.js} +1 -1
- package/bin/chunk-eztggp8r.js +1 -0
- package/bin/{chunk-n198tewr.js → chunk-f2j2cqd1.js} +2 -2
- package/bin/{chunk-1f8rr3ef.js → chunk-fcs4v6jq.js} +2 -2
- package/bin/{chunk-dfzmqx1v.js → chunk-ftc48rbb.js} +3 -3
- package/bin/{chunk-pm64et9d.js → chunk-g60v3jc1.js} +1 -1
- package/bin/chunk-gf5ds9r9.js +2 -0
- package/bin/{chunk-f2eh802w.js → chunk-gjdmnfms.js} +1 -1
- package/bin/{chunk-gra3617w.js → chunk-gjn3w26y.js} +2 -2
- package/bin/{chunk-8jdgzy22.js → chunk-h9emz0zb.js} +2 -2
- package/bin/{chunk-3egeywt8.js → chunk-h9k2atte.js} +1 -1
- package/bin/{chunk-fzaw1e34.js → chunk-hqkmdp31.js} +2 -2
- package/bin/{chunk-9annjnj2.js → chunk-jszpvg8e.js} +2 -2
- package/bin/{chunk-snexx7ks.js → chunk-k48y9e5s.js} +1 -1
- package/bin/{chunk-d2qp8g98.js → chunk-karn564z.js} +2 -2
- package/bin/{chunk-fdm1yc29.js → chunk-kkq4wvnc.js} +1 -1
- package/bin/{chunk-aeg4kya9.js → chunk-kpn9d97x.js} +1 -1
- package/bin/chunk-ksx113sp.js +1 -0
- package/bin/chunk-m6a4rzdt.js +62 -0
- package/bin/chunk-mw8f8ngt.js +7 -0
- package/bin/{chunk-w98wvk17.js → chunk-n4gghgrj.js} +2 -2
- package/bin/{chunk-hqbzjzsm.js → chunk-n76r6s9k.js} +2 -2
- package/bin/{chunk-g70eyttc.js → chunk-nvjp2rnh.js} +2 -2
- package/bin/{chunk-29nhtrfv.js → chunk-p4c4z0f2.js} +1 -1
- package/bin/{chunk-ex4qa7gv.js → chunk-ptw49k86.js} +1 -1
- package/bin/{chunk-tqxmj05h.js → chunk-qcqw7wnv.js} +2 -2
- package/bin/{chunk-z0zevgb6.js → chunk-qdycy714.js} +1 -1
- package/bin/{chunk-gewh7p42.js → chunk-qh9rz2ee.js} +2 -2
- package/bin/{chunk-mxee09jk.js → chunk-qmpph1gt.js} +2 -2
- package/bin/{chunk-dmjzrdan.js → chunk-qy93r7tm.js} +2 -2
- package/bin/{chunk-j1awxx51.js → chunk-r5dv0rfv.js} +2 -2
- package/bin/{chunk-gct52xks.js → chunk-rfyaphas.js} +2 -2
- package/bin/chunk-rvspnthy.js +1 -0
- package/bin/{chunk-9hsfjqgq.js → chunk-s0hgykza.js} +2 -2
- package/bin/chunk-sjjndwt4.js +2 -0
- package/bin/{chunk-8g0mhzsg.js → chunk-t3tp9trj.js} +2 -2
- package/bin/{chunk-1fq10abj.js → chunk-t9t9evan.js} +2 -2
- package/bin/{chunk-vw1rhgjs.js → chunk-tpp9qf5m.js} +2 -2
- package/bin/chunk-tvg9gvqs.js +1 -0
- package/bin/{chunk-yzra1x8f.js → chunk-tzt4c1dm.js} +2 -2
- package/bin/{chunk-js0genbf.js → chunk-v8w2nxew.js} +1 -1
- package/bin/{chunk-z2ef8zpz.js → chunk-v98e3gex.js} +1 -1
- package/bin/{chunk-89kqtj7x.js → chunk-vxpnp4xg.js} +2 -2
- package/bin/{chunk-4ajat3xv.js → chunk-x3ynjbt5.js} +14 -14
- package/bin/{chunk-800vdz5n.js → chunk-x6532q76.js} +1 -1
- package/bin/chunk-xp4dcyk3.js +1 -0
- package/bin/chunk-y8aehqr8.js +2 -0
- package/bin/{chunk-n9cjmkky.js → chunk-ytzk81tr.js} +1 -1
- package/bin/chunk-yvxt48r4.js +1 -0
- package/bin/{chunk-q7xfrtnj.js → chunk-zg60j9x2.js} +1 -1
- package/bin/{chunk-bq2aq6v8.js → chunk-zjj9qj6y.js} +2 -2
- package/bin/{chunk-gx5rjm9m.js → chunk-zqg4f56h.js} +1 -1
- package/bin/{chunk-thj4cpev.js → chunk-zwgf211t.js} +2 -2
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +240 -245
- package/package.json +7 -7
- package/prisma/migrations/20260813022501_backfill_autofill_source_in_config/migration.sql +8 -0
- package/prisma/migrations/20260813022502_drop_legacy_autofill_columns/migration.sql +12 -0
- package/prisma/migrations/20260813122613_add_network_sandbox_enabled_column/migration.sql +2 -0
- package/prisma/migrations/20260813122618_migrate_legacy_sandboxes_enabled/migration.sql +2 -0
- package/prisma/schema.prisma +8 -9
- package/bin/chunk-1hn9v6hv.js +0 -2
- package/bin/chunk-2882s5sp.js +0 -1
- package/bin/chunk-3htn4m2d.js +0 -7
- package/bin/chunk-6bztpk7h.js +0 -1
- package/bin/chunk-76hs7g0x.js +0 -2
- package/bin/chunk-e5s7202g.js +0 -2
- package/bin/chunk-f5zg7b38.js +0 -1
- package/bin/chunk-gh64hag9.js +0 -2
- package/bin/chunk-h0p8yew4.js +0 -1
- package/bin/chunk-hgngnc1k.js +0 -1
- package/bin/chunk-jt4yh37q.js +0 -62
- package/bin/chunk-k0xpskyq.js +0 -1
- package/bin/chunk-nhc72y4x.js +0 -2
- package/bin/chunk-px6q3jpz.js +0 -1
- package/bin/chunk-sx3by19j.js +0 -1
- package/bin/chunk-vz75bqvx.js +0 -2
- package/bin/chunk-wa8k9fwx.js +0 -1
- package/bin/chunk-z3p3qz9d.js +0 -3
- package/bin/chunk-zv85aqwb.css +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shumai-one/shumai",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "A fullstack AI-powered media workspace and workflow engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"zod": "4.4.3"
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@shumai-one/shumai-darwin-arm64": "0.3.
|
|
31
|
-
"@shumai-one/shumai-darwin-x64": "0.3.
|
|
32
|
-
"@shumai-one/shumai-linux-arm64": "0.3.
|
|
33
|
-
"@shumai-one/shumai-linux-x64": "0.3.
|
|
34
|
-
"@shumai-one/shumai-win32-arm64": "0.3.
|
|
35
|
-
"@shumai-one/shumai-win32-x64": "0.3.
|
|
30
|
+
"@shumai-one/shumai-darwin-arm64": "0.3.7",
|
|
31
|
+
"@shumai-one/shumai-darwin-x64": "0.3.7",
|
|
32
|
+
"@shumai-one/shumai-linux-arm64": "0.3.7",
|
|
33
|
+
"@shumai-one/shumai-linux-x64": "0.3.7",
|
|
34
|
+
"@shumai-one/shumai-win32-arm64": "0.3.7",
|
|
35
|
+
"@shumai-one/shumai-win32-x64": "0.3.7"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- Backfill autofillSource in config JSON where ai_autofill is true
|
|
2
|
+
UPDATE "metadata_fields"
|
|
3
|
+
SET "config" = jsonb_set(COALESCE("config", '{}'::jsonb), '{autofillSource}', '"CONTENT"')
|
|
4
|
+
WHERE "ai_autofill" = true;
|
|
5
|
+
|
|
6
|
+
UPDATE "metadata_fields"
|
|
7
|
+
SET "config" = jsonb_set(COALESCE("config", '{}'::jsonb), '{autofillSource}', '"NONE"')
|
|
8
|
+
WHERE "ai_autofill" = false OR "ai_autofill" IS NULL;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `autofill_context` on the `assets` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `ai_autofill` on the `metadata_fields` table. All the data in the column will be lost.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
-- AlterTable
|
|
9
|
+
ALTER TABLE "assets" DROP COLUMN "autofill_context";
|
|
10
|
+
|
|
11
|
+
-- AlterTable
|
|
12
|
+
ALTER TABLE "metadata_fields" DROP COLUMN "ai_autofill";
|
package/prisma/schema.prisma
CHANGED
|
@@ -263,11 +263,12 @@ model Team {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
model Sandbox {
|
|
266
|
-
id
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
266
|
+
id String @id @default(ulid())
|
|
267
|
+
networkSandboxEnabled Boolean @default(false) @map("network_sandbox_enabled")
|
|
268
|
+
allowedDomains String[] @default(["npmjs.org", "*.npmjs.org", "registry.npmjs.org", "registry.yarnpkg.com", "pypi.org", "*.pypi.org", "github.com", "*.github.com", "api.github.com", "raw.githubusercontent.com"])
|
|
269
|
+
pendingDomains String[] @default([]) @map("pending_domains")
|
|
270
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
271
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
271
272
|
|
|
272
273
|
teamId String @unique @map("team_id")
|
|
273
274
|
team Team @relation("TeamToSandbox", fields: [teamId], references: [id], onDelete: Cascade)
|
|
@@ -450,7 +451,6 @@ model Asset {
|
|
|
450
451
|
transcodeTaskId String? @map("transcode_task_id")
|
|
451
452
|
/// [MediaInfo]
|
|
452
453
|
media Json?
|
|
453
|
-
autofillContext String? @map("autofill_context")
|
|
454
454
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
455
455
|
deletedAt DateTime? @map("deleted_at")
|
|
456
456
|
sortIndex String? @map("sort_index")
|
|
@@ -622,9 +622,8 @@ model MetadataField {
|
|
|
622
622
|
scope MetadataFieldScope?
|
|
623
623
|
/// [FieldConfig]
|
|
624
624
|
config Json?
|
|
625
|
-
readOnly
|
|
626
|
-
|
|
627
|
-
description String @default("")
|
|
625
|
+
readOnly Boolean @default(false) @map("read_only")
|
|
626
|
+
description String @default("")
|
|
628
627
|
|
|
629
628
|
teamId String? @map("team_id")
|
|
630
629
|
team Team? @relation("TeamToMetadataField", fields: [teamId], references: [id])
|
package/bin/chunk-1hn9v6hv.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$b as p,_b as e,ac as t}from"./chunk-a5fw02xq.js";import"./chunk-dfzmqx1v.js";import"./chunk-9tnfhrnh.js";import"./chunk-kk0gx8eg.js";import"./chunk-w16jgdfx.js";import"./chunk-g70eyttc.js";import"./chunk-mgbqjbfc.js";export{t as kyselyAdapter,e as getKyselyDatabaseType,p as createKyselyAdapter};
|
package/bin/chunk-2882s5sp.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as KJ,b as S}from"./chunk-gh64hag9.js";import{c as P,d as A,e as C,f as D,g as z,h as _}from"./chunk-sx7kparv.js";import{v as VJ}from"./chunk-mhj0pqq3.js";import{ca as ZJ}from"./chunk-j1awxx51.js";import{da as $J,ea as OJ,fa as XJ}from"./chunk-ym47952x.js";import{ma as DJ}from"./chunk-nhc72y4x.js";import{If as u,Jf as g,Kf as b,Lf as c,Mf as n}from"./chunk-vgr9db5g.js";import{xg as Q}from"./chunk-7b60a9sy.js";import"./chunk-f44d9fpd.js";import{Dg as t}from"./chunk-n198tewr.js";import{dh as m}from"./chunk-6edadcpn.js";import{$h as M,Ak as p,Bh as _J,Bk as I,Ch as f,Ek as Y,Fh as r,Fk as kJ,Hj as GJ,Lj as wJ,Ph as NJ,bk as QJ,ci as RJ,ji as YJ,ki as N,ri as s,tj as i,vh as o,wk as e,xh as J,yh as K,yk as d,zk as v}from"./chunk-jt4yh37q.js";import{Il as l}from"./chunk-mgbqjbfc.js";var yJ=l(o(),1);var WJ=l(o(),1);function EJ({teamId:O}){let[X,k]=WJ.useState("team"),[V,R]=WJ.useState("1h"),{data:q,isLoading:F}=f({queryKey:["teams",O,"ai-usage",V,"team"],queryFn:async()=>{let Z=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:O},query:{timeframe:V}});if(!Z.ok)throw Error("Failed to fetch team AI usage");return await Z.json()},enabled:!!O&&X==="team"}),{data:T,isLoading:B}=f({queryKey:["teams",O,"members"],queryFn:async()=>{let Z=await M.api.teams[":teamId"].members.$get({param:{teamId:O},query:{}});if(!Z.ok)throw Error("Failed to fetch team members");return await Z.json()},enabled:!!O&&X==="members"}),h=_J({queries:(T||[]).map((Z)=>({queryKey:["teams",O,"ai-usage",V,Z.id],queryFn:async()=>{let G=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:O},query:{timeframe:V,userId:Z.id}});if(!G.ok)throw Error(`Failed to fetch AI usage for member ${Z.id}`);return await G.json()},enabled:!!O&&X==="members"}))}),y=B||h.some((Z)=>Z.isLoading),H=(Z)=>{if(!Z)return"U";let G=Z.split(" ");if(G.length>1)return`${G[0][0]}${G[G.length-1][0]}`.toUpperCase();return Z.substring(0,2).toUpperCase()},x=(Z)=>{if(!Z)return"";switch(Z.toLowerCase()){case"owner":return Y.owner();case"editor":return Y.editor();case"reviewer":return Y.reviewer();default:return Z}},$=(Z)=>(Z??0).toLocaleString(),L=(Z)=>`$${(Z??0).toFixed(6)}`;return K(u,{className:"border-border/60 shadow-sm",children:[K(g,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[K("div",{children:[J(b,{className:"text-xl font-semibold tracking-tight",children:Y.ai_usage()}),J(c,{className:"text-sm text-muted-foreground mt-1",children:Y.ai_usage_description()})]}),K("div",{className:"flex flex-wrap items-center gap-3",children:[K(KJ,{type:"single",value:X,onValueChange:(Z)=>{if(Z)k(Z)},className:"border rounded-lg p-1 bg-muted/30",children:[J(S,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:Y.team_view()}),J(S,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:Y.members_view()})]}),K(KJ,{type:"single",value:V,onValueChange:(Z)=>{if(Z)R(Z)},className:"border rounded-lg p-1 bg-muted/30",children:[J(S,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),J(S,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),J(S,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),J(S,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),J(n,{children:X==="team"?F?J("div",{className:"flex h-48 items-center justify-center",children:J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(P,{children:[J(A,{children:K(D,{children:[J(z,{children:Y.team()}),J(z,{className:"text-right",children:Y.input_tokens()}),J(z,{className:"text-right",children:Y.output_tokens()}),J(z,{className:"text-right",children:Y.cache_read_tokens()}),J(z,{className:"text-right",children:Y.total_tokens()}),J(z,{className:"text-right",children:Y.cost()})]})}),J(C,{children:K(D,{children:[J(_,{className:"font-medium",children:Y.team()}),J(_,{className:"text-right",children:$(q?.team?.inputTokens)}),J(_,{className:"text-right",children:$(q?.team?.outputTokens)}),J(_,{className:"text-right",children:$(q?.team?.cacheReadTokens)}),J(_,{className:"text-right font-medium",children:$(q?.team?.totalTokens)}),J(_,{className:"text-right font-medium",children:L(q?.team?.cost)})]})})]})}):y?J("div",{className:"flex h-48 items-center justify-center",children:J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(P,{children:[J(A,{children:K(D,{children:[J(z,{children:Y.members()}),J(z,{children:Y.role()}),J(z,{className:"text-right",children:Y.input_tokens()}),J(z,{className:"text-right",children:Y.output_tokens()}),J(z,{className:"text-right",children:Y.cache_read_tokens()}),J(z,{className:"text-right",children:Y.total_tokens()}),J(z,{className:"text-right",children:Y.cost()})]})}),J(C,{children:(T||[]).map((Z,G)=>{let U=h[G]?.data?.member;return K(D,{children:[J(_,{children:K("div",{className:"flex items-center gap-3",children:[K(v,{className:"h-8 w-8 rounded-full",children:[Z.image&&J(p,{src:Z.image,alt:Z.name,className:"object-cover"}),J(I,{className:"bg-primary/20 text-xs",children:H(Z.name)})]}),K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-medium leading-none",children:Z.name}),J("span",{className:"text-xs text-muted-foreground mt-0.5",children:Z.email})]})]})}),J(_,{className:"text-xs text-muted-foreground",children:x(Z.role)}),J(_,{className:"text-right",children:$(U?.inputTokens)}),J(_,{className:"text-right",children:$(U?.outputTokens)}),J(_,{className:"text-right",children:$(U?.cacheReadTokens)}),J(_,{className:"text-right font-medium",children:$(U?.totalTokens)}),J(_,{className:"text-right font-medium",children:L(U?.cost)})]},Z.id)})})]})})})]})}var a=l(o(),1);function qJ({teamId:O}){let[X,k]=a.useState(null),{ref:V,inView:R}=t(),{data:q,isLoading:F,isError:T,fetchNextPage:B,hasNextPage:h,isFetchingNextPage:y}=r({queryKey:["teams",O,"agent-sessions"],queryFn:async({pageParam:$})=>{let L=await M.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:O},query:{first:"20",after:$?String($):void 0}});if(!L.ok)throw Error("Failed to fetch agent sessions");return await L.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo.cursor||void 0,enabled:!!O});a.useEffect(()=>{if(R&&h&&!y)B()},[R,h,y,B]);let H=q?.pages.flatMap(($)=>$.data).filter(($)=>$.id!=="pending")||[],x=($)=>{switch($){case"comment":return J(Q,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:Y.session_type_comment()});case"chat":return J(Q,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:Y.session_type_chat()});case"naming":return J(Q,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:Y.session_type_naming()});default:return J(Q,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:$})}};return K("div",{className:"space-y-6",children:[K(u,{className:"border border-border/50 shadow-xs",children:[J(g,{className:"pb-4",children:J("div",{className:"flex items-center justify-between",children:K("div",{children:[K(b,{className:"text-xl font-bold flex items-center gap-2",children:[J(i,{className:"w-5 h-5 text-violet-500"}),Y.sessions()]}),J(c,{className:"mt-1 text-sm text-muted-foreground",children:Y.sessions_description()})]})})}),J(n,{children:F?J("div",{className:"flex h-64 items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):T?J("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):H.length===0?K("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[J(i,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),J("p",{className:"text-base font-medium",children:Y.no_sessions_found()})]}):K("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[K(P,{children:[J(A,{className:"bg-muted/40",children:K(D,{children:[J(z,{children:Y.session_name()}),J(z,{children:Y.creator()}),J(z,{children:Y.session_type()}),J(z,{className:"text-right",children:Y.create_time()})]})}),J(C,{children:H.map(($)=>K(D,{onClick:()=>k($.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[J(_,{className:"font-medium",children:K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-semibold text-foreground",children:$.name||Y.untitled_session()}),J("span",{className:"text-xs font-mono text-muted-foreground/70",children:$.id})]})}),J(_,{children:K("div",{className:"flex items-center gap-2",children:[K(v,{className:"h-6 w-6",children:[J(p,{src:$.creator?.image||void 0}),J(I,{className:"text-[10px]",children:$.creator?.name?.[0]?.toUpperCase()||"?"})]}),J("span",{className:"text-sm text-foreground/90",children:$.creator?.name||"System / Agent"})]})}),J(_,{children:x($.type)}),J(_,{className:"text-right text-xs text-muted-foreground",children:m($.createdAt)})]},$.id))})]}),J("div",{ref:V,className:"py-4 flex justify-center",children:y&&J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),J(VJ,{sessionId:X,open:!!X,onOpenChange:($)=>{if(!$)k(null)}})]})}var j=l(o(),1);var hJ=Object.values(DJ);function MJ({teamId:O}){let[X,k]=j.useState([]),[V,R]=j.useState([]),[q,F]=j.useState(""),{ref:T,inView:B}=t(),{data:h}=f({queryKey:["teams",O,"members"],queryFn:async()=>{let W=await M.api.teams[":teamId"].members.$get({param:{teamId:O},query:{}});if(!W.ok)return[];return await W.json()},enabled:!!O}),y=h||[],{data:H,isLoading:x,isError:$,fetchNextPage:L,hasNextPage:Z,isFetchingNextPage:G}=r({queryKey:["teams",O,"audit-logs",X,V,q],queryFn:async({pageParam:W})=>{let E=await M.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:O},query:{first:"20",after:W?String(W):void 0,actions:X.length>0?X:void 0,userIds:V.length>0?V:void 0,itemId:q.trim()||void 0}});if(!E.ok)throw Error("Failed to fetch audit logs");return await E.json()},initialPageParam:"",getNextPageParam:(W)=>W.pageInfo.endCursor||void 0,enabled:!!O});j.useEffect(()=>{if(B&&Z&&!G)L()},[B,Z,G,L]);let U=H?.pages.flatMap((W)=>W.nodes)||[],zJ=H?.pages[0]?.total??0,LJ=(W)=>{k((E)=>E.includes(W)?E.filter((w)=>w!==W):[...E,W])},UJ=(W)=>{R((E)=>E.includes(W)?E.filter((w)=>w!==W):[...E,W])},FJ=(W)=>{if(W.includes("delete")||W.includes("remove")||W.includes("revoke"))return J(Q,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:W});if(W.includes("create")||W.includes("add"))return J(Q,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:W});if(W.includes("update")||W.includes("reparent")||W.includes("copy"))return J(Q,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:W});return J(Q,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:W})},BJ=new Map(y.map((W)=>[W.userId||W.id,W]));return J("div",{className:"space-y-6",children:K(u,{className:"border border-border/50 shadow-xs",children:[K(g,{className:"pb-4",children:[K("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[K("div",{children:[K(b,{className:"text-xl font-bold flex items-center gap-2",children:[J(s,{className:"h-5 w-5 text-primary"}),Y.audit_logs()]}),J(c,{className:"mt-1",children:Y.audit_logs_description()})]}),zJ>0&&K(Q,{variant:"secondary",className:"w-fit text-xs font-normal",children:[zJ," ",Y.audit_logs()]})]}),K("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[K($J,{children:[J(OJ,{asChild:!0,children:K(d,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(YJ,{className:"h-3.5 w-3.5"}),Y.filter_by_action(),X.length>0&&J(Q,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:X.length})]})}),K(XJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:Y.select_actions()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:hJ.map((W)=>K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(ZJ,{checked:X.includes(W),onCheckedChange:()=>LJ(W)}),J("span",{className:"font-mono",children:W})]},W))}),X.length>0&&J(d,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>k([]),children:"Clear Actions"})]})]}),K($J,{children:[J(OJ,{asChild:!0,children:K(d,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(YJ,{className:"h-3.5 w-3.5"}),Y.filter_by_user(),V.length>0&&J(Q,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:V.length})]})}),K(XJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:Y.select_users()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:y.map((W)=>{let E=W.userId||W.user?.id||W.id,w=W.user?.name||W.name||E,JJ=W.user?.image||W.image;return K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(ZJ,{checked:V.includes(E),onCheckedChange:()=>UJ(E)}),K(v,{className:"h-5 w-5",children:[J(p,{src:JJ||void 0}),J(I,{className:"text-[10px]",children:w.slice(0,2).toUpperCase()})]}),J("span",{className:"truncate",children:w})]},E)})}),V.length>0&&J(d,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>R([]),children:"Clear Users"})]})]}),K("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[J(GJ,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),J(kJ,{type:"text",placeholder:Y.search_item_id(),value:q,onChange:(W)=>F(W.target.value),className:"pl-8 pr-8 h-9 text-xs"}),q&&J("button",{onClick:()=>F(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:J(QJ,{className:"h-4 w-4"})})]}),(X.length>0||V.length>0||q)&&J(d,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{k([]),R([]),F("")},children:"Clear all"})]})]}),K(n,{className:"p-0",children:[x?J("div",{className:"flex h-64 items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):$?J("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):U.length===0?J("div",{className:"p-12 text-center text-sm text-muted-foreground",children:Y.no_audit_logs()}):K(P,{children:[J(A,{children:K(D,{className:"hover:bg-transparent border-b border-border/50",children:[J(z,{className:"w-[180px] text-xs font-semibold",children:Y.action()}),J(z,{className:"w-[200px] text-xs font-semibold",children:Y.user()}),J(z,{className:"text-xs font-semibold",children:Y.item_id()}),J(z,{className:"text-xs font-semibold",children:Y.project_id()}),J(z,{className:"w-[160px] text-right text-xs font-semibold",children:Y.timestamp()})]})}),J(C,{children:U.map((W)=>{let E=W.userId?BJ.get(W.userId):null,w=E?.user?.name||E?.name||W.userId||"System",JJ=E?.user?.image||E?.image;return K(D,{className:"hover:bg-muted/40 transition-colors",children:[J(_,{className:"py-3 font-medium",children:FJ(W.action)}),J(_,{className:"py-3",children:K("div",{className:"flex items-center gap-2",children:[K(v,{className:"h-6 w-6",children:[J(p,{src:JJ||void 0}),J(I,{className:"text-[10px]",children:w.slice(0,2).toUpperCase()})]}),J("span",{className:"text-xs font-medium text-foreground truncate max-w-[140px]",children:w})]})}),J(_,{className:"py-3 text-xs font-mono text-muted-foreground",children:W.itemId||"-"}),J(_,{className:"py-3 text-xs font-mono text-muted-foreground",children:W.projectId||"-"}),J(_,{className:"py-3 text-right text-xs text-muted-foreground",children:m(W.createdAt)})]},W.id)})})]}),J("div",{ref:T,className:"py-4 flex justify-center",children:G&&J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function HJ(){let{teamId:O}=SJ.useParams(),[X,k]=yJ.useState("audit-logs"),{data:V,isLoading:R}=f({queryKey:["teams",O,"me"],queryFn:async()=>{let q=await M.api.teams[":teamId"].me.$get({param:{teamId:O}});if(!q.ok)throw Error("Failed to fetch me");return await q.json()},enabled:!!O});if(R)return J("div",{className:"flex h-screen items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(V?.role?.toLowerCase()!=="owner")return K("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[J(wJ,{className:"h-12 w-12 text-destructive mb-4"}),J("h2",{className:"text-xl font-bold tracking-tight mb-2",children:Y.access_denied()}),J("p",{className:"text-sm text-muted-foreground max-w-md",children:Y.only_owner_dashboard()})]});return J("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:K("div",{className:"flex flex-col md:flex-row h-full",children:[J("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:K("nav",{className:"p-4 space-y-1 mt-4",children:[J("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:Y.dashboard()}),J("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:Y.team_category()}),K("button",{onClick:()=>k("audit-logs"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="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:[J(s,{className:"w-5 h-5"}),Y.audit_logs(),X==="audit-logs"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),J("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:Y.ai()}),K("button",{onClick:()=>k("ai-usage"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="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:[J(RJ,{className:"w-5 h-5"}),Y.usage(),X==="ai-usage"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),K("button",{onClick:()=>k("ai-sessions"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="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:[J(i,{className:"w-5 h-5"}),Y.sessions(),X==="ai-sessions"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),J("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:K("div",{className:"max-w-6xl mx-auto space-y-8",children:[X==="audit-logs"&&J(MJ,{teamId:O}),X==="ai-usage"&&J(EJ,{teamId:O}),X==="ai-sessions"&&J(qJ,{teamId:O})]})})]})})}var SJ=NJ("/teams/$teamId/dashboard")({component:HJ});export{SJ as Route};
|