@humanu/orchestra 0.5.59 → 0.5.62

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanu/orchestra",
3
- "version": "0.5.59",
3
+ "version": "0.5.62",
4
4
  "description": "AI-powered Git worktree and tmux session manager with modern TUI",
5
5
  "keywords": [
6
6
  "git",
@@ -24,6 +24,9 @@ fi
24
24
  # Note: tmux session names cannot contain ':'; use a safe delimiter
25
25
  ORCHESTRA_SESSION_DELIM="__"
26
26
 
27
+ # Absolute directory that contains this script when sourced.
28
+ _TMUX_API_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
29
+
27
30
  # Helper: return delimiter
28
31
  _tmux_delim() { echo "$ORCHESTRA_SESSION_DELIM"; }
29
32
 
@@ -108,18 +111,38 @@ _tmux_normalize_app_from_command() {
108
111
 
109
112
  # Helper: absolute path to the command hook script (if present)
110
113
  _orchestra_command_hook() {
111
- local root
112
- root="$(repo_root)"
113
- if [[ -z "$root" ]]; then
114
- echo ""
115
- return
114
+ local hook=""
115
+
116
+ # 1) Explicit install root set by wrappers (Homebrew/NPM)
117
+ if [[ -n "${GW_ORCHESTRATOR_ROOT-}" ]]; then
118
+ hook="$GW_ORCHESTRATOR_ROOT/shell/orchestra-command-hook.sh"
119
+ if [[ -f "$hook" ]]; then
120
+ echo "$hook"
121
+ return
122
+ fi
116
123
  fi
117
- local hook="$root/shell/orchestra-command-hook.sh"
124
+
125
+ # 2) Resolve relative to this script's install location
126
+ local script_root
127
+ script_root="$(cd "$_TMUX_API_DIR/.." && pwd -P)"
128
+ hook="$script_root/shell/orchestra-command-hook.sh"
118
129
  if [[ -f "$hook" ]]; then
119
130
  echo "$hook"
120
- else
121
- echo ""
131
+ return
132
+ fi
133
+
134
+ # 3) Fallback to repo root for legacy/dev flows
135
+ local root
136
+ root="$(repo_root)"
137
+ if [[ -n "$root" ]]; then
138
+ hook="$root/shell/orchestra-command-hook.sh"
139
+ if [[ -f "$hook" ]]; then
140
+ echo "$hook"
141
+ return
142
+ fi
122
143
  fi
144
+
145
+ echo ""
123
146
  }
124
147
 
125
148
  # Source the command hook inside a tmux session to enable command history logging
@@ -144,8 +167,8 @@ _tmux_source_command_hook() {
144
167
  pane_id="${line%% *}"
145
168
  pane_cmd="${line#* }"
146
169
  case "$pane_cmd" in
147
- bash|zsh|sh|fish|dash|ksh)
148
- tmux send-keys -t "$pane_id" "source '$hook'" C-m 2>/dev/null || true
170
+ bash|zsh)
171
+ tmux send-keys -t "$pane_id" ". '$hook'" C-m 2>/dev/null || true
149
172
  ;;
150
173
  *)
151
174
  ;;
@@ -1296,6 +1319,8 @@ allowed_prefixes = (
1296
1319
  def clean_tokens(tokens):
1297
1320
  while tokens and tokens[0] in {"$", "#", "%"}:
1298
1321
  tokens = tokens[1:]
1322
+ while tokens and (tokens[0].endswith("$") or tokens[0].endswith("#") or tokens[0].endswith("%")):
1323
+ tokens = tokens[1:]
1299
1324
  return tokens
1300
1325
 
1301
1326
 
@@ -1468,7 +1493,7 @@ def normalize_app(cmd: str) -> str:
1468
1493
  return ""
1469
1494
  return base
1470
1495
 
1471
- app_commands = history_commands
1496
+ app_commands = history_commands if history_commands else app_command_candidates
1472
1497
  app_prefix = ""
1473
1498
  for candidate in reversed(app_commands):
1474
1499
  app_prefix = normalize_app(candidate)
@@ -1559,18 +1584,15 @@ EOF
1559
1584
  -F "file=@$context_file;type=text/plain" 2>/dev/null)
1560
1585
  rm -f "$context_file"
1561
1586
 
1562
- openai_file_id=$(echo "$file_upload_resp" | python3 - <<'PYCODE' 2>/dev/null || true
1563
- import json
1564
- import sys
1565
-
1587
+ openai_file_id=""
1588
+ if have_cmd python3; then
1589
+ openai_file_id="$(python3 -c 'import json,sys
1566
1590
  try:
1567
1591
  data = json.load(sys.stdin)
1568
1592
  except Exception:
1569
1593
  data = {}
1570
-
1571
- print(data.get("id", ""))
1572
- PYCODE
1573
- )
1594
+ print(data.get("id", ""))' <<<"$file_upload_resp" 2>/dev/null || true)"
1595
+ fi
1574
1596
 
1575
1597
  if [[ -n "$openai_file_id" ]]; then
1576
1598
  local responses_body responses_resp ai_desc
@@ -1621,12 +1643,11 @@ PYCODE
1621
1643
  curl -s -X DELETE "https://api.openai.com/v1/files/$openai_file_id" \
1622
1644
  -H "Authorization: Bearer $OPENAI_API_KEY" >/dev/null 2>&1 || true
1623
1645
 
1624
- ai_desc=$(echo "$responses_resp" | python3 - <<'PYCODE'
1625
- import json
1646
+ ai_desc="$(python3 -c 'import json
1626
1647
  import re
1627
1648
  import sys
1628
1649
 
1629
- def clean(value: str) -> str:
1650
+ def clean(value):
1630
1651
  value = (value or "").strip().lower()
1631
1652
  value = re.sub(r"[^a-z0-9_ -]+", "", value)
1632
1653
  value = value.replace(" ", "_")
@@ -1675,9 +1696,7 @@ if isinstance(obj, dict):
1675
1696
  if not description and text:
1676
1697
  description = clean(text)
1677
1698
 
1678
- print(description)
1679
- PYCODE
1680
- )
1699
+ print(description)' <<<"$responses_resp" 2>/dev/null || true)"
1681
1700
 
1682
1701
  if [[ -n "$ai_desc" ]]; then
1683
1702
  new_name="$ai_desc"