chore: land tree view-state, vault, Pi module split, and repo hygiene
Persist PageTree expand state via control-plane view-state and align chevron/DOM with restored expansion; keep Sidex-style shallow page-tree scan and drop the unused recursive scanner that only added cargo noise. Add password vault workbench routes/runtime/skill/CLI, split page_ai_pi into a module package, and retire Hermes/ACP/OpenHub recycle + root harness evidence from the index while gitignoring recycle and local diag dumps. Archive superseded design/bugs docs under old/, point architecture at ARCHITECTURE.md, and refresh smokes for Pi S1–S7, vault, and editor regressions so the working tree can stay clean.
This commit is contained in:
@@ -28,6 +28,34 @@ export const createDocumentSessionRuntime = (dependencies = {}) => {
|
||||
const SESSION_RELEASE_DELAY_MS = 1200;
|
||||
const LOCAL_FOLDER_SELF_CHANGE_SUPPRESSIONS_KEY = 'mnote.localFolder.selfChangeSuppressions.v1';
|
||||
|
||||
const effectiveSessionReadOnly = (session) => Boolean(session?.permissionReadOnly || session?.userReadOnlyMode);
|
||||
|
||||
const applySessionPermissionReadOnly = (session, permissionReadOnly) => {
|
||||
if (!session) return false;
|
||||
session.permissionReadOnly = Boolean(permissionReadOnly);
|
||||
session.readOnly = effectiveSessionReadOnly(session);
|
||||
return session.readOnly;
|
||||
};
|
||||
|
||||
const setDocumentSessionUserReadOnlyMode = (session, userReadOnlyMode, source) => {
|
||||
if (!session) return false;
|
||||
session.userReadOnlyMode = Boolean(userReadOnlyMode);
|
||||
session.readOnly = effectiveSessionReadOnly(session);
|
||||
sessionViews(session).forEach((view) => {
|
||||
if (view.mountId == null) return;
|
||||
dispatchRuntimeCommand(view, {
|
||||
command: 'setEditable',
|
||||
documentId: session.documentId,
|
||||
workspaceId: session.workspaceId,
|
||||
title: session.title,
|
||||
readOnly: session.readOnly,
|
||||
editable: !session.readOnly,
|
||||
}, source || 'mnote-web-document-user-readonly-mode');
|
||||
});
|
||||
setSessionStatus(session, session.readOnly ? 'read-only' : 'editable');
|
||||
return session.readOnly;
|
||||
};
|
||||
|
||||
const ensureLocalFolderSelfChangeSuppressions = () => {
|
||||
const now = Date.now();
|
||||
const map = window.__mnoteLocalFolderSelfChangeSuppressions instanceof Map
|
||||
@@ -660,7 +688,7 @@ export const createDocumentSessionRuntime = (dependencies = {}) => {
|
||||
session.revision = nextRevision;
|
||||
session.conflictDetectionKey = nextConflictKey;
|
||||
session.lastExternalConflictDetectionKey = nextConflictKey || '';
|
||||
session.readOnly = Boolean(nextPermissions.readOnly);
|
||||
applySessionPermissionReadOnly(session, Boolean(nextPermissions.readOnly));
|
||||
session.dirty = false;
|
||||
session.hasExternalConflict = false;
|
||||
session.externalChangePending = false;
|
||||
@@ -1315,7 +1343,7 @@ export const createDocumentSessionRuntime = (dependencies = {}) => {
|
||||
session.revision = nextRevision;
|
||||
session.conflictDetectionKey = nextConflictKey;
|
||||
session.lastExternalConflictDetectionKey = nextConflictKey || '';
|
||||
session.readOnly = Boolean(nextPermissions.readOnly);
|
||||
applySessionPermissionReadOnly(session, Boolean(nextPermissions.readOnly));
|
||||
session.dirty = false;
|
||||
session.hasExternalConflict = false;
|
||||
session.lastUserInputAt = 0;
|
||||
@@ -1831,7 +1859,9 @@ export const createDocumentSessionRuntime = (dependencies = {}) => {
|
||||
lastExternalConflictDetectionKey: conflictDetectionKey || '',
|
||||
relativePath: localMarkdownRelativePathFromDocumentId(runtimeDescriptor.bootstrap.documentId),
|
||||
bufferDirtyState: 'Clean',
|
||||
readOnly: Boolean(permissions.readOnly),
|
||||
permissionReadOnly: Boolean(permissions.readOnly),
|
||||
userReadOnlyMode: true,
|
||||
readOnly: true,
|
||||
dirty: false,
|
||||
saving: false,
|
||||
hasExternalConflict: false,
|
||||
@@ -1849,6 +1879,7 @@ export const createDocumentSessionRuntime = (dependencies = {}) => {
|
||||
localFolderChannel: null,
|
||||
};
|
||||
ensureLocalFolderEventChannel(session);
|
||||
session.readOnly = effectiveSessionReadOnly(session);
|
||||
return session;
|
||||
};
|
||||
|
||||
@@ -1885,6 +1916,7 @@ export const createDocumentSessionRuntime = (dependencies = {}) => {
|
||||
sessionHasRecentLocalInput,
|
||||
sessionMatchesDocumentWorkspace,
|
||||
sessionViews,
|
||||
setDocumentSessionUserReadOnlyMode,
|
||||
setSessionStatus,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user