RemoteFilesystem
public class RemoteFilesystem implements AbstractFilesystem
io/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:66–737远程文件系统,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.agent.filesystem.remote 包,实现 AbstractFilesystem。核心成员包括 withIndex、ls、read、write、edit、grep。
AbstractFilesystem backed by a BaseStore (persistent, cross-thread).
Files are organized via namespaces and persist across threads/sessions. The namespace can be
static (fixed at construction time) or dynamic (resolved at every operation via a NamespaceFactory).
Dynamic namespace example:
`RemoteFilesystem fs = new RemoteFilesystem(store,
() -> List.of("sessions", sessionIdSupplier.get(), "filesystem"));
`
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public RemoteFilesystem(BaseStore store, NamespaceFactory namespaceFactory) | 初始化 `RemoteFilesystem` 实例。 Creates a RemoteFilesystem with a `NamespaceFactory` that is called on every operation,
allowing the namespace to vary based on runtime context. |
public RemoteFilesystem(BaseStore store, List<String> namespace) | 初始化 `RemoteFilesystem` 实例。 Creates a RemoteFilesystem with a fixed namespace. |
public RemoteFilesystem(BaseStore store) | 创建RemoteFilesystem 使用默认"文件系统"命名空间。 Creates a RemoteFilesystem with a default "filesystem" namespace. |
方法摘要Method Summary
构造器详情Constructor Detail
RemoteFilesystem
public RemoteFilesystem(BaseStore store, NamespaceFactory namespaceFactory)
初始化 RemoteFilesystem 实例。
Creates a RemoteFilesystem with a NamespaceFactory that is called on every operation, allowing the namespace to vary based on runtime context.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | BaseStore | 存储到使用用于持久化。the store to use for persistence |
namespaceFactory | NamespaceFactory | 命名空间工厂(类型 `NamespaceFactory`)。factory that returns the namespace tuple per operation |
io/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:85–94RemoteFilesystem
public RemoteFilesystem(BaseStore store, List<String> namespace)
初始化 RemoteFilesystem 实例。
Creates a RemoteFilesystem with a fixed namespace.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | BaseStore | 存储到使用用于持久化。the store to use for persistence |
namespace | List<String> | 命名空间(类型 `List`)。the namespace tuple for organizing files |
io/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:102–104RemoteFilesystem
public RemoteFilesystem(BaseStore store)
创建RemoteFilesystem 使用默认"文件系统"命名空间。
Creates a RemoteFilesystem with a default "filesystem" namespace.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | BaseStore | 存储到使用用于持久化。the store to use for persistence |
io/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:111–113方法详情Method Detail
withIndex
public RemoteFilesystem withIndex(WorkspaceIndex index)
执行使用索引相关操作。
Attaches a best-effort WorkspaceIndex to accelerate list/glob/exists/grep operations.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
index | WorkspaceIndex | 索引(类型 `WorkspaceIndex`)。workspace index; `null` disables index-backed fast paths |
RemoteFilesystemio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:135–138ls
public LsResult ls(RuntimeContext runtimeContext, String path)
执行 ls 方法。
Performs the ls operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
path | String | 路径(类型 `String`)。The path. |
LsResultio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:156–215read
public ReadResult read(RuntimeContext runtimeContext, String filePath, int offset, int limit)
执行读取相关操作。
Performs the read operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
filePath | String | 文件路径(类型 `String`)。The file path. |
offset | int | 偏移量(类型 `int`)。The offset. |
limit | int | 数量上限(类型 `int`)。The limit. |
ReadResultio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:217–261write
public WriteResult write(RuntimeContext runtimeContext, String filePath, String content)
执行写入相关操作。
Performs the write operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
filePath | String | 文件路径(类型 `String`)。The file path. |
content | String | 内容(类型 `String`)。The content. |
WriteResultio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:263–277edit
public EditResult edit(RuntimeContext runtimeContext, String filePath, String oldString, String newString, boolean replaceAll)
执行 edit 方法。
Performs the edit operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
filePath | String | 文件路径(类型 `String`)。The file path. |
oldString | String | 旧的 String(类型 `String`)。The old string. |
newString | String | 新建 String(类型 `String`)。The new string. |
replaceAll | boolean | replace 所有(类型 `boolean`)。The replace all. |
EditResultio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:282–330grep
public GrepResult grep(RuntimeContext runtimeContext, String pattern, String path, String glob)
执行 grep 方法。
Performs the grep operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
pattern | String | pattern(类型 `String`)。The pattern. |
path | String | 路径(类型 `String`)。The path. |
glob | String | glob(类型 `String`)。The glob. |
GrepResultio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:332–417glob
public GlobResult glob(RuntimeContext runtimeContext, String pattern, String path)
执行 glob 方法。
Performs the glob operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
pattern | String | pattern(类型 `String`)。The pattern. |
path | String | 路径(类型 `String`)。The path. |
GlobResultio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:419–495uploadFiles
public List<FileUploadResponse> uploadFiles(RuntimeContext runtimeContext, List<Map.Entry<String, byte[]>> files)
执行上传文件相关操作。
Performs the upload files operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
files | List<Map.Entry<String, byte[]>> | 文件(类型 `List >`)。The files. |
List<FileUploadResponse>io/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:497–531downloadFiles
public List<FileDownloadResponse> downloadFiles(RuntimeContext runtimeContext, List<String> paths)
执行下载文件相关操作。
Performs the download files operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
paths | List<String> | paths(类型 `List`)。The paths. |
List<FileDownloadResponse>io/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:533–560exists
public boolean exists(RuntimeContext runtimeContext, String path)
判断数据是否存在。
Performs the exists operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
path | String | 路径(类型 `String`)。The path. |
booleanio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:562–592delete
public WriteResult delete(RuntimeContext runtimeContext, String path)
删除数据。
Performs the delete operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
path | String | 路径(类型 `String`)。The path. |
WriteResultio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:595–611move
public WriteResult move(RuntimeContext runtimeContext, String fromPath, String toPath)
执行 move 方法。
Performs the move operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
fromPath | String | 来自路径(类型 `String`)。The from path. |
toPath | String | 到路径(类型 `String`)。The to path. |
WriteResultio/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java:613–638