AS AgentScopeAPI 手册 / API Reference

JpaAgentVisibilityResolver

@Transactional(readOnly = true) public class JpaAgentVisibilityResolver implements AgentVisibilityResolver
源码Source io/agentscope/builder/web/share/JpaAgentVisibilityResolver.java:55–155

JPA 智能体 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 UserAgentDefinitionStore namespace.

  • Shared-in agents resolve by scanning other owners' namespaces and admitting the first entry on which AgentAclService#tierFor grants any tier (USER or WORKSPACE grantee).

Tier enforcement itself stays in AgentAccessGuard; this class only decides visibility and returns the definition.

构造器摘要Constructor Summary

构造器Constructor说明Description
public JpaAgentVisibilityResolver(AgentVersionEntityRepository versionRepository, AgentVersionService versionService, UserAgentDefinitionStore store, UserStore userStore, AgentAclService aclService)
初始化 `JpaAgentVisibilityResolver` 实例。
Creates a new instance.

方法摘要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.

参数Parameters
名称Name类型Type说明Description
versionRepositoryAgentVersionEntityRepository版本仓库(类型 `AgentVersionEntityRepository`)。The version repository.
versionServiceAgentVersionService版本服务(类型 `AgentVersionService`)。The version service.
storeUserAgentDefinitionStore存储实例(类型 `UserAgentDefinitionStore`)。The store.
userStoreUserStore用户存储(类型 `UserStore`)。The user store.
aclServiceAgentAclServiceacl 服务(类型 `AgentAclService`)。The acl service.
源码Source io/agentscope/builder/web/share/JpaAgentVisibilityResolver.java:64–75

方法详情Method Detail

findVisible

public Optional<AgentDefinition> findVisible(String userId, String agentId)

查找可见。

Finds the visible.

参数Parameters
名称Name类型Type说明Description
userIdString用户标识(类型 `String`)。The user id.
agentIdString智能体标识(类型 `String`)。The agent id.
返回Returns Optional<AgentDefinition>
返回可选。Returns optional.
源码Source io/agentscope/builder/web/share/JpaAgentVisibilityResolver.java:77–108
基于官方固定版本源码静态生成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.