类 ToolContextState
java.lang.Object
io.agentscope.core.state.ToolContextState
Read-cache backing for file-touching tools (Read / Write / Edit).
Maintains an ordered LRU list of ReadCacheEntry bounded by both entry count and
total bytes. Cache reads are validated against the file's current mtime; stale entries are
evicted on access. All filesystem interaction runs on Schedulers.boundedElastic() so
Reactor's non-blocking schedulers are never blocked.
Only configuration fields (maxCacheFiles, maxCacheBytes,
activatedGroups) participate in JSON serialization. The in-memory LRU cache itself is
runtime state and is reconstructed empty on deserialization.
-
嵌套类概要
嵌套类修饰符和类型类说明static final classstatic final recordSerializable metadata for a spawned subagent, persisted alongside the parent agent's state so thatagent_sendcan lazily rebuild the liveAgentinstance after session restore or on a different replica. -
方法概要
修饰符和类型方法说明static ToolContextState.Builderbuilder()reactor.core.publisher.Mono<Void> InsertlinesforfilePathinto the cache, evicting older entries to satisfy bothmaxCacheFilesandmaxCacheBytes.reactor.core.publisher.Mono<Optional<ReadCacheEntry>> Look up the cached entry forfilePath.doubleintSnapshot of the cache list at call time.voidputSpawnEntry(String key, ToolContextState.SpawnEntry entry) Register a spawned subagent entry so it survives session restore and cross-replica routing.voidremoveSpawnEntry(String key) Remove a spawn entry by key.voidsetActivatedGroups(List<String> groups) Replace the activated tool groups with the given list.
-
方法详细资料
-
getMaxCacheFiles
public int getMaxCacheFiles() -
getMaxCacheBytes
public double getMaxCacheBytes() -
getReadFileCache
Snapshot of the cache list at call time. Modifications do not affect the live cache. -
getActivatedGroups
-
setActivatedGroups
Replace the activated tool groups with the given list.- 参数:
groups- the new activated groups;nullclears the list
-
getSpawnRegistry
-
putSpawnEntry
Register a spawned subagent entry so it survives session restore and cross-replica routing.- 参数:
key- the agent key (e.g.agent:general-purpose:uuid)entry- the serializable spawn metadata
-
removeSpawnEntry
Remove a spawn entry by key. -
getCache
Look up the cached entry forfilePath. Evicts and returns empty if the file's mtime has changed or the file no longer exists. -
cacheFile
InsertlinesforfilePathinto the cache, evicting older entries to satisfy bothmaxCacheFilesandmaxCacheBytes. If the file's mtime is unavailable the insert is silently skipped. -
builder
-