@shumai-one/shumai 0.3.6 → 0.3.8

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.
Files changed (157) hide show
  1. package/bin/{chunk-0sajh8fw.js → chunk-0mmw31pj.js} +2 -2
  2. package/bin/{chunk-gra3617w.js → chunk-0pm8c9bq.js} +2 -2
  3. package/bin/{chunk-d8bpqbdw.js → chunk-0qpz48vc.js} +1 -1
  4. package/bin/{chunk-bq2aq6v8.js → chunk-0zbwpfsk.js} +2 -2
  5. package/bin/chunk-15jsnygy.js +5 -0
  6. package/bin/chunk-16s5kfy8.css +1 -0
  7. package/bin/{chunk-fzaw1e34.js → chunk-21rp4vzr.js} +2 -2
  8. package/bin/chunk-24ke0th1.css +1 -0
  9. package/bin/{chunk-5wrakb8p.js → chunk-28n8xqhm.js} +1 -1
  10. package/bin/{chunk-kk0gx8eg.js → chunk-2dxd0bar.js} +2 -2
  11. package/bin/{chunk-0jesq6sm.js → chunk-2ejky9qv.js} +1 -1
  12. package/bin/{chunk-mgbqjbfc.js → chunk-2em77vjv.js} +1 -1
  13. package/bin/{chunk-q7xfrtnj.js → chunk-2q26gz0p.js} +1 -1
  14. package/bin/{chunk-7b60a9sy.js → chunk-2t0asg3w.js} +2 -2
  15. package/bin/{chunk-gct52xks.js → chunk-2xaq1y16.js} +2 -2
  16. package/bin/{chunk-mxee09jk.js → chunk-33r4w0yv.js} +2 -2
  17. package/bin/{chunk-w4ycztv5.js → chunk-3bm3be9d.js} +1 -1
  18. package/bin/{chunk-fwbrcfaq.js → chunk-3mx22sn7.js} +2 -2
  19. package/bin/chunk-4cmw4qmt.js +1 -0
  20. package/bin/chunk-4d3wm83a.js +2 -0
  21. package/bin/{chunk-gg1gwjtn.js → chunk-4g4g02e0.js} +1 -1
  22. package/bin/{chunk-vw1rhgjs.js → chunk-5386brz2.js} +2 -2
  23. package/bin/{chunk-20wtz3kc.js → chunk-5f9fk8x0.js} +3 -3
  24. package/bin/chunk-5fj5w0gg.js +2 -0
  25. package/bin/chunk-61bxmjd9.js +2 -0
  26. package/bin/{chunk-ex4qa7gv.js → chunk-6pcs8810.js} +1 -1
  27. package/bin/{chunk-4ajat3xv.js → chunk-6pmsknnk.js} +13 -13
  28. package/bin/{chunk-c9bpf8gp.js → chunk-6vwqg1ra.js} +2 -2
  29. package/bin/{chunk-6edadcpn.js → chunk-75segwsp.js} +2 -2
  30. package/bin/{chunk-dfzmqx1v.js → chunk-7c85cyn0.js} +3 -3
  31. package/bin/chunk-7eyg2kgv.js +1 -0
  32. package/bin/chunk-7r22vcjy.js +2 -0
  33. package/bin/{chunk-9p5n3m2z.js → chunk-80g5kcm0.js} +1 -1
  34. package/bin/{chunk-mmrtjcst.js → chunk-8bhsdk1v.js} +1 -1
  35. package/bin/{chunk-jtd7rydv.js → chunk-8fsrs7mh.js} +1 -1
  36. package/bin/chunk-8jfm1j41.js +1 -0
  37. package/bin/chunk-8n6segk5.js +1 -0
  38. package/bin/chunk-99f9r6xm.js +2 -0
  39. package/bin/{chunk-y1t47c7f.js → chunk-9acfydwy.js} +1 -1
  40. package/bin/{chunk-89kqtj7x.js → chunk-9ntwrvhz.js} +2 -2
  41. package/bin/{chunk-9hsfjqgq.js → chunk-agdza65r.js} +2 -2
  42. package/bin/{chunk-kaxwma6y.js → chunk-antsxrw9.js} +1 -1
  43. package/bin/chunk-bapy3qv8.js +1 -0
  44. package/bin/chunk-bc2bf144.js +2 -0
  45. package/bin/{chunk-js0genbf.js → chunk-bznz6h19.js} +1 -1
  46. package/bin/{chunk-tqxmj05h.js → chunk-c24an5j3.js} +2 -2
  47. package/bin/chunk-cm74nd4n.js +1 -0
  48. package/bin/{chunk-f44d9fpd.js → chunk-cynjx7ha.js} +2 -2
  49. package/bin/chunk-cyq3m4qz.js +1 -0
  50. package/bin/chunk-ddff7vm3.js +2 -0
  51. package/bin/{chunk-a5fw02xq.js → chunk-djqs6m7w.js} +3 -3
  52. package/bin/chunk-dn8k5ef5.js +3 -0
  53. package/bin/chunk-dqdqs0d9.js +1 -0
  54. package/bin/chunk-drjaw6a5.js +14 -0
  55. package/bin/chunk-drvwchyn.js +2 -0
  56. package/bin/{chunk-6awkqp09.js → chunk-e4se9q6n.js} +1 -1
  57. package/bin/chunk-eb551xw7.js +1 -0
  58. package/bin/{chunk-g70eyttc.js → chunk-en96pr5c.js} +2 -2
  59. package/bin/{chunk-j1awxx51.js → chunk-ep138kb3.js} +2 -2
  60. package/bin/{chunk-9annjnj2.js → chunk-eqf7k7ax.js} +2 -2
  61. package/bin/{chunk-n198tewr.js → chunk-f3rqamey.js} +2 -2
  62. package/bin/{chunk-ce50f746.js → chunk-fvwz4mgw.js} +2 -2
  63. package/bin/chunk-g3p6h6sw.js +68 -0
  64. package/bin/{chunk-ew4cxkcc.js → chunk-h9f55mjv.js} +2 -2
  65. package/bin/{chunk-w98wvk17.js → chunk-jfjjh86p.js} +2 -2
  66. package/bin/{chunk-ym47952x.js → chunk-jg31cnqc.js} +2 -2
  67. package/bin/chunk-jk87gxbb.js +2 -0
  68. package/bin/{chunk-w16jgdfx.js → chunk-jqzvazsf.js} +1 -1
  69. package/bin/chunk-jyk483r4.js +1 -0
  70. package/bin/{chunk-1b7shyfp.js → chunk-k0ysbh3h.js} +1 -1
  71. package/bin/{chunk-1f8rr3ef.js → chunk-k5yxntns.js} +2 -2
  72. package/bin/chunk-khjybf4y.js +1 -0
  73. package/bin/{chunk-nh8azwsx.js → chunk-kmt9fj1z.js} +2 -2
  74. package/bin/{chunk-crdvxq38.js → chunk-m49ar48r.js} +2 -2
  75. package/bin/{chunk-hcvpb1hw.js → chunk-m7d52gfe.js} +1 -1
  76. package/bin/{chunk-800vdz5n.js → chunk-mjxay7yv.js} +1 -1
  77. package/bin/{chunk-gx5rjm9m.js → chunk-mp5etccz.js} +1 -1
  78. package/bin/{chunk-y0yrmcf3.js → chunk-n8pas7tj.js} +2 -2
  79. package/bin/{chunk-74zstxav.js → chunk-nc632fxz.js} +2 -2
  80. package/bin/{chunk-rmm6y799.js → chunk-nffrjwb7.js} +2 -2
  81. package/bin/{chunk-47093mwk.js → chunk-p1rrkrn4.js} +1 -1
  82. package/bin/chunk-p6ep6grv.js +1 -0
  83. package/bin/{chunk-29nhtrfv.js → chunk-ph43tgr6.js} +1 -1
  84. package/bin/{chunk-z0tbq08w.js → chunk-pqtwzb3s.js} +1 -1
  85. package/bin/chunk-q0xv46wa.js +2 -0
  86. package/bin/{chunk-gewh7p42.js → chunk-qhxznkjk.js} +5 -5
  87. package/bin/chunk-qmja7bsr.js +2 -0
  88. package/bin/{chunk-z2ef8zpz.js → chunk-qyegjbzd.js} +1 -1
  89. package/bin/{chunk-f2eh802w.js → chunk-r5rf62aa.js} +1 -1
  90. package/bin/{chunk-ghz19a7t.js → chunk-rjkj0dr9.js} +2 -2
  91. package/bin/chunk-rjr8c8be.js +3 -0
  92. package/bin/{chunk-7fm1hznx.js → chunk-rq4h4p2g.js} +2 -2
  93. package/bin/{chunk-thj4cpev.js → chunk-scmhhrte.js} +2 -2
  94. package/bin/chunk-sjr6mvgm.js +78 -0
  95. package/bin/{chunk-1fq10abj.js → chunk-ssz62jfs.js} +2 -2
  96. package/bin/{chunk-pm64et9d.js → chunk-ta02azkp.js} +1 -1
  97. package/bin/{chunk-yzra1x8f.js → chunk-tfnh9sk9.js} +2 -2
  98. package/bin/{chunk-nh31ma8d.js → chunk-thqahbva.js} +2 -2
  99. package/bin/chunk-tvzfm7g8.js +2 -0
  100. package/bin/{chunk-snexx7ks.js → chunk-twm329fs.js} +1 -1
  101. package/bin/{chunk-t5561vz5.js → chunk-ve826t5r.js} +1 -1
  102. package/bin/chunk-vpfj3q7r.js +1 -0
  103. package/bin/chunk-vqakgjsf.js +1 -0
  104. package/bin/chunk-wgjghs54.js +7 -0
  105. package/bin/chunk-wy1ytxw7.js +41 -0
  106. package/bin/{chunk-8g0mhzsg.js → chunk-x788nk6z.js} +2 -2
  107. package/bin/{chunk-sx7kparv.js → chunk-x8ksced7.js} +2 -2
  108. package/bin/{chunk-z0zevgb6.js → chunk-xexxh1zq.js} +1 -1
  109. package/bin/{chunk-vgr9db5g.js → chunk-xktnqktj.js} +2 -2
  110. package/bin/{chunk-y8vw7zv1.js → chunk-xpce3j7g.js} +1 -1
  111. package/bin/{chunk-d2qp8g98.js → chunk-xyzsmjtk.js} +2 -2
  112. package/bin/chunk-y03s8bkz.js +1 -0
  113. package/bin/{chunk-aeg4kya9.js → chunk-y5g2ge6f.js} +1 -1
  114. package/bin/{chunk-dmjzrdan.js → chunk-ygcmv04c.js} +2 -2
  115. package/bin/{chunk-n9cjmkky.js → chunk-ykarhcph.js} +1 -1
  116. package/bin/{chunk-9tnfhrnh.js → chunk-yr8a8nzv.js} +2 -2
  117. package/bin/chunk-yxtb7xn8.js +2 -0
  118. package/bin/{chunk-hqbzjzsm.js → chunk-zaft3sfe.js} +2 -2
  119. package/bin/shumai-app.html +1 -1
  120. package/bin/shumai-app.js +284 -267
  121. package/package.json +7 -7
  122. package/prisma/migrations/20260813022501_backfill_autofill_source_in_config/migration.sql +8 -0
  123. package/prisma/migrations/20260813022502_drop_legacy_autofill_columns/migration.sql +12 -0
  124. package/prisma/migrations/20260813122613_add_network_sandbox_enabled_column/migration.sql +2 -0
  125. package/prisma/migrations/20260813122618_migrate_legacy_sandboxes_enabled/migration.sql +2 -0
  126. package/prisma/migrations/20260814090300_add_asset_agentmd/migration.sql +2 -0
  127. package/prisma/migrations/20260814125921_create_asset_agentmd_table/migration.sql +21 -0
  128. package/prisma/schema.prisma +20 -9
  129. package/bin/chunk-0jr6q4j4.js +0 -3
  130. package/bin/chunk-1hn9v6hv.js +0 -2
  131. package/bin/chunk-2882s5sp.js +0 -1
  132. package/bin/chunk-3egeywt8.js +0 -1
  133. package/bin/chunk-3htn4m2d.js +0 -7
  134. package/bin/chunk-4a9sdfyp.js +0 -2
  135. package/bin/chunk-55myfmhy.js +0 -2
  136. package/bin/chunk-6bztpk7h.js +0 -1
  137. package/bin/chunk-76hs7g0x.js +0 -2
  138. package/bin/chunk-8jdgzy22.js +0 -2
  139. package/bin/chunk-8js9m1j7.js +0 -1
  140. package/bin/chunk-e5s7202g.js +0 -2
  141. package/bin/chunk-ef5v7gta.js +0 -71
  142. package/bin/chunk-f5zg7b38.js +0 -1
  143. package/bin/chunk-fdm1yc29.js +0 -1
  144. package/bin/chunk-gh64hag9.js +0 -2
  145. package/bin/chunk-h0p8yew4.js +0 -1
  146. package/bin/chunk-hgngnc1k.js +0 -1
  147. package/bin/chunk-jt4yh37q.js +0 -62
  148. package/bin/chunk-k0xpskyq.js +0 -1
  149. package/bin/chunk-mhj0pqq3.js +0 -15
  150. package/bin/chunk-nhc72y4x.js +0 -2
  151. package/bin/chunk-px6q3jpz.js +0 -1
  152. package/bin/chunk-sx3by19j.js +0 -1
  153. package/bin/chunk-vqgz25av.js +0 -1
  154. package/bin/chunk-vz75bqvx.js +0 -2
  155. package/bin/chunk-wa8k9fwx.js +0 -1
  156. package/bin/chunk-z3p3qz9d.js +0 -3
  157. 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.6",
