feat: support attached images for all providers

This commit is contained in:
Haileyesus
2026-07-03 15:42:29 +03:00
parent 3ade1a1105
commit a253a2bda4
33 changed files with 1467 additions and 321 deletions

View File

@@ -1239,3 +1239,24 @@ export async function extractFirstValidJsonlData<T>(
return null;
}
// ---------------------------
//----------------- CLI PROMPT ARGUMENT UTILITIES ------------
/**
* Makes a prompt safe to pass as one CLI argument to `.cmd`-shimmed tools on
* Windows (cursor-agent, gemini, opencode installed via npm-style shims).
*
* cmd.exe cannot carry newlines inside an argument: everything after the
* first newline is silently dropped before the target CLI ever sees it, which
* truncates multi-line prompts and any appended `<images_input>` block.
* Collapsing newline runs to single spaces loses formatting but never loses
* content, so runtimes should call this on win32 right before spawning.
*
* Used by the cursor, gemini, and opencode spawn runtimes.
*/
export function flattenPromptForWindowsShell(prompt: string): string {
if (process.platform !== 'win32' || typeof prompt !== 'string') {
return prompt;
}
return prompt.replace(/\s*\r?\n\s*/g, ' ').trim();
}