feat(quota): add 2-level database-backed resource quota system (#318)

* feat(quota): add database-backed resource quota system

* feat(webui): add resource quota management in team settings (#319)

* feat(webui): add resource quota settings in team management

* refactor(webui): update quotas list to full row layout and restrict skill/mcp to select list

* feat(quota): refactor quota system to 2-level rules and records

* fix(webui): fix overflow and scroll area in quota usage records dialog

* fix(webui): ensure quota records scroll area has explicit max height

* feat(webui): improve quota cards interaction and restrict editable fields in edit mode

* fix(quota): serialize initial records, validate merged updates, and reset on dimension changes (#320)

* feat(quota): replace network quota with agent tools quota (#321)

* feat(webui): show remaining time until next refresh in quota usage records

* fix(webui): rename bash quota resource to Agent Bash Calls

* refactor(quota): remove unused reserved field from quota records

* refactor(quota): remove quota rule cache (#322)
This commit is contained in:
Yiling-J
2026-08-17 20:24:05 +08:00
committed by GitHub
parent dd82daf65c
commit eed0264b9c
200 changed files with 13118 additions and 50 deletions
+79 -1
View File
@@ -1049,5 +1049,83 @@
"agents_md_placeholder": "Give AI agents instructions and context for this project or folder.\n\nShumai automatically loads this file, along with AGENTS.md files from parent folders up to the project level, whenever an agent works here.\n\nUse it to define things like:\n- What this project or folder contains\n- Rules the agent should follow\n- Terminology, style, or workflow\n- How metadata and autofill should be generated",
"agents_md_readonly_hint": "Only team owners can edit this file.",
"agents_md_save_failed": "Failed to save",
"agents_md_loading": "Loading AGENTS.md..."
"agents_md_loading": "Loading AGENTS.md...",
"quotas": "Quotas",
"resource_quotas": "Resource Quotas",
"resource_quotas_description": "Manage and limit resource usage across team members, roles, and AI operations.",
"add_quota": "Add Quota",
"create_quota_rule": "Create Quota Rule",
"edit_quota_rule": "Edit Quota Rule",
"edit_quota_rule_description": "Configure resource limits, target scopes, and evaluation periods.",
"create_quota_rule_description": "Set up a new resource quota to prevent unexpected usage.",
"quota_scope": "Scope",
"quota_scope_team": "Entire Team",
"quota_scope_role": "Role-based",
"quota_scope_user": "Specific User",
"quota_scope_team_description": "Applies collectively to the entire team",
"quota_scope_role_description": "Applies to members with the specified role",
"quota_scope_user_description": "Applies exclusively to the selected user",
"quota_resource": "Resource",
"quota_resource_agent_total_tokens": "AI Tokens",
"quota_resource_agent_cost": "AI Cost ($)",
"quota_resource_agent_skill_call_count": "Skill Calls",
"quota_resource_agent_mcp_call_count": "MCP Server Calls",
"quota_resource_agent_bash_call_count": "Agent Bash Calls",
"quota_resource_agent_tool_call_count": "Agent Tool Calls",
"quota_period": "Period Window",
"quota_period_1hour": "1 Hour",
"quota_period_5hour": "5 Hours",
"quota_period_1day": "1 Day",
"quota_period_7day": "7 Days",
"quota_limit": "Limit",
"quota_limit_placeholder": "e.g. 100000",
"quota_enabled": "Enabled",
"quota_disabled": "Disabled",
"quota_current_usage": "Current Usage",
"quota_consumed": "Consumed",
"quota_remaining": "Remaining",
"quota_period_resets": "Resets in",
"quota_active_window": "Active Window",
"no_quotas_title": "No resource quotas configured",
"no_quotas_description": "Set limits on AI tokens, costs, skill executions, and agent tool calls to manage team usage.",
"delete_quota": "Delete Quota",
"delete_quota_confirm": "Are you sure you want to delete this quota rule? This action cannot be undone.",
"quota_created_successfully": "Quota rule created successfully",
"quota_updated_successfully": "Quota rule updated successfully",
"quota_deleted_successfully": "Quota rule deleted successfully",
"failed_to_create_quota": "Failed to create quota rule",
"failed_to_update_quota": "Failed to update quota rule",
"failed_to_delete_quota": "Failed to delete quota rule",
"quota_status_updated": "Quota status updated",
"quota_scope_mode": "Target Mode",
"quota_scope_mode_each_member": "Each Member",
"quota_scope_mode_each_member_desc": "Individual limit for each matching member",
"quota_scope_mode_all_members": "All Members",
"quota_scope_mode_all_members_desc": "Shared pooled limit across all matching members",
"quota_scope_mode_selected_members": "Selected Members",
"quota_scope_mode_selected_members_desc": "Individual limit for selected users",
"quota_view_usage": "View Usage",
"quota_usage_records": "Usage Records",
"quota_usage_records_description": "Real-time usage breakdown for this quota rule.",
"quota_team_shared_pool": "Team Shared Pool",
"quota_role_shared_pool": "Role Shared Pool",
"quota_available": "Quota available",
"quota_active": "Active",
"quota_refreshes_in": "Refreshes in {time}",
"quota_search_members": "Search members...",
"quota_selected_users_count": "{count} members selected",
"select_members": "Select Members",
"select_role": "Select Role",
"select_user": "Select User",
"select_skill": "Select Skill",
"select_mcp_server": "Select MCP Server",
"select_tool": "Select Tool",
"custom_id": "Custom ID",
"enter_custom_id": "Enter custom ID",
"bash_command_pattern": "Bash Match Wildcard",
"bash_command_pattern_placeholder": "e.g. * or npm*",
"enter_skill_id": "Enter Skill ID",
"enter_mcp_id": "Enter MCP Server ID",
"quota_bash_hint": "Supports wildcards (*). Examples: git *, npm test, curl *, python script.py (use * for all commands)",
"quota_tool_hint": "Select a specific agent tool to configure its quota limit"
}
+79 -1
View File
@@ -1049,5 +1049,83 @@
"agents_md_placeholder": "为在此项目或文件夹中工作的 AI Agent 提供指引和上下文。\n\n当 Agent 在此处工作时,Shumai 会自动加载此文件以及向上追溯至项目根目录各级父文件夹中的 AGENTS.md 文件。\n\n您可以用它来定义:\n- 此项目或文件夹包含的内容\n- Agent 应当遵守的规则\n- 术语、风格或工作流规范\n- 元数据和自动填充的生成方式",
"agents_md_readonly_hint": "只有团队所有者可以修改此文件。",
"agents_md_save_failed": "保存失败",
"agents_md_loading": "正在加载 AGENTS.md..."
"agents_md_loading": "正在加载 AGENTS.md...",
"quotas": "配额",
"resource_quotas": "资源配额",
"resource_quotas_description": "管理并限制团队成员、角色以及 AI 操作的资源使用。",
"add_quota": "添加配额",
"create_quota_rule": "创建配额规则",
"edit_quota_rule": "编辑配额规则",
"edit_quota_rule_description": "配置资源上限、目标范围以及评估周期。",
"create_quota_rule_description": "设置新的资源配额以防止意外的超量使用。",
"quota_scope": "范围",
"quota_scope_team": "整个团队",
"quota_scope_role": "按角色",
"quota_scope_user": "指定用户",
"quota_scope_team_description": "对整个团队累计生效",
"quota_scope_role_description": "对具有指定角色的成员生效",
"quota_scope_user_description": "仅对选定的用户生效",
"quota_resource": "资源类型",
"quota_resource_agent_total_tokens": "AI Token 总量",
"quota_resource_agent_cost": "AI 费用 ($)",
"quota_resource_agent_skill_call_count": "Skill 调用次数",
"quota_resource_agent_mcp_call_count": "MCP 服务调用次数",
"quota_resource_agent_bash_call_count": "智能体 Bash 执行次数",
"quota_resource_agent_tool_call_count": "智能体工具调用次数",
"quota_period": "周期窗口",
"quota_period_1hour": "1 小时",
"quota_period_5hour": "5 小时",
"quota_period_1day": "1 天",
"quota_period_7day": "7 天",
"quota_limit": "上限",
"quota_limit_placeholder": "例如 100000",
"quota_enabled": "已启用",
"quota_disabled": "已禁用",
"quota_current_usage": "当前使用量",
"quota_consumed": "已消耗",
"quota_remaining": "剩余额度",
"quota_period_resets": "重置于",
"quota_active_window": "生效周期",
"no_quotas_title": "暂未配置资源配额",
"no_quotas_description": "为 AI Token、费用、Skill 执行和智能体工具调用设置限制,以便管理团队的使用情况。",
"delete_quota": "删除配额",
"delete_quota_confirm": "确定要删除此配额规则吗?此操作无法撤销。",
"quota_created_successfully": "配额规则创建成功",
"quota_updated_successfully": "配额规则更新成功",
"quota_deleted_successfully": "配额规则删除成功",
"failed_to_create_quota": "创建配额规则失败",
"failed_to_update_quota": "更新配额规则失败",
"failed_to_delete_quota": "删除配额规则失败",
"quota_status_updated": "配额状态已更新",
"quota_scope_mode": "目标模式",
"quota_scope_mode_each_member": "每个成员",
"quota_scope_mode_each_member_desc": "为每个符合条件的成员分别设定独立的配额上限",
"quota_scope_mode_all_members": "所有成员",
"quota_scope_mode_all_members_desc": "所有符合条件的成员共同享有总配额上限",
"quota_scope_mode_selected_members": "指定成员",
"quota_scope_mode_selected_members_desc": "为选定的成员分别设定独立的配额上限",
"quota_view_usage": "查看使用量",
"quota_usage_records": "使用记录",
"quota_usage_records_description": "该配额规则的实时使用明细与生效状态。",
"quota_team_shared_pool": "团队共享配额池",
"quota_role_shared_pool": "角色共享配额池",
"quota_available": "配额可用",
"quota_active": "使用中",
"quota_refreshes_in": "{time} 后重置",
"quota_search_members": "搜索成员...",
"quota_selected_users_count": "已选择 {count} 位成员",
"select_members": "选择成员",
"select_role": "选择角色",
"select_user": "选择用户",
"select_skill": "选择 Skill",
"select_mcp_server": "选择 MCP 服务",
"select_tool": "选择工具",
"custom_id": "自定义 ID",
"enter_custom_id": "输入自定义 ID",
"bash_command_pattern": "Bash 命令通配符",
"bash_command_pattern_placeholder": "例如 * 或 npm*",
"enter_skill_id": "输入技能 ID",
"enter_mcp_id": "输入 MCP 服务 ID",
"quota_bash_hint": "支持通配符 (*)。示例:git *、npm test、curl *、python script.py(使用 * 匹配所有命令)",
"quota_tool_hint": "选择特定的智能体工具以配置其配额限制"
}