Mastra.removeWorkspace()
.removeWorkspace() 方法从 Mastra 运行时注册表中移除 Workspace。传入 { destroy: true } 可在移除前销毁 Workspace。
使用示例使用示例的直接链接
await mastra.removeWorkspace('workspace-123', { destroy: true })
参数参数的直接链接
id:
string
要移除的 Workspace ID。
options?:
{ destroy?: boolean }
可选的清理行为。将
destroy 设为 true,可在移除 Workspace 前调用 workspace.destroy()。返回值返回值的直接链接
removed:
Promise<boolean>
成功移除 Workspace 时为
true。不存在具有该 ID 的 Workspace 时为 false。当 destroy 为 true 且 workspace.destroy() 抛出错误时,此调用会以该错误拒绝,Workspace 仍保持注册状态,以便调用方重试清理。