CoordinationStore
public interface CoordinationStore
io/agentscope/builder/web/coord/CoordinationStore.java:30–210定义 Coordination 存储契约的接口。位于 io.agentscope.builder.web.coord 包。核心成员包括 tryAcquireTurnLease、heartbeatTurnLease、releaseTurnLease、getTurnLease、listExpiredTurnLeases、requestTurnInterrupt。
Shared coordination plane for multi-replica Brain / Hands workers.
Authoritative business state stays in JPA session/event tables. This store holds short-lived leases, work-queue rows, HITL tickets, and sandbox-ready metadata. Default implementation is JDBC; operators may replace the bean with a Redis-backed store.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
LeaseHandle | 记录record | 承载 Lease Handle数据的记录类型。 Opaque turn-lease snapshot. |
TurnInterruptRequest | 记录record | 承载轮次中断请求数据的记录类型。 A record in io.agentscope.builder.web.coord that carries data used when components deploys, schedules and serves agents. |
HitlTicket | 记录record | 承载 Hitl Ticket数据的记录类型。 HITL confirmation ticket shared across Brain replicas. |
HitlDecisionFence | 记录record | 承载 Hitl 决策 Fence数据的记录类型。 Full correlation fence required to decide a managed AgentTask confirmation. |
HitlResolution | 记录record | 承载 Hitl Resolution数据的记录类型。 Atomic decision result; `changed=false` identifies a safe idempotent replay. |
WorkItemRecord | 记录record | 承载 Work 条目记录数据的记录类型。 Durable hands work-queue row. |
WorkStats | 记录record | 承载 Work Stats数据的记录类型。 Per-environment work-queue counters. |
SandboxReadyMeta | 记录record | 承载沙箱就绪元数据数据的记录类型。 Metadata that a worker has a sandbox ready for a session (object stays local). |
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
WORK_STALE_THRESHOLD | Duration | WORK 过期阈值字段。 Stale threshold for reclaiming starting/active work items during poll. |
方法摘要Method Summary
字段详情Field Detail
WORK_STALE_THRESHOLD
Duration WORK_STALE_THRESHOLD
WORK 过期阈值字段。声明为 Duration WORK_STALE_THRESHOLD。
Stale threshold for reclaiming starting/active work items during poll.
io/agentscope/builder/web/coord/CoordinationStore.java:33方法详情Method Detail
tryAcquireTurnLease
public Optional<LeaseHandle> tryAcquireTurnLease(String sessionId, String ownerId, String instanceId, Duration ttl)
执行 tryAcquireTurnLease 方法。
Attempts to acquire the turn lease for sessionId.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
instanceId | String | 实例标识(类型 `String`)。The instance id. |
ttl | Duration | 存活时间(类型 `Duration`)。The ttl. |
Optional<LeaseHandle>io/agentscope/builder/web/coord/CoordinationStore.java:41–42heartbeatTurnLease
public boolean heartbeatTurnLease(String sessionId, String instanceId, Duration ttl)
执行 heartbeatTurnLease 方法。
Extends TTL when instanceId still owns the lease.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
instanceId | String | 实例标识(类型 `String`)。The instance id. |
ttl | Duration | 存活时间(类型 `Duration`)。The ttl. |
booleanio/agentscope/builder/web/coord/CoordinationStore.java:45releaseTurnLease
public boolean releaseTurnLease(String sessionId, String instanceId)
执行 releaseTurnLease 方法。
Releases the lease when owned by instanceId.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
instanceId | String | 实例标识(类型 `String`)。The instance id. |
booleanio/agentscope/builder/web/coord/CoordinationStore.java:48getTurnLease
public Optional<LeaseHandle> getTurnLease(String sessionId)
获取 getTurnLease。
Returns the turn lease.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Optional<LeaseHandle>io/agentscope/builder/web/coord/CoordinationStore.java:50listExpiredTurnLeases
public List<LeaseHandle> listExpiredTurnLeases(long nowMillis)
列出 listExpiredTurnLeases。
Lists turn leases whose expiresAt is before nowMillis.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
nowMillis | long | 当前时间毫秒(类型 `long`)。The now millis. |
List<LeaseHandle>io/agentscope/builder/web/coord/CoordinationStore.java:53requestTurnInterrupt
public void requestTurnInterrupt(String sessionId, String reason)
执行请求轮次中断相关操作。
Records an interrupt request for sessionId.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
reason | String | 原因(类型 `String`)。The reason. |
io/agentscope/builder/web/coord/CoordinationStore.java:61requestFencedTurnInterrupt
public void requestFencedTurnInterrupt(String sessionId, String reason, String fenceToken)
执行 requestFencedTurnInterrupt 方法。
Records a managed-attempt interrupt that only the matching turn may consume.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
reason | String | 原因(类型 `String`)。The reason. |
fenceToken | String | fence 令牌(类型 `String`)。The fence token. |
io/agentscope/builder/web/coord/CoordinationStore.java:64consumeTurnInterrupt
public Optional<String> consumeTurnInterrupt(String sessionId)
设置消费轮次中断。
Atomically consumes a pending interrupt for sessionId, returning the reason when one was present.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Optional<String>io/agentscope/builder/web/coord/CoordinationStore.java:70consumeTurnInterruptRequest
public Optional<TurnInterruptRequest> consumeTurnInterruptRequest(String sessionId)
设置消费轮次中断请求。
Performs the consume turn interrupt request operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Optional<TurnInterruptRequest>io/agentscope/builder/web/coord/CoordinationStore.java:72tryAcquireFireLease
public boolean tryAcquireFireLease(String deploymentId, String fireWindow, String instanceId, Duration ttl)
执行 tryAcquireFireLease 方法。
One-shot fire window lease; returns true if this instance won the window.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
deploymentId | String | 部署标识(类型 `String`)。The deployment id. |
fireWindow | String | fire Window(类型 `String`)。The fire window. |
instanceId | String | 实例标识(类型 `String`)。The instance id. |
ttl | Duration | 存活时间(类型 `Duration`)。The ttl. |
booleanio/agentscope/builder/web/coord/CoordinationStore.java:77–78putHitlTicket
public HitlTicket putHitlTicket(HitlTicket ticket)
设置该参数。
Inserts an immutable ticket or returns the identical existing ticket.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ticket | HitlTicket | ticket(类型 `HitlTicket`)。The ticket. |
HitlTicketio/agentscope/builder/web/coord/CoordinationStore.java:83getHitlTicket
public Optional<HitlTicket> getHitlTicket(String sessionId, String toolUseId)
获取 getHitlTicket。
Finds the newest ticket for direct-session routing; managed resolve uses fenced overload.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
toolUseId | String | 工具使用标识(类型 `String`)。The tool use id. |
Optional<HitlTicket>io/agentscope/builder/web/coord/CoordinationStore.java:86getHitlTicket
public Optional<HitlTicket> getHitlTicket(HitlDecisionFence fence)
获取 getHitlTicket。
Returns the hitl ticket.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
fence | HitlDecisionFence | fence(类型 `HitlDecisionFence`)。The fence. |
Optional<HitlTicket>io/agentscope/builder/web/coord/CoordinationStore.java:88resolveHitlTicket
public Optional<HitlResolution> resolveHitlTicket(HitlDecisionFence fence, String resolutionStatus, long decisionVersion, boolean allow, String denyMessage, long resolvedAt)
解析 resolveHitlTicket。
Sets allow/deny after validating the complete immutable execution fence.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
fence | HitlDecisionFence | fence(类型 `HitlDecisionFence`)。The fence. |
resolutionStatus | String | resolution 状态(类型 `String`)。The resolution status. |
decisionVersion | long | 决策版本(类型 `long`)。The decision version. |
allow | boolean | allow(类型 `boolean`)。The allow. |
denyMessage | String | 拒绝消息(类型 `String`)。The deny message. |
resolvedAt | long | 已解析 At(类型 `long`)。The resolved at. |
Optional<HitlResolution>io/agentscope/builder/web/coord/CoordinationStore.java:95–101expireHitlTicket
public Optional<HitlResolution> expireHitlTicket(String sessionId, String toolUseId, long expiredAt)
执行 expireHitlTicket 方法。
Atomically denies a still-pending ticket once its deadline has passed.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
toolUseId | String | 工具使用标识(类型 `String`)。The tool use id. |
expiredAt | long | 已过期 At(类型 `long`)。The expired at. |
Optional<HitlResolution>io/agentscope/builder/web/coord/CoordinationStore.java:104markHitlContinuationReady
public boolean markHitlContinuationReady(HitlDecisionFence fence)
设置该参数。
Marks side effects complete so a polling continuation may safely resume.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
fence | HitlDecisionFence | fence(类型 `HitlDecisionFence`)。The fence. |
booleanio/agentscope/builder/web/coord/CoordinationStore.java:107deleteHitlTicket
public void deleteHitlTicket(String sessionId, String toolUseId)
删除 deleteHitlTicket。
Deletes the hitl ticket.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
toolUseId | String | 工具使用标识(类型 `String`)。The tool use id. |
io/agentscope/builder/web/coord/CoordinationStore.java:109deleteHitlTicketsBySession
public void deleteHitlTicketsBySession(String sessionId)
删除 deleteHitlTicketsBySession。
Deletes the hitl tickets by session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/builder/web/coord/CoordinationStore.java:111deleteResolvedHitlTicketsBefore
public long deleteResolvedHitlTicketsBefore(long expiresAtCutoff)
删除 deleteResolvedHitlTicketsBefore。
Deletes the resolved hitl tickets before.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
expiresAtCutoff | long | 过期 At Cutoff(类型 `long`)。The expires at cutoff. |
longio/agentscope/builder/web/coord/CoordinationStore.java:113listExpiredHitlTickets
public List<HitlTicket> listExpiredHitlTickets(long nowMillis)
列出 listExpiredHitlTickets。
Lists the expired hitl tickets.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
nowMillis | long | 当前时间毫秒(类型 `long`)。The now millis. |
List<HitlTicket>io/agentscope/builder/web/coord/CoordinationStore.java:115enqueueWork
public WorkItemRecord enqueueWork(String sessionId, String environmentId, String ownerId)
执行 enqueueWork 方法。
Performs the enqueue work operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
environmentId | String | 环境标识(类型 `String`)。The environment id. |
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
WorkItemRecordio/agentscope/builder/web/coord/CoordinationStore.java:119claimWork
public Optional<WorkItemRecord> claimWork(String environmentId, String workerId, long timeoutMs) throws InterruptedException
执行 claimWork 方法。
Performs the claim work operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
workerId | String | 工作进程标识(类型 `String`)。The worker id. |
timeoutMs | long | 超时 Ms(类型 `long`)。The timeout ms. |
Optional<WorkItemRecord>InterruptedException可能抛出 `InterruptedException`。Thrown when the operation cannot be completed.
io/agentscope/builder/web/coord/CoordinationStore.java:121–122ackWork
public void ackWork(String leaseId, String workerId, String workDir)
执行 ackWork 方法。
Performs the ack work operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leaseId | String | lease 标识(类型 `String`)。The lease id. |
workerId | String | 工作进程标识(类型 `String`)。The worker id. |
workDir | String | work 目录(类型 `String`)。The work dir. |
io/agentscope/builder/web/coord/CoordinationStore.java:124stopWork
public void stopWork(String leaseId)
停止 stopWork。
Stops the work.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leaseId | String | lease 标识(类型 `String`)。The lease id. |
io/agentscope/builder/web/coord/CoordinationStore.java:126heartbeatWork
public void heartbeatWork(String leaseId)
设置该参数。
Performs the heartbeat work operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leaseId | String | lease 标识(类型 `String`)。The lease id. |
io/agentscope/builder/web/coord/CoordinationStore.java:128getWork
public Optional<WorkItemRecord> getWork(String leaseId)
获取 getWork。
Returns the work.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leaseId | String | lease 标识(类型 `String`)。The lease id. |
Optional<WorkItemRecord>io/agentscope/builder/web/coord/CoordinationStore.java:130listWork
public List<WorkItemRecord> listWork(String environmentId, String statusFilter)
列出 listWork。
Lists the work.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
statusFilter | String | 状态过滤器(类型 `String`)。The status filter. |
List<WorkItemRecord>io/agentscope/builder/web/coord/CoordinationStore.java:132workStats
public WorkStats workStats(String environmentId)
设置该参数。
Performs the work stats operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
WorkStatsio/agentscope/builder/web/coord/CoordinationStore.java:134workerHeartbeat
public void workerHeartbeat(String workerId, String capabilitiesJson)
执行工作进程心跳相关操作。
Performs the worker heartbeat operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
workerId | String | 工作进程标识(类型 `String`)。The worker id. |
capabilitiesJson | String | 能力 JSON(类型 `String`)。The capabilities json. |
io/agentscope/builder/web/coord/CoordinationStore.java:136workerHeartbeats
public Map<String, Long> workerHeartbeats()
返回 workerHeartbeats 结果。
Returns the worker heartbeats.
Map<String, Long>io/agentscope/builder/web/coord/CoordinationStore.java:138pendingWorkCount
public int pendingWorkCount()
返回 pendingWorkCount 结果。
Returns the pending work count.
intio/agentscope/builder/web/coord/CoordinationStore.java:140getSandboxReady
public Optional<SandboxReadyMeta> getSandboxReady(String sessionId)
获取沙箱就绪。
Returns the sandbox ready.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Optional<SandboxReadyMeta>io/agentscope/builder/web/coord/CoordinationStore.java:142clearSandboxReady
public void clearSandboxReady(String sessionId)
清空沙箱就绪。
Clears the sandbox ready.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/builder/web/coord/CoordinationStore.java:144嵌套类详情Nested Class Detail
LeaseHandle
record LeaseHandle( String sessionId, String ownerId, String instanceId, long acquiredAt, long expiresAt)承载 Lease Handle数据的记录类型。位于 io.agentscope.builder.web.coord 包。核心成员包括 sessionId、ownerId、instanceId、acquiredAt、expiresAt。
Opaque turn-lease snapshot.
TurnInterruptRequest
record TurnInterruptRequest(String reason, String fenceToken)承载轮次中断请求数据的记录类型。位于 io.agentscope.builder.web.coord 包。核心成员包括 reason、fenceToken。
A record in io.agentscope.builder.web.coord that carries data used when components deploys, schedules and serves agents. Declared in io.agentscope.builder.web.coord.
HitlTicket
record HitlTicket( String toolUseId, String sessionId, String ownerId, String approvalId, String agentTaskId, String attemptId, long dispatchGeneration, String turnId, String continuationLeaseId, String toolName, String inputJson, String resolutionStatus, long decisionVersion, Boolean resolvedAllow, String denyMessage, long createdAt, long expiresAt, Long resolvedAt, boolean continuationReady)承载 Hitl Ticket数据的记录类型。位于 io.agentscope.builder.web.coord 包。核心成员包括 toolUseId、sessionId、ownerId、approvalId、agentTaskId、attemptId。
HITL confirmation ticket shared across Brain replicas.
HitlDecisionFence
record HitlDecisionFence( String sessionId, String toolUseId, String approvalId, String agentTaskId, String attemptId, long dispatchGeneration, String turnId)承载 Hitl 决策 Fence数据的记录类型。位于 io.agentscope.builder.web.coord 包。核心成员包括 sessionId、toolUseId、approvalId、agentTaskId、attemptId、dispatchGeneration。
Full correlation fence required to decide a managed AgentTask confirmation.
HitlResolution
record HitlResolution(HitlTicket ticket, boolean changed)承载 Hitl Resolution数据的记录类型。位于 io.agentscope.builder.web.coord 包。核心成员包括 ticket、changed。
Atomic decision result; changed=false identifies a safe idempotent replay.
WorkItemRecord
record WorkItemRecord( String leaseId, String sessionId, String environmentId, String ownerId, String status, String claimedBy, String workDir, long createdAt, long updatedAt)承载 Work 条目记录数据的记录类型。位于 io.agentscope.builder.web.coord 包。核心成员包括 leaseId、sessionId、environmentId、ownerId、status、claimedBy。
Durable hands work-queue row.
WorkStats
record WorkStats(Map<String, Long> countsByStatus, Long oldestQueuedAgeMs)承载 Work Stats数据的记录类型。位于 io.agentscope.builder.web.coord 包。核心成员包括 countsByStatus、oldestQueuedAgeMs。
Per-environment work-queue counters.
SandboxReadyMeta
record SandboxReadyMeta( String sessionId, String workerId, String workDir, String leaseId, long readyAt)承载沙箱就绪元数据数据的记录类型。位于 io.agentscope.builder.web.coord 包。核心成员包括 sessionId、workerId、workDir、leaseId、readyAt。
Metadata that a worker has a sandbox ready for a session (object stays local).