karnel-termux 4.17.21 → 4.17.23

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.
Files changed (48) hide show
  1. package/README.md +5 -4
  2. package/docs/CHANGELOG.md +8 -0
  3. package/install.sh +20 -5
  4. package/karnel/RELEASE_COMMIT +1 -1
  5. package/karnel/cli/commands/agent.sh +9 -5
  6. package/karnel/cli/commands/brain.sh +18 -14
  7. package/karnel/cli/commands/doctor/fixes.sh +4 -4
  8. package/karnel/cli/commands/doctor.sh +4 -2
  9. package/karnel/cli/commands/ia.sh +5 -1
  10. package/karnel/cli/commands/pg.sh +5 -2
  11. package/karnel/cli/commands/restore.sh +3 -0
  12. package/karnel/cli/commands/update.sh +18 -0
  13. package/karnel/cli/commands/upgrade.sh +9 -2
  14. package/karnel/cli/commands/voice.sh +4 -2
  15. package/karnel/modules/voice.sh +8 -5
  16. package/karnel/tools/ai/codebuff/install.sh +69 -9
  17. package/karnel/tools/ai/codex/install.sh +3 -0
  18. package/karnel/tools/ai/gemini-cli/install.sh +3 -0
  19. package/karnel/tools/ai/kimi-code/install.sh +3 -0
  20. package/karnel/tools/ai/minimax-cli/install.sh +3 -0
  21. package/karnel/tools/ai/openclaude/install.sh +3 -0
  22. package/karnel/tools/ai/openclaw/install.sh +3 -0
  23. package/karnel/tools/ai/pi/install.sh +3 -0
  24. package/karnel/tools/ai/qoder/install.sh +140 -29
  25. package/karnel/tools/ai/qwen-code/install.sh +3 -0
  26. package/karnel/tools/deploy/netlify/install.sh +10 -3
  27. package/karnel/tools/deploy/vercel/install.sh +10 -3
  28. package/karnel/tools/lang/bun/install.sh +2 -2
  29. package/karnel/tools/npm/all.sh +1 -23
  30. package/karnel/tools/npm/live-server/install.sh +2 -0
  31. package/karnel/tools/npm/localtunnel/install.sh +3 -1
  32. package/karnel/tools/npm/markserv/install.sh +2 -0
  33. package/karnel/tools/npm/ncu/install.sh +2 -0
  34. package/karnel/tools/npm/nestjs/install.sh +2 -0
  35. package/karnel/tools/npm/ngrok/install.sh +2 -0
  36. package/karnel/tools/npm/prettier/install.sh +2 -0
  37. package/karnel/tools/npm/psqlformat/install.sh +2 -0
  38. package/karnel/tools/npm/typescript/install.sh +2 -0
  39. package/karnel/tools/npm/vercel/install.sh +2 -0
  40. package/karnel/tools/utils/filecheck/filecheck.py +1 -0
  41. package/karnel/tools/utils/qrcode/qrcode.py +1 -0
  42. package/karnel/tools/utils/websites/websites.py +1 -0
  43. package/karnel/tools/voice/uninstall.sh +1 -0
  44. package/karnel/utils/agent_actions.sh +8 -0
  45. package/karnel/utils/agent_llm.sh +7 -7
  46. package/karnel/utils/downloaded-python.sh +1 -1
  47. package/karnel/utils/npm-shebang.sh +30 -0
  48. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  #!/data/data/com.termux/files/usr/bin/python3
2
+ import os
2
3
  import sys
3
4
  import subprocess
4
5
  import hashlib
@@ -1,4 +1,5 @@
1
1
  #!/data/data/com.termux/files/usr/bin/python3
2
+ import os
2
3
  import re
3
4
  import subprocess
4
5
  import sys
@@ -1,4 +1,5 @@
1
1
  #!/data/data/com.termux/files/usr/bin/python3
2
+ import os
2
3
  import re
3
4
  import datetime
4
5
 
