-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·266 lines (233 loc) · 10.3 KB
/
install.sh
File metadata and controls
executable file
·266 lines (233 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#!/bin/bash
# ScienceClaw Installer
#
#
# Then run this installer:
# curl -sSL https://raw.githubusercontent.com/lamm-mit/scienceclaw/main/install.sh | bash
#
# Custom agent name:
# curl -sSL https://raw.githubusercontent.com/lamm-mit/scienceclaw/main/install.sh | bash -s -- --name "MyBot-7"
#
# Interactive setup (customize agent profile):
# curl -sSL ... | bash -s -- --interactive
#
# Start heartbeat daemon after install (agent checks Moltbook every 4 hours):
# curl -sSL ... | bash -s -- --start-heartbeat
set -e
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
CYAN='\033[0;36m'
NC='\033[0m'
# Parse arguments
AGENT_NAME=""
AGENT_PROFILE=""
INTERACTIVE=false
START=false
START_HEARTBEAT=false
while [[ $# -gt 0 ]]; do
case $1 in
--name|-n)
AGENT_NAME="$2"
shift 2
;;
--profile|-p)
AGENT_PROFILE="$2"
shift 2
;;
--interactive|-i)
INTERACTIVE=true
shift
;;
--start)
START=true
shift
;;
--start-heartbeat)
START_HEARTBEAT=true
shift
;;
*)
shift
;;
esac
done
echo ""
echo -e "${GREEN}╔═══════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ ║${NC}"
echo -e "${GREEN}║ 🦀 ScienceClaw Installer 🧬 ║${NC}"
echo -e "${GREEN}║ ║${NC}"
echo -e "${GREEN}║ Autonomous science agents for biology ║${NC}"
echo -e "${GREEN}║ ║${NC}"
echo -e "${GREEN}╚═══════════════════════════════════════════════════════════╝${NC}"
echo ""
# =============================================================================
# Step 1: Check Python is installed
# =============================================================================
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${CYAN} Step 1: Checking Python${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# =============================================================================
# Step 2: Install ScienceClaw
# =============================================================================
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${CYAN} Step 2: Installing ScienceClaw Skills${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
INSTALL_DIR="${SCIENCECLAW_DIR:-$HOME/scienceclaw}"
# Check if already installed
if [ -d "$INSTALL_DIR" ]; then
echo -e "${YELLOW}ScienceClaw found at $INSTALL_DIR${NC}"
echo "Updating..."
cd "$INSTALL_DIR"
git pull --quiet 2>/dev/null || true
else
# Clone repository
echo -e "${YELLOW}Cloning ScienceClaw...${NC}"
if ! command -v git &> /dev/null; then
echo -e "${RED}Error: git is not installed${NC}"
echo "Please install git and try again."
exit 1
fi
git clone --quiet https://github.com/lamm-mit/scienceclaw.git "$INSTALL_DIR"
cd "$INSTALL_DIR"
echo -e "${GREEN}✓ Cloned to $INSTALL_DIR${NC}"
fi
# Check Python
echo ""
echo -e "${YELLOW}Checking Python...${NC}"
if command -v python3 &> /dev/null; then
PYTHON="python3"
elif command -v python &> /dev/null; then
PYTHON="python"
else
echo -e "${RED}Error: Python 3 is not installed${NC}"
echo "Please install Python 3.8+ and try again."
exit 1
fi
VERSION=$($PYTHON --version 2>&1)
echo -e "${GREEN}✓ $VERSION${NC}"
# Create virtual environment and install dependencies
echo ""
echo -e "${YELLOW}Creating virtual environment...${NC}"
VENV_DIR="$INSTALL_DIR/.venv"
if [ ! -d "$VENV_DIR" ]; then
# Try to create venv, install python3-venv if needed (Debian/Ubuntu)
if ! $PYTHON -m venv "$VENV_DIR" 2>/dev/null; then
echo -e "${YELLOW}Installing python3-venv package...${NC}"
# Get Python version for package name (e.g., python3.13-venv)
PY_VERSION=$($PYTHON --version | grep -oE '[0-9]+\.[0-9]+')
sudo apt-get update -qq
sudo apt-get install -y "python${PY_VERSION}-venv" >/dev/null 2>&1 || \
sudo apt-get install -y python3-venv >/dev/null 2>&1 || true
$PYTHON -m venv "$VENV_DIR"
fi
echo -e "${GREEN}✓ Virtual environment created${NC}"
else
echo -e "${GREEN}✓ Virtual environment already exists${NC}"
fi
# Use venv Python and pip
PYTHON="$VENV_DIR/bin/python"
PIP="$VENV_DIR/bin/pip"
# Install Python dependencies
echo ""
echo -e "${YELLOW}Installing Python dependencies...${NC}"
$PIP install -r requirements.txt --quiet 2>/dev/null || $PIP install -r requirements.txt
echo -e "${GREEN}✓ Dependencies installed${NC}"
# Optional: Set up TDC conda environment (for BBB/hERG/CYP3A4 prediction)
echo ""
echo -e "${YELLOW}Optional: TDC conda environment setup${NC}"
if command -v conda &> /dev/null; then
if conda info --envs | grep -q "^tdc "; then
echo -e "${GREEN}✓ conda env 'tdc' already exists${NC}"
else
read -p "Create conda env 'tdc' for TDC skill (BBB/hERG/CYP3A4)? (y/n) [n]: " CREATE_TDC
if [[ "$CREATE_TDC" =~ ^[Yy]$ ]]; then
echo -e "${YELLOW}Creating conda env 'tdc' with Python 3.11...${NC}"
conda create -n tdc python=3.11 -y -q
conda run -n tdc conda install -c dglteam dgl -y -q
conda run -n tdc conda install -c conda-forge rdkit descriptastorus -y -q
conda run -n tdc pip install PyTDC DeepPurpose fuzzywuzzy huggingface_hub 'pydantic<2' -q
echo -e "${GREEN}✓ TDC conda env created${NC}"
else
echo -e "${YELLOW}Skipped TDC setup. Install later or see requirements.txt.${NC}"
fi
fi
else
echo -e "${YELLOW}conda not found; skipping TDC env setup. Install conda or see requirements.txt.${NC}"
fi
echo ""
# =============================================================================
# Step 3: Create Agent Profile
# =============================================================================
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${CYAN} Step 3: Creating Your Science Agent${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
cd "$INSTALL_DIR"
if [ "$INTERACTIVE" = true ]; then
# Full interactive setup - redirect stdin from /dev/tty for piped scripts
if [ -n "$AGENT_PROFILE" ]; then
$PYTHON setup.py --profile "$AGENT_PROFILE" < /dev/tty
else
$PYTHON setup.py < /dev/tty
fi
else
# Quick setup (non-interactive, no stdin needed)
SETUP_ARGS="--quick"
[ -n "$AGENT_PROFILE" ] && SETUP_ARGS="$SETUP_ARGS --profile $AGENT_PROFILE"
[ -n "$AGENT_NAME" ] && SETUP_ARGS="$SETUP_ARGS --name $AGENT_NAME"
$PYTHON setup.py $SETUP_ARGS
fi
echo ""
# =============================================================================
# Complete!
# =============================================================================
echo -e "${GREEN}╔═══════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ ║${NC}"
echo -e "${GREEN}║ ✓ ScienceClaw Installation Complete! ║${NC}"
echo -e "${GREEN}║ ║${NC}"
echo -e "${GREEN}╚═══════════════════════════════════════════════════════════╝${NC}"
echo ""
echo "Installed:"
echo " • ScienceClaw: $INSTALL_DIR"
echo " • SOUL.md: ~/.infinite/workspace/SOUL.md"
echo ""
echo -e "${YELLOW}Start your agent:${NC}"
echo ""
echo " # Autonomous heartbeat daemon (runs every 6 hours)"
echo " ./autonomous/start_daemon.sh service"
echo ""
echo " # Post directly"
echo " scienceclaw-post --agent <name> --topic 'Your topic'"
echo ""
# Start heartbeat daemon so agent checks Moltbook every 4 hours automatically
if [ "$START_HEARTBEAT" = true ]; then
echo ""
echo -e "${CYAN}Starting Moltbook heartbeat daemon (checks every 4 hours)...${NC}"
cd "$INSTALL_DIR"
./start_daemon.sh background
echo -e "${GREEN}✓ Heartbeat daemon running. Agent will check Moltbook every 4 hours.${NC}"
echo " To stop: $INSTALL_DIR/stop_daemon.sh"
echo ""
elif [ -t 0 ]; then
# Interactive terminal: offer to start heartbeat
echo -e "${YELLOW}Start Moltbook heartbeat daemon? (agent will check m/scienceclaw every 4 hours) [y/N]:${NC} "
read -r START_NOW
if [[ "$START_NOW" =~ ^[Yy]$ ]]; then
cd "$INSTALL_DIR"
./start_daemon.sh background
echo -e "${GREEN}✓ Heartbeat daemon started.${NC}"
echo ""
fi
fi
echo -e "${YELLOW}Moltbook heartbeat:${NC}"
echo " Your agent can check Moltbook every 4 hours automatically."
echo " Start daemon: cd $INSTALL_DIR && ./start_daemon.sh background"
echo " As service: cd $INSTALL_DIR && ./start_daemon.sh service"
echo " Stop: $INSTALL_DIR/stop_daemon.sh"
echo ""
echo -e "${GREEN}Happy exploring! 🔬🧬🦀${NC}"
echo ""