MCPcopy Create free account
hub / github.com/coder/agentapi / formatPaste

Function formatPaste

lib/httpapi/claude.go:13–21  ·  view source on GitHub ↗

formatPaste wraps message in bracketed paste escape sequences. These sequences start with ESC (\x1b), which TUI selection widgets (e.g. Claude Code's numbered-choice prompt) interpret as "cancel". For selection prompts, callers should use MessageTypeRaw to send raw keystrokes directly instead.

(message string)

Source from the content-addressed store, hash-verified

11// as "cancel". For selection prompts, callers should use
12// MessageTypeRaw to send raw keystrokes directly instead.
13func formatPaste(message string) []st.MessagePart {
14 return []st.MessagePart{
15 // Bracketed paste mode start sequence
16 st.MessagePartText{Content: "\x1b[200~", Hidden: true},
17 st.MessagePartText{Content: message},
18 // Bracketed paste mode end sequence
19 st.MessagePartText{Content: "\x1b[201~", Hidden: true},
20 }
21}
22
23func formatClaudeCodeMessage(message string) []st.MessagePart {
24 parts := make([]st.MessagePart, 0)

Callers 1

formatClaudeCodeMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected