@humanu/orchestra 0.5.38 → 0.5.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/resources/api/tmux.sh
CHANGED
|
@@ -668,7 +668,7 @@ tmux_get_active_pane() {
|
|
|
668
668
|
tmux list-panes -t "$win" -F '#{pane_active} #{pane_id}' 2>/dev/null | awk '$1==1{print $2; exit}' || true
|
|
669
669
|
}
|
|
670
670
|
|
|
671
|
-
# Capture enhanced session preview showing current terminal view (
|
|
671
|
+
# Capture enhanced session preview showing current terminal view (bottom lines)
|
|
672
672
|
# Usage: tmux_session_preview <session_name>
|
|
673
673
|
tmux_session_preview() {
|
|
674
674
|
local s="$1"
|
|
@@ -681,11 +681,11 @@ tmux_session_preview() {
|
|
|
681
681
|
return 0
|
|
682
682
|
fi
|
|
683
683
|
|
|
684
|
-
#
|
|
684
|
+
# Always capture from the BOTTOM of the terminal buffer (last visible lines)
|
|
685
685
|
# -e flag preserves escape sequences for colors and formatting
|
|
686
|
-
# -
|
|
687
|
-
# -E
|
|
688
|
-
# This
|
|
686
|
+
# -p prints to stdout
|
|
687
|
+
# NO -S/-E flags means capture the current viewport (what's visible NOW)
|
|
688
|
+
# This ensures we always see the bottom/most recent output
|
|
689
689
|
local txt
|
|
690
690
|
txt="$(tmux capture-pane -e -p -t "$pane" 2>/dev/null)"
|
|
691
691
|
|
|
@@ -694,6 +694,22 @@ tmux_session_preview() {
|
|
|
694
694
|
return 0
|
|
695
695
|
fi
|
|
696
696
|
|
|
697
|
+
# Check if the pane is idle (cursor at prompt, no running process)
|
|
698
|
+
local pane_cmd pane_mode
|
|
699
|
+
pane_cmd="$(tmux display-message -t "$pane" -p '#{pane_current_command}' 2>/dev/null || echo "")"
|
|
700
|
+
pane_mode="$(tmux display-message -t "$pane" -p '#{pane_mode}' 2>/dev/null || echo "")"
|
|
701
|
+
|
|
702
|
+
# Detect idle state: shell running and not in copy mode
|
|
703
|
+
local is_idle="false"
|
|
704
|
+
case "$pane_cmd" in
|
|
705
|
+
bash|zsh|sh|fish|dash|ksh)
|
|
706
|
+
# Shell is running, check if we're at a prompt (not in copy mode)
|
|
707
|
+
if [[ "$pane_mode" == "" ]]; then
|
|
708
|
+
is_idle="true"
|
|
709
|
+
fi
|
|
710
|
+
;;
|
|
711
|
+
esac
|
|
712
|
+
|
|
697
713
|
# Optimized: Get terminal info in a single command instead of multiple calls
|
|
698
714
|
local term_info has_rgb
|
|
699
715
|
term_info="$(tmux show-environment -t "$s" TERM 2>/dev/null | cut -d= -f2 || echo "unknown")"
|
|
@@ -706,7 +722,7 @@ tmux_session_preview() {
|
|
|
706
722
|
fi
|
|
707
723
|
|
|
708
724
|
# For ANSI-preserved preview with color mode info
|
|
709
|
-
# Add markers for the Rust parser to detect color capabilities
|
|
725
|
+
# Add markers for the Rust parser to detect color capabilities and idle state
|
|
710
726
|
if [[ "$has_rgb" == "true" || "$term_info" == *"direct"* || "$term_info" == *"truecolor"* ]]; then
|
|
711
727
|
echo "<<<COLORMODE:RGB>>>"
|
|
712
728
|
elif [[ "$term_info" == *"256color"* ]]; then
|
|
@@ -714,6 +730,14 @@ tmux_session_preview() {
|
|
|
714
730
|
else
|
|
715
731
|
echo "<<<COLORMODE:16>>>"
|
|
716
732
|
fi
|
|
733
|
+
|
|
734
|
+
# Add idle marker so Rust can stop polling when terminal is idle
|
|
735
|
+
if [[ "$is_idle" == "true" ]]; then
|
|
736
|
+
echo "<<<IDLE:true>>>"
|
|
737
|
+
else
|
|
738
|
+
echo "<<<IDLE:false>>>"
|
|
739
|
+
fi
|
|
740
|
+
|
|
717
741
|
echo "$txt"
|
|
718
742
|
}
|
|
719
743
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|