karnel-termux 0.0.1

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 (258) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +454 -0
  3. package/install.sh +272 -0
  4. package/karnel/bin/karnel +77 -0
  5. package/karnel/cli/commands/brain.sh +1553 -0
  6. package/karnel/cli/commands/cleanup.sh +66 -0
  7. package/karnel/cli/commands/doctor.sh +1528 -0
  8. package/karnel/cli/commands/env.sh +233 -0
  9. package/karnel/cli/commands/help.sh +8 -0
  10. package/karnel/cli/commands/ia.sh +502 -0
  11. package/karnel/cli/commands/init.sh +1274 -0
  12. package/karnel/cli/commands/install.sh +718 -0
  13. package/karnel/cli/commands/list.sh +399 -0
  14. package/karnel/cli/commands/open.sh +106 -0
  15. package/karnel/cli/commands/pg.sh +719 -0
  16. package/karnel/cli/commands/reinstall.sh +663 -0
  17. package/karnel/cli/commands/show.sh +90 -0
  18. package/karnel/cli/commands/start.sh +54 -0
  19. package/karnel/cli/commands/status.sh +96 -0
  20. package/karnel/cli/commands/uninstall.sh +668 -0
  21. package/karnel/cli/commands/update.sh +723 -0
  22. package/karnel/cli/commands/upgrade.sh +40 -0
  23. package/karnel/cli/commands/version.sh +3 -0
  24. package/karnel/cli/commands/voice.sh +230 -0
  25. package/karnel/cli/karnel.sh +706 -0
  26. package/karnel/modules/ai.sh +135 -0
  27. package/karnel/modules/auto.sh +114 -0
  28. package/karnel/modules/db.sh +132 -0
  29. package/karnel/modules/deploy.sh +74 -0
  30. package/karnel/modules/dev.sh +148 -0
  31. package/karnel/modules/editor.sh +115 -0
  32. package/karnel/modules/lang.sh +124 -0
  33. package/karnel/modules/npm.sh +146 -0
  34. package/karnel/modules/shell.sh +338 -0
  35. package/karnel/modules/ui.sh +139 -0
  36. package/karnel/modules/voice.sh +118 -0
  37. package/karnel/tools/ai/all.sh +209 -0
  38. package/karnel/tools/ai/antigravity-cli/README.md +45 -0
  39. package/karnel/tools/ai/antigravity-cli/bin/agy +28 -0
  40. package/karnel/tools/ai/antigravity-cli/helper/agy_helper.c +39 -0
  41. package/karnel/tools/ai/antigravity-cli/install.sh +469 -0
  42. package/karnel/tools/ai/claude-code/README.md +45 -0
  43. package/karnel/tools/ai/claude-code/bin/claude +29 -0
  44. package/karnel/tools/ai/claude-code/helper/claude_helper.c +42 -0
  45. package/karnel/tools/ai/claude-code/install.sh +278 -0
  46. package/karnel/tools/ai/cline/install.sh +160 -0
  47. package/karnel/tools/ai/codegraph/README.md +43 -0
  48. package/karnel/tools/ai/codegraph/bin/codegraph +5 -0
  49. package/karnel/tools/ai/codegraph/install.sh +160 -0
  50. package/karnel/tools/ai/codex/README.md +44 -0
  51. package/karnel/tools/ai/codex/install.sh +104 -0
  52. package/karnel/tools/ai/command-code/README.md +62 -0
  53. package/karnel/tools/ai/command-code/install.sh +136 -0
  54. package/karnel/tools/ai/crush/README.md +17 -0
  55. package/karnel/tools/ai/crush/install.sh +89 -0
  56. package/karnel/tools/ai/ctx7/README.md +26 -0
  57. package/karnel/tools/ai/ctx7/install.sh +61 -0
  58. package/karnel/tools/ai/engram/README.md +44 -0
  59. package/karnel/tools/ai/engram/install.sh +127 -0
  60. package/karnel/tools/ai/freebuff/README.md +52 -0
  61. package/karnel/tools/ai/freebuff/bin/freebuff +28 -0
  62. package/karnel/tools/ai/freebuff/helper/freebuff_helper.c +47 -0
  63. package/karnel/tools/ai/freebuff/install.sh +303 -0
  64. package/karnel/tools/ai/gemini-cli/README.md +46 -0
  65. package/karnel/tools/ai/gemini-cli/install.sh +111 -0
  66. package/karnel/tools/ai/gentle-ai/README.md +42 -0
  67. package/karnel/tools/ai/gentle-ai/install.sh +253 -0
  68. package/karnel/tools/ai/gentle-ai/termux-patches.go +256 -0
  69. package/karnel/tools/ai/gga/README.md +49 -0
  70. package/karnel/tools/ai/gga/install.sh +134 -0
  71. package/karnel/tools/ai/hermes-agent/README.md +50 -0
  72. package/karnel/tools/ai/hermes-agent/install.sh +120 -0
  73. package/karnel/tools/ai/kilocode-cli/README.md +45 -0
  74. package/karnel/tools/ai/kilocode-cli/bin/kilocode +21 -0
  75. package/karnel/tools/ai/kilocode-cli/helper/kilocode_helper.c +47 -0
  76. package/karnel/tools/ai/kilocode-cli/install.sh +179 -0
  77. package/karnel/tools/ai/kimchi-code/README.md +53 -0
  78. package/karnel/tools/ai/kimchi-code/install.sh +221 -0
  79. package/karnel/tools/ai/kimi-code/README.md +45 -0
  80. package/karnel/tools/ai/kimi-code/install.sh +111 -0
  81. package/karnel/tools/ai/kiro/README.md +17 -0
  82. package/karnel/tools/ai/kiro/install.sh +134 -0
  83. package/karnel/tools/ai/mimocode/README.md +43 -0
  84. package/karnel/tools/ai/mimocode/bin/mimo +28 -0
  85. package/karnel/tools/ai/mimocode/helper/mimocode_helper.c +47 -0
  86. package/karnel/tools/ai/mimocode/install.sh +287 -0
  87. package/karnel/tools/ai/minimax-cli/README.md +45 -0
  88. package/karnel/tools/ai/minimax-cli/install.sh +111 -0
  89. package/karnel/tools/ai/mistral-vibe/README.md +46 -0
  90. package/karnel/tools/ai/mistral-vibe/install.sh +119 -0
  91. package/karnel/tools/ai/odysseus/README.md +35 -0
  92. package/karnel/tools/ai/odysseus/install.sh +198 -0
  93. package/karnel/tools/ai/ollama/README.md +44 -0
  94. package/karnel/tools/ai/ollama/install.sh +78 -0
  95. package/karnel/tools/ai/omni-route/README.md +111 -0
  96. package/karnel/tools/ai/omni-route/install.sh +165 -0
  97. package/karnel/tools/ai/openclaude/README.md +46 -0
  98. package/karnel/tools/ai/openclaude/install.sh +110 -0
  99. package/karnel/tools/ai/openclaw/README.md +47 -0
  100. package/karnel/tools/ai/openclaw/install.sh +112 -0
  101. package/karnel/tools/ai/opencode/README.md +51 -0
  102. package/karnel/tools/ai/opencode/bin/opencode +28 -0
  103. package/karnel/tools/ai/opencode/helper/opencode_helper.c +57 -0
  104. package/karnel/tools/ai/opencode/install.sh +290 -0
  105. package/karnel/tools/ai/openspec/README.md +34 -0
  106. package/karnel/tools/ai/openspec/install.sh +61 -0
  107. package/karnel/tools/ai/pi/README.md +46 -0
  108. package/karnel/tools/ai/pi/install.sh +104 -0
  109. package/karnel/tools/ai/qwen-code/README.md +45 -0
  110. package/karnel/tools/ai/qwen-code/install.sh +111 -0
  111. package/karnel/tools/auto/all.sh +57 -0
  112. package/karnel/tools/auto/n8n/README.md +47 -0
  113. package/karnel/tools/auto/n8n/install.sh +102 -0
  114. package/karnel/tools/db/all.sh +61 -0
  115. package/karnel/tools/db/mariadb/README.md +43 -0
  116. package/karnel/tools/db/mariadb/install.sh +65 -0
  117. package/karnel/tools/db/mongodb/README.md +42 -0
  118. package/karnel/tools/db/mongodb/install.sh +73 -0
  119. package/karnel/tools/db/postgresql/README.md +45 -0
  120. package/karnel/tools/db/postgresql/install.sh +65 -0
  121. package/karnel/tools/db/redis/README.md +46 -0
  122. package/karnel/tools/db/redis/install.sh +64 -0
  123. package/karnel/tools/db/sqlite/README.md +44 -0
  124. package/karnel/tools/db/sqlite/install.sh +65 -0
  125. package/karnel/tools/deploy/all.sh +43 -0
  126. package/karnel/tools/deploy/netlify/install.sh +41 -0
  127. package/karnel/tools/deploy/railway/install.sh +109 -0
  128. package/karnel/tools/deploy/vercel/install.sh +43 -0
  129. package/karnel/tools/dev/all.sh +77 -0
  130. package/karnel/tools/dev/bat/README.md +44 -0
  131. package/karnel/tools/dev/bat/install.sh +82 -0
  132. package/karnel/tools/dev/bc/README.md +44 -0
  133. package/karnel/tools/dev/bc/install.sh +82 -0
  134. package/karnel/tools/dev/cloudflared/README.md +43 -0
  135. package/karnel/tools/dev/cloudflared/install.sh +82 -0
  136. package/karnel/tools/dev/curl/README.md +43 -0
  137. package/karnel/tools/dev/curl/install.sh +82 -0
  138. package/karnel/tools/dev/fzf/README.md +44 -0
  139. package/karnel/tools/dev/fzf/install.sh +82 -0
  140. package/karnel/tools/dev/gh/README.md +43 -0
  141. package/karnel/tools/dev/gh/install.sh +82 -0
  142. package/karnel/tools/dev/html2text/README.md +44 -0
  143. package/karnel/tools/dev/html2text/install.sh +82 -0
  144. package/karnel/tools/dev/imagemagick/README.md +44 -0
  145. package/karnel/tools/dev/imagemagick/install.sh +82 -0
  146. package/karnel/tools/dev/jq/README.md +44 -0
  147. package/karnel/tools/dev/jq/install.sh +82 -0
  148. package/karnel/tools/dev/lsd/README.md +44 -0
  149. package/karnel/tools/dev/lsd/install.sh +82 -0
  150. package/karnel/tools/dev/make/README.md +44 -0
  151. package/karnel/tools/dev/make/install.sh +82 -0
  152. package/karnel/tools/dev/ncurses/README.md +42 -0
  153. package/karnel/tools/dev/ncurses/install.sh +82 -0
  154. package/karnel/tools/dev/openssh/README.md +43 -0
  155. package/karnel/tools/dev/openssh/install.sh +75 -0
  156. package/karnel/tools/dev/proot/README.md +43 -0
  157. package/karnel/tools/dev/proot/install.sh +82 -0
  158. package/karnel/tools/dev/shfmt/README.md +44 -0
  159. package/karnel/tools/dev/shfmt/install.sh +82 -0
  160. package/karnel/tools/dev/tmate/README.md +44 -0
  161. package/karnel/tools/dev/tmate/install.sh +82 -0
  162. package/karnel/tools/dev/tmux/README.md +43 -0
  163. package/karnel/tools/dev/tmux/install.sh +75 -0
  164. package/karnel/tools/dev/translate/README.md +44 -0
  165. package/karnel/tools/dev/translate/install.sh +82 -0
  166. package/karnel/tools/dev/tree/README.md +44 -0
  167. package/karnel/tools/dev/tree/install.sh +82 -0
  168. package/karnel/tools/dev/udocker/README.md +44 -0
  169. package/karnel/tools/dev/udocker/install.sh +82 -0
  170. package/karnel/tools/dev/wget/README.md +44 -0
  171. package/karnel/tools/dev/wget/install.sh +82 -0
  172. package/karnel/tools/editor/all.sh +59 -0
  173. package/karnel/tools/editor/code-server/README.md +42 -0
  174. package/karnel/tools/editor/code-server/install.sh +74 -0
  175. package/karnel/tools/editor/neovim/README.md +43 -0
  176. package/karnel/tools/editor/neovim/install.sh +64 -0
  177. package/karnel/tools/editor/nvchad/README.md +45 -0
  178. package/karnel/tools/editor/nvchad/install.sh +105 -0
  179. package/karnel/tools/lang/all.sh +63 -0
  180. package/karnel/tools/lang/clang/README.md +43 -0
  181. package/karnel/tools/lang/clang/install.sh +79 -0
  182. package/karnel/tools/lang/golang/README.md +43 -0
  183. package/karnel/tools/lang/golang/install.sh +79 -0
  184. package/karnel/tools/lang/nodejs/README.md +43 -0
  185. package/karnel/tools/lang/nodejs/install.sh +79 -0
  186. package/karnel/tools/lang/perl/README.md +43 -0
  187. package/karnel/tools/lang/perl/install.sh +79 -0
  188. package/karnel/tools/lang/php/README.md +43 -0
  189. package/karnel/tools/lang/php/install.sh +79 -0
  190. package/karnel/tools/lang/python/README.md +43 -0
  191. package/karnel/tools/lang/python/install.sh +79 -0
  192. package/karnel/tools/lang/rust/README.md +43 -0
  193. package/karnel/tools/lang/rust/install.sh +79 -0
  194. package/karnel/tools/npm/all.sh +90 -0
  195. package/karnel/tools/npm/live-server/README.md +43 -0
  196. package/karnel/tools/npm/live-server/install.sh +96 -0
  197. package/karnel/tools/npm/localtunnel/README.md +43 -0
  198. package/karnel/tools/npm/localtunnel/install.sh +112 -0
  199. package/karnel/tools/npm/markserv/README.md +43 -0
  200. package/karnel/tools/npm/markserv/install.sh +95 -0
  201. package/karnel/tools/npm/ncu/README.md +43 -0
  202. package/karnel/tools/npm/ncu/install.sh +95 -0
  203. package/karnel/tools/npm/nestjs/README.md +43 -0
  204. package/karnel/tools/npm/nestjs/install.sh +95 -0
  205. package/karnel/tools/npm/ngrok/README.md +44 -0
  206. package/karnel/tools/npm/ngrok/install.sh +95 -0
  207. package/karnel/tools/npm/prettier/README.md +43 -0
  208. package/karnel/tools/npm/prettier/install.sh +95 -0
  209. package/karnel/tools/npm/psqlformat/README.md +43 -0
  210. package/karnel/tools/npm/psqlformat/install.sh +95 -0
  211. package/karnel/tools/npm/turbopack/README.md +8 -0
  212. package/karnel/tools/npm/turbopack/install.sh +42 -0
  213. package/karnel/tools/npm/typescript/README.md +43 -0
  214. package/karnel/tools/npm/typescript/install.sh +95 -0
  215. package/karnel/tools/npm/vercel/README.md +43 -0
  216. package/karnel/tools/npm/vercel/install.sh +95 -0
  217. package/karnel/tools/shell/all.sh +67 -0
  218. package/karnel/tools/shell/better-npm/README.md +43 -0
  219. package/karnel/tools/shell/better-npm/install.sh +85 -0
  220. package/karnel/tools/shell/fzf-tab/README.md +44 -0
  221. package/karnel/tools/shell/fzf-tab/install.sh +85 -0
  222. package/karnel/tools/shell/history-substring/README.md +43 -0
  223. package/karnel/tools/shell/history-substring/install.sh +85 -0
  224. package/karnel/tools/shell/powerlevel10k/README.md +43 -0
  225. package/karnel/tools/shell/powerlevel10k/install.sh +85 -0
  226. package/karnel/tools/shell/you-should-use/README.md +43 -0
  227. package/karnel/tools/shell/you-should-use/install.sh +85 -0
  228. package/karnel/tools/shell/zsh-autopair/README.md +44 -0
  229. package/karnel/tools/shell/zsh-autopair/install.sh +85 -0
  230. package/karnel/tools/shell/zsh-autosuggestions/README.md +43 -0
  231. package/karnel/tools/shell/zsh-autosuggestions/install.sh +85 -0
  232. package/karnel/tools/shell/zsh-completions/README.md +43 -0
  233. package/karnel/tools/shell/zsh-completions/install.sh +85 -0
  234. package/karnel/tools/shell/zsh-defer/README.md +43 -0
  235. package/karnel/tools/shell/zsh-defer/install.sh +85 -0
  236. package/karnel/tools/shell/zsh-syntax-highlighting/README.md +43 -0
  237. package/karnel/tools/shell/zsh-syntax-highlighting/install.sh +72 -0
  238. package/karnel/tools/ui/all.sh +61 -0
  239. package/karnel/tools/ui/banner/README.md +42 -0
  240. package/karnel/tools/ui/banner/install.sh +160 -0
  241. package/karnel/tools/ui/cursor/README.md +42 -0
  242. package/karnel/tools/ui/cursor/install.sh +58 -0
  243. package/karnel/tools/ui/extra-keys/README.md +43 -0
  244. package/karnel/tools/ui/extra-keys/install.sh +62 -0
  245. package/karnel/tools/ui/font/README.md +43 -0
  246. package/karnel/tools/ui/font/install.sh +63 -0
  247. package/karnel/tools/voice/all.sh +27 -0
  248. package/karnel/tools/voice/install.sh +10 -0
  249. package/karnel/tools/voice/uninstall.sh +8 -0
  250. package/karnel/utils/banner.sh +492 -0
  251. package/karnel/utils/bootstrap.sh +25 -0
  252. package/karnel/utils/colors.sh +33 -0
  253. package/karnel/utils/dialogrc +30 -0
  254. package/karnel/utils/env.sh +53 -0
  255. package/karnel/utils/log.sh +567 -0
  256. package/karnel/utils/version.sh +205 -0
  257. package/package.json +42 -0
  258. package/scripts/npm-install.js +60 -0