3
+ "version": "0.3.8",
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.6",
31
- "@shumai-one/shumai-darwin-x64": "0.3.6",
32
- "@shumai-one/shumai-linux-arm64": "0.3.6",
33
- "@shumai-one/shumai-linux-x64": "0.3.6",
34
- "@shumai-one/shumai-win32-arm64": "0.3.6",
35
- "@shumai-one/shumai-win32-x64": "0.3.6"
30
+ "@shumai-one/shumai-darwin-arm64": "0.3.8",
31
+ "@shumai-one/shumai-darwin-x64": "0.3.8",
32
+ "@shumai-one/shumai-linux-arm64": "0.3.8",
33
+ "@shumai-one/shumai-linux-x64": "0.3.8",
34
+ "@shumai-one/shumai-win32-arm64": "0.3.8",
35
+ "@shumai-one/shumai-win32-x64": "0.3.8"
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";
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "sandboxes" ADD COLUMN "network_sandbox_enabled" BOOLEAN NOT NULL DEFAULT false;
@@ -0,0 +1,2 @@
1
+ -- Data migration: set network_sandbox_enabled to true for existing legacy sandbox records
2
+ UPDATE "sandboxes" SET "network_sandbox_enabled" = true;
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "assets" ADD COLUMN "agentmd" TEXT;
@@ -0,0 +1,21 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `agentmd` on the `assets` table. All the data in the column will be lost.
5
+
6
+ */
7
+ -- AlterTable
8
+ ALTER TABLE "assets" DROP COLUMN "agentmd";
9
+
10
+ -- CreateTable
11
+ CREATE TABLE "asset_agentmd" (
12
+ "asset_id" TEXT NOT NULL,
13
+ "content" TEXT NOT NULL,
14
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
15
+ "updated_at" TIMESTAMP(3) NOT NULL,
16
+
17
+ CONSTRAINT "asset_agentmd_pkey" PRIMARY KEY ("asset_id")
18
+ );
19
+
20
+ -- AddForeignKey
21
+ ALTER TABLE "asset_agentmd" ADD CONSTRAINT "asset_agentmd_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -263,11 +263,12 @@ model Team {
263
263
  }
