AS AgentScopeAPI 手册 / API Reference

PermissionContextState

@JsonPropertyOrder({"mode", "working_directories", "allow_rules", "deny_rules", "ask_rules"}) public final class PermissionContextState
源码Source io/agentscope/core/permission/PermissionContextState.java:36–249

权限上下文状态,驱动智能体的推理、工具调用与会话执行。位于 io.agentscope.core.permission 包。核心成员包括 getMode、isTrivial、getWorkingDirectories、getAllowRules、getDenyRules、getAskRules。

Permission evaluation context: mode + working directories + three rule tables.

Rule tables are keyed by tool name; each value is the ordered list of rules registered for that tool. The engine evaluates denyRules first, then askRules, then tool self-check, then allowRules; see the PermissionEngine javadoc for full ordering.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
A class in io.agentscope.core.permission that drives agent reasoning, tool calls and conversation execution.

方法摘要Method Summary

方法Method说明Description
public PermissionMode getMode()
获取模式。
Returns the mode.
public boolean isTrivial()
判断是否 `isTrivial`。
Whether this context is "trivial" — built from `Builder#build()` with no further customisation.
public Map<String, AdditionalWorkingDirectory> getWorkingDirectories()
获取 `getWorkingDirectories`。
Returns the working directories.
public Map<String, List<PermissionRule>> getAllowRules()
获取 `getAllowRules`。
Returns the allow rules.
public Map<String, List<PermissionRule>> getDenyRules()
获取拒绝规则。
Returns the deny rules.
public Map<String, List<PermissionRule>> getAskRules()
获取 `getAskRules`。
Returns the ask rules.
public static Builder builder()
static
返回构建器实例。
Returns the builder.
public PermissionContextState withMode(PermissionMode newMode)
执行使用模式相关操作。
Returns a copy of this context with the `PermissionMode` replaced and every working directory and rule preserved.
public boolean equals(Object o)
设置该参数。
Performs the equals operation.
public int hashCode()
返回 `hashCode` 结果。
Returns the hash code.
public String toString()
返回 `toString` 结果。
Returns the to string.

方法详情Method Detail

getMode

public PermissionMode getMode()

获取模式。

Returns the mode.

返回Returns PermissionMode
返回PermissionMode。Returns permission mode.
源码Source io/agentscope/core/permission/PermissionContextState.java:95–98

isTrivial

public boolean isTrivial()

判断是否 isTrivial。

Whether this context is "trivial" — built from Builder#build() with no further customisation.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/permission/PermissionContextState.java:106–113

getWorkingDirectories

public Map<String, AdditionalWorkingDirectory> getWorkingDirectories()

获取 getWorkingDirectories。

Returns the working directories.

返回Returns Map<String, AdditionalWorkingDirectory>
返回映射。Returns map.
源码Source io/agentscope/core/permission/PermissionContextState.java:115–118

getAllowRules

public Map<String, List<PermissionRule>> getAllowRules()

获取 getAllowRules。

Returns the allow rules.

返回Returns Map<String, List<PermissionRule>>
返回映射。Returns map.
源码Source io/agentscope/core/permission/PermissionContextState.java:120–123

getDenyRules

public Map<String, List<PermissionRule>> getDenyRules()

获取拒绝规则。

Returns the deny rules.

返回Returns Map<String, List<PermissionRule>>
返回映射。Returns map.
源码Source io/agentscope/core/permission/PermissionContextState.java:125–128

getAskRules

public Map<String, List<PermissionRule>> getAskRules()

获取 getAskRules。

Returns the ask rules.

返回Returns Map<String, List<PermissionRule>>
返回映射。Returns map.
源码Source io/agentscope/core/permission/PermissionContextState.java:130–133

builder

public static Builder builder()
static

返回构建器实例。

Returns the builder.

返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/permission/PermissionContextState.java:135–137

withMode

public PermissionContextState withMode(PermissionMode newMode)

执行使用模式相关操作。

Returns a copy of this context with the PermissionMode replaced and every working directory and rule preserved.

参数Parameters
名称Name类型Type说明Description
newModePermissionMode新建模式(类型 `PermissionMode`)。the mode the returned context should use
返回Returns PermissionContextState
返回PermissionContextState。a new context identical to this one except for its mode (returns `this` when the mode is unchanged)
源码Source io/agentscope/core/permission/PermissionContextState.java:148–159

equals

public boolean equals(Object o)

设置该参数。

Performs the equals operation.

参数Parameters
名称Name类型Type说明Description
oObjecto(类型 `Object`)。The o.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/permission/PermissionContextState.java:161–174

hashCode

public int hashCode()

返回 hashCode 结果。

Returns the hash code.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/permission/PermissionContextState.java:176–179

toString

public String toString()

返回 toString 结果。

Returns the to string.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/permission/PermissionContextState.java:181–194

嵌套类详情Nested Class Detail

Builder

public static final class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.core.permission 包。核心成员包括 mode、addWorkingDirectory、addAllowRule、addDenyRule、addAskRule、build。

A class in io.agentscope.core.permission that drives agent reasoning, tool calls and conversation execution. Declared in io.agentscope.core.permission.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.