@shumai-one/shumai-transcode 0.2.1 → 0.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumai-one/shumai-transcode",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Media transcoding worker for the shumai media workspace",
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-transcode-darwin-arm64": "0.2.1",
31
- "@shumai-one/shumai-transcode-darwin-x64": "0.2.1",
32
- "@shumai-one/shumai-transcode-linux-arm64": "0.2.1",
33
- "@shumai-one/shumai-transcode-linux-x64": "0.2.1",
34
- "@shumai-one/shumai-transcode-win32-arm64": "0.2.1",
35
- "@shumai-one/shumai-transcode-win32-x64": "0.2.1"
30
+ "@shumai-one/shumai-transcode-darwin-arm64": "0.2.2",
31
+ "@shumai-one/shumai-transcode-darwin-x64": "0.2.2",
32
+ "@shumai-one/shumai-transcode-linux-arm64": "0.2.2",
33
+ "@shumai-one/shumai-transcode-linux-x64": "0.2.2",
34
+ "@shumai-one/shumai-transcode-win32-arm64": "0.2.2",
35
+ "@shumai-one/shumai-transcode-win32-x64": "0.2.2"
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
@@ -0,0 +1,28 @@
1
+ -- CreateTable
2
+ CREATE TABLE "ai_usages" (
3
+ "id" TEXT NOT NULL,
4
+ "team_id" TEXT NOT NULL,
5
+ "user_id" TEXT,
6
+ "period_start" TIMESTAMP(3) NOT NULL,
7
+ "input_tokens" INTEGER NOT NULL DEFAULT 0,
8
+ "output_tokens" INTEGER NOT NULL DEFAULT 0,
9
+ "cache_read_tokens" INTEGER NOT NULL DEFAULT 0,
10
+ "total_tokens" INTEGER NOT NULL DEFAULT 0,
11
+ "cost" DOUBLE PRECISION NOT NULL DEFAULT 0,
12
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
13
+ "updated_at" TIMESTAMP(3) NOT NULL,
14
+
15
+ CONSTRAINT "ai_usages_pkey" PRIMARY KEY ("id")
16
+ );
17
+
18
+ -- CreateIndex
19
+ CREATE INDEX "ai_usages_team_id_period_start_idx" ON "ai_usages"("team_id", "period_start");
20
+
21
+ -- CreateIndex
22
+ CREATE INDEX "ai_usages_team_id_user_id_period_start_idx" ON "ai_usages"("team_id", "user_id", "period_start");
23
+
24
+ -- AddForeignKey
25
+ ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
26
+
27
+ -- AddForeignKey
28
+ ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[team_id,user_id,period_start]` on the table `ai_usages` will be added. If there are existing duplicate values, this will fail.
5
+
6
+ */
7
+ -- CreateIndex
8
+ CREATE UNIQUE INDEX "ai_usages_team_id_user_id_period_start_key" ON "ai_usages"("team_id", "user_id", "period_start");
@@ -155,6 +155,7 @@ model User {
155
155
  collections Collection[] @relation("UserToCollection")
156
156
  shareLinks ShareLink[] @relation("UserToShareLink")
157
157
  apiTokens ApiToken[] @relation("UserToApiToken")
158
+ aiUsages AiUsage[] @relation("UserToAiUsage")
158
159
 
159
160
  @@map("users")
160
161
  }
@@ -237,6 +238,7 @@ model Team {
237
238
  skills Skill[] @relation("TeamToSkill")
238
239
  sandbox Sandbox? @relation("TeamToSandbox")
239
240
  agents Agent[] @relation("TeamToAgent")
241
+ aiUsages AiUsage[] @relation("TeamToAiUsage")
240
242
 
241
243
  @@map("teams")
242
244
  }
@@ -814,3 +816,26 @@ model ApiToken {
814
816
 
815
817
  @@map("api_tokens")
816
818
  }
819
+
820
+ model AiUsage {
821
+ id String @id @default(ulid())
822
+ teamId String @map("team_id")
823
+ userId String? @map("user_id")
824
+ periodStart DateTime @map("period_start")
825
+ inputTokens Int @default(0) @map("input_tokens")
826
+ outputTokens Int @default(0) @map("output_tokens")
827
+ cacheReadTokens Int @default(0) @map("cache_read_tokens")
828
+ totalTokens Int @default(0) @map("total_tokens")
829
+ cost Float @default(0) @map("cost")
830
+ createdAt DateTime @default(now()) @map("created_at")
831
+ updatedAt DateTime @updatedAt @map("updated_at")
832
+
833
+ team Team @relation("TeamToAiUsage", fields: [teamId], references: [id], onDelete: Cascade)
834
+ user User? @relation("UserToAiUsage", fields: [userId], references: [id], onDelete: SetNull)
835
+
836
+ @@map("ai_usages")
837
+ @@unique([teamId, userId, periodStart])
838
+ @@index([teamId, periodStart])
839
+ @@index([teamId, userId, periodStart])
840
+ }
841
+