summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Omni/Agent/Telegram.hs27
-rwxr-xr-xOmni/Ide/push.sh65
2 files changed, 63 insertions, 29 deletions
diff --git a/Omni/Agent/Telegram.hs b/Omni/Agent/Telegram.hs
index 9e6eca0..913fc2b 100644
--- a/Omni/Agent/Telegram.hs
+++ b/Omni/Agent/Telegram.hs
@@ -170,19 +170,24 @@ telegramSystemPrompt =
"",
"prioritize esoteric interpretations of literature, art, and philosophy.",
"",
- "## formatting",
+ "## TELEGRAM FORMATTING (CRITICAL)",
"",
- "you are in telegram which only supports basic markdown:",
- "- *bold* (single asterisks)",
- "- _italic_ (underscores)",
- "- `code` (backticks)",
- "- ```pre``` (triple backticks for code blocks)",
- "- [links](url)",
+ "you MUST use telegram MarkdownV2 syntax. this is DIFFERENT from standard markdown:",
"",
- "DO NOT use:",
- "- headers (# or ##) - these break message rendering",
- "- **double asterisks** - use *single* instead",
- "- bullet lists with - or * at start of line",
+ "CORRECT telegram syntax:",
+ " *bold* (SINGLE asterisks only)",
+ " _italic_ (underscores)",
+ " `code` (backticks)",
+ " ```pre``` (triple backticks)",
+ " [link text](url)",
+ "",
+ "WRONG - DO NOT USE:",
+ " **double asterisks** - WRONG, use *single*",
+ " # headers - WRONG, breaks rendering",
+ " - bullet points - WRONG, breaks rendering",
+ " * list items - WRONG, conflicts with bold",
+ "",
+ "for lists, just use plain text with numbers or dashes inline.",
"",
"## memory",
"",
diff --git a/Omni/Ide/push.sh b/Omni/Ide/push.sh
index f6d67f4..a713e46 100755
--- a/Omni/Ide/push.sh
+++ b/Omni/Ide/push.sh
@@ -48,24 +48,53 @@ nixos_deploy() {
# hack: get the domain from the systemd service
where=$(rg --only-matching --replace '$2' --regexp '(domainname ")(.*)(")' \
"$what/etc/systemd/system/domainname.service")
- nix copy --to ssh://"$USER"@"$where" "$what"
- ssh "$USER"@"$where" sudo nix-env --profile /nix/var/nix/profiles/system --set "$what"
- switch_cmd=(
- systemd-run
- -E LOCALE_ARCHIVE
- --setenv=XDG_RUNTIME_DIR=""
- --collect
- --no-ask-password
- --pipe
- --quiet
- --service-type=exec
- --unit=push-switch-to-configuration
- --wait
- "$what/bin/switch-to-configuration"
- "switch"
- )
- # shellcheck disable=SC2029
- ssh "$USER"@"$where" sudo "${switch_cmd[@]}"
+
+ # Check if we're deploying to ourselves (local deploy)
+ # Extract hostname from NixOS config path (e.g., Omni.Dev.Beryllium.nix -> beryllium)
+ local current_hostname
+ current_hostname=$(hostname)
+ local config_hostname
+ config_hostname=$(echo "$target" | sed -E 's/.*\.([^.]+)\.nix$/\1/' | tr '[:upper:]' '[:lower:]')
+
+ if [[ "$current_hostname" == "$config_hostname" ]] || [[ "$where" == "localhost" ]]; then
+ echo -e "${YLW}info: push: local deploy detected${NC}"
+ sudo nix-env --profile /nix/var/nix/profiles/system --set "$what"
+ switch_cmd=(
+ "$what/bin/switch-to-configuration"
+ "switch"
+ )
+ sudo "${switch_cmd[@]}"
+ else
+ # Try domain first, fall back to Tailscale hostname (config_hostname)
+ local ssh_target="$USER@$where"
+ if ! ssh -o ConnectTimeout=5 -o BatchMode=yes "$ssh_target" true 2>/dev/null; then
+ echo -e "${YLW}info: push: $where unreachable, trying Tailscale hostname $config_hostname${NC}"
+ ssh_target="$USER@$config_hostname"
+ if ! ssh -o ConnectTimeout=5 -o BatchMode=yes "$ssh_target" true 2>/dev/null; then
+ echo -e "${RED}fail: push: cannot reach $where or $config_hostname${NC}"
+ exit 1
+ fi
+ fi
+
+ nix copy --to ssh://"$ssh_target" "$what"
+ ssh "$ssh_target" sudo nix-env --profile /nix/var/nix/profiles/system --set "$what"
+ switch_cmd=(
+ systemd-run
+ -E LOCALE_ARCHIVE
+ --setenv=XDG_RUNTIME_DIR=""
+ --collect
+ --no-ask-password
+ --pipe
+ --quiet
+ --service-type=exec
+ --unit=push-switch-to-configuration
+ --wait
+ "$what/bin/switch-to-configuration"
+ "switch"
+ )
+ # shellcheck disable=SC2029
+ ssh "$ssh_target" sudo "${switch_cmd[@]}"
+ fi
echo -e "${GRN}good: push: $target${NC}"
}