import {
normalizeOptionalLowercaseString,
normalizeOptionalString,
} from "../shared/string-coerce.js"; import type { RealtimeVoiceTool } from "./provider-types.js";
export function isRealtimeVoiceAgentConsultToolPolicy(
value: unknown,
): value is RealtimeVoiceAgentConsultToolPolicy { return ( typeof value === "string" &&
REALTIME_VOICE_AGENT_CONSULT_TOOL_POLICIES.includes(
value as RealtimeVoiceAgentConsultToolPolicy,
)
);
}
return [
`You are helping an OpenClaw realtime voice agent during ${params.surface}.`,
`Answer the ${questionSourceLabel}'s question with the strongest useful reasoning and available tools.`, "Return only the concise answer the realtime voice agent should speak next.", "Do not include markdown, citations unless needed, tool logs, or private reasoning.",
parsed.responseStyle ? `Spoken style: ${parsed.responseStyle}` : undefined,
transcript ? `Recent transcript:\n${transcript}` : undefined,
parsed.context ? `Additional context:\n${parsed.context}` : undefined,
`Question:\n${parsed.question}`,
]
.filter(Boolean)
.join("\n\n");
}
export function collectRealtimeVoiceAgentConsultVisibleText(
payloads: Array<{ text?: unknown; isError?: boolean; isReasoning?: boolean }>,
): string | null { const chunks: string[] = []; for (const payload of payloads) { if (payload.isError || payload.isReasoning) { continue;
} const text = normalizeOptionalString(payload.text); if (text) {
chunks.push(text);
}
} return chunks.length > 0 ? chunks.join("\n\n").trim() : null;
}
function readConsultStringArg(args: unknown, key: string): string | undefined { if (!args || typeof args !== "object" || Array.isArray(args)) { return undefined;
} return normalizeOptionalString((args as Record<string, unknown>)[key]);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.