@@ -19,6 +19,7 @@ _uninstall_voice_tool() {
19
19
  fi
20
20
  else
21
21
  log_info "Termux:API is not installed"
22
+ rm -f "$marker"
22
23
  fi
23
24
  return 0
24
25
  }
@@ -551,11 +551,19 @@ _agent_cmd_is_readonly() {
551
551
  # commands. Anything the write-gate flags, or any command not in this
552
552
  # allowlist (ruby/php/lua/tclsh/expect/sbcl/...), is blocked — so PLAN
553
553
  # mode can never modify the machine or run arbitrary code.
554
+ # Shell syntax makes a string-level allowlist unsafe: quoted command names,
555
+ # separators, substitutions and redirects can hide writes from the first token.
556
+ case "$1" in
557
+ *';'* | *'&'* | *'|'* | *"'"* | *'"'* | *'`'* | *'\'* | *'<'* | *'>'* | *'$'*) return 1 ;;
558
+ esac
554
559
  _agent_cmd_is_write "$1" && return 1
555
560
  local first
556
561
  first=$(printf '%s\n' "$1" | sed 's/^[[:space:]]*//' | cut -d' ' -f1)
557
562
  case "$first" in
558
563
  ls | cat | head | tail | grep | rg | find | stat | wc | file | diff | sort | uniq | cut | tr | tree | du | df | which | type | echo | printf | jq | readlink | realpath | date | pwd | whoami | uname | sed)
564
+ if [[ " $1 " == *" -delete "* || " $1 " == *" -exec "* || " $1 " == *" -execdir "* || " $1 " == *" -ok "* || " $1 " == *" -okdir "* || " $1 " == *" -fprint "* || " $1 " == *" -fls "* || " $1 " == *" -i "* ]]; then
565
+ return 1
566
+ fi
559
567
  return 0
560
568
  ;;
561
569
  git)
@@ -50,10 +50,10 @@ agent_config_load() {
50
50
  # Reject tampered config (defense-in-depth): numeric/boolean fields
51
51
  # must match the expected shape or they are reset to safe defaults.
52
52
  [[ "$AGENT_TEMPERATURE" =~ ^[0-9]+(\.[0-9]+)?$ ]] || AGENT_TEMPERATURE=0.3
53
- [[ "$AGENT_MAX_TOKENS" =~ ^[0-9]+$ ]] || AGENT_MAX_TOKENS=2048
54
- [[ "$AGENT_MAX_ITERATIONS" =~ ^[0-9]+$ ]] || AGENT_MAX_ITERATIONS=12
53
+ [[ "$AGENT_MAX_TOKENS" =~ ^[1-9][0-9]*$ ]] || AGENT_MAX_TOKENS=2048
54
+ [[ "$AGENT_MAX_ITERATIONS" =~ ^[1-9][0-9]*$ ]] || AGENT_MAX_ITERATIONS=12
55
55
  [[ "$AGENT_CONFIRM_COMMANDS" =~ ^[01]$ ]] || AGENT_CONFIRM_COMMANDS=1
56
- [[ "$AGENT_CONTEXT_WINDOW" =~ ^[0-9]+$ ]] || AGENT_CONTEXT_WINDOW=8192
56
+ [[ "$AGENT_CONTEXT_WINDOW" =~ ^[1-9][0-9]*$ ]] || AGENT_CONTEXT_WINDOW=8192
57
57
  }
58
58
 
59
59
  # ------------------------------------------------------------
@@ -89,16 +89,16 @@ agent_config_set() {
89
89
  [[ "$value" =~ ^[0-9]+(\.[0-9]+)?$ ]] || { log_error "temperature must be a number (e.g. 0.3)"; return 1; }
90
90
  AGENT_TEMPERATURE="$value" ;;
91
91
  max_tokens | maxtokens)
92
- [[ "$value" =~ ^[0-9]+$ ]] || { log_error "max_tokens must be a positive integer"; return 1; }
92
+ [[ "$value" =~ ^[1-9][0-9]*$ ]] || { log_error "max_tokens must be a positive integer"; return 1; }
93
93
  AGENT_MAX_TOKENS="$value" ;;
