mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 03:45:46 -06:00
b1f4aac349
New openclaw delegation tool relays to openclaw.chat in-process; persistent writes surface through the existing durable operator-approval registry as a third system-agent kind (no parallel store), armed only by a human operator in the Control UI — a delegated agent can never self-approve. Setup wizards (channel/model/open-setup/open-tui) are refused in delegated mode so a machine agent cannot complete setup or persist credentials unattended. Vendor-neutral inference fallback ladder (requester route first, then other authed providers by provider id). update.run removed from the gateway tool. Caveman system-prompt fragment steers config/channels/plugins/agents/updates to the openclaw tool. Doctor-owned state migration widens the approval-kind constraint; runtime stays canonical-only. Refs #107237
16 lines
512 B
TypeScript
16 lines
512 B
TypeScript
// Lazily loads one gateway handler without changing its request contract.
|
|
import type { GatewayRequestHandler, GatewayRequestHandlers } from "./server-methods/types.js";
|
|
|
|
export function createLazyHandler(
|
|
method: string,
|
|
loadHandlers: () => Promise<GatewayRequestHandlers>,
|
|
): GatewayRequestHandler {
|
|
return async (opts) => {
|
|
const handler = (await loadHandlers())[method];
|
|
if (!handler) {
|
|
throw new Error(`lazy gateway handler not found: ${method}`);
|
|
}
|
|
await handler(opts);
|
|
};
|
|
}
|