feat(memory): release Mnemo project bridge and schema2 recovery
Official contracts and Windows source CI / windows-source (push) Has been cancelled
Official contracts and Windows source CI / windows-source (push) Has been cancelled
This commit is contained in:
@@ -165,6 +165,18 @@ return async (request, response) => {
|
||||
if (method === 'POST') { if (workerForProject(store, projectId)) throw workerConflict('受限子项目不能修改MCP登记,请返回父项目。'); const input = await body(request);
|
||||
return json(response, mcpMatch[2] ? registry.configure(projectId, input) : registry.register(projectId, input), mcpMatch[2] ? 200 : 201); }
|
||||
}
|
||||
const mnemoBridgeMatch = route.match(/^\/api\/projects\/([a-f0-9-]+)\/memory-bridge(?:\/(configure|sources|lookup)(?:\/([a-f0-9-]+))?)?$/i);
|
||||
if (mnemoBridgeMatch) {
|
||||
const projectId = mnemoBridgeMatch[1], bridge = runtime.mnemoBridge();
|
||||
if (method === 'GET' && !mnemoBridgeMatch[2]) return json(response, await bridge.view(projectId));
|
||||
if (method === 'POST') {
|
||||
if (workerForProject(store, projectId)) throw workerConflict('请从来源项目管理可选记忆桥。');
|
||||
const input = await body(request);
|
||||
if (mnemoBridgeMatch[2] === 'configure' && !mnemoBridgeMatch[3]) return json(response, await bridge.configure(projectId, input));
|
||||
if (mnemoBridgeMatch[2] === 'lookup') { if (typeof input.memoryId !== 'string' || Object.keys(input).length !== 1) throw new Error('需要原来源ID。'); return json(response, await bridge.lookupSource(projectId, input.memoryId)); }
|
||||
if (mnemoBridgeMatch[2] === 'sources' && mnemoBridgeMatch[3]) return json(response, await bridge.changeSource(projectId, mnemoBridgeMatch[3], input));
|
||||
}
|
||||
}
|
||||
const projectMemoryMatch = route.match(/^\/api\/projects\/([a-f0-9-]+)\/memories$/i);
|
||||
if (projectMemoryMatch && method === 'GET') {
|
||||
const includeExpired = url.searchParams.get('include_expired') !== '0';
|
||||
|
||||
Reference in New Issue
Block a user