An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
import {TemplateEntry} from "./fileTree";
export const getTemplateActionEntry = (action: string, selected: TemplateEntry | undefined, editing: TemplateEntry | undefined) =>
["save", "preview", "source", "more"].includes(action) ? editing : selected;
export const getTemplateActionState = (action: string, selected: TemplateEntry | undefined, dirty: boolean, busy: boolean,
hasPreviewContext = true) => {
const packageMove = !!selected?.isPackage && ["rename", "move"].includes(action);
const disabled = (["save", "preview"].includes(action) && (!selected || selected.isDir)) ||
(action === "save" && !dirty) || (action === "preview" && !hasPreviewContext) || packageMove ||
(["rename", "move", "remove"].includes(action) && !selected);
// 忙碌状态仅影响操作可用性,不切换原生禁用样式。
return {disabled, ariaDisabled: busy || disabled, packageMove};
};