export interface KbxWorkspaceLifecycle {
  save?: () => boolean | Promise<boolean>
}
const registry = new Map<string,KbxWorkspaceLifecycle>()
export function registerWorkspaceLifecycle(path:string, lifecycle:KbxWorkspaceLifecycle){ registry.set(path,lifecycle); return () => registry.delete(path) }
export async function requestWorkspaceSave(path:string):Promise<boolean>{ const handler=registry.get(path)?.save; return handler ? await handler() : false }
export function canWorkspaceSave(path:string){ return Boolean(registry.get(path)?.save) }
