feat(tui): persist large pastes to ~/.hermes/pastes/ via paste.collapse

This commit is contained in:
Brooklyn Nicholson 2026-04-18 09:16:44 -05:00
parent a397b0fd4d
commit 586b2f2089
2 changed files with 15 additions and 1 deletions

View file

@ -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(() => {