类 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 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.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
-
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
-