mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 08:19:06 +00:00
fix(quota): exclude agents from quota rules and usage records (#325)
* fix(quota): exclude agents from quota rules and usage records * refactor(quota): remove agent_skill_call_count resource type and related logic * chore(db): replace manual migration with prisma-generated migration
This commit is contained in:
@@ -3,7 +3,6 @@ import { Type } from 'typebox'
|
||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||
import { quotaService } from '@shumai/core/src/quota/quota-service'
|
||||
|
||||
const readSkillSchema = Type.Object({
|
||||
skillId: Type.String({ description: 'The ID of the skill to read' }),
|
||||
@@ -61,18 +60,6 @@ export const createReadSkillTool = (
|
||||
)
|
||||
}
|
||||
|
||||
// Quota pre-check
|
||||
await quotaService.checkQuota(
|
||||
{
|
||||
teamId: skill.teamId,
|
||||
userId,
|
||||
role: effectiveRole,
|
||||
resource: 'agent_skill_call_count',
|
||||
resourceData: { id: params.skillId, skillId: params.skillId },
|
||||
},
|
||||
1,
|
||||
)
|
||||
|
||||
// Capture environment variables using agentService
|
||||
const envs = await agentService.getSkillEnvs(params.skillId)
|
||||
onEnvsAdded(envs)
|
||||
@@ -83,18 +70,6 @@ export const createReadSkillTool = (
|
||||
// Notify that a skill was successfully loaded (e.g. to enable restricted tools)
|
||||
await onSkillLoaded?.()
|
||||
|
||||
// Consume quota
|
||||
await quotaService.consumeQuota(
|
||||
{
|
||||
teamId: skill.teamId,
|
||||
userId,
|
||||
role: effectiveRole,
|
||||
resource: 'agent_skill_call_count',
|
||||
resourceData: { id: params.skillId, skillId: params.skillId },
|
||||
},
|
||||
1,
|
||||
)
|
||||
|
||||
return {
|
||||
content: [{ type: 'text', text: skillMdContent }],
|
||||
details: { skillId: params.skillId },
|
||||
|
||||
Reference in New Issue
Block a user