From 586b2f208913e2d63f08e426ac0c2ac6b3bc3823 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sat, 18 Apr 2026 09:16:44 -0500 Subject: [PATCH] feat(tui): persist large pastes to ~/.hermes/pastes/ via paste.collapse --- ui-tui/src/app/interfaces.ts | 1 + ui-tui/src/app/useComposerState.ts | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ui-tui/src/app/interfaces.ts b/ui-tui/src/app/interfaces.ts index 998afe2a1..ff2b1e5b5 100644 --- a/ui-tui/src/app/interfaces.ts +++ b/ui-tui/src/app/interfaces.ts @@ -335,5 +335,6 @@ export interface AppOverlaysProps { export interface PasteSnippet { label: string + path?: string text: string } diff --git a/ui-tui/src/app/useComposerState.ts b/ui-tui/src/app/useComposerState.ts index 14a40412c..bebda273d 100644 --- a/ui-tui/src/app/useComposerState.ts +++ b/ui-tui/src/app/useComposerState.ts @@ -70,12 +70,25 @@ export function useComposerState({ gw, onClipboardPaste, submitRef }: UseCompose setPasteSnips(prev => [...prev, { label, text: cleanedText }].slice(-32)) + void gw + .request<{ path?: string }>('paste.collapse', { text: cleanedText }) + .then(r => { + const path = r?.path + + if (!path) { + return + } + + setPasteSnips(prev => prev.map(s => (s.label === label ? { ...s, path } : s))) + }) + .catch(() => {}) + return { cursor: cursor + insert.length, value: value.slice(0, cursor) + insert + value.slice(cursor) } }, - [onClipboardPaste] + [gw, onClipboardPaste] ) const openEditor = useCallback(() => {