Files
gori-agent/src/core/adapter.ts
T
2026-08-14 23:06:31 +08:00

16 lines
560 B
TypeScript

import type { OutgoingMessage, WebhookRequestContext, WebhookResponse } from "./types.js";
export interface PlatformAdapter {
name: string;
handleWebhook(context: WebhookRequestContext): Promise<WebhookResponse>;
sendMessage(message: OutgoingMessage): Promise<void>;
}
export function jsonResponse(body: unknown, status = 200): WebhookResponse {
return { status, body };
}
export function notImplemented(platform: string): WebhookResponse {
return jsonResponse({ ok: false, error: `${platform} inbound webhook is not implemented in v1` }, 501);
}