Files
openclaw/src/gateway/lazy-handler.ts
T
Peter Steinberger b1f4aac349 feat(agents): OpenClaw system-agent delegation
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
2026-07-15 01:56:31 -07:00

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);
};
}