Skip to content

Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.

12.6 KB
Raw Blame
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["1676"],{22915(e,n,r){r.r(n),r.d(n,{metadata:()=>s,default:()=>u,frontMatter:()=>a,contentTitle:()=>l,toc:()=>d,assets:()=>o});var s=JSON.parse('{"id":"getting-started/platforms/termux","title":"Termux & Lightweight Devices","description":"Mercury runs on Android via Termux. Other lightweight environments require a compatible Node.js 22+ build and Mercury dependencies; availability varies by operating system and CPU.","source":"@site/docs/getting-started/platforms/termux.mdx","sourceDirName":"getting-started/platforms","slug":"/getting-started/platforms/termux","permalink":"/docs/getting-started/platforms/termux","draft":false,"unlisted":false,"editUrl":"https://github.com/cosmicstack-labs/mercury-agent/tree/main/website/docs/getting-started/platforms/termux.mdx","tags":[],"version":"current","frontMatter":{"id":"termux","title":"Termux & Lightweight Devices","sidebar_label":"Termux & Mobile"},"sidebar":"docsSidebar","previous":{"title":"Windows","permalink":"/docs/getting-started/platforms/windows"},"next":{"title":"Cloud Instance","permalink":"/docs/getting-started/platforms/cloud-instance"}}'),i=r(74848),t=r(28453);let a={id:"termux",title:"Termux & Lightweight Devices",sidebar_label:"Termux & Mobile"},l,o={},d=[{value:"Termux (Android)",id:"termux-android",level:2},{value:"Requirements",id:"requirements",level:3},{value:"Install Node.js + Mercury",id:"install-nodejs--mercury",level:3},{value:"Storage access (optional but recommended)",id:"storage-access-optional-but-recommended",level:3},{value:"Keep Mercury running in the background",id:"keep-mercury-running-in-the-background",level:3},{value:"Telegram bot on the go",id:"telegram-bot-on-the-go",level:3},{value:"Known limitations",id:"known-limitations",level:3},{value:"Updating",id:"updating",level:3},{value:"iSH (iOS)",id:"ish-ios",level:2},{value:"Alpine Linux / minimal containers",id:"alpine-linux--minimal-containers",level:2},{value:"Raspberry Pi",id:"raspberry-pi",level:2},{value:"Other lightweight environments",id:"other-lightweight-environments",level:2},{value:"Next steps",id:"next-steps",level:2}];function c(e){let n={a:"a",code:"code",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:["Mercury runs on ",(0,i.jsxs)(n.strong,{children:["Android via ",(0,i.jsx)(n.a,{href:"https://termux.dev/",children:"Termux"})]}),". Other lightweight environments require a compatible Node.js 22+ build and Mercury dependencies; availability varies by operating system and CPU."]}),"\n",(0,i.jsx)(n.h2,{id:"termux-android",children:"Termux (Android)"}),"\n",(0,i.jsx)(n.h3,{id:"requirements",children:"Requirements"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Android 7.0+"}),"\n",(0,i.jsxs)(n.li,{children:["Termux installed from ",(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.a,{href:"https://f-droid.org/en/packages/com.termux/",children:"F-Droid"})})," or ",(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.a,{href:"https://github.com/termux/termux-app/releases",children:"GitHub Releases"})})," (the Play Store build is unmaintained \u2014 do not use it)"]}),"\n",(0,i.jsx)(n.li,{children:"~500 MB free storage for Node.js, Mercury, and native module compilation"}),"\n",(0,i.jsx)(n.li,{children:"Network access"}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"install-nodejs--mercury",children:"Install Node.js + Mercury"}),"\n",(0,i.jsxs)(n.p,{children:["Termux is the recommended path on Android because the prebuilt Linux binaries target glibc, while Termux uses bionic libc. ",(0,i.jsx)(n.strong,{children:"Use the npm route:"})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pkg update && pkg upgrade -y\npkg install nodejs-lts git python make clang pkg-config -y\nnpm i -g @cosmicstack/mercury-agent\nmercury\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"nodejs-lts"})," provides Node 22+ (required since 1.3.1) and npm. Python, Make, Clang, and pkg-config are required when npm needs to build native dependencies such as ",(0,i.jsx)(n.code,{children:"better-sqlite3"})," for Android's bionic libc. Do not use Mercury's standalone Linux binary on Termux."]}),"\n",(0,i.jsx)(n.h3,{id:"storage-access-optional-but-recommended",children:"Storage access (optional but recommended)"}),"\n",(0,i.jsx)(n.p,{children:"Let Mercury read/write files in your Android storage:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"termux-setup-storage\n# grants ~/storage/ symlinks: ~/storage/shared, ~/storage/downloads, etc.\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Now you can point Mercury at projects in ",(0,i.jsx)(n.code,{children:"~/storage/shared/Projects/..."}),"."]}),"\n",(0,i.jsx)(n.h3,{id:"keep-mercury-running-in-the-background",children:"Keep Mercury running in the background"}),"\n",(0,i.jsx)(n.p,{children:"Android may stop Termux processes when the app is swiped away or the device sleeps. For the best available background behavior:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Install ",(0,i.jsxs)(n.strong,{children:["Termux",":API"]})," and ",(0,i.jsxs)(n.strong,{children:["Termux",":Boot"]})," from the same source as Termux (F-Droid or GitHub), then install the API commands:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pkg install termux-api\ntermux-wake-lock\n"})}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Disable battery optimization for Termux in ",(0,i.jsx)(n.strong,{children:"Settings \u2192 Apps \u2192 Termux \u2192 Battery"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:"Start Mercury with its supported daemon command:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"mercury start\n"})}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Termux does not run systemd, so ",(0,i.jsx)(n.code,{children:"mercury service install"})," is intentionally unsupported. To request startup after reboot, create ",(0,i.jsx)(n.code,{children:"~/.termux/boot/start-mercury"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"mkdir -p ~/.termux/boot\ncat > ~/.termux/boot/start-mercury <<'EOF'\n#!/data/data/com.termux/files/usr/bin/sh\ntermux-wake-lock\nmercury start\nEOF\nchmod +x ~/.termux/boot/start-mercury\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Termux",":Boot"," only runs after the user has opened its app once, and Android/OEM background restrictions can still stop Mercury. A wakelock reduces suspension but increases battery use; release it with ",(0,i.jsx)(n.code,{children:"termux-wake-unlock"})," when Mercury is stopped. This setup cannot guarantee server-like 24/7 availability."]}),"\n",(0,i.jsxs)(n.p,{children:["See ",(0,i.jsx)(n.a,{href:"../../daemon-mode/daemon-mode",children:"Daemon Mode"})," for ",(0,i.jsx)(n.code,{children:"mercury start"}),", ",(0,i.jsx)(n.code,{children:"mercury status"}),", and ",(0,i.jsx)(n.code,{children:"mercury stop"})," details."]}),"\n",(0,i.jsx)(n.h3,{id:"telegram-bot-on-the-go",children:"Telegram bot on the go"}),"\n",(0,i.jsxs)(n.p,{children:["A common Termux setup: run Mercury's ",(0,i.jsx)(n.a,{href:"../../integrations/telegram",children:"Telegram integration"})," on your phone so you can chat with it from any device."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"mercury doctor   # enable Telegram, paste bot token\nmercury start\n"})}),"\n",(0,i.jsx)(n.h3,{id:"known-limitations",children:"Known limitations"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"No prebuilt binary"})," \u2014 must use npm. The standalone installer (",(0,i.jsx)(n.code,{children:"install.sh"}),") won't work on Termux because of glibc/bionic differences."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"No system service manager"})," \u2014 systemd service install/status/uninstall is unavailable. Use Mercury's daemon commands and optionally Termux",":Boot","."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"No guaranteed background uptime"})," \u2014 wakelocks and Termux",":Boot"," cannot override every Android or OEM process-killing policy."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"TUI rendering"})," \u2014 Mercury's interface assumes a wide terminal. Rotate landscape or pair Termux with an external keyboard for the best experience."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Background limits"})," \u2014 Aggressive OEMs (Xiaomi, Oppo, Huawei) need extra battery-optimization tweaks beyond the standard Android settings."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Storage permission"})," \u2014 Required for accessing project files outside ",(0,i.jsx)(n.code,{children:"$HOME"}),"."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"updating",children:"Updating"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"mercury upgrade\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u2026or:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"npm i -g @cosmicstack/mercury-agent@latest\n"})}),"\n",(0,i.jsx)(n.h2,{id:"ish-ios",children:"iSH (iOS)"}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://ish.app/",children:"iSH"})," runs an Alpine Linux user-space on iOS. Its emulated x86 environment is not covered by Mercury's standalone releases. Only try the npm route if Node.js 22+ and the dependencies are available:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sh",children:"apk add nodejs npm\nnpm i -g @cosmicstack/mercury-agent\nmercury\n"})}),"\n",(0,i.jsx)(n.p,{children:"Performance is limited \u2014 iSH emulates x86 via usermode, so expect slow startup. Best used for read-only / chat-style sessions."}),"\n",(0,i.jsx)(n.h2,{id:"alpine-linux--minimal-containers",children:"Alpine Linux / minimal containers"}),"\n",(0,i.jsx)(n.p,{children:"Alpine uses musl libc, so the standalone Linux binary won't load. Use npm:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sh",children:"apk add --no-cache nodejs npm git\nnpm i -g @cosmicstack/mercury-agent\n"})}),"\n",(0,i.jsxs)(n.p,{children:["This applies to Docker images based on ",(0,i.jsx)(n.code,{children:"alpine:*"})," as well."]}),"\n",(0,i.jsx)(n.h2,{id:"raspberry-pi",children:"Raspberry Pi"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"64-bit Pi OS (Pi 3/4/5)"}),": the standard ",(0,i.jsx)(n.a,{href:"/docs/getting-started/platforms/linux",children:"Linux installer"})," works \u2014 pulls ",(0,i.jsx)(n.code,{children:"mercury-linux-arm64"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"32-bit Pi OS or armv6 (Pi Zero, Pi 1)"}),": no prebuilt binary. The npm route requires a compatible Node.js 22+ build for the device and may require compiling native dependencies. Do not install Node.js 20 as a fallback; it does not meet Mercury's minimum version."]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"other-lightweight-environments",children:"Other lightweight environments"}),"\n",(0,i.jsxs)(n.p,{children:["If a binary reports ",(0,i.jsx)(n.code,{children:"Exec format error"})," or a missing libc, check the ",(0,i.jsx)(n.a,{href:"/docs/#standalone-support-limits",children:"standalone support limits"}),". The npm route requires Node.js 22+ and compatible dependencies; it is not guaranteed on unlisted systems. ",(0,i.jsx)(n.a,{href:"../build-from-source",children:"Building from source"})," also requires a compatible runtime."]}),"\n",(0,i.jsx)(n.h2,{id:"next-steps",children:"Next steps"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"../setup",children:"Setup"})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"../../integrations/telegram",children:"Telegram integration"})," \u2014 control Mercury from anywhere"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"../../daemon-mode/daemon-mode",children:"Daemon Mode"})," \u2014 keep it running 24/7"]}),"\n"]})]})}function u(e={}){let{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},28453(e,n,r){r.d(n,{R:()=>a,x:()=>l});var s=r(96540);let i={},t=s.createContext(i);function a(e){let n=s.useContext(t);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]);