264
264
 
265
265
  model Sandbox {
266
- id String @id @default(ulid())
267
- 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"])
268
- pendingDomains String[] @default([]) @map("pending_domains")
269
- createdAt DateTime @default(now()) @map("created_at")
270
- updatedAt DateTime @updatedAt @map("updated_at")
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")
@@ -490,6 +490,7 @@ model Asset {
490
490
  shareLinkRootFolder ShareLink? @relation("ShareLinkToRootFolder")
491
491
  agentSessions AgentSession[] @relation("AssetToAgentSession")
492
492
  watermarkFiles WatermarkFile[] @relation("AssetToWatermarkFile")
493
+ agentMd AssetAgentMd? @relation("AssetToAgentMd")
493
494
 
494
495
  @@map("assets")
495
496
  @@index([type])
@@ -537,6 +538,17 @@ model AssetMetadataValue {
537
538
  @@map("asset_metadata_values")
538
539
  }
539
540
 
541
+ model AssetAgentMd {
542
+ assetId String @id @map("asset_id")
543
+ content String @db.Text
544
+ createdAt DateTime @default(now()) @map("created_at")
545
+ updatedAt DateTime @updatedAt @map("updated_at")
546
+
547
+ asset Asset @relation("AssetToAgentMd", fields: [assetId], references: [id], onDelete: Cascade)
548
+
549
+ @@map("asset_agentmd")
550
+ }
551
+
540
552
  model AssetComment {
541
553
  id String @id @default(ulid())
542
554
  message String?
@@ -622,9 +634,8 @@ model MetadataField {
622
634
  scope MetadataFieldScope?
623
635
  /// [FieldConfig]
624
636
  config Json?
625
- readOnly Boolean @default(false) @map("read_only")
626
- aiAutofill Boolean @default(false) @map("ai_autofill")
627
- description String @default("")
637
+ readOnly Boolean @default(false) @map("read_only")
638
+ description String @default("")
628
639
 
629
640
  teamId String? @map("team_id")
630
641
  team Team? @relation("TeamToMetadataField", fields: [teamId], references: [id])
@@ -1,3 +0,0 @@
1
- import{$h as U,Ch as _,Th as u,Uh as F,Zh as H,vh as m}from"./chunk-jt4yh37q.js";import{Il as E}from"./chunk-mgbqjbfc.js";var V=null,r=F((p)=>({projectState:null,setProjectState:(c)=>{if(V)clearTimeout(V),V=null;p({projectState:c})},clearProjectState:()=>{if(V)clearTimeout(V);V=setTimeout(()=>{p({projectState:null}),V=null},10)}}));var v="shumai_selected_agent_id",R=()=>{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(v);return null},X=F((p)=>({isChatbotOpen:!1,setIsChatbotOpen:(c)=>p({isChatbotOpen:c}),isHistoryMode:!1,setIsHistoryMode:(c)=>p({isHistoryMode:c}),currentSessionId:null,setCurrentSessionId:(c)=>p({currentSessionId:c}),chatAssets:[],addAssets:(c)=>p((j)=>{let f=new Set(j.chatAssets.map(($)=>$.id)),q=c.filter(($)=>!f.has($.id));return{chatAssets:[...j.chatAssets,...q]}}),removeAsset:(c)=>p((j)=>({chatAssets:j.chatAssets.filter((f)=>f.id!==c)})),clearAssets:()=>p({chatAssets:[]}),messages:[],setMessages:(c)=>p({messages:c}),historySessions:[],setHistorySessions:(c)=>p({historySessions:c}),isStreaming:!1,setIsStreaming:(c)=>p({isStreaming:c}),selectedAgentId:R(),setSelectedAgentId:(c)=>{if(typeof window<"u"&&window.localStorage)if(c)localStorage.setItem(v,c);else localStorage.removeItem(v);p({selectedAgentId:c})},inputText:"",setInputText:(c)=>p({inputText:c}),scrollTop:0,isAtBottom:!0,setScrollState:(c,j)=>p({scrollTop:c,isAtBottom:j}),fetchHistorySessions:async(c)=>{try{let j=await U.api.teams[":teamId"].chat.sessions.$get({param:{teamId:c},query:{first:"50"}});if(j.ok){let f=await j.json();p({historySessions:f.data||[]})}}catch(j){console.error("Failed to fetch history sessions:",j)}},loadSession:async(c,j)=>{try{let f=await U.api.teams[":teamId"].chat.sessions[":sessionId"].messages.$get({param:{teamId:c,sessionId:j}});if(f.ok){let q=await f.json(),Q=X.getState().historySessions.find((Z)=>Z.id===j)?.agentId||null;p({currentSessionId:j,messages:q,isHistoryMode:!1,scrollTop:0,isAtBottom:!0,...Q?{selectedAgentId:Q}:{}})}else throw Error("Failed to load session messages")}catch(f){let q=f instanceof Error?f.message:"Failed to load session";H.error(q)}},deleteSession:async(c,j)=>{try{if((await U.api.teams[":teamId"].chat.sessions[":sessionId"].$delete({param:{teamId:c,sessionId:j}})).ok)H.success("Session deleted successfully"),p((q)=>({historySessions:q.historySessions.filter(($)=>$.id!==j),currentSessionId:q.currentSessionId===j?null:q.currentSessionId,messages:q.currentSessionId===j?[]:q.messages}));else throw Error("Failed to delete session")}catch(f){let q=f instanceof Error?f.message:"Failed to delete session";H.error(q)}},startNewSession:()=>{let c=R();p({currentSessionId:null,messages:[],chatAssets:[],inputText:"",scrollTop:0,isAtBottom:!0,...c?{selectedAgentId:c}:{}})},sendMessage:async(c,j,f,q,$)=>{let Q=X.getState();if(Q.isStreaming)return;let Z=`temp-${Date.now()}`,y={id:Z,role:"user",content:[{type:"text",text:j}],timestamp:Date.now()},z=[...Q.messages];if(Q.chatAssets.length>0){let W={id:`temp-context-${Date.now()}`,role:"custom",customType:"context_display_info",details:{assets:Q.chatAssets.map((J)=>({id:J.id,name:J.name,type:J.type}))},timestamp:Date.now()-1};z.push(W)}z.push(y),p({messages:z,isStreaming:!0,chatAssets:[],isAtBottom:!0});let b=Q.chatAssets.map((w)=>w.id),G=Q.selectedAgentId;if(!G){H.error("No agent selected");return}try{let w=await U.api.teams[":teamId"].chat.$post({param:{teamId:c},json:{agentId:G,textPrompt:j,assetIds:b,sessionId:Q.currentSessionId||void 0,contextAssetId:q,projectId:f}});if(!w.ok)throw Error("Failed to start chat");let W=w.headers.get("x-session-id");if(W&&!Q.currentSessionId)p({currentSessionId:W});let J=w.body?.getReader();if(!J)throw Error("No stream body");let B=new TextDecoder,K="";while(!0){let{done:S,value:x}=await J.read();if(S)break;K+=B.decode(x,{stream:!0});let N=K.split(`
2
- `);K=N.pop()||"";for(let l of N){let Y=l.trim();if(!Y)continue;if(Y.startsWith("data: ")){let A=Y.slice(6);try{let D=JSON.parse(A);if(D.type==="session"){if(!X.getState().currentSessionId)p({currentSessionId:D.sessionId})}else if(D.type==="entry"){let L=D.entry,h=L;if(h.role==="toolResult"&&typeof h.toolName==="string"&&["create_file","create_folder","create_version"].includes(h.toolName)&&!h.isError)$?.();p((O)=>{let C=O.messages.some((k)=>k.id===L.id),T=O.messages.filter((k)=>{if(L.role==="user"&&!C)return!(k.id.startsWith("temp-")&&!k.id.startsWith("temp-context-"));if(L.role==="custom"&&L.customType==="context_display_info"&&!C)return!k.id.startsWith("temp-context-");return!0}),M=T.findIndex((k)=>k.id===L.id);if(M!==-1){let k=[...T];return k[M]=L,{messages:k}}else return{messages:[...T,L]}})}else if(D.type==="done"){if(D.status==="failed")H.error(D.error||"Workflow failed")}}catch(D){console.error("Error parsing SSE line:",D)}}}}X.getState().fetchHistorySessions(c)}catch(w){let W=w instanceof Error?w.message:"Failed to send message";H.error(W),p((J)=>({messages:J.messages.filter((B)=>B.id!==Z)}))}finally{p({isStreaming:!1})}},abortActiveSession:async(c)=>{let{currentSessionId:j,isStreaming:f}=X.getState();if(!j||!f)return;try{if((await U.api.teams[":teamId"].chat.sessions[":sessionId"].abort.$post({param:{teamId:c,sessionId:j}})).ok)H.success("Agent execution stopped");else throw Error("Failed to abort agent execution")}catch(q){let $=q instanceof Error?q.message:"Failed to abort execution";H.error($)}}}));var P=E(m(),1);function g(p){let c=p.match(/teams\/([^/]+)/);if(c)return{teamId:c[1]};let j=p.match(/projects\/([^/]+)/);if(j)return{projectId:j[1]};return{}}function jc(){let[p,c]=P.useState(),j=u({select:(Q)=>Q.location.pathname}),{teamId:f,projectId:q}=g(j),{data:$}=_({queryKey:["projects",q,"team"],queryFn:async()=>{let Q=await U.api.projects[":projectId"].team.$get({param:{projectId:q}});if(!Q.ok)throw Error("failed to fetch project team");return await Q.json()},enabled:!!q});return P.useEffect(()=>{if(f)c(f);else if($?.teamId)c($.teamId)},[f,$]),p}
3
- export{jc as ug,r as vg,X as wg};
@@ -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};
@@ -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};
@@ -1 +0,0 @@
1
- import{c as d,d as x,e as r,f as D,g as G,h as M}from"./chunk-sx7kparv.js";import{oa as m}from"./chunk-vw1rhgjs.js";import{cb as p}from"./chunk-ef5v7gta.js";import"./chunk-gct52xks.js";import"./chunk-d2qp8g98.js";import{Df as I}from"./chunk-1fq10abj.js";import{Qf as g}from"./chunk-9hsfjqgq.js";import{Cg as u}from"./chunk-4a9sdfyp.js";import{Dg as f}from"./chunk-n198tewr.js";import{rh as b}from"./chunk-w98wvk17.js";import{$h as N,Ak as P,Bk as T,Dh as R,Di as C,Ek as Y,Fh as k,Kh as v,Ph as L,gj as S,ki as h,vh as o,wh as y,xh as q,yh as K,zi as z,zk as F}from"./chunk-jt4yh37q.js";import{Il as t}from"./chunk-mgbqjbfc.js";var Z=t(o(),1);var s=(X)=>{if(!X)return"??";return X.split(" ").map((_)=>_[0]).slice(0,2).join("").toUpperCase()};function e(){let{projectId:X}=qq.useParams(),{teamId:_,ensureTeamIdForProject:E}=b(),j=v();Z.useEffect(()=>{E(X)},[X,E]);let{data:O}=R(I(X)),W=O?.rootFolder,[n,i]=Z.useState(240),{fileListLeftSidebarCollapsed:A,setFileListLeftSidebarCollapsed:c}=u(),{data:B,isLoading:a,fetchNextPage:Q,hasNextPage:V,isFetchingNextPage:U}=k({queryKey:["collections",X],queryFn:async({pageParam:J})=>{let $=await N.api.projects[":projectId"].collections.$get({param:{projectId:X},query:{first:"20",after:J}});if(!$.ok)throw Error("Failed to fetch collections");return await $.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!X}),{ref:l,inView:H}=f();Z.useEffect(()=>{if(H&&V&&!U)Q()},[H,V,U,Q]);let w=Z.useMemo(()=>B?.pages.flatMap((J)=>J.data)||[],[B]);if(!_||!W||!O)return q(g,{});return q("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!A&&q("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>c(!0)}),!A&&K(y,{children:[q("div",{className:"bg-background",style:{width:n},children:q(m,{teamId:_,projectId:X,projectName:O.name??"",rootFolderId:W})}),q(p,{onResize:(J)=>{i(($)=>Math.max(180,Math.min(400,$+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[q("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[q(z,{className:"h-5 w-5 text-primary"}),q("h1",{className:"font-bold text-lg text-foreground",children:Y.all_collections()})]})}),q("div",{className:"flex-1 overflow-y-auto p-6",children:a?q("div",{className:"flex justify-center items-center h-64",children:q("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):w.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[q(S,{className:"h-10 w-10 text-muted-foreground/50"}),q("p",{children:Y.no_collections_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(d,{children:[q(x,{children:K(D,{className:"hover:bg-transparent bg-muted/20",children:[q(G,{className:"font-semibold px-4 py-3",children:Y.collection_name()}),q(G,{className:"font-semibold px-4 py-3",children:Y.creator()}),q(G,{className:"font-semibold px-4 py-3 w-[200px]",children:Y.created_date()})]})}),q(r,{children:w.map((J)=>K(D,{className:"hover:bg-muted/10 transition-colors cursor-pointer",onClick:()=>j({to:"/projects/$projectId/collections/$collectionId",params:{projectId:X,collectionId:J.id}}),children:[q(M,{className:"font-medium px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[q(z,{className:"h-4 w-4 text-primary shrink-0"}),q("span",{className:"text-foreground font-semibold hover:underline",children:J.name})]})}),q(M,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(F,{className:"h-6 w-6",children:[J.creator?.image&&q(P,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),q(T,{className:"text-[10px]",children:s(J.creator?.name)})]}),q("span",{className:"text-sm font-medium text-foreground truncate max-w-[200px]",children:J.creator?.name||Y.unknown()})]})}),q(M,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[q(C,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),q("span",{children:new Date(J.createdAt).toLocaleDateString()})]})})]},J.id))})]}),q("div",{ref:l,className:"h-10 w-full flex items-center justify-center",children:U&&q(h,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var qq=L("/projects/$projectId/collections/")({component:e});export{qq as Route};