mindspace: close authority boundaries

This commit is contained in:
john
2026-07-27 15:34:35 +08:00
parent dfab78c75a
commit e94052ff24
78 changed files with 11962 additions and 2162 deletions
+15 -41
View File
@@ -5,11 +5,6 @@ import {
assertMindSpaceServerAdapterContract,
createMindSpaceServerAdapter,
} from '../mindspace-server-adapter.mjs';
import {
resolveMindSpaceRuntimeConfig,
} from '../mindspace-runtime-config.mjs';
import { createWorkspacePageDeliverService } from '../mindspace-workspace-page-deliver.mjs';
import { ensurePageDataHtmlPagesBound } from '../page-data-workspace-ensure.mjs';
import { createPageDataPublicService } from '../page-data-public-service.mjs';
import { createPageDataService } from '../page-data-service.mjs';
import {
@@ -43,7 +38,6 @@ export async function bootstrapPortalDomainServices({
getUserAuth = () => null,
getSessionSnapshotService = () => null,
onMindSearchSchemaReady = () => {},
registerPublicHtmlArtifactsForConversation,
workspaceMaintenanceEnabled = true,
logger = console,
initSchemaFn = initSchema,
@@ -61,12 +55,6 @@ export async function bootstrapPortalDomainServices({
createMindSpaceServerAdapter,
assertMindSpaceServerAdapterContractFn =
assertMindSpaceServerAdapterContract,
createWorkspacePageDeliverServiceFn =
createWorkspacePageDeliverService,
ensurePageDataHtmlPagesBoundFn =
ensurePageDataHtmlPagesBound,
resolveMindSpaceRuntimeConfigFn =
resolveMindSpaceRuntimeConfig,
ensureAlgorithmConfigFn = ensureAlgorithmConfig,
loadAlgorithmConfigFn = loadAlgorithmConfig,
createPlazaRedisFn = createPlazaRedis,
@@ -89,15 +77,6 @@ export async function bootstrapPortalDomainServices({
'bootstrapPortalDomainServices requires pool and runtime',
);
}
if (
typeof registerPublicHtmlArtifactsForConversation !==
'function'
) {
throw new Error(
'bootstrapPortalDomainServices requires artifact registration',
);
}
const mindSearchConfigService =
createMindSearchConfigServiceFn(pool);
await mindSearchConfigService.ensureSchema();
@@ -175,7 +154,6 @@ export async function bootstrapPortalDomainServices({
getUserAuth().resolveWorkingDir(userId),
resolveSessionSnapshot: (sessionId) =>
getSessionSnapshotService()?.get?.(sessionId),
registerPublicHtmlArtifactsForConversation,
syncWorkspaceAssetsEnabled:
workspaceMaintenanceEnabled,
remote: runtime.remote,
@@ -186,6 +164,15 @@ export async function bootstrapPortalDomainServices({
const mindSpaceServiceFacade =
mindSpaceRuntimeAdapter.serviceFacade;
const mindSpaceChatSave =
mindSpaceRuntimeAdapter.chatSaveService;
const mindSpaceConversationArtifacts =
mindSpaceRuntimeAdapter.conversationArtifactService;
const mindSpacePublicFinish =
mindSpaceRuntimeAdapter.publicFinishService;
const mindSpaceWorkspacePublicationDelivery =
mindSpaceRuntimeAdapter
.workspacePublicationDeliveryService;
const mindSpaceConversationPackageRegistry =
mindSpaceRuntimeAdapter.conversationPackageRegistry;
const mindSpaceAssets =
@@ -200,25 +187,8 @@ export async function bootstrapPortalDomainServices({
const mindSpacePublications =
mindSpaceRuntimeAdapter.publicationService;
const workspacePageDeliver =
createWorkspacePageDeliverServiceFn({
pool,
pageService: mindSpacePages,
publicationService: mindSpacePublications,
pageSyncService: mindSpacePageSync,
pageDataEnsure: {
ensurePageDataHtmlPagesBound:
ensurePageDataHtmlPagesBoundFn,
},
h5Root,
storageRoot:
resolveMindSpaceRuntimeConfigFn(h5Root, env)
.storageRoot,
findPageByRelativePath:
mindSpacePages.findPageByRelativePath.bind(
mindSpacePages,
),
logger,
});
mindSpaceRuntimeAdapter
.workspacePageDeliveryService;
const resolveUserIdByDirKey = async (dirKey) => {
let userId = dirKey;
@@ -309,6 +279,10 @@ export async function bootstrapPortalDomainServices({
mindSpace,
mindSpaceRuntimeAdapter,
mindSpaceServiceFacade,
mindSpaceChatSave,
mindSpaceConversationArtifacts,
mindSpacePublicFinish,
mindSpaceWorkspacePublicationDelivery,
mindSpaceConversationPackageRegistry,
mindSpaceAssets,
mindSpacePages,