zerochat 9.1.0__tar.gz → 9.3.0__tar.gz

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.

Potentially problematic release.


This version of zerochat might be problematic. Click here for more details.

@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: zerochat
3
+ Version: 9.3.0
4
+ Summary: Private local web client for AI models, tools and MCP services
5
+ Author: Alberto Alday
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://albalday.github.io/zerochat/
8
+ Project-URL: Repository, https://github.com/albalday/zerochat
9
+ Project-URL: Issues, https://github.com/albalday/zerochat/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
22
+
23
+ # ZeroChat
24
+
25
+ [English](#english) · [Español](#español)
26
+
27
+ ---
28
+
29
+ <a name="english"></a>
30
+ ## English
31
+
32
+ ZeroChat is a personal, private web client for chatting with AI models, consulting documents and running tools. This documentation covers the **9.x** series. Free and open source under the MIT licence.
33
+
34
+ The interface runs entirely in the browser as static files: history and settings remain in local browser storage without automatic cloud synchronization.
35
+
36
+ ### Key features
37
+
38
+ - **AI Profiles:** OpenAI and compatible chat APIs, Ollama, OpenRouter, Claude and Gemini. Supports reasoning, vision and function calling.
39
+ - **WebLLM:** In-browser WebGPU inference with downloadable models (requires compatible hardware).
40
+ - **Documents & RAG:** Local document attachments and collections with client-side text extraction and Orama lexical search (no external embeddings required).
41
+ - **Agentic Tools:** JavaScript sandbox, web search, page fetching, interactive charts and read-only subagents. The optional local backend adds filesystem access, shell commands, diagnostics and MCP services.
42
+ - **Diagnostics:** Conversation branches, JSON and Markdown export, PDF print, context metrics and request inspector.
43
+
44
+ ### Quick start
45
+
46
+ 1. **Web (client-only):** Open [ZeroChat on GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), configure a connection profile, and start chatting.
47
+ 2. **With local computer tools (Python backend):**
48
+
49
+ ```bash
50
+ # Via PyPI (Linux, macOS, Windows)
51
+ pip install zerochat
52
+ zerochat
53
+
54
+ # Or download and run directly
55
+ curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
56
+ python3 zerochat.py
57
+ ```
58
+
59
+ ### Documentation & Help
60
+
61
+ Comprehensive guides covering configuration, supported environments (Linux, Windows, macOS, Android/Termux), MCP services, and security:
62
+ - [ZeroChat 9.x Help — English](https://albalday.github.io/zerochat/help/en/index.html)
63
+ - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
64
+
65
+ ### Development
66
+
67
+ ZeroChat is developed on the `dev` branch:
68
+
69
+ ```bash
70
+ git checkout dev
71
+ npm install
72
+ npm test
73
+ ```
74
+
75
+ For development rules, architecture and test suites, see [`AGENTS.md`](./AGENTS.md), [`js/README.md`](./js/README.md), [`py/README.md`](./py/README.md) and [`tests/README.md`](./tests/README.md).
76
+
77
+ ---
78
+
79
+ <a name="español"></a>
80
+ ## Español
81
+
82
+ ZeroChat es un cliente web de uso personal para conversar con modelos de IA, consultar documentos y ejecutar herramientas. Esta documentación corresponde a la serie **9.x**. Proyecto de libre uso bajo licencia MIT.
83
+
84
+ La interfaz se ejecuta íntegramente en el navegador como archivos estáticos: el historial y la configuración se conservan en el almacenamiento local del navegador, sin sincronización automática en la nube.
85
+
86
+ ### Características principales
87
+
88
+ - **Perfiles de IA:** OpenAI y APIs compatibles, Ollama, OpenRouter, Claude y Gemini. Soporta razonamiento, visión y llamadas a herramientas (*tool calling*).
89
+ - **WebLLM:** Inferencia local en el navegador mediante WebGPU tras descargar el modelo (requiere hardware compatible).
90
+ - **Documentos y RAG:** Adjuntos y colecciones locales con extracción de texto en el cliente y búsqueda léxica mediante Orama (sin requerir *embeddings* externos).
91
+ - **Herramientas agénticas:** Entorno aislado de JavaScript, búsqueda y lectura web, gráficos interactivos y subagentes de solo lectura. El backend local opcional añade acceso al sistema de archivos, ejecución de comandos, diagnósticos y servicios MCP.
92
+ - **Diagnóstico e historial:** Ramas de conversación, exportación a JSON y Markdown, impresión en PDF, métricas de contexto e inspección de peticiones.
93
+
94
+ ### Inicio rápido
95
+
96
+ 1. **Web directa (solo cliente):** Abre [ZeroChat en GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), configura un perfil de conexión y comienza.
97
+ 2. **Con herramientas del equipo (backend Python):**
98
+
99
+ ```bash
100
+ # Mediante PyPI (Linux, macOS, Windows)
101
+ pip install zerochat
102
+ zerochat
103
+
104
+ # O descarga directa del script
105
+ curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
106
+ python3 zerochat.py
107
+ ```
108
+
109
+ ### Documentación y ayuda
110
+
111
+ Guías completas de configuración, soporte de entornos (Linux, Windows, macOS, Android/Termux), servicios MCP y seguridad:
112
+ - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
113
+ - [ZeroChat 9.x Help — English](https://albalday.github.io/zerochat/help/en/index.html)
114
+
115
+ ### Desarrollo
116
+
117
+ El desarrollo se realiza en la rama `dev`:
118
+
119
+ ```bash
120
+ git checkout dev
121
+ npm install
122
+ npm test
123
+ ```
124
+
125
+ Las normas de desarrollo, arquitectura y suite de pruebas se describen en [`AGENTS.md`](./AGENTS.md), [`js/README.md`](./js/README.md), [`py/README.md`](./py/README.md) y [`tests/README.md`](./tests/README.md).
@@ -0,0 +1,103 @@
1
+ # ZeroChat
2
+
3
+ [English](#english) · [Español](#español)
4
+
5
+ ---
6
+
7
+ <a name="english"></a>
8
+ ## English
9
+
10
+ ZeroChat is a personal, private web client for chatting with AI models, consulting documents and running tools. This documentation covers the **9.x** series. Free and open source under the MIT licence.
11
+
12
+ The interface runs entirely in the browser as static files: history and settings remain in local browser storage without automatic cloud synchronization.
13
+
14
+ ### Key features
15
+
16
+ - **AI Profiles:** OpenAI and compatible chat APIs, Ollama, OpenRouter, Claude and Gemini. Supports reasoning, vision and function calling.
17
+ - **WebLLM:** In-browser WebGPU inference with downloadable models (requires compatible hardware).
18
+ - **Documents & RAG:** Local document attachments and collections with client-side text extraction and Orama lexical search (no external embeddings required).
19
+ - **Agentic Tools:** JavaScript sandbox, web search, page fetching, interactive charts and read-only subagents. The optional local backend adds filesystem access, shell commands, diagnostics and MCP services.
20
+ - **Diagnostics:** Conversation branches, JSON and Markdown export, PDF print, context metrics and request inspector.
21
+
22
+ ### Quick start
23
+
24
+ 1. **Web (client-only):** Open [ZeroChat on GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), configure a connection profile, and start chatting.
25
+ 2. **With local computer tools (Python backend):**
26
+
27
+ ```bash
28
+ # Via PyPI (Linux, macOS, Windows)
29
+ pip install zerochat
30
+ zerochat
31
+
32
+ # Or download and run directly
33
+ curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
34
+ python3 zerochat.py
35
+ ```
36
+
37
+ ### Documentation & Help
38
+
39
+ Comprehensive guides covering configuration, supported environments (Linux, Windows, macOS, Android/Termux), MCP services, and security:
40
+ - [ZeroChat 9.x Help — English](https://albalday.github.io/zerochat/help/en/index.html)
41
+ - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
42
+
43
+ ### Development
44
+
45
+ ZeroChat is developed on the `dev` branch:
46
+
47
+ ```bash
48
+ git checkout dev
49
+ npm install
50
+ npm test
51
+ ```
52
+
53
+ For development rules, architecture and test suites, see [`AGENTS.md`](./AGENTS.md), [`js/README.md`](./js/README.md), [`py/README.md`](./py/README.md) and [`tests/README.md`](./tests/README.md).
54
+
55
+ ---
56
+
57
+ <a name="español"></a>
58
+ ## Español
59
+
60
+ ZeroChat es un cliente web de uso personal para conversar con modelos de IA, consultar documentos y ejecutar herramientas. Esta documentación corresponde a la serie **9.x**. Proyecto de libre uso bajo licencia MIT.
61
+
62
+ La interfaz se ejecuta íntegramente en el navegador como archivos estáticos: el historial y la configuración se conservan en el almacenamiento local del navegador, sin sincronización automática en la nube.
63
+
64
+ ### Características principales
65
+
66
+ - **Perfiles de IA:** OpenAI y APIs compatibles, Ollama, OpenRouter, Claude y Gemini. Soporta razonamiento, visión y llamadas a herramientas (*tool calling*).
67
+ - **WebLLM:** Inferencia local en el navegador mediante WebGPU tras descargar el modelo (requiere hardware compatible).
68
+ - **Documentos y RAG:** Adjuntos y colecciones locales con extracción de texto en el cliente y búsqueda léxica mediante Orama (sin requerir *embeddings* externos).
69
+ - **Herramientas agénticas:** Entorno aislado de JavaScript, búsqueda y lectura web, gráficos interactivos y subagentes de solo lectura. El backend local opcional añade acceso al sistema de archivos, ejecución de comandos, diagnósticos y servicios MCP.
70
+ - **Diagnóstico e historial:** Ramas de conversación, exportación a JSON y Markdown, impresión en PDF, métricas de contexto e inspección de peticiones.
71
+
72
+ ### Inicio rápido
73
+
74
+ 1. **Web directa (solo cliente):** Abre [ZeroChat en GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), configura un perfil de conexión y comienza.
75
+ 2. **Con herramientas del equipo (backend Python):**
76
+
77
+ ```bash
78
+ # Mediante PyPI (Linux, macOS, Windows)
79
+ pip install zerochat
80
+ zerochat
81
+
82
+ # O descarga directa del script
83
+ curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
84
+ python3 zerochat.py
85
+ ```
86
+
87
+ ### Documentación y ayuda
88
+
89
+ Guías completas de configuración, soporte de entornos (Linux, Windows, macOS, Android/Termux), servicios MCP y seguridad:
90
+ - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
91
+ - [ZeroChat 9.x Help — English](https://albalday.github.io/zerochat/help/en/index.html)
92
+
93
+ ### Desarrollo
94
+
95
+ El desarrollo se realiza en la rama `dev`:
96
+
97
+ ```bash
98
+ git checkout dev
99
+ npm install
100
+ npm test
101
+ ```
102
+
103
+ Las normas de desarrollo, arquitectura y suite de pruebas se describen en [`AGENTS.md`](./AGENTS.md), [`js/README.md`](./js/README.md), [`py/README.md`](./py/README.md) y [`tests/README.md`](./tests/README.md).
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "zerochat"
7
- version = "9.1.0"
7
+ version = "9.3.0"
8
8
  description = "Private local web client for AI models, tools and MCP services"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: zerochat
3
+ Version: 9.3.0
4
+ Summary: Private local web client for AI models, tools and MCP services
5
+ Author: Alberto Alday
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://albalday.github.io/zerochat/
8
+ Project-URL: Repository, https://github.com/albalday/zerochat
9
+ Project-URL: Issues, https://github.com/albalday/zerochat/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
22
+
23
+ # ZeroChat
24
+
25
+ [English](#english) · [Español](#español)
26
+
27
+ ---
28
+
29
+ <a name="english"></a>
30
+ ## English
31
+
32
+ ZeroChat is a personal, private web client for chatting with AI models, consulting documents and running tools. This documentation covers the **9.x** series. Free and open source under the MIT licence.
33
+
34
+ The interface runs entirely in the browser as static files: history and settings remain in local browser storage without automatic cloud synchronization.
35
+
36
+ ### Key features
37
+
38
+ - **AI Profiles:** OpenAI and compatible chat APIs, Ollama, OpenRouter, Claude and Gemini. Supports reasoning, vision and function calling.
39
+ - **WebLLM:** In-browser WebGPU inference with downloadable models (requires compatible hardware).
40
+ - **Documents & RAG:** Local document attachments and collections with client-side text extraction and Orama lexical search (no external embeddings required).
41
+ - **Agentic Tools:** JavaScript sandbox, web search, page fetching, interactive charts and read-only subagents. The optional local backend adds filesystem access, shell commands, diagnostics and MCP services.
42
+ - **Diagnostics:** Conversation branches, JSON and Markdown export, PDF print, context metrics and request inspector.
43
+
44
+ ### Quick start
45
+
46
+ 1. **Web (client-only):** Open [ZeroChat on GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), configure a connection profile, and start chatting.
47
+ 2. **With local computer tools (Python backend):**
48
+
49
+ ```bash
50
+ # Via PyPI (Linux, macOS, Windows)
51
+ pip install zerochat
52
+ zerochat
53
+
54
+ # Or download and run directly
55
+ curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
56
+ python3 zerochat.py
57
+ ```
58
+
59
+ ### Documentation & Help
60
+
61
+ Comprehensive guides covering configuration, supported environments (Linux, Windows, macOS, Android/Termux), MCP services, and security:
62
+ - [ZeroChat 9.x Help — English](https://albalday.github.io/zerochat/help/en/index.html)
63
+ - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
64
+
65
+ ### Development
66
+
67
+ ZeroChat is developed on the `dev` branch:
68
+
69
+ ```bash
70
+ git checkout dev
71
+ npm install
72
+ npm test
73
+ ```
74
+
75
+ For development rules, architecture and test suites, see [`AGENTS.md`](./AGENTS.md), [`js/README.md`](./js/README.md), [`py/README.md`](./py/README.md) and [`tests/README.md`](./tests/README.md).
76
+
77
+ ---
78
+
79
+ <a name="español"></a>
80
+ ## Español
81
+
82
+ ZeroChat es un cliente web de uso personal para conversar con modelos de IA, consultar documentos y ejecutar herramientas. Esta documentación corresponde a la serie **9.x**. Proyecto de libre uso bajo licencia MIT.
83
+
84
+ La interfaz se ejecuta íntegramente en el navegador como archivos estáticos: el historial y la configuración se conservan en el almacenamiento local del navegador, sin sincronización automática en la nube.
85
+
86
+ ### Características principales
87
+
88
+ - **Perfiles de IA:** OpenAI y APIs compatibles, Ollama, OpenRouter, Claude y Gemini. Soporta razonamiento, visión y llamadas a herramientas (*tool calling*).
89
+ - **WebLLM:** Inferencia local en el navegador mediante WebGPU tras descargar el modelo (requiere hardware compatible).
90
+ - **Documentos y RAG:** Adjuntos y colecciones locales con extracción de texto en el cliente y búsqueda léxica mediante Orama (sin requerir *embeddings* externos).
91
+ - **Herramientas agénticas:** Entorno aislado de JavaScript, búsqueda y lectura web, gráficos interactivos y subagentes de solo lectura. El backend local opcional añade acceso al sistema de archivos, ejecución de comandos, diagnósticos y servicios MCP.
92
+ - **Diagnóstico e historial:** Ramas de conversación, exportación a JSON y Markdown, impresión en PDF, métricas de contexto e inspección de peticiones.
93
+
94
+ ### Inicio rápido
95
+
96
+ 1. **Web directa (solo cliente):** Abre [ZeroChat en GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), configura un perfil de conexión y comienza.
97
+ 2. **Con herramientas del equipo (backend Python):**
98
+
99
+ ```bash
100
+ # Mediante PyPI (Linux, macOS, Windows)
101
+ pip install zerochat
102
+ zerochat
103
+
104
+ # O descarga directa del script
105
+ curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
106
+ python3 zerochat.py
107
+ ```
108
+
109
+ ### Documentación y ayuda
110
+
111
+ Guías completas de configuración, soporte de entornos (Linux, Windows, macOS, Android/Termux), servicios MCP y seguridad:
112
+ - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
113
+ - [ZeroChat 9.x Help — English](https://albalday.github.io/zerochat/help/en/index.html)
114
+
115
+ ### Desarrollo
116
+
117
+ El desarrollo se realiza en la rama `dev`:
118
+
119
+ ```bash
120
+ git checkout dev
121
+ npm install
122
+ npm test
123
+ ```
124
+
125
+ Las normas de desarrollo, arquitectura y suite de pruebas se describen en [`AGENTS.md`](./AGENTS.md), [`js/README.md`](./js/README.md), [`py/README.md`](./py/README.md) y [`tests/README.md`](./tests/README.md).
@@ -17,6 +17,7 @@ import base64
17
17
  import datetime
18
18
  import fnmatch
19
19
  import functools
20
+ import gzip
20
21
  import hashlib
21
22
  import hmac
22
23
  import importlib.metadata
@@ -36,14 +37,16 @@ import threading
36
37
  import time
37
38
  import traceback
38
39
  import urllib.error
40
+ import urllib.parse
39
41
  import urllib.request
40
42
  from urllib.parse import urlencode
41
43
  import venv
42
44
  import webbrowser
45
+ import zlib
43
46
  from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
44
47
  from pathlib import Path
45
48
 
46
- SOURCE_BACKEND_VERSION = "9.1.0"
49
+ SOURCE_BACKEND_VERSION = "9.3.0"
47
50
 
48
51
  def _read_source_version(filename: str) -> str | None:
49
52
  """Lee la versión de un archivo del repositorio cuando se ejecuta desde fuentes."""
@@ -1133,6 +1136,12 @@ def _atomic_write_text(target: Path, text: str):
1133
1136
  temp_path.replace(target)
1134
1137
 
1135
1138
 
1139
+ IGNORED_WORKSPACE_DIRS = {
1140
+ ".git", ".venv", "venv", "node_modules", "__pycache__",
1141
+ ".pytest_cache", ".cache", ".gemini", "dist", "build"
1142
+ }
1143
+
1144
+
1136
1145
  def list_directory(path: str = ".", recursive: bool = False) -> str:
1137
1146
  """List files and directories in a local directory with safe bounded recursive traversal."""
1138
1147
  try:
@@ -1158,21 +1167,28 @@ def list_directory(path: str = ".", recursive: bool = False) -> str:
1158
1167
  try:
1159
1168
  stat = entry.stat(follow_symlinks=False)
1160
1169
  is_dir = entry.is_dir(follow_symlinks=False)
1170
+ try:
1171
+ resolved_path = str(Path(entry.path).resolve())
1172
+ except (OSError, RuntimeError):
1173
+ resolved_path = str(Path(entry.path).absolute())
1161
1174
  entry_data = {
1162
1175
  "name": entry.name,
1163
- "path": str(Path(entry.path).resolve()),
1176
+ "path": resolved_path,
1164
1177
  "type": "directory" if is_dir else "file",
1165
1178
  "size_bytes": None if is_dir else stat.st_size,
1166
1179
  "is_symlink": entry.is_symlink()
1167
1180
  }
1168
1181
  if recursive:
1169
- entry_data["relative_path"] = str(Path(entry.path).resolve().relative_to(target))
1182
+ try:
1183
+ entry_data["relative_path"] = str(Path(entry.path).relative_to(target))
1184
+ except ValueError:
1185
+ entry_data["relative_path"] = entry.name
1170
1186
  entries.append(entry_data)
1171
1187
  if recursive and is_dir and not entry.is_symlink():
1172
1188
  _scan(Path(entry.path), current_depth + 1)
1173
- except (PermissionError, FileNotFoundError):
1189
+ except (PermissionError, FileNotFoundError, OSError):
1174
1190
  continue
1175
- except (PermissionError, FileNotFoundError):
1191
+ except (PermissionError, FileNotFoundError, OSError):
1176
1192
  pass
1177
1193
 
1178
1194
  _scan(target, 1)
@@ -1203,7 +1219,8 @@ def read_file(path: str, start_line: int = 1, end_line: int = None, max_lines: i
1203
1219
 
1204
1220
  if end_line is not None:
1205
1221
  safe_end_line = max(safe_start_line, int(end_line))
1206
- target_line_count = safe_end_line - safe_start_line + 1
1222
+ target_line_count = min(safe_end_line - safe_start_line + 1, 2000)
1223
+ safe_end_line = safe_start_line + target_line_count - 1
1207
1224
  else:
1208
1225
  safe_end_line = None
1209
1226
  target_line_count = max(1, min(int(max_lines), 2000))
@@ -1239,6 +1256,7 @@ def read_file(path: str, start_line: int = 1, end_line: int = None, max_lines: i
1239
1256
  selected_lines.append(encoded.decode("utf-8", errors="ignore"))
1240
1257
  truncated_bytes = True
1241
1258
  reached_end_bound = True
1259
+ break
1242
1260
  else:
1243
1261
  selected_lines.append(line)
1244
1262
  current_bytes += line_bytes
@@ -1335,19 +1353,25 @@ def search_files(query: str, path: str = ".", file_pattern: str = None, max_resu
1335
1353
  if not target.is_dir():
1336
1354
  return _tool_error(f"Path '{path}' is not a directory.")
1337
1355
 
1356
+ warning = None
1338
1357
  try:
1339
1358
  regex = re.compile(query, re.MULTILINE)
1340
- except re.error:
1359
+ except re.error as err:
1360
+ warning = f"Query '{query}' is not a valid regular expression ({err}); treated as literal text."
1341
1361
  regex = re.compile(re.escape(query), re.MULTILINE)
1342
1362
 
1343
- ignored_dirs = {".git", ".venv", "node_modules", "__pycache__", ".pytest_cache", ".cache"}
1363
+ try:
1364
+ safe_max_results = max(1, min(int(max_results), 500))
1365
+ except (TypeError, ValueError):
1366
+ safe_max_results = 100
1367
+
1344
1368
  matches = []
1345
1369
  files_searched = 0
1346
1370
  max_file_size = 2 * 1024 * 1024
1347
1371
  truncated = False
1348
1372
 
1349
1373
  for root, dirs, files in os.walk(target):
1350
- dirs[:] = [d for d in dirs if d not in ignored_dirs and not d.startswith(".")]
1374
+ dirs[:] = [d for d in dirs if d not in IGNORED_WORKSPACE_DIRS and not d.startswith(".")]
1351
1375
 
1352
1376
  for fname in sorted(files):
1353
1377
  if file_pattern and not fnmatch.fnmatch(fname, file_pattern):
@@ -1355,6 +1379,12 @@ def search_files(query: str, path: str = ".", file_pattern: str = None, max_resu
1355
1379
 
1356
1380
  fpath = Path(root) / fname
1357
1381
  try:
1382
+ if fpath.is_symlink():
1383
+ try:
1384
+ if not fpath.resolve().is_relative_to(target):
1385
+ continue
1386
+ except (OSError, ValueError):
1387
+ continue
1358
1388
  stat = fpath.stat()
1359
1389
  if stat.st_size > max_file_size:
1360
1390
  continue
@@ -1376,7 +1406,7 @@ def search_files(query: str, path: str = ".", file_pattern: str = None, max_resu
1376
1406
  "line_number": line_idx,
1377
1407
  "content": line.rstrip("\r\n")[:300]
1378
1408
  })
1379
- if len(matches) >= max_results:
1409
+ if len(matches) >= safe_max_results:
1380
1410
  truncated = True
1381
1411
  break
1382
1412
  except (PermissionError, OSError):
@@ -1387,7 +1417,7 @@ def search_files(query: str, path: str = ".", file_pattern: str = None, max_resu
1387
1417
  if truncated:
1388
1418
  break
1389
1419
 
1390
- return json.dumps({
1420
+ payload = {
1391
1421
  "success": True,
1392
1422
  "path": str(target),
1393
1423
  "query": query,
@@ -1396,7 +1426,11 @@ def search_files(query: str, path: str = ".", file_pattern: str = None, max_resu
1396
1426
  "total_matches": len(matches),
1397
1427
  "truncated": truncated,
1398
1428
  "matches": matches
1399
- }, ensure_ascii=False, indent=2)
1429
+ }
1430
+ if warning:
1431
+ payload["warning"] = warning
1432
+
1433
+ return json.dumps(payload, ensure_ascii=False, indent=2)
1400
1434
  except Exception as e:
1401
1435
  return _tool_error(str(e))
1402
1436
 
@@ -1474,12 +1508,20 @@ def get_diagnostics(path: str | None = None) -> str:
1474
1508
  files_checked = 1
1475
1509
  diagnostics.extend(check_single_file(target))
1476
1510
  else:
1477
- ignore_dirs = {".git", "node_modules", ".venv", "venv", "dist", "build", "__pycache__", ".gemini", ".cache"}
1478
1511
  max_scan = 200
1479
1512
  for root, dirs, files in os.walk(target):
1480
- dirs[:] = [d for d in dirs if d not in ignore_dirs and not d.startswith(".")]
1513
+ dirs[:] = [d for d in dirs if d not in IGNORED_WORKSPACE_DIRS and not d.startswith(".")]
1481
1514
  for fname in sorted(files):
1482
1515
  fp = Path(root) / fname
1516
+ try:
1517
+ if fp.is_symlink():
1518
+ try:
1519
+ if not fp.resolve().is_relative_to(target):
1520
+ continue
1521
+ except (OSError, ValueError):
1522
+ continue
1523
+ except OSError:
1524
+ continue
1483
1525
  if fp.suffix.lower() in (".py", ".js", ".mjs", ".cjs", ".json"):
1484
1526
  files_checked += 1
1485
1527
  diagnostics.extend(check_single_file(fp))
@@ -1813,7 +1855,8 @@ LOCAL_TOOLS_DEFINITIONS = [
1813
1855
  "properties": {
1814
1856
  "query": {"type": "string", "maxLength": 4096, "description": "Plain text string or regular expression to search for"},
1815
1857
  "path": {"type": "string", "maxLength": MAX_PATH_LENGTH, "description": "Base search directory (defaults to '.')", "default": "."},
1816
- "file_pattern": {"type": "string", "maxLength": 256, "description": "Optional glob filter (e.g. *.js, *.py)"}
1858
+ "file_pattern": {"type": "string", "maxLength": 256, "description": "Optional glob filter (e.g. *.js, *.py)"},
1859
+ "max_results": {"type": "integer", "description": "Maximum number of matching lines to return (default 100, max 500)", "default": 100}
1817
1860
  },
1818
1861
  "required": ["query"]
1819
1862
  }
@@ -2666,6 +2709,178 @@ DEV_CONTENT_TYPES = {
2666
2709
  ".map": "application/json",
2667
2710
  }
2668
2711
 
2712
+ METADATA_HOSTS = frozenset({
2713
+ "169.254.169.254",
2714
+ "metadata.google.internal",
2715
+ "instance-data",
2716
+ "100.100.100.200",
2717
+ })
2718
+ DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
2719
+
2720
+
2721
+ def is_dangerous_host(hostname: str, allow_local: bool = False) -> bool:
2722
+ """Verifica si un host representa un riesgo de SSRF (metadatos cloud, loopback o privados)."""
2723
+ if not hostname:
2724
+ return True
2725
+ clean_host = hostname.strip().lower().strip("[]")
2726
+ if clean_host in METADATA_HOSTS:
2727
+ return True
2728
+
2729
+ try:
2730
+ ip = ipaddress.ip_address(clean_host)
2731
+ if ip.is_link_local:
2732
+ return True
2733
+ if not allow_local and (ip.is_loopback or ip.is_private or ip.is_reserved or ip.is_unspecified):
2734
+ return True
2735
+ return False
2736
+ except ValueError:
2737
+ pass
2738
+
2739
+ if clean_host.isdigit():
2740
+ try:
2741
+ num = int(clean_host)
2742
+ if 0 <= num <= 4294967295:
2743
+ ip = ipaddress.IPv4Address(num)
2744
+ if ip.is_link_local:
2745
+ return True
2746
+ if not allow_local and (ip.is_loopback or ip.is_private or ip.is_reserved or ip.is_unspecified):
2747
+ return True
2748
+ return False
2749
+ except ValueError:
2750
+ pass
2751
+
2752
+ if clean_host.startswith("0x"):
2753
+ try:
2754
+ num = int(clean_host, 16)
2755
+ if 0 <= num <= 4294967295:
2756
+ ip = ipaddress.IPv4Address(num)
2757
+ if ip.is_link_local:
2758
+ return True
2759
+ if not allow_local and (ip.is_loopback or ip.is_private or ip.is_reserved or ip.is_unspecified):
2760
+ return True
2761
+ return False
2762
+ except ValueError:
2763
+ pass
2764
+
2765
+ if not allow_local:
2766
+ if clean_host in ("localhost", "0.0.0.0", "127.0.0.1", "::1"):
2767
+ return True
2768
+ if clean_host.endswith(".local") or clean_host.endswith(".internal"):
2769
+ return True
2770
+
2771
+ return False
2772
+
2773
+
2774
+ def fetch_web_resource(params: dict) -> dict:
2775
+ """Descarga de forma segura un recurso web vía HTTP/HTTPS para el cliente web."""
2776
+ url = params.get("url")
2777
+ if not isinstance(url, str) or not url.strip():
2778
+ raise ValueError("URL no válida o ausente.")
2779
+ url = url.strip()
2780
+ parsed = urllib.parse.urlparse(url)
2781
+ if parsed.scheme not in ("http", "https"):
2782
+ raise ValueError(f"Protocolo no permitido: '{parsed.scheme}'. Solo se admite http y https.")
2783
+ hostname = (parsed.hostname or "").lower().strip("[]")
2784
+ if not hostname:
2785
+ raise ValueError("URL sin nombre de host válido.")
2786
+
2787
+ allow_local = bool(params.get("allow_local", False))
2788
+ if is_dangerous_host(hostname, allow_local):
2789
+ raise PermissionError("Acceso bloqueado: intento de acceso a servicios internos o metadatos de infraestructura (SSRF).")
2790
+
2791
+ timeout_s = float(params.get("timeout_s", 10.0))
2792
+ timeout_s = max(0.5, min(timeout_s, 30.0))
2793
+ max_bytes = int(params.get("max_bytes", 2 * 1024 * 1024))
2794
+ max_bytes = max(1024, min(max_bytes, 10 * 1024 * 1024))
2795
+ as_binary = bool(params.get("binary", False))
2796
+
2797
+ req_headers = {
2798
+ "User-Agent": DEFAULT_USER_AGENT,
2799
+ "Accept": "text/html,application/xhtml+xml,application/json,application/pdf,text/plain;q=0.9,*/*;q=0.8",
2800
+ "Accept-Encoding": "gzip, deflate",
2801
+ }
2802
+ custom_headers = params.get("headers")
2803
+ if isinstance(custom_headers, dict):
2804
+ for k, v in custom_headers.items():
2805
+ if isinstance(k, str) and isinstance(v, str) and k.lower() != "host":
2806
+ req_headers[k] = v
2807
+
2808
+ req = urllib.request.Request(url, headers=req_headers)
2809
+ try:
2810
+ with urllib.request.urlopen(req, timeout=timeout_s) as resp:
2811
+ status = resp.status
2812
+ content_type = resp.headers.get("Content-Type", "")
2813
+ content_encoding = resp.headers.get("Content-Encoding", "").lower()
2814
+ raw_data = resp.read(max_bytes + 1)
2815
+ truncated = len(raw_data) > max_bytes
2816
+ if truncated:
2817
+ raw_data = raw_data[:max_bytes]
2818
+
2819
+ if "gzip" in content_encoding:
2820
+ try:
2821
+ raw_data = gzip.decompress(raw_data)
2822
+ except (OSError, gzip.BadGzipFile):
2823
+ pass
2824
+ elif "deflate" in content_encoding:
2825
+ try:
2826
+ raw_data = zlib.decompress(raw_data)
2827
+ except (OSError, zlib.error):
2828
+ pass
2829
+
2830
+ resp_headers = {k: v for k, v in resp.getheaders()}
2831
+
2832
+ if as_binary:
2833
+ return {
2834
+ "ok": True,
2835
+ "status": status,
2836
+ "content_type": content_type,
2837
+ "headers": resp_headers,
2838
+ "base64": base64.b64encode(raw_data).decode("ascii"),
2839
+ "byte_size": len(raw_data),
2840
+ "truncated": truncated
2841
+ }
2842
+
2843
+ charset = resp.headers.get_content_charset() or "utf-8"
2844
+ try:
2845
+ text_content = raw_data.decode(charset, errors="replace")
2846
+ return {
2847
+ "ok": True,
2848
+ "status": status,
2849
+ "content_type": content_type,
2850
+ "headers": resp_headers,
2851
+ "text": text_content,
2852
+ "byte_size": len(raw_data),
2853
+ "truncated": truncated
2854
+ }
2855
+ except (UnicodeDecodeError, LookupError):
2856
+ return {
2857
+ "ok": True,
2858
+ "status": status,
2859
+ "content_type": content_type,
2860
+ "headers": resp_headers,
2861
+ "base64": base64.b64encode(raw_data).decode("ascii"),
2862
+ "byte_size": len(raw_data),
2863
+ "truncated": truncated
2864
+ }
2865
+ except urllib.error.HTTPError as he:
2866
+ err_body = ""
2867
+ try:
2868
+ err_body = he.read(2048).decode("utf-8", errors="replace")
2869
+ except (OSError, UnicodeDecodeError):
2870
+ pass
2871
+ return {
2872
+ "ok": False,
2873
+ "status": he.code,
2874
+ "error": f"HTTP {he.code}: {he.reason}",
2875
+ "text": err_body
2876
+ }
2877
+ except Exception as exc:
2878
+ return {
2879
+ "ok": False,
2880
+ "status": 0,
2881
+ "error": str(exc)
2882
+ }
2883
+
2669
2884
 
2670
2885
  class ZeroChatServerHandler(BaseHTTPRequestHandler):
2671
2886
  server_version = f"ZeroChatServer/{VERSION}"
@@ -3071,6 +3286,13 @@ class ZeroChatServerHandler(BaseHTTPRequestHandler):
3071
3286
  return set_project_directory(params.get("path")), None, ""
3072
3287
  except (ValueError, OSError) as exc:
3073
3288
  return None, {"code": -32602, "message": str(exc)}, ""
3289
+ if method == "zerochat/web/fetch":
3290
+ try:
3291
+ return fetch_web_resource(params), None, ""
3292
+ except (ValueError, PermissionError) as exc:
3293
+ return None, {"code": -32602, "message": str(exc)}, ""
3294
+ except Exception as exc:
3295
+ return None, {"code": -32603, "message": f"Error en transporte web: {exc}"}, str(exc)
3074
3296
  if method.startswith("zerochat/jobs/"):
3075
3297
  return self._dispatch_jobs(method, params)
3076
3298
  if method == "zerochat/external/status":
zerochat-9.1.0/PKG-INFO DELETED
@@ -1,118 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: zerochat
3
- Version: 9.1.0
4
- Summary: Private local web client for AI models, tools and MCP services
5
- Author: Alberto Alday
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://albalday.github.io/zerochat/
8
- Project-URL: Repository, https://github.com/albalday/zerochat
9
- Project-URL: Issues, https://github.com/albalday/zerochat/issues
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Environment :: Web Environment
12
- Classifier: Operating System :: OS Independent
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Requires-Python: >=3.10
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Dynamic: license-file
22
-
23
- # ZeroChat
24
-
25
- ZeroChat es un cliente web de uso personal para conversar con modelos de IA, consultar documentos y utilizar herramientas. Esta documentación corresponde a la serie **9.x**. Es un proyecto personal, de libre uso con licencia MIT si a alguien le sirve; su objetivo actual es servir de frontend único para un LLM local (Swift-Qwen3.8) con una API compatible con OpenAI.
26
-
27
- La interfaz se sirve como archivos estáticos: `zerochat.html` necesita sus módulos `js/` y `css/`. El historial y la configuración se guardan en el navegador; no se sincronizan automáticamente entre dispositivos. Los proveedores remotos reciben el contenido incluido en las peticiones, y las herramientas web pueden utilizar servicios intermediarios. Almacenamiento local no significa privacidad absoluta.
28
-
29
- *English:* ZeroChat is a web client for personal use: chatting with AI models, consulting documents and using tools. This documentation covers the **9.x** series. It is a personal project, free to use under the MIT licence if it helps anyone; its current goal is to serve as the single frontend for a local LLM (Swift-Qwen3.8) through an OpenAI-compatible API.
30
-
31
- The interface is served as static files: `zerochat.html` needs its `js/` and `css/` modules. History and settings are stored in the browser, without automatic cross-device sync. Remote providers receive content included in requests, and web tools may use intermediary services. Local storage does not mean absolute privacy.
32
-
33
- ## Características principales / Main features
34
-
35
- - **Perfiles:** OpenAI y APIs de chat compatibles, Ollama, OpenRouter, Claude y Gemini. La visión, las herramientas y el razonamiento dependen del modelo y del adaptador.
36
- - **WebLLM:** inferencia en el navegador con WebGPU, tras descargar un modelo. Necesita hardware compatible y memoria suficiente.
37
- - **Documentos:** adjuntos y colecciones RAG con extracción local y búsqueda léxica mediante Orama; sin embeddings. Los fragmentos recuperados se envían al modelo elegido. La extracción de PDF tiene límites y no incluye OCR general.
38
- - **Herramientas:** JavaScript aislado, búsqueda y lectura web, gráficos, preguntas al usuario y subagentes de solo lectura. El backend opcional añade archivos, comandos, diagnósticos, automatización de navegador y servicios MCP.
39
- - **Historial y diagnóstico:** ramas de conversación, exportación JSON y Markdown, impresión a PDF, métricas de contexto y revisión de peticiones antes del envío.
40
-
41
- *English:*
42
-
43
- - **Profiles:** OpenAI and compatible chat APIs, Ollama, OpenRouter, Claude and Gemini. Vision, tools and reasoning depend on the model and adapter.
44
- - **WebLLM:** browser inference through WebGPU after downloading a model. Requires compatible hardware and enough memory.
45
- - **Documents:** attachments and RAG collections with local extraction and Orama lexical search, without embeddings. Retrieved passages are sent to the selected model. PDF extraction has limitations and no general OCR.
46
- - **Tools:** isolated JavaScript, web search and retrieval, charts, questions to the user and read-only subagents. The optional backend adds files, commands, diagnostics, browser automation and MCP services.
47
- - **History and diagnostics:** conversation branches, JSON and Markdown export, printing to PDF, context metrics and request inspection before sending.
48
-
49
- ## Inicio rápido / Quick start
50
-
51
- Abre [ZeroChat en GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), crea un perfil, introduce la URL y la clave si corresponde, consulta los modelos con **Query** y guarda. El perfil **Espejo** permite probar la interfaz sin inferencia. Para WebLLM, prepara un modelo del catálogo.
52
-
53
- *English:* Open [ZeroChat on GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), create a profile, enter the URL and key where required, query models with **Query**, and save. **Mirror** lets you try the interface without inference. For WebLLM, prepare a catalogue model.
54
-
55
- Para añadir herramientas del equipo, instala y ejecuta el backend con Python. / To add computer tools, install and run the Python backend:
56
-
57
- ```bash
58
- # Linux, macOS, Android (Termux)
59
- pip install zerochat
60
- zerochat
61
- ```
62
-
63
- ```powershell
64
- # Windows (PowerShell o CMD / PowerShell or CMD)
65
- py -m pip install zerochat
66
- py -m zerochat
67
- ```
68
-
69
- También puedes descargar el script y ejecutarlo. / You can also download and run the script:
70
-
71
- ```bash
72
- # Linux, macOS, Android (Termux)
73
- curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
74
- python3 zerochat.py
75
- ```
76
-
77
- ```powershell
78
- # Windows (PowerShell o CMD / PowerShell or CMD)
79
- curl.exe -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
80
- py zerochat.py
81
- ```
82
-
83
- > **Entornos probados / Tested environments:** Linux (x86_64, ARM), Windows 10/11 (PowerShell, `py -m zerochat`), Android (Termux con `python`; Playwright no se puede usar actualmente en Termux / Playwright cannot currently be used on Termux).
84
- > **Navegadores / Browsers:** ZeroChat **no es compatible con Safari / does not work on Safari**. En macOS debería funcionar con Firefox o Chromium, pero no se ha probado / On macOS it should work with Firefox or Chromium, but it has not been tested.
85
-
86
- Fuera del repositorio de desarrollo, ambos modos abren la interfaz de GitHub Pages. Crean `~/zerochat/` para configuración y servicios, con `.venv/` para dependencias MCP Python. Mantén el proceso abierto y usa su enlace de arranque para autenticar la conexión local. Revisa **Ajustes → MCP** y **Permisos** antes de habilitar herramientas: los comandos actúan con los permisos del proceso local y detenerlos no deshace cambios.
87
-
88
- Borrar `~/zerochat/` elimina ese estado y los MCP gestionados, no el ejecutable, los archivos modificados fuera de esa carpeta ni los datos del navegador. Exporta las conversaciones y perfiles que quieras conservar; sus copias no incluyen las colecciones RAG ni los modelos descargados. El cifrado predeterminado de perfiles utiliza una clave integrada conocida: trata las copias como archivos sensibles.
89
-
90
- *English:* Outside the development repository, both modes open the GitHub Pages interface. They create `~/zerochat/` for configuration and services, with `.venv/` for Python MCP dependencies. Keep the process running and use its startup link to authenticate the local connection. Review **Settings → MCP** and **Permissions** before enabling tools: commands run with the local process permissions, and stopping them does not undo changes.
91
-
92
- Deleting `~/zerochat/` removes that state and managed MCP services, not the executable, files changed elsewhere or browser data. Export conversations and profiles you want to keep; these backups do not include RAG collections or downloaded models. Default profile encryption uses a known built-in key: treat backups as sensitive files.
93
-
94
- ## Documentación y ayuda / Documentation and help
95
-
96
- - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
97
- - [ZeroChat 9.x help — English](https://albalday.github.io/zerochat/help/en/index.html)
98
-
99
- Las guías explican configuración, uso y límites.
100
-
101
- *English:* The guides explain setup, usage and limits.
102
-
103
- ## Desarrollo / Development
104
-
105
- Trabaja en `dev`. Para instalar dependencias y ejecutar las pruebas del proyecto: / Work on `dev`. To install dependencies and run the project tests:
106
-
107
- ```bash
108
- npm install
109
- npm test
110
- ```
111
-
112
- Dentro del repositorio, `python3 zerochat.py` sirve la interfaz local de desarrollo. Si modificas `py/`, reconstruye `zerochat.py` con `npm run build:backend`. La web carga directamente sus módulos, sin un bundle de aplicación.
113
-
114
- *English:* Inside the repository, `python3 zerochat.py` serves the local development interface. After changing `py/`, rebuild `zerochat.py` with `npm run build:backend`. The web app loads its modules directly, without an application bundle.
115
-
116
- Las normas y validaciones se describen en [`AGENTS.md`](./AGENTS.md) y [`tests/README.md`](./tests/README.md).
117
-
118
- *English:* See those files for the applicable development rules and validation.
zerochat-9.1.0/README.md DELETED
@@ -1,96 +0,0 @@
1
- # ZeroChat
2
-
3
- ZeroChat es un cliente web de uso personal para conversar con modelos de IA, consultar documentos y utilizar herramientas. Esta documentación corresponde a la serie **9.x**. Es un proyecto personal, de libre uso con licencia MIT si a alguien le sirve; su objetivo actual es servir de frontend único para un LLM local (Swift-Qwen3.8) con una API compatible con OpenAI.
4
-
5
- La interfaz se sirve como archivos estáticos: `zerochat.html` necesita sus módulos `js/` y `css/`. El historial y la configuración se guardan en el navegador; no se sincronizan automáticamente entre dispositivos. Los proveedores remotos reciben el contenido incluido en las peticiones, y las herramientas web pueden utilizar servicios intermediarios. Almacenamiento local no significa privacidad absoluta.
6
-
7
- *English:* ZeroChat is a web client for personal use: chatting with AI models, consulting documents and using tools. This documentation covers the **9.x** series. It is a personal project, free to use under the MIT licence if it helps anyone; its current goal is to serve as the single frontend for a local LLM (Swift-Qwen3.8) through an OpenAI-compatible API.
8
-
9
- The interface is served as static files: `zerochat.html` needs its `js/` and `css/` modules. History and settings are stored in the browser, without automatic cross-device sync. Remote providers receive content included in requests, and web tools may use intermediary services. Local storage does not mean absolute privacy.
10
-
11
- ## Características principales / Main features
12
-
13
- - **Perfiles:** OpenAI y APIs de chat compatibles, Ollama, OpenRouter, Claude y Gemini. La visión, las herramientas y el razonamiento dependen del modelo y del adaptador.
14
- - **WebLLM:** inferencia en el navegador con WebGPU, tras descargar un modelo. Necesita hardware compatible y memoria suficiente.
15
- - **Documentos:** adjuntos y colecciones RAG con extracción local y búsqueda léxica mediante Orama; sin embeddings. Los fragmentos recuperados se envían al modelo elegido. La extracción de PDF tiene límites y no incluye OCR general.
16
- - **Herramientas:** JavaScript aislado, búsqueda y lectura web, gráficos, preguntas al usuario y subagentes de solo lectura. El backend opcional añade archivos, comandos, diagnósticos, automatización de navegador y servicios MCP.
17
- - **Historial y diagnóstico:** ramas de conversación, exportación JSON y Markdown, impresión a PDF, métricas de contexto y revisión de peticiones antes del envío.
18
-
19
- *English:*
20
-
21
- - **Profiles:** OpenAI and compatible chat APIs, Ollama, OpenRouter, Claude and Gemini. Vision, tools and reasoning depend on the model and adapter.
22
- - **WebLLM:** browser inference through WebGPU after downloading a model. Requires compatible hardware and enough memory.
23
- - **Documents:** attachments and RAG collections with local extraction and Orama lexical search, without embeddings. Retrieved passages are sent to the selected model. PDF extraction has limitations and no general OCR.
24
- - **Tools:** isolated JavaScript, web search and retrieval, charts, questions to the user and read-only subagents. The optional backend adds files, commands, diagnostics, browser automation and MCP services.
25
- - **History and diagnostics:** conversation branches, JSON and Markdown export, printing to PDF, context metrics and request inspection before sending.
26
-
27
- ## Inicio rápido / Quick start
28
-
29
- Abre [ZeroChat en GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), crea un perfil, introduce la URL y la clave si corresponde, consulta los modelos con **Query** y guarda. El perfil **Espejo** permite probar la interfaz sin inferencia. Para WebLLM, prepara un modelo del catálogo.
30
-
31
- *English:* Open [ZeroChat on GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), create a profile, enter the URL and key where required, query models with **Query**, and save. **Mirror** lets you try the interface without inference. For WebLLM, prepare a catalogue model.
32
-
33
- Para añadir herramientas del equipo, instala y ejecuta el backend con Python. / To add computer tools, install and run the Python backend:
34
-
35
- ```bash
36
- # Linux, macOS, Android (Termux)
37
- pip install zerochat
38
- zerochat
39
- ```
40
-
41
- ```powershell
42
- # Windows (PowerShell o CMD / PowerShell or CMD)
43
- py -m pip install zerochat
44
- py -m zerochat
45
- ```
46
-
47
- También puedes descargar el script y ejecutarlo. / You can also download and run the script:
48
-
49
- ```bash
50
- # Linux, macOS, Android (Termux)
51
- curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
52
- python3 zerochat.py
53
- ```
54
-
55
- ```powershell
56
- # Windows (PowerShell o CMD / PowerShell or CMD)
57
- curl.exe -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
58
- py zerochat.py
59
- ```
60
-
61
- > **Entornos probados / Tested environments:** Linux (x86_64, ARM), Windows 10/11 (PowerShell, `py -m zerochat`), Android (Termux con `python`; Playwright no se puede usar actualmente en Termux / Playwright cannot currently be used on Termux).
62
- > **Navegadores / Browsers:** ZeroChat **no es compatible con Safari / does not work on Safari**. En macOS debería funcionar con Firefox o Chromium, pero no se ha probado / On macOS it should work with Firefox or Chromium, but it has not been tested.
63
-
64
- Fuera del repositorio de desarrollo, ambos modos abren la interfaz de GitHub Pages. Crean `~/zerochat/` para configuración y servicios, con `.venv/` para dependencias MCP Python. Mantén el proceso abierto y usa su enlace de arranque para autenticar la conexión local. Revisa **Ajustes → MCP** y **Permisos** antes de habilitar herramientas: los comandos actúan con los permisos del proceso local y detenerlos no deshace cambios.
65
-
66
- Borrar `~/zerochat/` elimina ese estado y los MCP gestionados, no el ejecutable, los archivos modificados fuera de esa carpeta ni los datos del navegador. Exporta las conversaciones y perfiles que quieras conservar; sus copias no incluyen las colecciones RAG ni los modelos descargados. El cifrado predeterminado de perfiles utiliza una clave integrada conocida: trata las copias como archivos sensibles.
67
-
68
- *English:* Outside the development repository, both modes open the GitHub Pages interface. They create `~/zerochat/` for configuration and services, with `.venv/` for Python MCP dependencies. Keep the process running and use its startup link to authenticate the local connection. Review **Settings → MCP** and **Permissions** before enabling tools: commands run with the local process permissions, and stopping them does not undo changes.
69
-
70
- Deleting `~/zerochat/` removes that state and managed MCP services, not the executable, files changed elsewhere or browser data. Export conversations and profiles you want to keep; these backups do not include RAG collections or downloaded models. Default profile encryption uses a known built-in key: treat backups as sensitive files.
71
-
72
- ## Documentación y ayuda / Documentation and help
73
-
74
- - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
75
- - [ZeroChat 9.x help — English](https://albalday.github.io/zerochat/help/en/index.html)
76
-
77
- Las guías explican configuración, uso y límites.
78
-
79
- *English:* The guides explain setup, usage and limits.
80
-
81
- ## Desarrollo / Development
82
-
83
- Trabaja en `dev`. Para instalar dependencias y ejecutar las pruebas del proyecto: / Work on `dev`. To install dependencies and run the project tests:
84
-
85
- ```bash
86
- npm install
87
- npm test
88
- ```
89
-
90
- Dentro del repositorio, `python3 zerochat.py` sirve la interfaz local de desarrollo. Si modificas `py/`, reconstruye `zerochat.py` con `npm run build:backend`. La web carga directamente sus módulos, sin un bundle de aplicación.
91
-
92
- *English:* Inside the repository, `python3 zerochat.py` serves the local development interface. After changing `py/`, rebuild `zerochat.py` with `npm run build:backend`. The web app loads its modules directly, without an application bundle.
93
-
94
- Las normas y validaciones se describen en [`AGENTS.md`](./AGENTS.md) y [`tests/README.md`](./tests/README.md).
95
-
96
- *English:* See those files for the applicable development rules and validation.
@@ -1,118 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: zerochat
3
- Version: 9.1.0
4
- Summary: Private local web client for AI models, tools and MCP services
5
- Author: Alberto Alday
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://albalday.github.io/zerochat/
8
- Project-URL: Repository, https://github.com/albalday/zerochat
9
- Project-URL: Issues, https://github.com/albalday/zerochat/issues
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Environment :: Web Environment
12
- Classifier: Operating System :: OS Independent
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Requires-Python: >=3.10
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Dynamic: license-file
22
-
23
- # ZeroChat
24
-
25
- ZeroChat es un cliente web de uso personal para conversar con modelos de IA, consultar documentos y utilizar herramientas. Esta documentación corresponde a la serie **9.x**. Es un proyecto personal, de libre uso con licencia MIT si a alguien le sirve; su objetivo actual es servir de frontend único para un LLM local (Swift-Qwen3.8) con una API compatible con OpenAI.
26
-
27
- La interfaz se sirve como archivos estáticos: `zerochat.html` necesita sus módulos `js/` y `css/`. El historial y la configuración se guardan en el navegador; no se sincronizan automáticamente entre dispositivos. Los proveedores remotos reciben el contenido incluido en las peticiones, y las herramientas web pueden utilizar servicios intermediarios. Almacenamiento local no significa privacidad absoluta.
28
-
29
- *English:* ZeroChat is a web client for personal use: chatting with AI models, consulting documents and using tools. This documentation covers the **9.x** series. It is a personal project, free to use under the MIT licence if it helps anyone; its current goal is to serve as the single frontend for a local LLM (Swift-Qwen3.8) through an OpenAI-compatible API.
30
-
31
- The interface is served as static files: `zerochat.html` needs its `js/` and `css/` modules. History and settings are stored in the browser, without automatic cross-device sync. Remote providers receive content included in requests, and web tools may use intermediary services. Local storage does not mean absolute privacy.
32
-
33
- ## Características principales / Main features
34
-
35
- - **Perfiles:** OpenAI y APIs de chat compatibles, Ollama, OpenRouter, Claude y Gemini. La visión, las herramientas y el razonamiento dependen del modelo y del adaptador.
36
- - **WebLLM:** inferencia en el navegador con WebGPU, tras descargar un modelo. Necesita hardware compatible y memoria suficiente.
37
- - **Documentos:** adjuntos y colecciones RAG con extracción local y búsqueda léxica mediante Orama; sin embeddings. Los fragmentos recuperados se envían al modelo elegido. La extracción de PDF tiene límites y no incluye OCR general.
38
- - **Herramientas:** JavaScript aislado, búsqueda y lectura web, gráficos, preguntas al usuario y subagentes de solo lectura. El backend opcional añade archivos, comandos, diagnósticos, automatización de navegador y servicios MCP.
39
- - **Historial y diagnóstico:** ramas de conversación, exportación JSON y Markdown, impresión a PDF, métricas de contexto y revisión de peticiones antes del envío.
40
-
41
- *English:*
42
-
43
- - **Profiles:** OpenAI and compatible chat APIs, Ollama, OpenRouter, Claude and Gemini. Vision, tools and reasoning depend on the model and adapter.
44
- - **WebLLM:** browser inference through WebGPU after downloading a model. Requires compatible hardware and enough memory.
45
- - **Documents:** attachments and RAG collections with local extraction and Orama lexical search, without embeddings. Retrieved passages are sent to the selected model. PDF extraction has limitations and no general OCR.
46
- - **Tools:** isolated JavaScript, web search and retrieval, charts, questions to the user and read-only subagents. The optional backend adds files, commands, diagnostics, browser automation and MCP services.
47
- - **History and diagnostics:** conversation branches, JSON and Markdown export, printing to PDF, context metrics and request inspection before sending.
48
-
49
- ## Inicio rápido / Quick start
50
-
51
- Abre [ZeroChat en GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), crea un perfil, introduce la URL y la clave si corresponde, consulta los modelos con **Query** y guarda. El perfil **Espejo** permite probar la interfaz sin inferencia. Para WebLLM, prepara un modelo del catálogo.
52
-
53
- *English:* Open [ZeroChat on GitHub Pages](https://albalday.github.io/zerochat/zerochat.html), create a profile, enter the URL and key where required, query models with **Query**, and save. **Mirror** lets you try the interface without inference. For WebLLM, prepare a catalogue model.
54
-
55
- Para añadir herramientas del equipo, instala y ejecuta el backend con Python. / To add computer tools, install and run the Python backend:
56
-
57
- ```bash
58
- # Linux, macOS, Android (Termux)
59
- pip install zerochat
60
- zerochat
61
- ```
62
-
63
- ```powershell
64
- # Windows (PowerShell o CMD / PowerShell or CMD)
65
- py -m pip install zerochat
66
- py -m zerochat
67
- ```
68
-
69
- También puedes descargar el script y ejecutarlo. / You can also download and run the script:
70
-
71
- ```bash
72
- # Linux, macOS, Android (Termux)
73
- curl -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
74
- python3 zerochat.py
75
- ```
76
-
77
- ```powershell
78
- # Windows (PowerShell o CMD / PowerShell or CMD)
79
- curl.exe -fsSL https://albalday.github.io/zerochat/zerochat.py -o zerochat.py
80
- py zerochat.py
81
- ```
82
-
83
- > **Entornos probados / Tested environments:** Linux (x86_64, ARM), Windows 10/11 (PowerShell, `py -m zerochat`), Android (Termux con `python`; Playwright no se puede usar actualmente en Termux / Playwright cannot currently be used on Termux).
84
- > **Navegadores / Browsers:** ZeroChat **no es compatible con Safari / does not work on Safari**. En macOS debería funcionar con Firefox o Chromium, pero no se ha probado / On macOS it should work with Firefox or Chromium, but it has not been tested.
85
-
86
- Fuera del repositorio de desarrollo, ambos modos abren la interfaz de GitHub Pages. Crean `~/zerochat/` para configuración y servicios, con `.venv/` para dependencias MCP Python. Mantén el proceso abierto y usa su enlace de arranque para autenticar la conexión local. Revisa **Ajustes → MCP** y **Permisos** antes de habilitar herramientas: los comandos actúan con los permisos del proceso local y detenerlos no deshace cambios.
87
-
88
- Borrar `~/zerochat/` elimina ese estado y los MCP gestionados, no el ejecutable, los archivos modificados fuera de esa carpeta ni los datos del navegador. Exporta las conversaciones y perfiles que quieras conservar; sus copias no incluyen las colecciones RAG ni los modelos descargados. El cifrado predeterminado de perfiles utiliza una clave integrada conocida: trata las copias como archivos sensibles.
89
-
90
- *English:* Outside the development repository, both modes open the GitHub Pages interface. They create `~/zerochat/` for configuration and services, with `.venv/` for Python MCP dependencies. Keep the process running and use its startup link to authenticate the local connection. Review **Settings → MCP** and **Permissions** before enabling tools: commands run with the local process permissions, and stopping them does not undo changes.
91
-
92
- Deleting `~/zerochat/` removes that state and managed MCP services, not the executable, files changed elsewhere or browser data. Export conversations and profiles you want to keep; these backups do not include RAG collections or downloaded models. Default profile encryption uses a known built-in key: treat backups as sensitive files.
93
-
94
- ## Documentación y ayuda / Documentation and help
95
-
96
- - [Ayuda de ZeroChat 9.x — Español](https://albalday.github.io/zerochat/help/index.html)
97
- - [ZeroChat 9.x help — English](https://albalday.github.io/zerochat/help/en/index.html)
98
-
99
- Las guías explican configuración, uso y límites.
100
-
101
- *English:* The guides explain setup, usage and limits.
102
-
103
- ## Desarrollo / Development
104
-
105
- Trabaja en `dev`. Para instalar dependencias y ejecutar las pruebas del proyecto: / Work on `dev`. To install dependencies and run the project tests:
106
-
107
- ```bash
108
- npm install
109
- npm test
110
- ```
111
-
112
- Dentro del repositorio, `python3 zerochat.py` sirve la interfaz local de desarrollo. Si modificas `py/`, reconstruye `zerochat.py` con `npm run build:backend`. La web carga directamente sus módulos, sin un bundle de aplicación.
113
-
114
- *English:* Inside the repository, `python3 zerochat.py` serves the local development interface. After changing `py/`, rebuild `zerochat.py` with `npm run build:backend`. The web app loads its modules directly, without an application bundle.
115
-
116
- Las normas y validaciones se describen en [`AGENTS.md`](./AGENTS.md) y [`tests/README.md`](./tests/README.md).
117
-
118
- *English:* See those files for the applicable development rules and validation.
File without changes
File without changes