feat(ui): attach large text pastes as virtual files

Offer to turn sufficiently large plain-text clipboard pastes into
pasted-context-N.txt attachments instead of inserting them into the
composer, with ask/attach/inline composer settings.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-04 11:38:02 +00:00
co-authored by Serhii Dziupin
parent f47110c66f
commit ef11ab5b14
33 changed files with 458 additions and 11 deletions
@@ -144,6 +144,20 @@ export const assignImageAttachmentFilenames = (
});
};
/** Next unused `pasted-context-N.txt` name for a large text paste attachment. */
export const nextPastedContextFilename = (existingFilenames: string[]): string => {
const used = new Set(existingFilenames.map(normalizeFilenameKey));
for (let index = 1; index < Number.MAX_SAFE_INTEGER; index += 1) {
const candidate = `pasted-context-${index}.txt`;
if (!used.has(normalizeFilenameKey(candidate))) {
return candidate;
}
}
return `pasted-context-${Date.now()}.txt`;
};
export const buildAttachmentCitationText = (filenames: string[]): string => (
filenames.map((filename) => `[${filename}]`).join(' ')
);