Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
core ac-notify
1.0 kB · 28 lines
1234567891011121314151617181920212223242526272829#!/bin/bash# ac-notify - Send notifications to ac-event-daemon# Usage: ac-notify [success|error|info] [message]# Set VERBOSE=1 for debug outputNOTIFICATION_TYPE="${1:-success}"MESSAGE="${2:-Prompt completed}"# Determine host address (container vs native)if [ -n "$CODESPACES" ] || [ -n "$DEVCONTAINER" ] || [ -f /.dockerenv ]; then # In a container - get the default gateway IP GATEWAY_IP=$(ip route show default | awk '/default/ {print $3}' | head -1) HOST_ADDR="${GATEWAY_IP:-172.17.0.1}" # Only show debug info if verbose mode is requested [ "${VERBOSE:-}" = "1" ] && echo "Container detected, using host address: $HOST_ADDR" >&2else HOST_ADDR="127.0.0.1"fi# Send UDP message to ac-event-daemonecho "prompt-complete:${NOTIFICATION_TYPE}:${MESSAGE}" | nc -u "$HOST_ADDR" 9999 2>/dev/null || { # If nc fails, try sending directly via filesystem (fallback) echo "Warning: Could not send notification to ac-event-daemon" >&2 exit 1}echo "Notification sent: ${NOTIFICATION_TYPE} - ${MESSAGE}"