SessionFreshnessEvaluator
public final class SessionFreshnessEvaluator
源码Source
io/agentscope/harness/coding/session/SessionFreshnessEvaluator.java:36–92会话 Freshness 评估器,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.harness.coding.session 包。核心成员包括 evaluate。
Evaluates whether a session is still "fresh" based on its last activity time and the configured
SessionResetPolicy. Mirrors OpenClaw's evaluateSessionFreshness.
Two independent staleness criteria:
-
Daily reset: stale if
updatedAtis before the most recent daily boundary atpolicy.dailyResetHour()in the system default timezone. -
Idle timeout: stale if
nowexceedsupdatedAt + idleMinutes * 60_000.
If either criterion triggers, the session is considered stale (fresh = false).
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static SessionFreshness evaluate(long updatedAtMs, long nowMs, SessionResetPolicy policy)static | 执行 `evaluate` 方法。 Evaluates freshness of a session. |
方法详情Method Detail
evaluate
public static SessionFreshness evaluate(long updatedAtMs, long nowMs, SessionResetPolicy policy)
static
执行 evaluate 方法。
Evaluates freshness of a session.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
updatedAtMs | long | 已更新 At Ms(类型 `long`)。the session's last activity timestamp (epoch millis) |
nowMs | long | 当前时间 Ms(类型 `long`)。the current time (epoch millis) |
policy | SessionResetPolicy | 策略(类型 `SessionResetPolicy`)。the reset policy to apply |
SessionFreshness返回SessionFreshness。freshness evaluation result
源码Source
io/agentscope/harness/coding/session/SessionFreshnessEvaluator.java:48–76