import {
createMoltbotHooks,
createMoltbotEscalationManager,
} from "sec0-sdk/integrations/openclaw";
import { createEscalationManager } from "sec0-sdk/escalation";
const hooks = createMoltbotHooks(cfg);
const sharedEscalationManager = createEscalationManager({
apiKey: process.env.SEC0_API_KEY,
controlPlaneUrl: process.env.SEC0_CONTROL_PLANE_URL,
tenant: process.env.SEC0_TENANT_ID,
timeoutMs: 5 * 60_000,
pollIntervalMs: 2000,
defaults: {
ttlSeconds: 300,
timeoutAction: "auto_reject",
},
});
const escalation = createMoltbotEscalationManager({
escalationMode: "human",
manager: sharedEscalationManager,
waitForResolution: true,
});
const gate = await hooks.messageSending?.({ to, content, metadata }, ctx);
const decision = await escalation.handle({
gateResult: gate,
nodeId: ctx?.accountId,
agentRef: ctx?.conversationId,
metadata: { turn: 3 },
});
if (!decision.allow) {
return;
}
await sendToChannel(content);