Class DefaultHistoryService
java.lang.Object
cloud.opencode.base.flow.internal.DefaultHistoryService
- All Implemented Interfaces:
HistoryService
Default
HistoryService implementation — delegates to the repository
with an optional engine-side authorisation check.
默认 HistoryService 实现 —— 委托给仓储并支持引擎侧鉴权。
R3 SEC P0-3: when a non-no-op CurrentUserProvider is wired,
timeline(String) / findByUser(String, int, int) /
findByTaskId(String) are restricted to participants of the
instance (initiator / current or past assignee). With
CurrentUserProvider.NO_OP the engine reverts to the legacy
permissive behaviour and assumes the host enforces auth on its API
boundary.
R3 SEC P0-3:装配真实 CurrentUserProvider 时
timeline/findByUser/findByTaskId 仅允许实例参与者读取;NO_OP 则维持兼容模式。
- Since:
- JDK 25, opencode-base-flow V1.0.5
- Author:
- Leon Soo
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct the service with no engine-level authz (legacy / test mode).DefaultHistoryService(FlowRepository repo, CurrentUserProvider currentUser) Construct the service with engine-level authz enforced via the givenCurrentUserProvider. -
Method Summary
Modifier and TypeMethodDescriptionfindByTaskId(String taskId) Returns the single history row tied to the given task id (if any).findByUser(String userId, int page, int size) Paginated history rows operated by the given user.Returns the full chronological timeline (earliest first) for an instance.
-
Constructor Details
-
DefaultHistoryService
Construct the service with no engine-level authz (legacy / test mode). 构造服务(无引擎级鉴权——兼容/测试模式)。- Parameters:
repo- persistence facade — 持久化门面- Since:
- JDK 25, opencode-base-flow V1.0.5
-
DefaultHistoryService
Construct the service with engine-level authz enforced via the givenCurrentUserProvider. 构造服务并启用引擎级鉴权。- Parameters:
repo- persistence facade — 持久化门面currentUser- current-user SPI — 当前用户 SPI- Since:
- JDK 25, opencode-base-flow V1.0.5
-
-
Method Details
-
timeline
Description copied from interface:HistoryServiceReturns the full chronological timeline (earliest first) for an instance. 返回实例的完整时间线(按时间升序)。- Specified by:
timelinein interfaceHistoryService- Parameters:
instanceId- instance id — 实例 ID- Returns:
- chronological history — 历史
-
findByUser
Description copied from interface:HistoryServicePaginated history rows operated by the given user. 分页查询某用户的历史记录。- Specified by:
findByUserin interfaceHistoryService- Parameters:
userId- operator user id — 操作人page- zero-based page — 页码(0 起)size- page size — 每页大小- Returns:
- history rows — 历史
-
findByTaskId
Description copied from interface:HistoryServiceReturns the single history row tied to the given task id (if any). 返回关联指定 task 的历史记录(若有)。- Specified by:
findByTaskIdin interfaceHistoryService- Parameters:
taskId- task id — 任务 ID- Returns:
- history row (Optional) — 历史记录(Optional)
-