类 PermissionEngine
java.lang.Object
io.agentscope.core.permission.PermissionEngine
Evaluates tool execution requests against configured permission rules.
Evaluation order:
- Tool-level deny rules (highest priority).
- Tool-level ask rules.
- Tool-specific checks (bypass-immune): EXPLORE/ACCEPT_EDITS read-only handling, dangerous
path checks, plus whatever the tool's own
ToolBase.checkPermissions(java.util.Map<java.lang.String, java.lang.Object>, io.agentscope.core.permission.PermissionContextState)returns. - Tool-level allow rules.
PermissionMode.BYPASSfallback.- Default ASK (converted to DENY under
PermissionMode.DONT_ASK).
The engine snapshots rules from the supplied PermissionContextState into its own mutable
tables on construction; the original context is never mutated. Use addRule(io.agentscope.core.permission.PermissionRule) to extend
the engine's rule set at runtime.
-
构造器概要
构造器构造器说明PermissionEngine(PermissionContextState context) Creates an engine seeded from the given context's rules and mode. -
方法概要
修饰符和类型方法说明voidaddRule(PermissionRule rule) Adds a rule to the engine's internal rule set.reactor.core.publisher.Mono<PermissionDecision> checkPermission(ToolBase tool, Map<String, Object> toolInput) Resolves a permission decision for the given tool invocation.Read-only view of the engine's current allow-rule table.Read-only view of the engine's current ask-rule table.Returns the underlying context (mode and working directories are read from it).Read-only view of the engine's current deny-rule table.
-
构造器详细资料
-
PermissionEngine
Creates an engine seeded from the given context's rules and mode.- 参数:
context- permission context providing mode, working directories, and initial rules
-
-
方法详细资料
-
getContext
Returns the underlying context (mode and working directories are read from it).- 返回:
- the immutable context this engine was constructed with
-
addRule
Adds a rule to the engine's internal rule set.The rule is routed by its
PermissionRule.behavior(): ALLOW/DENY/ASK rules are appended to the engine's allow/deny/ask tables; PASSTHROUGH rules are ignored.- 参数:
rule- the rule to add; must be non-null
-
getAllowRules
Read-only view of the engine's current allow-rule table. -
getDenyRules
Read-only view of the engine's current deny-rule table. -
getAskRules
Read-only view of the engine's current ask-rule table. -
checkPermission
public reactor.core.publisher.Mono<PermissionDecision> checkPermission(ToolBase tool, Map<String, Object> toolInput) Resolves a permission decision for the given tool invocation.- 参数:
tool- the tool being calledtoolInput- the input map the tool will receive- 返回:
- a Mono emitting the resolved
PermissionDecision
-