Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ The plugin communicates with Warp via OSC 777 escape sequences. Each hook script

Payloads include a protocol version negotiated between the plugin and Warp (`min(plugin_version, warp_version)`), the session ID, working directory, and event-specific fields.

When Warp exports `WARP_CLI_AGENT_IPC`, the notification scripts send the OSC payload over that Unix socket instead of writing to `/dev/tty`. Older Warp builds keep using the terminal fallback.

The plugin registers six hooks:
- **SessionStart** — emits the plugin version and a welcome system message
- **Stop** — reads the transcript to extract your prompt and Claude's response, then sends a task-complete notification
Expand Down
10 changes: 8 additions & 2 deletions plugins/warp/scripts/legacy/warp-notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@ TITLE="${1:-Notification}"
BODY="${2:-}"

# OSC 777 format: \033]777;notify;<title>;<body>\007
# Write directly to /dev/tty to ensure it reaches the terminal
printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY" > /dev/tty 2>/dev/null || true
OSC_PAYLOAD=$(printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY")

if [ -n "${WARP_CLI_AGENT_IPC:-}" ]; then
(printf "%s" "$OSC_PAYLOAD" | nc -U "$WARP_CLI_AGENT_IPC") 2>/dev/null || true
else
# Write directly to /dev/tty to ensure it reaches the terminal.
(printf "%s" "$OSC_PAYLOAD" > /dev/tty) 2>/dev/null || true
fi
10 changes: 8 additions & 2 deletions plugins/warp/scripts/warp-notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ TITLE="${1:-Notification}"
BODY="${2:-}"

# OSC 777 format: \033]777;notify;<title>;<body>\007
# Write directly to /dev/tty to ensure it reaches the terminal
printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY" > /dev/tty 2>/dev/null || true
OSC_PAYLOAD=$(printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY")

if [ -n "${WARP_CLI_AGENT_IPC:-}" ]; then
(printf "%s" "$OSC_PAYLOAD" | nc -U "$WARP_CLI_AGENT_IPC") 2>/dev/null || true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nc -U ships with macOS but is not universally available on Linux (GNU netcat doesn't support -U). Since Claude Code is a Node.js app, node should be guaranteed on $PATH. Could we fall back to node when nc - U fails? Something like:

send_via_ipc() {
    (printf "%s" "$1" | nc -U "$WARP_CLI_AGENT_IPC") 2>/dev/null && return
    node -e "require('net').createConnection(process.argv[1]).end(process.argv[2])" \
        "$WARP_CLI_AGENT_IPC" "$1" 2>/dev/null || true
}

else
# Write directly to /dev/tty to ensure it reaches the terminal.
(printf "%s" "$OSC_PAYLOAD" > /dev/tty) 2>/dev/null || true
fi