@shumai-one/shumai-transcode 0.3.8 → 0.3.9
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-4gv9dx9w.js → chunk-avy6q6yh.js} +1 -1
- package/bin/shumai-transcode-app.js +103 -33
- package/package.json +7 -7
- package/prisma/migrations/20260816020719_add_agent_permission/migration.sql +2 -0
- package/prisma/migrations/20260817022118_add_quota_rules_and_records/migration.sql +68 -0
- package/prisma/migrations/20260818025858_remove_agent_skill_call_count_from_quota_resource_type/migration.sql +14 -0
- package/prisma/schema.prisma +70 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shumai-one/shumai-transcode",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
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.3.
|
|
31
|
-
"@shumai-one/shumai-transcode-darwin-x64": "0.3.
|
|
32
|
-
"@shumai-one/shumai-transcode-linux-arm64": "0.3.
|
|
33
|
-
"@shumai-one/shumai-transcode-linux-x64": "0.3.
|
|
34
|
-
"@shumai-one/shumai-transcode-win32-arm64": "0.3.
|
|
35
|
-
"@shumai-one/shumai-transcode-win32-x64": "0.3.
|
|
30
|
+
"@shumai-one/shumai-transcode-darwin-arm64": "0.3.9",
|
|
31
|
+
"@shumai-one/shumai-transcode-darwin-x64": "0.3.9",
|
|
32
|
+
"@shumai-one/shumai-transcode-linux-arm64": "0.3.9",
|
|
33
|
+
"@shumai-one/shumai-transcode-linux-x64": "0.3.9",
|
|
34
|
+
"@shumai-one/shumai-transcode-win32-arm64": "0.3.9",
|
|
35
|
+
"@shumai-one/shumai-transcode-win32-x64": "0.3.9"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "QuotaScopeMode" AS ENUM ('all_members', 'each_member', 'selected_members');
|
|
3
|
+
|
|
4
|
+
-- CreateEnum
|
|
5
|
+
CREATE TYPE "QuotaPeriod" AS ENUM ('1hour', '5hour', '1day', '7day');
|
|
6
|
+
|
|
7
|
+
-- CreateEnum
|
|
8
|
+
CREATE TYPE "QuotaResourceType" AS ENUM ('agent_total_tokens', 'agent_cost', 'agent_skill_call_count', 'agent_mcp_call_count', 'agent_bash_call_count', 'agent_tool_call_count');
|
|
9
|
+
|
|
10
|
+
-- CreateTable
|
|
11
|
+
CREATE TABLE "quota_rules" (
|
|
12
|
+
"id" TEXT NOT NULL,
|
|
13
|
+
"team_id" TEXT NOT NULL,
|
|
14
|
+
"scope_mode" "QuotaScopeMode" NOT NULL,
|
|
15
|
+
"role" "TeamMemberRole",
|
|
16
|
+
"user_ids" JSONB,
|
|
17
|
+
"resource" "QuotaResourceType" NOT NULL,
|
|
18
|
+
"resource_data" JSONB,
|
|
19
|
+
"limit" DOUBLE PRECISION NOT NULL,
|
|
20
|
+
"period" "QuotaPeriod" NOT NULL,
|
|
21
|
+
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
|
22
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
23
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
24
|
+
|
|
25
|
+
CONSTRAINT "quota_rules_pkey" PRIMARY KEY ("id")
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
-- CreateTable
|
|
29
|
+
CREATE TABLE "quota_records" (
|
|
30
|
+
"id" TEXT NOT NULL,
|
|
31
|
+
"rule_id" TEXT NOT NULL,
|
|
32
|
+
"team_id" TEXT NOT NULL,
|
|
33
|
+
"user_id" TEXT,
|
|
34
|
+
"period_start" TIMESTAMP(3),
|
|
35
|
+
"period_end" TIMESTAMP(3),
|
|
36
|
+
"consumed" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
37
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
38
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
39
|
+
|
|
40
|
+
CONSTRAINT "quota_records_pkey" PRIMARY KEY ("id")
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
-- CreateIndex
|
|
44
|
+
CREATE INDEX "quota_rules_team_id_enabled_idx" ON "quota_rules"("team_id", "enabled");
|
|
45
|
+
|
|
46
|
+
-- CreateIndex
|
|
47
|
+
CREATE INDEX "quota_rules_team_id_resource_idx" ON "quota_rules"("team_id", "resource");
|
|
48
|
+
|
|
49
|
+
-- CreateIndex
|
|
50
|
+
CREATE INDEX "quota_records_team_id_user_id_idx" ON "quota_records"("team_id", "user_id");
|
|
51
|
+
|
|
52
|
+
-- CreateIndex
|
|
53
|
+
CREATE INDEX "quota_records_rule_id_idx" ON "quota_records"("rule_id");
|
|
54
|
+
|
|
55
|
+
-- CreateIndex
|
|
56
|
+
CREATE UNIQUE INDEX "quota_records_rule_id_user_id_key" ON "quota_records"("rule_id", "user_id");
|
|
57
|
+
|
|
58
|
+
-- AddForeignKey
|
|
59
|
+
ALTER TABLE "quota_rules" ADD CONSTRAINT "quota_rules_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
60
|
+
|
|
61
|
+
-- AddForeignKey
|
|
62
|
+
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_rule_id_fkey" FOREIGN KEY ("rule_id") REFERENCES "quota_rules"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
63
|
+
|
|
64
|
+
-- AddForeignKey
|
|
65
|
+
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
66
|
+
|
|
67
|
+
-- AddForeignKey
|
|
68
|
+
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- The values [agent_skill_call_count] on the enum `QuotaResourceType` will be removed. If these variants are still used in the database, this will fail.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- AlterEnum
|
|
8
|
+
BEGIN;
|
|
9
|
+
CREATE TYPE "QuotaResourceType_new" AS ENUM ('agent_total_tokens', 'agent_cost', 'agent_mcp_call_count', 'agent_bash_call_count', 'agent_tool_call_count');
|
|
10
|
+
ALTER TABLE "quota_rules" ALTER COLUMN "resource" TYPE "QuotaResourceType_new" USING ("resource"::text::"QuotaResourceType_new");
|
|
11
|
+
ALTER TYPE "QuotaResourceType" RENAME TO "QuotaResourceType_old";
|
|
12
|
+
ALTER TYPE "QuotaResourceType_new" RENAME TO "QuotaResourceType";
|
|
13
|
+
DROP TYPE "public"."QuotaResourceType_old";
|
|
14
|
+
COMMIT;
|
package/prisma/schema.prisma
CHANGED
|
@@ -135,6 +135,27 @@ enum WatermarkFileStatus {
|
|
|
135
135
|
failed
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
enum QuotaScopeMode {
|
|
139
|
+
all_members
|
|
140
|
+
each_member
|
|
141
|
+
selected_members
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
enum QuotaPeriod {
|
|
145
|
+
one_hour @map("1hour")
|
|
146
|
+
five_hours @map("5hour")
|
|
147
|
+
one_day @map("1day")
|
|
148
|
+
seven_days @map("7day")
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
enum QuotaResourceType {
|
|
152
|
+
agent_total_tokens
|
|
153
|
+
agent_cost
|
|
154
|
+
agent_mcp_call_count
|
|
155
|
+
agent_bash_call_count
|
|
156
|
+
agent_tool_call_count
|
|
157
|
+
}
|
|
158
|
+
|
|
138
159
|
// ----------------------------------------------------------------------
|
|
139
160
|
// Models
|
|
140
161
|
// ----------------------------------------------------------------------
|
|
@@ -172,6 +193,7 @@ model User {
|
|
|
172
193
|
apiTokens ApiToken[] @relation("UserToApiToken")
|
|
173
194
|
aiUsages AiUsage[] @relation("UserToAiUsage")
|
|
174
195
|
auditLogs AuditLog[] @relation("UserToAuditLog")
|
|
196
|
+
quotaRecords QuotaRecord[] @relation("UserToQuotaRecord")
|
|
175
197
|
|
|
176
198
|
@@map("users")
|
|
177
199
|
}
|
|
@@ -258,6 +280,8 @@ model Team {
|
|
|
258
280
|
aiUsages AiUsage[] @relation("TeamToAiUsage")
|
|
259
281
|
auditLogs AuditLog[] @relation("TeamToAuditLog")
|
|
260
282
|
watermarkTemplates WatermarkTemplate[] @relation("TeamToWatermarkTemplate")
|
|
283
|
+
quotaRules QuotaRule[] @relation("TeamToQuotaRule")
|
|
284
|
+
quotaRecords QuotaRecord[] @relation("TeamToQuotaRecord")
|
|
261
285
|
|
|
262
286
|
@@map("teams")
|
|
263
287
|
}
|
|
@@ -751,6 +775,7 @@ model Agent {
|
|
|
751
775
|
user User @relation(fields: [id], references: [id], onDelete: Cascade)
|
|
752
776
|
type AgentType
|
|
753
777
|
enabled Boolean @default(true)
|
|
778
|
+
permission TeamMemberRole @default(reviewer)
|
|
754
779
|
soul String? @db.Text
|
|
755
780
|
providerId String? @map("provider_id")
|
|
756
781
|
provider Provider? @relation("ProviderToAgent", fields: [providerId], references: [id], onDelete: SetNull)
|
|
@@ -1017,4 +1042,49 @@ model AuditLog {
|
|
|
1017
1042
|
@@map("audit_logs")
|
|
1018
1043
|
}
|
|
1019
1044
|
|
|
1045
|
+
model QuotaRule {
|
|
1046
|
+
id String @id @default(ulid())
|
|
1047
|
+
teamId String @map("team_id")
|
|
1048
|
+
scopeMode QuotaScopeMode @map("scope_mode")
|
|
1049
|
+
role TeamMemberRole? @map("role")
|
|
1050
|
+
/// [QuotaUserIds]
|
|
1051
|
+
userIds Json? @map("user_ids")
|
|
1052
|
+
resource QuotaResourceType @map("resource")
|
|
1053
|
+
/// [QuotaResourceData]
|
|
1054
|
+
resourceData Json? @map("resource_data")
|
|
1055
|
+
limit Float @map("limit")
|
|
1056
|
+
period QuotaPeriod @map("period")
|
|
1057
|
+
enabled Boolean @default(true) @map("enabled")
|
|
1058
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1059
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
1060
|
+
|
|
1061
|
+
team Team @relation("TeamToQuotaRule", fields: [teamId], references: [id], onDelete: Cascade)
|
|
1062
|
+
records QuotaRecord[] @relation("QuotaRuleToRecord")
|
|
1063
|
+
|
|
1064
|
+
@@index([teamId, enabled])
|
|
1065
|
+
@@index([teamId, resource])
|
|
1066
|
+
@@map("quota_rules")
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
model QuotaRecord {
|
|
1070
|
+
id String @id @default(ulid())
|
|
1071
|
+
ruleId String @map("rule_id")
|
|
1072
|
+
teamId String @map("team_id")
|
|
1073
|
+
userId String? @map("user_id")
|
|
1074
|
+
periodStart DateTime? @map("period_start")
|
|
1075
|
+
periodEnd DateTime? @map("period_end")
|
|
1076
|
+
consumed Float @default(0) @map("consumed")
|
|
1077
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1078
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
1079
|
+
|
|
1080
|
+
rule QuotaRule @relation("QuotaRuleToRecord", fields: [ruleId], references: [id], onDelete: Cascade)
|
|
1081
|
+
team Team @relation("TeamToQuotaRecord", fields: [teamId], references: [id], onDelete: Cascade)
|
|
1082
|
+
user User? @relation("UserToQuotaRecord", fields: [userId], references: [id], onDelete: Cascade)
|
|
1083
|
+
|
|
1084
|
+
@@unique([ruleId, userId])
|
|
1085
|
+
@@index([teamId, userId])
|
|
1086
|
+
@@index([ruleId])
|
|
1087
|
+
@@map("quota_records")
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1020
1090
|
|