mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-10-14 19:51:32 +02:00
Add token usage tracking and UI refinements
This commit is contained in:
1 parent
a34cab431a
commit
e218316c55
23 files changed
+1285
-93
No files matched your search
@@ -118,6 +118,8 @@ func permissionForRequest(method, fullPath string) string {
|
||||
return "hitl:write"
|
||||
case strings.HasPrefix(path, "/agent-loop"), strings.HasPrefix(path, "/batch-tasks"):
|
||||
return crudPermission(method, "tasks")
|
||||
case path == "/usage/tokens":
|
||||
return "dashboard:read"
|
||||
case strings.HasPrefix(path, "/conversations"), strings.HasPrefix(path, "/messages"), strings.HasPrefix(path, "/process-details"):
|
||||
return crudPermission(method, "chat")
|
||||
case strings.HasPrefix(path, "/groups"):
|
||||
|
||||
@@ -119,6 +119,12 @@ func TestRBACResourcePickerRequiresWritePermission(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRBACMiddlewareMapsTokenUsageStatsToDashboardRead(t *testing.T) {
|
||||
if got := permissionForRequest(http.MethodGet, "/api/usage/tokens"); got != "dashboard:read" {
|
||||
t.Fatalf("token usage permission = %q, want dashboard:read", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMCPInvocationPermissionIsSeparateFromMCPAdministration(t *testing.T) {
|
||||
if got := permissionForRequest(http.MethodPost, "/api/mcp"); got != "mcp:execute" {
|
||||
t.Fatalf("MCP invocation permission = %q, want mcp:execute", got)
|
||||
|
||||
Reference in new issue
Block a user