Open-source, local-first AI agent for real work.
TypeScript agent-toolsai-agentbyokcoding-agentcross-platformdesktop-appdeveloper-toolselectronharnessknowledge-basellmwikilocal-firstmcpplugin-systemprivacy-firstskillstypescriptvettaworkflow-automation
/** ~/.vetta 存储概览与清理的跨进程合同。 */
/** 体积归属;`candidates` 里可手动清理的部分已从所属分组扣除,所有数字相加等于总量。 */
export const STORAGE_GROUP_IDS = [
"conversations",
"projects",
"knowledge",
"history",
"plugins",
"runtimes",
"app",
"other",
] as const;
export type StorageGroupId = (typeof STORAGE_GROUP_IDS)[number];
export type StorageCandidateKind =
| "npm-cache"
| "pip-cache"
| "app-cache"
| "dependencies"
| "npx-package"
| "python-venv"
| "build-output";
/** manual:规则就能判定,设置页可直接清;review:要结合上下文判断,只经 Vetta 提议、用户审批后清理。 */
export type StorageCandidateTier = "manual" | "review";
/** delete:可还原,直接删;trash:不保证能还原,只进系统废纸篓。 */
export type StorageDisposal = "delete" | "trash";
export type StorageBlockReason = "running-session" | "in-use" | "install-running" | "usage-unknown";
export interface StorageCandidate {
/** 由宿主生成;清理请求只认 id,不接受路径。 */
id: string;
kind: StorageCandidateKind;
group: StorageGroupId;
/** 相对 Vetta 数据目录,统一用 `/` 分隔。 */
path: string;
/** 所属对话或项目目录;缓存类没有。 */
owner?: string;
bytes: number;
lastActiveAt: number | null;
tier: StorageCandidateTier;
disposal: StorageDisposal;
/** 能还原时的命令;null 表示没有需要用户执行的命令。 */
restoreCommand: string | null;
/** 宿主看到的事实,供 Vetta 判断。 */
evidence: string[];
blocked?: StorageBlockReason;
}
export interface StorageOwnerUsage {
path: string;
group: "conversations" | "projects";
bytes: number;
lastActiveAt: number | null;
sessionPath?: string;
}
/** 目录里的一项;子项之和小于自身时,差额是没有单独列出的较小内容。 */
export interface StorageNode {
name: string;
bytes: number;
directory: boolean;
/** 只保留较大的子项,从大到小;依赖、产物和版本库不再展开。 */
children?: StorageNode[];
}
export interface StorageOwnerTree extends StorageOwnerUsage {
children: StorageNode[];
}
export interface StorageScan {
scannedAt: number;
/** 数据目录的绝对路径,用于在文件管理器中打开。 */
home: string;
totalBytes: number;
groups: { id: StorageGroupId; bytes: number }[];
candidates: StorageCandidate[];
/** 占用最大的对话与项目,从大到小。 */
largest: StorageOwnerUsage[];
/** 设置页逐层查看用;owners 是全部对话与项目,从大到小,totalBytes 是它们之和。 */
explorer: { totalBytes: number; owners: StorageOwnerTree[] };
}
export type StorageCleanFailure = StorageBlockReason | "not-found" | "changed" | "not-allowed" | "failed";
export interface StorageCleanItemResult {
id: string;
path: string;
bytes: number;
disposal: StorageDisposal;
ok: boolean;
reason?: StorageCleanFailure;
}
export interface StorageCleanResult {
/** 已经真正释放的体积;进废纸篓的不算在内。 */
freedBytes: number;
trashedBytes: number;
items: StorageCleanItemResult[];
}
/** 设置页直接清理的对话依赖至少要闲置这么久。 */
export const STORAGE_IDLE_DAYS = 14;