refactor(athena): consolidate tool restriction deny lists to direct boolean records
This commit is contained in:
parent
f9fdd08481
commit
21202ee877
@ -4,8 +4,6 @@
|
|||||||
* true = tool allowed, false = tool denied.
|
* true = tool allowed, false = tool denied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createAgentToolRestrictions } from "./permission-compat"
|
|
||||||
|
|
||||||
const EXPLORATION_AGENT_DENYLIST: Record<string, boolean> = {
|
const EXPLORATION_AGENT_DENYLIST: Record<string, boolean> = {
|
||||||
write: false,
|
write: false,
|
||||||
edit: false,
|
edit: false,
|
||||||
@ -13,10 +11,6 @@ const EXPLORATION_AGENT_DENYLIST: Record<string, boolean> = {
|
|||||||
call_omo_agent: false,
|
call_omo_agent: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ATHENA_RESTRICTIONS = permissionToToolBooleans(
|
|
||||||
createAgentToolRestrictions(["write", "edit", "call_omo_agent"]).permission
|
|
||||||
)
|
|
||||||
|
|
||||||
const AGENT_RESTRICTIONS: Record<string, Record<string, boolean>> = {
|
const AGENT_RESTRICTIONS: Record<string, Record<string, boolean>> = {
|
||||||
explore: EXPLORATION_AGENT_DENYLIST,
|
explore: EXPLORATION_AGENT_DENYLIST,
|
||||||
|
|
||||||
@ -49,7 +43,11 @@ const AGENT_RESTRICTIONS: Record<string, Record<string, boolean>> = {
|
|||||||
task: false,
|
task: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
athena: ATHENA_RESTRICTIONS,
|
athena: {
|
||||||
|
write: false,
|
||||||
|
edit: false,
|
||||||
|
call_omo_agent: false,
|
||||||
|
},
|
||||||
|
|
||||||
"council-member": {
|
"council-member": {
|
||||||
write: false,
|
write: false,
|
||||||
@ -59,14 +57,6 @@ const AGENT_RESTRICTIONS: Record<string, Record<string, boolean>> = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function permissionToToolBooleans(
|
|
||||||
permission: Record<string, "ask" | "allow" | "deny">
|
|
||||||
): Record<string, boolean> {
|
|
||||||
return Object.fromEntries(
|
|
||||||
Object.entries(permission).map(([tool, value]) => [tool, value === "allow"])
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getAgentToolRestrictions(agentName: string): Record<string, boolean> {
|
export function getAgentToolRestrictions(agentName: string): Record<string, boolean> {
|
||||||
return AGENT_RESTRICTIONS[agentName]
|
return AGENT_RESTRICTIONS[agentName]
|
||||||
?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1]
|
?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user