feat: add optional MindSearch skill orchestration
This commit is contained in:
@@ -90,6 +90,31 @@ test('admin memory-v2 config routes expose config and runtime state', async () =
|
||||
}
|
||||
});
|
||||
|
||||
test('admin MindSearch routes persist only through injected control-plane service', async () => {
|
||||
const updates = [];
|
||||
const router = createAdminApi({
|
||||
jsonBody: express.json(), getToken() { return 'token-admin'; },
|
||||
userAuth: { async getMe() { return { id: 'admin-1', role: 'admin' }; } },
|
||||
llmProviderService: null, memoryV2ConfigService: null,
|
||||
mindSearchConfigService: {
|
||||
async getAdminConfig() { return { config: { enabled: false, mode: 'off', providers: { searxng: false, github: false, reader: false } }, source: 'env' }; },
|
||||
async updateAdminConfig(patch, context) { updates.push({ patch, context }); return { config: { enabled: true, mode: 'shadow', providers: { searxng: true, github: false, reader: false } }, source: 'admin' }; },
|
||||
async getRuntimeState() { return { effective: false, mode: 'off' }; },
|
||||
},
|
||||
plazaPosts: null, plazaOps: null, wechatAdmin: null, subscriptionService: null,
|
||||
});
|
||||
const server = await startTestServer(router);
|
||||
try {
|
||||
const config = await fetch(`${server.baseUrl}/admin-api/mindsearch/config`, { headers: { cookie: 'h5_user_session=token-admin' } });
|
||||
assert.equal(config.status, 200);
|
||||
const update = await fetch(`${server.baseUrl}/admin-api/mindsearch/config`, { method: 'PATCH', headers: { 'content-type': 'application/json', cookie: 'h5_user_session=token-admin' }, body: JSON.stringify({ enabled: true, mode: 'shadow' }) });
|
||||
assert.equal(update.status, 200);
|
||||
assert.deepEqual(updates, [{ patch: { enabled: true, mode: 'shadow' }, context: { updatedBy: 'admin-1' } }]);
|
||||
const runtime = await fetch(`${server.baseUrl}/admin-api/mindsearch/runtime`, { headers: { cookie: 'h5_user_session=token-admin' } });
|
||||
assert.deepEqual(await runtime.json(), { effective: false, mode: 'off' });
|
||||
} finally { await server.close(); }
|
||||
});
|
||||
|
||||
test('admin asset gateway routes preserve an explicit, admin-only control plane', async () => {
|
||||
const calls = [];
|
||||
const router = createAdminApi({
|
||||
|
||||
Reference in New Issue
Block a user