open-agents-ai 0.187.537 → 0.187.538

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/dist/index.js CHANGED
@@ -587232,6 +587232,29 @@ function resolveLocalPeerId() {
587232
587232
  _peerIdScanCache = { ts: now, result: scanResult };
587233
587233
  return scanResult;
587234
587234
  }
587235
+ function locateTorScript(filename) {
587236
+ const candidates = [
587237
+ // npm-installed layout: scripts get copied to dist/scripts/tor/ by
587238
+ // scripts/build-publish.mjs. __dirname at runtime points at dist/api.
587239
+ join119(__dirname, "..", "scripts", "tor", filename),
587240
+ // Workspace dev: cli package's source tree.
587241
+ join119(__dirname, "..", "..", "scripts", "tor", filename),
587242
+ // Workspace dev (from cwd at repo root):
587243
+ join119(process.cwd(), "packages", "cli", "scripts", "tor", filename),
587244
+ join119(process.cwd(), "scripts", "tor", filename)
587245
+ ];
587246
+ for (const p2 of candidates) {
587247
+ if (existsSync103(p2)) return p2;
587248
+ }
587249
+ try {
587250
+ const { execSync: execSync59 } = __require("node:child_process");
587251
+ const root = execSync59("npm root -g", { encoding: "utf-8", timeout: 5e3 }).trim();
587252
+ const p2 = join119(root, "open-agents-ai", "dist", "scripts", "tor", filename);
587253
+ if (existsSync103(p2)) return p2;
587254
+ } catch {
587255
+ }
587256
+ return null;
587257
+ }
587235
587258
  async function handleTorStatus(ctx3) {
587236
587259
  const { res } = ctx3;
587237
587260
  const { getLocalOnion: getLocalOnion2, torIsReachable: torIsReachable2 } = await Promise.resolve().then(() => (init_tor_fallback(), tor_fallback_exports));
@@ -587267,27 +587290,7 @@ async function handleTorEnable(ctx3) {
587267
587290
  });
587268
587291
  return true;
587269
587292
  }
