Workspace 文件管理

wesgine Workspace Handle:文件上传、下载、列表与 GC。


Workspace API

方法路径说明
GET/workspace/files文件列表(?actor=&path=&depth=)
GET/workspace/file下载文件(?actor=&path=)
POST/workspace/upload上传文件(?actor=&path=,raw body)
DELETE/workspace/file删除文件(?actor=&path=)
GET/workspace/stats使用统计(?actor=)
POST/workspace/gc触发 GC
DELETE/workspace/delete-by-prefix按前缀批量删除(?actor=&prefix=)

SDK API

cell.Workspace().List(ctx, actor, path, depth)
cell.Workspace().Download(ctx, actor, path)
cell.Workspace().Upload(ctx, actor, path, reader)
cell.Workspace().Delete(ctx, actor, path)
cell.Workspace().Stats(ctx, actor)
cell.Workspace().GC(ctx)
cell.Workspace().DeleteByPrefix(ctx, actor, prefix)

物理位置

{CellDataDir}/workspace/{actor}/

Actor 独立目录,满足 AX-1 隔离。


与 Memory Handle 的关系

cell.Workspace() 与 cell.Memory() 对等:

Handle管理对象
cell.Memory()结构化记忆条目
cell.Workspace()文件产物

Export 行为

Cell Export 默认包含 workspace/。

ExportOpts{SkipWorkspace: true}  // 可排除

.scratch/ 永不包含。


GC 策略

POST /workspace/gc 清理孤立文件。

工具产出的临时文件在 Run 结束后由引擎 GC。


相关文档