An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
export interface ISubElementLifecycleState {
subElement?: HTMLElement;
subElementCloseCB?: (() => void) | null;
subElementResizeCB?: (() => void) | null;
}
export const SELECTION_TOOLBAR_SUB_ELEMENT_SOURCE = "selection-toolbar";
export const setSubElementSource = (state: ISubElementLifecycleState, source?: string) => {
if (!state.subElement) {
return;
}
if (source) {
state.subElement.dataset.subElementSource = source;
} else {
delete state.subElement.dataset.subElementSource;
}
};
export const closeSubElement = (state: ISubElementLifecycleState) => {
const closeCallback = state.subElementCloseCB;
state.subElementCloseCB = undefined;
state.subElementResizeCB = undefined;
setSubElementSource(state);
closeCallback?.();
};