feat: add stable proactive delivery

This commit is contained in:
xmanrui 2026-08-30 11:24:53 +08:00
parent 410cb822d7
commit 31792d7bc8
88 changed files with 6427 additions and 488 deletions

View file

@ -10,6 +10,8 @@ export async function apply(ctx, config = {}) {
}
const production = await createProductionController(ctx, config, config.internals);
const unregisterDelivery = config.deliveryService && production.deliveryAdapter
? config.deliveryService.registerAdapter(production.deliveryAdapter) : undefined;
const disposeRpc = installDingtalkRpc(
ctx,
production.controller,
@ -17,6 +19,7 @@ export async function apply(ctx, config = {}) {
config.rpcAuthority,
);
ctx.effect(() => async () => {
await unregisterDelivery?.();
await production.close();
}, 'dsh-dingtalk: close bot connections');
return disposeRpc;

View file

@ -15,6 +15,7 @@ import {
observeBotWorkspaceRemovals,
} from '../../../../src/channels/shared/bot-workspace-store.mjs';
import { listAgentPresetCatalog } from '../../../../src/channels/shared/agent-preset.mjs';
import { createDeliveryAdapter } from '../../delivery-adapter.mjs';
import { createConnectionSupervisor } from './connection-supervisor.mjs';
import { createHarnessCommandExecutor } from '../../harness-command-executor.mjs';
import { harnessConnection } from '../../harness-connection.mjs';
@ -149,6 +150,9 @@ export async function createProductionController(ctx, config = {}, internals = {
}).start();
return {
controller,
deliveryAdapter: createDeliveryAdapter({
channel: 'dingtalk', workspaces, coreController, stateFor,
}),
ready: supervisor.ready,
async close() {
await supervisor.close();