AgentAccessGuard
@Service public class AgentAccessGuard
io/agentscope/builder/web/share/AgentAccessGuard.java:33–76智能体访问守卫,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.share 包。核心成员包括 require、load、AgentAccessGuard。
Convenience gate for controllers: resolve an agent by id (across globals, own, shared-in) and
verify the caller holds at least the required tier. Keeps the findVisible + can pattern
out of every controller while staying explicit at the call site (no AOP magic).
Visibility resolution is delegated to the plane-local AgentVisibilityResolver
(catalog service in the control plane, a JPA read view in the data plane) so this guard stays
usable from both planes without a cross-plane Maven dependency.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public AgentAccessGuard(AgentVisibilityResolver visibilityResolver, AgentAclService acl) | 初始化 `AgentAccessGuard` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public AgentDefinition require(String userId, String agentId, Tier required) | 执行 `require` 方法。 Resolves the agent and returns it iff `userId` holds at least `required`. |
public AgentDefinition load(String userId, String agentId) | 从持久化存储恢复数据。 Get the agent without enforcing a tier (404 if invisible). |
构造器详情Constructor Detail
AgentAccessGuard
public AgentAccessGuard(AgentVisibilityResolver visibilityResolver, AgentAclService acl)
初始化 AgentAccessGuard 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
visibilityResolver | AgentVisibilityResolver | visibility 解析器(类型 `AgentVisibilityResolver`)。The visibility resolver. |
acl | AgentAclService | acl(类型 `AgentAclService`)。The acl. |
io/agentscope/builder/web/share/AgentAccessGuard.java:39–42方法详情Method Detail
require
public AgentDefinition require(String userId, String agentId, Tier required)
执行 require 方法。
Resolves the agent and returns it iff userId holds at least required.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
required | Tier | 必填(类型 `Tier`)。The required. |
AgentDefinitionResponseStatusException可能抛出 `ResponseStatusException`。404 if the agent is invisible to the user, 403 if visible but below the required tier.
io/agentscope/builder/web/share/AgentAccessGuard.java:50–65load
public AgentDefinition load(String userId, String agentId)
从持久化存储恢复数据。
Get the agent without enforcing a tier (404 if invisible).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
AgentDefinitionio/agentscope/builder/web/share/AgentAccessGuard.java:68–75