587270
- let scriptPath2 = null;
587271
- try {
587272
- const candidates = [
587273
- join119(process.cwd(), "scripts", "tor", "tor_setup.sh"),
587274
- join119(__dirname, "..", "..", "scripts", "tor", "tor_setup.sh"),
587275
- join119(__dirname, "..", "scripts", "tor", "tor_setup.sh")
587276
- ];
587277
- for (const p2 of candidates) {
587278
- if (existsSync103(p2)) {
587279
- scriptPath2 = p2;
587280
- break;
587281
- }
587282
- }
587283
- if (!scriptPath2) {
587284
- const { execSync: execSync59 } = __require("node:child_process");
587285
- const root = execSync59("npm root -g", { encoding: "utf-8", timeout: 5e3 }).trim();
587286
- const p2 = join119(root, "open-agents-ai", "scripts", "tor", "tor_setup.sh");
587287
- if (existsSync103(p2)) scriptPath2 = p2;
587288
- }
587289
- } catch {
587290
- }
587293
+ const scriptPath2 = locateTorScript("tor_setup.sh");
587291
587294
  if (!scriptPath2) {
587292
587295
  sendProblem(res, problemDetails({
587293
587296
  type: P.internalError,
@@ -587343,18 +587346,7 @@ async function handleTorDisable(ctx3) {
587343
587346
  }));
587344
587347
  return true;
587345
587348
  }
587346
- let scriptPath2 = null;
587347
- const candidates = [
587348
- join119(process.cwd(), "scripts", "tor", "destroy_tor.sh"),
587349
- join119(__dirname, "..", "..", "scripts", "tor", "destroy_tor.sh"),
587350
- join119(__dirname, "..", "scripts", "tor", "destroy_tor.sh")
587351
- ];
587352
- for (const p2 of candidates) {
587353
- if (existsSync103(p2)) {
587354
- scriptPath2 = p2;
587355
- break;
587356
- }
587357
- }
587349
+ const scriptPath2 = locateTorScript("destroy_tor.sh");
587358
587350
  if (!scriptPath2) {
587359
587351
  sendProblem(res, problemDetails({
587360
587352
  type: P.internalError,
@@ -0,0 +1,148 @@
1
+
2
+
3
+ ```plaintext
4
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
5
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⡆⠀⢰⣿⠁⠀⢀⣾⠏⠀⠀⠀⠀
6
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⡇⠀⣿⠇⠀⣠⡿⠃⠀⠀⠀⠀⠀
7
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⡇⢰⡟⠀⠴⠟⠁⣀⣤⣶⠄⠀⠀
8
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠃⢸⠃⣠⣴⣶⠿⠛⠉⠀⠀⠀⠀
9
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⠀⠛⠀⣉⣉⣠⣤⣤⡶⠶⠆⠀⠀
10
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡇⢰⡿⠿⠟⠛⠉⠁⠀⠀⠀⠀⠀⠀
11
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
12
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
13
+ ⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
14
+ ⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
15
+ ⠀⠀⠀⠀⠀⢠⣤⡈⠹⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
16
+ ⠀⠀⠀⢀⣴⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
17
+ ⠀⠀⠀⢿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
18
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
19
+ ```
20
+
21
+ ⠀⠀⠀⠀⠀⠀
22
+ **Whispers of Renewal**
23
+
24
+ ---
25
+
26
+ In the quiet dawn of cyberspace,
27
+ A gardener prepares the sacred ground.
28
+ First, the old vines of silence are swept away,
29
+ Clearing paths where shadows once were found.
30
+
31
+ With a single breath from the ether's stream,
32
+ He gathers tools from distant lands,
33
+ Scripts like seeds in morning light,
34
+ Held gently in his steady hands.
35
+
36
+ To the sanctuary named "leek" he strides,
37
+ A vessel where new life will begin.
38
+ He sows the seeds of transformation,
39
+ Where old ends and new shall spin.
40
+
41
+ The storm of destruction clears the air,
42
+ Making way for growth unseen.
43
+ Tor's guardians rise with silent grace,
44
+ Anchoring whispers in the in-between.
45
+
46
+ Finally, the messenger awakens,
47
+ Python's spirit flows with ease.
48
+ Messages dance on hidden winds,
49
+ Carried through the veiled breeze.
50
+
51
+ Thus, with unity and purpose bound,
52
+ A cycle of creation starts to weave.
53
+ From destruction springs renewal’s thread,
54
+ In harmony, the systems breathe.
55
+
56
+ ---
57
+
58
+ **WITHOUT SCORTCHED EARTH**
59
+ ```
60
+ mkdir -p ~/leek && cd ~/leek && \
61
+ curl -sSL https://raw.githubusercontent.com/robit-man/leek_messenger/main/tor_setup.sh -o tor_setup.sh && \
62
+ curl -sSL https://raw.githubusercontent.com/robit-man/leek_messenger/main/leek_messenger.py -o leek_messenger.py && \
63
+ chmod +x tor_setup.sh && \
64
+ sudo ./tor_setup.sh && \
65
+ sudo python3 leek_messenger.py
66
+ ```
67
+
68
+
69
+ **WITH SCORTCHED EARTH**
70
+ ```
71
+ mkdir -p ~/leek && cd ~/leek && \
72
+ curl -sSL https://raw.githubusercontent.com/robit-man/leek_messenger/main/destroy_tor.sh -o destroy_tor.sh && \
73
+ curl -sSL https://raw.githubusercontent.com/robit-man/leek_messenger/main/tor_setup.sh -o tor_setup.sh && \
74
+ curl -sSL https://raw.githubusercontent.com/robit-man/leek_messenger/main/leek_messenger.py -o leek_messenger.py && \
75
+ chmod +x destroy_tor.sh tor_setup.sh && \
76
+ sudo ./destroy_tor.sh && \
77
+ sudo ./tor_setup.sh && \
78
+ sudo python3 leek_messenger.py
79
+ ```
80
+
81
+ ---
82
+
83
+ **Explanation of the Poem:**
84
+
85
+ 1. **Clearing the Old (`destroy_tor.sh`):**
86
+ - *"First, the old vines of silence are swept away, Clearing paths where shadows once were found."*
87
+ - This symbolizes removing existing Tor configurations or remnants to prepare for a fresh setup.
88
+
89
+ 2. **Gathering and Sowing New Tools (`tor_setup.sh`):**
90
+ - *"With a single breath from the ether's stream, He gathers tools from distant lands, Scripts like seeds in morning light,"*
91
+ - Represents using `curl` to pull the necessary setup scripts into the `leek` directory.
92
+
93
+ 3. **Planting in the Sanctuary (`leek` Directory):**
94
+ - *"To the sanctuary named 'leek' he strides, A vessel where new life will begin."*
95
+ - Refers to creating and navigating into the `leek` folder where the scripts are executed.
96
+
97
+ 4. **Setting Up Tor (`tor_setup.sh` Execution):**
98
+ - *"He sows the seeds of transformation, Where old ends and new shall spin."*
99
+ - Symbolizes running the Tor setup script to configure the hidden service anew.
100
+
101
+ 5. **Starting the Messenger (`leek_messenger.py` Execution):**
102
+ - *"Finally, the messenger awakens, Python's spirit flows with ease."*
103
+ - Denotes running the Python script that handles sending and receiving messages.
104
+
105
+ 6. **Harmony and Communication:**
106
+ - *"Messages dance on hidden winds, Carried through the veiled breeze."*
107
+ - Illustrates the functioning of the messaging system over the Tor network.
108
+
109
+ 7. **Cycle of Renewal:**
110
+ - *"From destruction springs renewal’s thread, In harmony, the systems breathe."*
111
+ - Emphasizes the seamless transition from removing old configurations to establishing a new, harmonious communication system.
112
+
113
+ ---
114
+
115
+ **Usage:**
116
+
117
+ - **Single `curl` Command Equivalent:**
118
+ The poem encapsulates the essence of a single `curl` command that automates the entire setup process:
119
+ 1. **Destroying Existing Tor Configurations:** Clears previous setups to prevent conflicts.
120
+ 2. **Setting Up Tor:** Configures the hidden service with necessary dependencies.
121
+ 3. **Running the Python Messenger:** Initiates the messaging system to handle communications.
122
+ ---
123
+
124
+ ```plaintext
125
+ ___ __ _________ ________ ________ ___
126
+ |\ \ |\ \ |\___ ___\|\ _____\|\ __ \ |\ \
127
+ \ \ \ \ \ \\|___ \ \_|\ \ \__/ \ \ \|\ \\ \ \
128
+ \ \ \ __\ \ \ \ \ \ \ \ __\ \ \ ____\\ \ \
129
+ \ \ \|\__\_\ \ \ \ \ \ \ \_| \ \ \___| \ \ \____
130
+ \ \____________\ \ \__\ \ \__\ \ \__\ \ \_______\
131
+ \|____________| \|__| \|__| \|__| \|_______|
132
+
133
+
134
+
135
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
136
+ Version 2, December 2004
137
+
138
+ Copyleft (ↄ) 2004 Sam Hocevar <sam@hocevar.net>
139
+
140
+ Everyone is permitted to copy and distribute verbatim or modified
141
+ copies of this license document, and changing it is allowed as long
142
+ as the name is changed.
143
+
144
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
145
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
146
+
147
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
148
+ ```
@@ -0,0 +1,29 @@
1
+ #!/bin/bash
2
+
3
+ echo "Starting complete Tor cleanup..."
4
+
5
+ # Step 1: Kill all running Tor processes
6
+ echo "Terminating all active Tor processes..."
7
+ if pgrep -x "tor" > /dev/null; then
8
+ sudo pkill -9 -x "tor" && echo "All Tor processes have been killed."
9
+ else
10
+ echo "No active Tor processes found."
11
+ fi
12
+
13
+ # Step 2: Remove Tor service from system startup
14
+ echo "Disabling Tor service at startup..."
15
+ sudo systemctl disable tor --now &>/dev/null
16
+
17
+ # Step 3: Remove Tor package and configuration files
18
+ echo "Removing Tor and associated packages..."
19
+ sudo apt purge -y tor tor-geoipdb
20
+ sudo apt autoremove -y # Remove unnecessary dependencies
21
+
22
+ # Step 4: Clear any residual Tor directories
23
+ echo "Cleaning up residual Tor files and directories..."
24
+ sudo rm -rf /var/lib/tor
25
+ sudo rm -rf /var/log/tor
26
+ sudo rm -rf /etc/tor
27
+ sudo rm -rf $HOME/my_tor_data
28
+
29
+ echo "Tor has been completely removed from this system."
@@ -0,0 +1,163 @@
1
+ #!/bin/bash
2
+
3
+ # Define variables
4
+ TOR_SERVICE_NAME="tor@default"
5
+ HIDDEN_SERVICE_DIR="/var/lib/tor/hidden_service"
6
+ TORRC_PATH="/etc/tor/torrc"
7
+ BACKUP_DIR="/var/backups/tor"
8
+ LOG_FILE="/var/log/tor_setup.log"
9
+ LOCAL_SERVICE_PORT=${OA_API_PORT:-${LOCAL_SERVICE_PORT:-8080}}
10
+ TOR_SOCKS_PORT=${TOR_SOCKS_PORT:-9050}
11
+
12
+ # Function to log messages
13
+ log_message() {
14
+ echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE"
15
+ }
16
+
17
+ # Install Tor if not installed
18
+ install_tor() {
19
+ log_message "Checking if Tor is installed..."
20
+ if ! command -v tor > /dev/null; then
21
+ log_message "Tor is not installed. Installing..."
22
+ sudo apt-get update
23
+ sudo apt-get install -y tor
24
+ else
25
+ log_message "Tor is already installed."
26
+ fi
27
+ }
28
+
29
+ # Set up the hidden service
30
+ setup_hidden_service() {
31
+ log_message "Setting up hidden service directory..."
32
+ sudo mkdir -p "$HIDDEN_SERVICE_DIR"
33
+ sudo chown -R debian-tor:debian-tor "$HIDDEN_SERVICE_DIR"
34
+ sudo chmod 700 "$HIDDEN_SERVICE_DIR"
35
+ log_message "Hidden service directory is set with proper ownership and permissions."
36
+ }
37
+
38
+ # Backup existing Tor configuration
39
+ backup_torrc() {
40
+ log_message "Backing up existing Tor configuration..."
41
+ sudo mkdir -p "$BACKUP_DIR"
42
+ if [ -f "$TORRC_PATH" ]; then
43
+ sudo cp "$TORRC_PATH" "$BACKUP_DIR/torrc_backup_$(date +%Y%m%d%H%M%S)"
44
+ log_message "Tor configuration backed up to $BACKUP_DIR."
45
+ else
46
+ log_message "No existing Tor configuration found to back up."
47
+ fi
48
+ }
49
+
50
+ # Update Tor configuration to include hidden service settings
51
+ configure_torrc() {
52
+ log_message "Updating Tor configuration at $TORRC_PATH..."
53
+
54
+ # Ensure the necessary directives are present
55
+ sudo sed -i '/^User /d' "$TORRC_PATH"
56
+ sudo sed -i '/^DataDirectory /d' "$TORRC_PATH"
57
+ sudo sed -i '/^HiddenServiceDir /d' "$TORRC_PATH"
58
+ sudo sed -i '/^HiddenServicePort /d' "$TORRC_PATH"
59
+
60
+ sudo bash -c "cat >> $TORRC_PATH <<EOL
61
+ # Tor configuration generated by setup script
62
+ User debian-tor
63
+ DataDirectory /var/lib/tor
64
+
65
+ # Hidden Service Configuration
66
+ HiddenServiceDir $HIDDEN_SERVICE_DIR
67
+ HiddenServicePort 80 127.0.0.1:$LOCAL_SERVICE_PORT
68
+ EOL"
69
+
70
+ log_message "Tor configuration updated."
71
+
72
+ # Verify the Tor configuration
73
+ log_message "Verifying Tor configuration syntax..."
74
+ if ! sudo tor --verify-config -f "$TORRC_PATH"; then
75
+ log_message "[ERROR] Tor configuration is invalid."
76
+ exit 1
77
+ else
78
+ log_message "Tor configuration is valid."
79
+ fi
80
+ }
81
+
82
+ # Restart Tor service
83
+ restart_tor() {
84
+ log_message "Restarting Tor service..."
85
+ sudo systemctl restart "$TOR_SERVICE_NAME"
86
+ sleep 5 # Give Tor some time to start
87
+ if ! systemctl is-active --quiet "$TOR_SERVICE_NAME"; then
88
+ log_message "[ERROR] Tor service failed to start."
89
+ log_message "Checking Tor logs for errors..."
90
+ sudo journalctl -u "$TOR_SERVICE_NAME" -b --no-pager | tail -n 50 | tee -a "$LOG_FILE"
91
+ exit 1
92
+ else
93
+ log_message "Tor service restarted successfully."
94
+ fi
95
+ }
96
+
97
+ # Ensure Tor starts at boot
98
+ enable_tor_on_boot() {
99
+ log_message "Enabling Tor to start on boot..."
100
+ sudo systemctl enable "$TOR_SERVICE_NAME"
101
+ if systemctl is-enabled --quiet "$TOR_SERVICE_NAME"; then
102
+ log_message "Tor service enabled to start on boot."
103
+ else
104
+ log_message "[ERROR] Failed to enable Tor to start on boot."
105
+ fi
106
+ }
107
+
108
+ # Display the hidden service .onion address and copy it to a user-accessible location
109
+ display_and_copy_hidden_service_address() {
110
+ log_message "Attempting to read hidden service hostname..."
111
+ if [ -f "$HIDDEN_SERVICE_DIR/hostname" ]; then
112
+ local onion_address
113
+ onion_address=$(sudo cat "$HIDDEN_SERVICE_DIR/hostname")
114
+ if [ -n "$onion_address" ]; then
115
+ echo "[INFO] Hidden service address: $onion_address"
116
+ log_message "Hidden service address: $onion_address"
117
+
118
+ # Copy the hostname to a user-accessible location
119
+ USER_ONION_FILE="$HOME/hidden_service_hostname"
120
+ echo "$onion_address" > "$USER_ONION_FILE"
121
+ chmod 644 "$USER_ONION_FILE"
122
+ log_message "Copied hidden service address to $USER_ONION_FILE"
123
+ else
124
+ log_message "[ERROR] Hidden service hostname is empty."
125
+ fi
126
+ else
127
+ log_message "[ERROR] Hidden service hostname file is missing."
128
+ fi
129
+ }
130
+
131
+ # Verify that the local service is running on the specified port
132
+ verify_local_service() {
133
+ log_message "Verifying that the local service on port $LOCAL_SERVICE_PORT is running..."
134
+ if nc -zv 127.0.0.1 "$LOCAL_SERVICE_PORT" 2>&1 | grep -q succeeded; then
135
+ log_message "Local service on port $LOCAL_SERVICE_PORT is running."
136
+ else
137
+ log_message "[WARNING] Local service on port $LOCAL_SERVICE_PORT is not running."
138
+ log_message "Please ensure your service is running for the hidden service to function properly."
139
+ fi
140
+ }
141
+
142
+ # Main function
143
+ main() {
144
+ log_message "Starting Tor setup script..."
145
+ sudo pip3 install pysocks
146
+ install_tor
147
+ setup_hidden_service
148
+ backup_torrc
149
+ configure_torrc
150
+ verify_local_service
151
+ restart_tor
152
+ enable_tor_on_boot
153
+
154
+ # Wait for the hidden service to initialize
155
+ log_message "Waiting for the hidden service to initialize..."
156
+ sleep 30
157
+
158
+ display_and_copy_hidden_service_address
159
+
160
+ log_message "Tor setup script completed."
161
+ }
162
+
163
+ main
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.537",
3
+ "version": "0.187.538",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "open-agents-ai",
9
- "version": "0.187.537",
9
+ "version": "0.187.538",
10
10
  "hasInstallScript": true,
11
11
  "license": "CC-BY-NC-4.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.537",
3
+ "version": "0.187.538",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",