refactor: dedupe agent and browser cli helpers

This commit is contained in:
Peter Steinberger
2026-03-03 00:14:48 +00:00
parent fe14be2352
commit fd3ca8a34c
46 changed files with 1051 additions and 1117 deletions

View File

@@ -0,0 +1,24 @@
export const LIVE_OK_PROMPT = "Reply with the word ok.";
export function createSingleUserPromptMessage(content = LIVE_OK_PROMPT) {
return [
{
role: "user" as const,
content,
timestamp: Date.now(),
},
];
}
export function extractNonEmptyAssistantText(
content: Array<{
type?: string;
text?: string;
}>,
) {
return content
.filter((block) => block.type === "text")
.map((block) => block.text?.trim() ?? "")
.filter(Boolean)
.join(" ");
}