mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
refactor: dedupe reader helpers
This commit is contained in:
@@ -8,6 +8,7 @@ import { z } from "zod";
|
||||
import { PROTOCOL_VERSION } from "../../src/gateway/protocol/index.ts";
|
||||
import { formatErrorMessage } from "../../src/infra/errors.ts";
|
||||
import { rawDataToString } from "../../src/infra/ws.ts";
|
||||
import { readStringValue } from "../../src/shared/string-coerce.ts";
|
||||
|
||||
export const ClaudeChannelNotificationSchema = z.object({
|
||||
method: z.literal("notifications/claude/channel"),
|
||||
@@ -66,8 +67,7 @@ export function extractTextFromGatewayPayload(
|
||||
if (!first || typeof first !== "object") {
|
||||
return undefined;
|
||||
}
|
||||
const text = (first as { text?: unknown }).text;
|
||||
return typeof text === "string" ? text : undefined;
|
||||
return readStringValue((first as { text?: unknown }).text);
|
||||
}
|
||||
|
||||
export async function waitFor<T>(
|
||||
|
||||
Reference in New Issue
Block a user