@@ -0,0 +1,198 @@
1
+ #!/usr/bin/env bash
2
+
3
+ import "@/utils/log"
4
+ import "@/utils/colors"
5
+
6
+ LOG_FILE="$KARNEL_CACHE/install_ai.log"
7
+ ODYSSEUS_DATA_DIR="$HOME/.local/share/karnel-data/odysseus"
8
+
9
+ _odysseus_dependencies() {
10
+ loading "Installing dependencies" _odysseus_dependencies_impl
11
+ }
12
+
13
+ _odysseus_dependencies_impl() {
14
+ declare -A DEPS=(
15
+ ["git"]="git"
16
+ ["curl"]="curl"
17
+ ["proot-distro"]="proot-distro"
18
+ )
19
+
20
+ local pkg_name bin_name
21
+ for pkg_name in "${!DEPS[@]}"; do
22
+ bin_name="${DEPS[$pkg_name]}"
23
+ if ! command -v "$bin_name" &>/dev/null; then
24
+ if ! pkg install "$pkg_name" -y &>>"$LOG_FILE"; then
25
+ log_error "Failed to install $pkg_name"
26
+ return 1
27
+ fi
28
+ fi
29
+ done
30
+
31
+ return 0
32
+ }
33
+
34
+ _odysseus_detect_ubuntu_root() {
35
+ local root
36
+ root="$(find /data/data/com.termux -maxdepth 10 -type d \
37
+ -name "rootfs" -path "*/containers/ubuntu/*" 2>/dev/null | head -1)"
38
+
39
+ if [ -z "$root" ]; then
40
+ root="$(find /data/data/com.termux -maxdepth 10 -type d \
41
+ -name "ubuntu" -path "*/installed-rootfs/*" 2>/dev/null | head -1)"
42
+ fi
43
+
44
+ echo "$root"
45
+ }
46
+
47
+ _odysseus_proot_ubuntu() {
48
+ proot-distro login \
49
+ --shared-tmp \
50
+ ubuntu \
51
+ -- "$@"
52
+ }
53
+
54
+ _install_odysseus_impl() {
55
+ mkdir -p "$(dirname "$LOG_FILE")"
56
+
57
+ if ! command -v proot-distro &>/dev/null; then
58
+ pkg install proot-distro -y &>>"$LOG_FILE"
59
+ fi
60
+
61
+ if [ ! -d "$(_odysseus_detect_ubuntu_root)" ]; then
62
+ proot-distro install ubuntu:24.04 &>>"$LOG_FILE"
63
+ fi
64
+
65
+ _odysseus_proot_ubuntu /bin/bash -c '
66
+ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
67
+ export DEBIAN_FRONTEND=noninteractive
68
+
69
+ apt-get update -qq && apt-get upgrade -y -qq && apt-get install -y -qq curl git python3-pip
70
+
71
+ python3 -m pip install --break-system-packages \
72
+ fastapi uvicorn python-multipart python-dotenv httpx pydantic pydantic-settings \
73
+ mcp bcrypt sqlalchemy aiosqlite jinja2 aiofiles python-dateutil \
74
+ pyotp qrcode croniter pypdf beautifulsoup4 charset-normalizer \
75
+ numpy chromadb-client fastembed youtube-transcript-api markdown \
76
+ nh3 icalendar caldav pytest pytest-asyncio
77
+ ' &>>"$LOG_FILE"
78
+
79
+ _odysseus_proot_ubuntu /bin/bash -c '
80
+ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
81
+
82
+ if [ ! -d /root/odysseus ]; then
83
+ git clone --depth 1 https://github.com/pewdiepie-archdaemon/odysseus.git /root/odysseus
84
+ fi
85
+
86
+ cd /root/odysseus
87
+ if [ -f requirements.txt ]; then
88
+ python3 -m pip install --break-system-packages -r requirements.txt 2>&1
89
+ fi
90
+ ' &>>"$LOG_FILE"
91
+
92
+ local ubuntu_root
93
+ ubuntu_root="$(_odysseus_detect_ubuntu_root)"
94
+
95
+ if [ -z "$ubuntu_root" ]; then
96
+ log_error "Ubuntu rootfs not found"
97
+ return 1
98
+ fi
99
+
100
+ local wrapper_path="$PREFIX/bin/odysseus"
101
+ cat > "$wrapper_path" << WRAPPER
102
+ #!$PREFIX/bin/bash
103
+ exec proot-distro login --shared-tmp ubuntu -- bash -c 'cd /root/odysseus && exec python3 app.py "\$@"' bash "\$@"
104
+ WRAPPER
105
+ chmod +x "$wrapper_path"
106
+
107
+ log_success "Odysseus installed (proot-distro)"
108
+ echo
109
+ log_info "Start with: ${D_CYAN}odysseus${NC}"
110
+ log_info "Web UI at: ${D_CYAN}http://localhost:7000${NC}"
111
+ }
112
+
113
+ _install_odysseus_native() {
114
+ mkdir -p "$(dirname "$LOG_FILE")"
115
+
116
+ if ! command -v glibc-repo &>/dev/null && ! command -v glibc &>/dev/null; then
117
+ pkg install glibc-repo glibc clang curl git tar -y &>>"$LOG_FILE" || true
118
+ fi
119
+
120
+ _odysseus_proot_ubuntu /bin/bash -c '
121
+ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
122
+ export DEBIAN_FRONTEND=noninteractive
123
+
124
+ if [ ! -d /root/odysseus ]; then
125
+ git clone --depth 1 https://github.com/pewdiepie-archdaemon/odysseus.git /root/odysseus
126
+ fi
127
+
128
+ cd /root/odysseus
129
+ if [ -f requirements.txt ]; then
130
+ python3 -m pip install --break-system-packages -r requirements.txt 2>&1
131
+ fi
132
+ ' &>>"$LOG_FILE"
133
+
134
+ mkdir -p "$ODYSSEUS_DATA_DIR"
135
+ local wrapper_path="$PREFIX/bin/odysseus"
136
+ cat > "$wrapper_path" << WRAPPER
137
+ #!$PREFIX/bin/bash
138
+ exec proot-distro login --shared-tmp ubuntu -- bash -c 'cd /root/odysseus && exec python3 app.py "\$@"' bash "\$@"
139
+ WRAPPER
140
+ chmod +x "$wrapper_path"
141
+
142
+ log_success "Odysseus installed (native glibc)"
143
+ echo
144
+ log_info "Start with: ${D_CYAN}odysseus${NC}"
145
+ log_info "Web UI at: ${D_CYAN}http://localhost:7000${NC}"
146
+ }
147
+
148
+ install_odysseus() {
149
+ if command -v odysseus &>/dev/null || [ -d "$ODYSSEUS_DATA_DIR/repo" ]; then
150
+ log_info "Odysseus is already installed"
151
+ return 2
152
+ fi
153
+
154
+ log_info "Installing Odysseus..."
155
+
156
+ mkdir -p "$(dirname "$LOG_FILE")"
157
+
158
+ _odysseus_dependencies || return 1
159
+
160
+ log_info "Installing via proot-distro Ubuntu (Docker not available on Termux)..."
161
+ _install_odysseus_impl
162
+
163
+ log_success "Odysseus installed successfully"
164
+ return 0
165
+ }
166
+
167
+ uninstall_odysseus() {
168
+ log_info "Uninstalling Odysseus..."
169
+ mkdir -p "$(dirname "$LOG_FILE")"
170
+
171
+ if [ -f "$PREFIX/bin/odysseus" ]; then
172
+ rm -f "$PREFIX/bin/odysseus"
173
+ fi
174
+
175
+ if [ -d "$ODYSSEUS_DATA_DIR" ]; then
176
+ rm -rf "$ODYSSEUS_DATA_DIR"
177
+ fi
178
+
179
+ log_success "Odysseus uninstalled"
180
+ return 0
181
+ }
182
+
183
+ update_odysseus() {
184
+ log_info "Updating Odysseus..."
185
+ mkdir -p "$(dirname "$LOG_FILE")"
186
+
187
+ _odysseus_proot_ubuntu /bin/bash -c '
188
+ cd /root/odysseus && git pull
189
+ ' &>>"$LOG_FILE" && log_success "Odysseus updated" || {
190
+ log_error "Failed to update Odysseus"
191
+ return 1
192
+ }
193
+ }
194
+
195
+ reinstall_odysseus() {
196
+ uninstall_odysseus
197
+ install_odysseus
198
+ }
@@ -0,0 +1,44 @@
1
+ # Ollama
2
+
3
+ Run open-source LLMs locally on Termux
4
+
5
+ **Package:** ollama
6
+ **Author:** israel marques
7
+ **Repository:** https://github.com/israelmarques1024-dotcom/karnel-termux
8
+ **Official:** https://ollama.com
9
+ **Type:** Local LLM runtime (pkg)
10
+ **License:** MIT
11
+
12
+ ## Description
13
+
14
+ Ollama allows you to run open-source LLMs locally on Termux. It supports a wide range of models including Llama, Mistral, Gemma, Qwen, DeepSeek, and many more. All processing is done locally with no data sent to external servers.
15
+
16
+ ## Dependencies
17
+
18
+ - Installed via pkg (termux package)
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ karnel install ai --ollama
24
+ ```
25
+
26
+ ## Uninstall
27
+
28
+ ```bash
29
+ karnel uninstall ai --ollama
30
+ ```
31
+
32
+ ## Update
33
+
34
+ ```bash
35
+ karnel update ai --ollama
36
+ ```
37
+
38
+ ## Notes
39
+
40
+ - Runs entirely locally on your device
41
+ - Supports models from Ollama library
42
+ - Command: `ollama`
43
+ - Model storage: `~/.ollama/`
44
+
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env bash
2
+
3
+ import "@/utils/log"
4
+
5
+ LOG_FILE="$KARNEL_CACHE/install_ai.log"
6
+
7
+ _install_ollama_pkg() {
8
+ loading "Installing Ollama" _install_ollama_pkg_impl
9
+ }
10
+
11
+ _install_ollama_pkg_impl() {
12
+ if ! pkg install ollama -y &>>"$LOG_FILE"; then
13
+ log_error "Failed to install Ollama"
14
+ return 1
15
+ fi
16
+
17
+ return 0
18
+ }
19
+
20
+ install_ollama() {
21
+ if command -v ollama &>/dev/null; then
22
+ log_info "Ollama is already installed"
23
+ return 2
24
+ fi
25
+ log_info "Installing Ollama..."
26
+
27
+ mkdir -p "$(dirname "$LOG_FILE")"
28
+
29
+ _install_ollama_pkg || return 1
30
+
31
+ log_success "Ollama installed"
32
+ return 0
33
+ }
34
+
35
+ uninstall_ollama() {
36
+ if ! command -v ollama &>/dev/null; then
37
+ log_info "Ollama is not installed"
38
+ return 2
39
+ fi
40
+ log_info "Uninstalling Ollama..."
41
+ mkdir -p "$(dirname "$LOG_FILE")"
42
+
43
+ loading "Removing Ollama" _uninstall_ollama_impl
44
+
45
+ log_success "Ollama uninstalled"
46
+ return 0
47
+ }
48
+
49
+ _uninstall_ollama_impl() {
50
+ if ! pkg uninstall ollama -y &>>"$LOG_FILE"; then
51
+ log_error "Failed to uninstall Ollama"
52
+ return 1
53
+ fi
54
+ return 0
55
+ }
56
+
57
+ update_ollama() {
58
+ log_info "Updating Ollama..."
59
+ mkdir -p "$(dirname "$LOG_FILE")"
60
+
61
+ loading "Updating Ollama" _update_ollama_impl
62
+
63
+ log_success "Ollama updated"
64
+ return 0
65
+ }
66
+
67
+ _update_ollama_impl() {
68
+ if ! pkg upgrade ollama -y &>>"$LOG_FILE"; then
69
+ log_error "Failed to update Ollama"
70
+ return 1
71
+ fi
72
+ return 0
73
+ }
74
+
75
+ reinstall_ollama() {
76
+ uninstall_ollama
77
+ install_ollama
78
+ }
@@ -0,0 +1,111 @@
1
+ # karnelRoute
2
+
3
+ **AI Gateway CLI** — 236+ AI providers via a single endpoint.
4
+
5
+ **Package:** karnel-route
6
+ **Author:** israel marques
7
+ **Repository:** https://github.com/israelmarques1024-dotcom/karnel-termux
8
+ **Official:** https://karnelroute.online
9
+ **npm:** https://www.npmjs.com/package/karnelroute
10
+ **Type:** AI Gateway (npm package with smart wrapper)
11
+ **License:** MIT
12
+
13
+ ## Description
14
+
15
+ karnelRoute is the Karnel Termux wrapper for the official `karnelroute` npm package — an AI Gateway that provides 236+ AI providers via a single endpoint, with auto-fallback to free providers and smart routing with compression (15-95% token savings).
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ karnel install ai --karnel-route
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```bash
26
+ karnel-route # Start AI gateway on localhost:20128
27
+ karnel-route serve --daemon # Start as background daemon
28
+ karnel-route serve --daemon --no-open # Daemon without browser
29
+ karnel-route stop # Stop the server
30
+ karnel-route --help # Show all commands
31
+ karnel-route --version # Show version
32
+ ```
33
+
34
+ ## Dashboard
35
+
36
+ Access the web dashboard at:
37
+ - **URL:** http://localhost:20128
38
+ - **Setup:** Configure providers at `/dashboard`
39
+ - **API Base:** `http://localhost:20128/v1`
40
+
41
+ ## Architecture
42
+
43
+ The wrapper uses a **3-tier fallback** strategy:
44
+
45
+ 1. **Local install** (`~/.karnel/packages/karnelroute/`) — Fast, no download on subsequent runs
46
+ 2. **npm install** (first run) — Downloads and caches locally with `--ignore-scripts`
47
+ 3. **npx** (last resort) — Falls back to on-demand execution
48
+
49
+ ### Termux / Android Native Fixes (root cause of "Internal Server Error" 500)
50
+
51
+ KarnelRoute bundles `better-sqlite3` (and `sqlite-vec`) as **prebuilt `linux-x64` glibc**
52
+ native addons. On Termux/Android the runtime is **aarch64 + Bionic libc** and
53
+ `process.platform` reports `android`, so those addons fail to load
54
+ (`dlopen: cannot locate symbol …`). With no working database, every HTTP request
55
+ returns `500` and the logs show an `out of memory` DB-probe death spiral.
56
+
57
+ The installer fixes this **definitively** (no workarounds) by rebuilding the
58
+ native addons from source for the running Node/ABI:
59
+
60
+ 1. **Rebuild native modules** — `better-sqlite3` and `sqlite-vec` are recompiled
61
+ with Termux's `clang` against the local Node headers. `node-gyp` mis-detects
62
+ Termux as Android and demands `android_ndk_path`; the installer supplies a
63
+ dummy value so the Android gyp config resolves while Termux's clang compiles.
64
+ 2. **Instrumentation resilience** — Next.js `registerInstrumentation()` used to
65
+ *re-throw* any error from KarnelRoute's (non-critical) instrumentation hook and
66
+ crash the whole server. The installer patches Next's
67
+ `instrumentation-globals.external.js` so a hook error is logged and the server
68
+ keeps running (the real application database is unaffected).
69
+
70
+ Both fixes are re-applied automatically on every `install` / `update`, so a fresh
71
+ or updated install keeps working on Termux/Android.
72
+
73
+ ### Resetting a corrupted database
74
+
75
+ If `~/.karnelroute/storage.sqlite` becomes corrupt, KarnelRoute cannot auto-recover
76
+ and renames it to `storage.sqlite.probe-failed-*`. Remove those files and let the
77
+ server recreate a fresh database:
78
+
79
+ ```bash
80
+ rm -f ~/.karnelroute/storage.sqlite{,-wal,-shm} ~/.karnelroute/storage.sqlite.probe-failed-*
81
+ karnel-route serve --daemon
82
+ ```
83
+
84
+ ## Commands
85
+
86
+ | Command | Description |
87
+ |---------|-------------|
88
+ | `karnel-route` | Shortcut to karnelroute |
89
+ | `karnel-route serve` | Start the server |
90
+ | `karnel-route serve --daemon` | Run in background |
91
+ | `karnel-route stop` | Stop the daemon |
92
+
93
+ ## Notes
94
+
95
+ - Installed via npm package: `karnelroute` (official)
96
+ - Data directory: `~/.karnelroute/` (auto-generated config)
97
+ - Default port: 20128
98
+ - Dashboard requires `INITIAL_PASSWORD` (auto-generated on first run)
99
+ - For external access, configure `JWT_SECRET` and `API_KEY_SECRET` in `.env`
100
+
101
+ ## Links
102
+
103
+ - Website: https://karnelroute.online
104
+ - GitHub: https://github.com/diegosouzapw/KarnelRoute
105
+ - npm: https://www.npmjs.com/package/karnelroute
106
+
107
+ ## Related
108
+
109
+ - `karnel ia routes` — List installed AI CLI tools
110
+ - `karnel ia sessions` — View active AI sessions
111
+ - `karnel install ai --karnel-route` — Install
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env bash
2
+
3
+ import "@/utils/log"
4
+
5
+ LOG_FILE="$KARNEL_CACHE/install_ai.log"
6
+
7
+ # Check if omni-route binary exists and works
8
+ _omni_route_ok() {
9
+ command -v omni-route &>/dev/null && omni-route --version &>/dev/null 2>&1
10
+ }
11
+
12
+ # Detect Termux / Android (Node reports platform "android" and uname mentions android)
13
+ _omni_route_is_android() {
14
+ if [ "$(node -e 'process.stdout.write(process.platform)' 2>/dev/null)" = "android" ]; then
15
+ return 0
16
+ fi
17
+ case "$(uname -s 2>/dev/null) $(uname -o 2>/dev/null)" in
18
+ *android*|*Android*) return 0 ;;
19
+ esac
20
+ return 1
21
+ }
22
+
23
+ # Apply platform-specific fixes so omniRoute actually runs on Termux/Android.
24
+ # Two real, root-cause issues are addressed here (no workarounds/masking):
25
+ # 1. omniRoute bundles better-sqlite3 / sqlite-vec as prebuilt linux-x64 glibc
26
+ # native addons. On Android/Bionic (aarch64) those fail to load
27
+ # (dlopen: cannot locate symbol), so the database can never open and every
28
+ # HTTP request returns 500. We rebuild the native addons from source for the
29
+ # running Node/ABI. node-gyp mis-detects Termux as Android and demands
30
+ # android_ndk_path, which does not exist; we supply a dummy value so the
31
+ # Android gyp config resolves while Termux's own clang does the compile.
32
+ # 2. Next.js registerInstrumentation() re-throws any error from omniRoute's
33
+ # (non-critical) instrumentation hook and that crash takes down the whole
34
+ # server. We make it log-and-continue so a transient hook error does not
35
+ # kill the gateway (the real application DB is unaffected).
36
+ _omni_route_apply_platform_fixes() {
37
+ local pkg_root="$1"
38
+ [ -d "$pkg_root" ] || return 0
39
+ _omni_route_is_android || return 0
40
+
41
+ log_info "Termux/Android detected — applying native build fixes for omniRoute..."
42
+
43
+ local ng="/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
44
+ if [ -x "$ng" ] && command -v clang >/dev/null 2>&1; then
45
+ for mod in better-sqlite3 sqlite-vec; do
46
+ local moddir="$pkg_root/node_modules/$mod"
47
+ [ -d "$moddir" ] || continue
48
+ log_info "Rebuilding native module: $mod (aarch64/Bionic)"
49
+ if ( cd "$moddir" && CC=clang CXX=clang++ GYP_DEFINES="android_ndk_path=$PREFIX" node "$ng" rebuild --release "-Dandroid_ndk_path=$PREFIX" ) >>"$LOG_FILE" 2>&1; then
50
+ log_success "Rebuilt $mod"
51
+ else
52
+ log_warn "Could not rebuild $mod (see $LOG_FILE); omniRoute may fail to open its database"
53
+ fi
54
+ done
55
+ else
56
+ log_warn "Native toolchain (node-gyp/clang) not found; cannot rebuild omniRoute native modules"
57
+ fi
58
+
59
+ # Patch Next.js instrumentation so a non-critical hook error does not crash the server.
60
+ local ig
61
+ ig=$(find "$pkg_root/node_modules/karnelroute/dist/node_modules/next" -path '*router-utils/instrumentation-globals.external.js' 2>/dev/null | head -1)
62
+ if [ -n "$ig" ] && grep -q "An error occurred while loading instrumentation hook" "$ig"; then
63
+ if perl -0pi -e 's/err\.message = `An error occurred while loading instrumentation hook: \$\{err\.message\}`;\s*\n\s*throw err;/err.message = `An error occurred while loading instrumentation hook: ${err.message}`;\n console.error("[instrumentation] Non-fatal error in instrumentation hook (server continues):", err && err.message ? err.message : err);/g' "$ig"; then
64
+ log_success "Patched Next.js instrumentation (hook errors are now non-fatal)"
65
+ else
66
+ log_warn "Could not patch Next.js instrumentation at $ig"
67
+ fi
68
+ fi
69
+ }
70
+
71
+ install_omni_route() {
72
+ # Already working? Still ensure platform fixes are present (e.g. after an
73
+ # update re-fetched a broken prebuild) and return.
74
+ if _omni_route_ok; then
75
+ log_info "omniRoute already installed ($(omni-route --version 2>&1 | tail -1))"
76
+ _omni_route_apply_platform_fixes "$HOME/.karnel/packages/karnelroute"
77
+ return 2
78
+ fi
79
+
80
+ # Try local install first (fast, no download)
81
+ local local_bin="$HOME/.karnel/packages/karnelroute/node_modules/karnelroute/bin/karnelroute.mjs"
82
+ if [ -f "$local_bin" ]; then
83
+ sed -i '1s|^#!/usr/bin/env node|#!/data/data/com.termux/files/usr/bin/node|' "$local_bin" 2>/dev/null
84
+ # Create both karnelroute (official) and omni-route (karnel wrapper)
85
+ for cmd in karnelroute omni-route; do
86
+ cat > "$PREFIX/bin/$cmd" <<'WRAPPER'
87
+ #!/data/data/com.termux/files/usr/bin/env bash
88
+ exec node "$HOME/.karnel/packages/karnelroute/node_modules/karnelroute/bin/karnelroute.mjs" "$@"
89
+ WRAPPER
90
+ chmod +x "$PREFIX/bin/$cmd"
91
+ done
92
+ _omni_route_apply_platform_fixes "$HOME/.karnel/packages/karnelroute"
93
+ if _omni_route_ok; then
94
+ log_success "omniRoute restored from local install"
95
+ return 0
96
+ fi
97
+ fi
98
+
99
+ # Install into the local prefix (self-contained; works offline after first download)
100
+ log_info "Installing omniRoute (this may take a while)..."
101
+ mkdir -p "$HOME/.karnel/packages/karnelroute"
102
+ if command -v npm >/dev/null 2>&1 && npm i karnelroute --prefix "$HOME/.karnel/packages/karnelroute" 2>>"$LOG_FILE"; then
103
+ sed -i '1s|^#!/usr/bin/env node|#!/data/data/com.termux/files/usr/bin/node|' "$local_bin" 2>/dev/null
104
+ for cmd in karnelroute omni-route; do
105
+ cat > "$PREFIX/bin/$cmd" <<'WRAPPER'
106
+ #!/data/data/com.termux/files/usr/bin/env bash
107
+ exec node "$HOME/.karnel/packages/karnelroute/node_modules/karnelroute/bin/karnelroute.mjs" "$@"
108
+ WRAPPER
109
+ chmod +x "$PREFIX/bin/$cmd"
110
+ done
111
+ _omni_route_apply_platform_fixes "$HOME/.karnel/packages/karnelroute"
112
+ if _omni_route_ok; then
113
+ log_success "omniRoute installed"
114
+ return 0
115
+ fi
116
+ fi
117
+
118
+ # Try npx as last resort
119
+ log_warn "npm failed, trying npx..."
120
+ if npx -y karnelroute --version &>/dev/null 2>&1; then
121
+ log_success "omniRoute available via npx"
122
+ return 0
123
+ fi
124
+
125
+ log_error "Failed to install omniRoute"
126
+ return 1
127
+ }
128
+
129
+ uninstall_omni_route() {
130
+ if ! _omni_route_ok; then
131
+ log_info "omniRoute is not installed"
132
+ return 0
133
+ fi
134
+
135
+ log_info "Uninstalling omniRoute..."
136
+ npm uninstall -g karnelroute 2>>"$LOG_FILE" 2>/dev/null
137
+ rm -rf "$HOME/.karnel/packages/karnelroute"
138
+ rm -f "$PREFIX/bin/karnelroute" "$PREFIX/bin/omni-route"
139
+ log_success "omniRoute uninstalled"
140
+ return 0
141
+ }
142
+
143
+ update_omni_route() {
144
+ if ! _omni_route_ok; then
145
+ install_omni_route
146
+ return $?
147
+ fi
148
+
149
+ # Update the canonical local install (the one the wrappers actually use),
150
+ # then re-apply the Termux/Android native fixes so it keeps working.
151
+ log_info "Updating omniRoute..."
152
+ if npm i karnelroute@latest --prefix "$HOME/.karnel/packages/karnelroute" 2>>"$LOG_FILE"; then
153
+ _omni_route_apply_platform_fixes "$HOME/.karnel/packages/karnelroute"
154
+ log_success "omniRoute updated"
155
+ return 0
156
+ else
157
+ log_error "Failed to update omniRoute"
158
+ return 1
159
+ fi
160
+ }
161
+
162
+ reinstall_omni_route() {
163
+ uninstall_omni_route
164
+ install_omni_route
165
+ }
@@ -0,0 +1,46 @@
1
+ # OpenClaude
2
+
3
+ Open source Claude Code alternative
4
+
5
+ **Package:** @gitlawb/openclaude
6
+ **Author:** israel marques
7
+ **Repository:** https://github.com/israelmarques1024-dotcom/karnel-termux
8
+ **Official:** https://github.com/gitlawb/openclaude
9
+ **Type:** AI client (npm global package)
10
+ **License:** MIT
11
+
12
+ ## Description
13
+
14
+ OpenClaude is an open source Claude Code alternative. It provides a CLI interface for code generation, analysis, and AI assistance.
15
+
16
+ ## Dependencies
17
+
18
+ - Node.js LTS (nodejs-lts)
19
+ - npm
20
+ - git, ripgrep
21
+
22
+ ## Install
23
+
24
+ ```bash
25
+ karnel install ai --openclaude
26
+ ```
27
+
28
+ ## Uninstall
29
+
30
+ ```bash
31
+ karnel uninstall ai --openclaude
32
+ ```
33
+
34
+ ## Update
35
+
36
+ ```bash
37
+ karnel update ai --openclaude
38
+ ```
39
+
40
+ ## Notes
41
+
42
+ - Installed as a global npm package: `@gitlawb/openclaude`
43
+ - Command: `openclaude`
44
+ - Requires an Anthropic API key
45
+ - Environment variable: `ANTHROPIC_API_KEY`
46
+