fix: use in-process Harness API for local plugin connections

This commit is contained in:
xmanrui 2026-08-28 01:24:17 +08:00
parent f4ded46278
commit f0b6b38b45
40 changed files with 1413 additions and 603 deletions

View file

@ -1124,7 +1124,7 @@ test('DSH credential adapter stores refs off the browser plane and clears them',
assert.equal(await store.configured(), false);
});
test('production assembly needs only ctx credentials and the active DSH webServer', async () => {
test('production assembly uses ctx credentials and the active Host apiProxy without a webServer', async () => {
const constructed = {};
const httpInstance = { request: async () => ({}) };
const wsAgent = {
@ -1157,9 +1157,10 @@ test('production assembly needs only ctx credentials and the active DSH webServe
async close() { constructed.closed = true; }
}
const credentials = {};
const apiProxy = {};
const production = await createProductionController({
credentials,
webServer: { port: 43123, host: '127.0.0.1' },
apiProxy,
logger: console,
}, {
dshHome: '/tmp/dsh-feishu-host-test',
@ -1192,7 +1193,8 @@ test('production assembly needs only ctx credentials and the active DSH webServe
assert.equal(constructed.verifyOptions.httpInstance, httpInstance);
assert.equal(constructed.wsAgentCreated, 1);
assert.equal(constructed.wsProxyUrl, 'http://proxy.test:8080');
assert.equal(String(constructed.harness.baseUrl), 'http://127.0.0.1:43123/');
assert.equal(constructed.harness.apiProxy, apiProxy);
assert.equal(Object.hasOwn(constructed.harness, 'baseUrl'), false);
assert.equal(constructed.harness.autostart, false);
assert.match(constructed.configPath, /integrations\/dsh-feishu\/config\.json$/);
@ -1291,7 +1293,7 @@ test('a corrupt legacy state file cannot prevent a healthy v2 bot from starting'
async set(ref, value) { secrets.set(ref, value); },
async unset(ref) { secrets.delete(ref); },
},
webServer: { port: 43124 },
apiProxy: {},
logger: console,
}, { dataDir, workspace: dataDir }, {
lark: { registerApp: async () => ({}) },