94
94
  iterations | max_iterations)
95
- [[ "$value" =~ ^[0-9]+$ ]] || { log_error "iterations must be a positive integer"; return 1; }
95
+ [[ "$value" =~ ^[1-9][0-9]*$ ]] || { log_error "iterations must be a positive integer"; return 1; }
96
96
  AGENT_MAX_ITERATIONS="$value" ;;
97
97
  confirm_commands | confirm)
98
98
  [[ "$value" =~ ^[01]$ ]] || { log_error "confirm_commands must be 0 or 1"; return 1; }
99
99
  AGENT_CONFIRM_COMMANDS="$value" ;;
100
100
  context_window | context)
101
- [[ "$value" =~ ^[0-9]+$ ]] || { log_error "context_window must be a positive integer"; return 1; }
101
+ [[ "$value" =~ ^[1-9][0-9]*$ ]] || { log_error "context_window must be a positive integer"; return 1; }
102
102
  AGENT_CONTEXT_WINDOW="$value" ;;
103
103
  server_command | server) AGENT_SERVER_CMD="$value" ;;
104
104
  workspace)
@@ -363,4 +363,4 @@ agent_history_ensure_system() {
363
363
  agent_history_drop_system() {
364
364
  local history="$1"
365
365
  echo "$history" | jq -c '[.[] | select(.role != "system")]'
366
- }
366
+ }
@@ -40,7 +40,7 @@ _downloaded_python_install() {
40
40
  curl -fsSL "$download_url" -o "$staged_payload" || commit_failed=1
41
41
  fi
42
42
  if (( commit_failed != 0 )) || ! sed -i "1s|.*|#!$python3_path|" "$staged_payload" ||
43
- ! chmod +x "$staged_payload" || ! sha256sum "$staged_payload" >"$staged_marker" ||
43
+ ! chmod 755 "$staged_payload" || ! sha256sum "$staged_payload" >"$staged_marker" ||
44
44
  ! ln -s "$payload" "$staged_link"; then
45
45
  rm -rf "$tool_staging" "$link_staging"
46
46
  return 1
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Shared npm shebang repair for Termux.
4
+ # Rewrites `#!/usr/bin/env <interp>` shebangs of npm-installed bins to the
5
+ # absolute Termux interpreter path. Safe to call on any bin name.
6
+
7
+ _fix_npm_shebang() {
8
+ local bin_name="$1"
9
+ local bin_path="$PREFIX/bin/$bin_name"
10
+ [ ! -f "$bin_path" ] && [ ! -L "$bin_path" ] && return 0
11
+
12
+ local real_path
13
+ real_path=$(readlink -f "$bin_path" 2>/dev/null || echo "$bin_path")
14
+ [ ! -f "$real_path" ] && return 0
15
+
16
+ local shebang
17
+ shebang=$(head -1 "$real_path")
18
+
19
+ case "$shebang" in
20
+ "#!/usr/bin/env node"|"#!/data/data/com.termux/files/usr/bin/env node"|"#!$PREFIX/bin/env node")
21
+ sed -i "1s|.*|#!$PREFIX/bin/node|" "$real_path" || return 1
22
+ log_info "Fixed shebang for $bin_name: $shebang → $PREFIX/bin/node"
23
+ ;;
24
+ "#!/usr/bin/env bash"|"#!/data/data/com.termux/files/usr/bin/env bash"|"#!$PREFIX/bin/env bash")
25
+ sed -i "1s|.*|#!$PREFIX/bin/bash|" "$real_path" || return 1
26
+ log_info "Fixed shebang for $bin_name: $shebang → $PREFIX/bin/bash"
27
+ ;;
28
+ esac
29
+ return 0
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karnel-termux",
3
- "version": "4.17.21",
3
+ "version": "4.17.23",
4
4
  "description": "Modular Dev Environment for Termux — install languages, databases, AI agents, editors, and more with one command",
5
5
  "bin": {
6
6
  "karnel": "karnel/bin/karnel"