JpaAgentVisibilityResolver
@Transactional(readOnly = true) public class JpaAgentVisibilityResolver implements AgentVisibilityResolver
io/agentscope/builder/web/share/JpaAgentVisibilityResolver.java:55–155JPA 智能体 Visibility 解析器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.share 包,实现 AgentVisibilityResolver。核心成员包括 findVisible、JpaAgentVisibilityResolver。
JPA-only AgentVisibilityResolver: a read view over the shared database, usable by any
plane that does not own the file-backed catalog (data plane, scheduler).
Declared as a plain class rather than a @Component so the control plane — which has
its own authoritative catalog-backed resolver — never ends up with two beans of this type.
Non-control planes declare it as a @Bean in their own configuration.
Visibility mirrors the control plane's catalog semantics without any file-backed state:
-
Global agents are detected by the presence of version rows under
AgentVersionService#GLOBAL_OWNER. The control plane materializes those rows at startup (ManagedAgentsMigrationRunner → AgentCatalogService#ensureGlobalVersions), so any agent the data plane can be asked to run already has one — sessions are created by the control plane before traffic reaches here. -
Own agents resolve from the caller's
UserAgentDefinitionStorenamespace. -
Shared-in agents resolve by scanning other owners' namespaces and admitting the first entry on which
AgentAclService#tierForgrants any tier (USER or WORKSPACE grantee).
Tier enforcement itself stays in AgentAccessGuard; this class only decides
visibility and returns the definition.
构造器摘要Constructor Summary
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Optional<AgentDefinition> findVisible(String userId, String agentId) | 查找可见。 Finds the visible. |
构造器详情Constructor Detail
JpaAgentVisibilityResolver
public JpaAgentVisibilityResolver(AgentVersionEntityRepository versionRepository, AgentVersionService versionService, UserAgentDefinitionStore store, UserStore userStore, AgentAclService aclService)
初始化 JpaAgentVisibilityResolver 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
versionRepository | AgentVersionEntityRepository | 版本仓库(类型 `AgentVersionEntityRepository`)。The version repository. |
versionService | AgentVersionService | 版本服务(类型 `AgentVersionService`)。The version service. |
store | UserAgentDefinitionStore | 存储实例(类型 `UserAgentDefinitionStore`)。The store. |
userStore | UserStore | 用户存储(类型 `UserStore`)。The user store. |
aclService | AgentAclService | acl 服务(类型 `AgentAclService`)。The acl service. |
io/agentscope/builder/web/share/JpaAgentVisibilityResolver.java:64–75方法详情Method Detail
findVisible
public Optional<AgentDefinition> findVisible(String userId, String agentId)
查找可见。
Finds the visible.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
Optional<AgentDefinition>io/agentscope/builder/web/share/JpaAgentVisibilityResolver.java:77–108