Storage
Storage 被注入到 Agent 运行时。
ts
import { memoryStorage, type Storage, type Message } from "duclaw-cli/sdk";Storage<T>
使用 storage contract 提供消息历史或运行时状态。
ts
const storage = memoryStorage<Message[]>();memoryStorage() 创建的是进程内的 Map<string, T>。数据只在当前 JavaScript 进程生命周期内存在,进程重启后会丢失。
Runtime Storage
memoryStorage() 是通用 SDK 在示例、测试和短生命周期本地 Agent 中的默认选择。产品运行时如果需要持久化、跨进程共享或生产级可靠性,应注入自己的 Storage<T> 实现。
ts
const agent = createAgent({
system,
model,
storage: memoryStorage<Message[]>(),
tools,
});Duclaw 产品 storage 仍属于 Duclaw preset path。