fix: resolve PR #48 review comments for OpenClaw notifier

- Register openclaw in BUILTIN_PLUGINS array (plugin-registry.ts)
- Fix URL path from /hooks/wake to /api/sessions/main/message
- Fix payload field from {text, mode} to {message} to match API
- Fix warning string from "hookToken" to "token" to match config
- Remove openclaw from default notificationRouting (optional plugin)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
sjd9021 2026-02-15 23:52:39 +05:30
parent ef28f4fd8d
commit 6b7047e499
3 changed files with 7 additions and 6 deletions

View File

@ -92,8 +92,8 @@ const OrchestratorConfigSchema = z.object({
projects: z.record(ProjectConfigSchema),
notifiers: z.record(NotifierConfigSchema).default({}),
notificationRouting: z.record(z.array(z.string())).default({
urgent: ["desktop", "composio", "openclaw"],
action: ["desktop", "composio", "openclaw"],
urgent: ["desktop", "composio"],
action: ["desktop", "composio"],
warning: ["composio"],
info: ["composio"],
}),

View File

@ -44,6 +44,7 @@ const BUILTIN_PLUGINS: Array<{ slot: PluginSlot; name: string; pkg: string }> =
{ slot: "notifier", name: "desktop", pkg: "@composio/ao-plugin-notifier-desktop" },
{ slot: "notifier", name: "slack", pkg: "@composio/ao-plugin-notifier-slack" },
{ slot: "notifier", name: "webhook", pkg: "@composio/ao-plugin-notifier-webhook" },
{ slot: "notifier", name: "openclaw", pkg: "@composio/ao-plugin-notifier-openclaw" },
// Terminals
{ slot: "terminal", name: "iterm2", pkg: "@composio/ao-plugin-terminal-iterm2" },
{ slot: "terminal", name: "web", pkg: "@composio/ao-plugin-terminal-web" },

View File

@ -122,13 +122,13 @@ function formatMessage(event: OrchestratorEvent): string {
}
function buildUrl(host: string, port: number): string {
return `http://${host}:${port}/hooks/wake`;
return `http://${host}:${port}/api/sessions/main/message`;
}
export function create(config?: Record<string, unknown>): Notifier {
const host = (config?.host as string | undefined) ?? "localhost";
const port = (config?.port as number | undefined) ?? 8080;
const hookToken = (config?.hookToken as string | undefined) ?? (config?.token as string | undefined);
const hookToken = config?.token as string | undefined;
const rawRetries = (config?.retries as number) ?? 2;
const rawDelay = (config?.retryDelayMs as number) ?? 1000;
const retries = Number.isFinite(rawRetries) ? Math.max(0, rawRetries) : 2;
@ -142,7 +142,7 @@ export function create(config?: Record<string, unknown>): Notifier {
: DEFAULT_EVENTS;
if (!hookToken) {
console.warn("[notifier-openclaw] No hookToken configured — notifications will be no-ops");
console.warn("[notifier-openclaw] No token configured — notifications will be no-ops");
}
const url = buildUrl(host, port);
@ -155,7 +155,7 @@ export function create(config?: Record<string, unknown>): Notifier {
if (!allowedEvents.has(event.type)) return;
const text = formatMessage(event);
await postWithRetry(url, { text, mode: "now" }, hookToken, retries, retryDelayMs);
await postWithRetry(url, { message: text }, hookToken, retries, retryDelayMs);
},
};
}