escribano 0.1.0 → 0.1.2
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/README.md
CHANGED
|
@@ -157,6 +157,10 @@ Uses VLM-first visual understanding, not OCR + text clustering. OCR fails for de
|
|
|
157
157
|
brew install ollama whisper-cpp ffmpeg
|
|
158
158
|
|
|
159
159
|
# MLX-VLM for frame analysis (Apple Silicon)
|
|
160
|
+
# Using uv (recommended, faster)
|
|
161
|
+
uv pip install mlx-vlm
|
|
162
|
+
|
|
163
|
+
# Or using pip
|
|
160
164
|
pip install mlx-vlm
|
|
161
165
|
```
|
|
162
166
|
|
|
@@ -13,7 +13,9 @@ import { spawn } from 'node:child_process';
|
|
|
13
13
|
import { existsSync, unlinkSync } from 'node:fs';
|
|
14
14
|
import { createConnection } from 'node:net';
|
|
15
15
|
import { homedir } from 'node:os';
|
|
16
|
-
import { resolve } from 'node:path';
|
|
16
|
+
import { dirname, resolve } from 'node:path';
|
|
17
|
+
import { fileURLToPath } from 'node:url';
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
19
|
const DEBUG_MLX = process.env.ESCRIBANO_VERBOSE === 'true';
|
|
18
20
|
function debugLog(...args) {
|
|
19
21
|
if (DEBUG_MLX) {
|
|
@@ -26,7 +28,7 @@ const DEFAULT_CONFIG = {
|
|
|
26
28
|
batchSize: Number(process.env.ESCRIBANO_VLM_BATCH_SIZE) || 4,
|
|
27
29
|
maxTokens: Number(process.env.ESCRIBANO_VLM_MAX_TOKENS) || 2000,
|
|
28
30
|
socketPath: process.env.ESCRIBANO_MLX_SOCKET_PATH ?? '/tmp/escribano-mlx.sock',
|
|
29
|
-
bridgeScript: resolve(
|
|
31
|
+
bridgeScript: resolve(__dirname, '../../scripts/mlx_bridge.py'),
|
|
30
32
|
startupTimeout: Number(process.env.ESCRIBANO_MLX_STARTUP_TIMEOUT) || 60000,
|
|
31
33
|
};
|
|
32
34
|
/**
|
package/dist/prerequisites.js
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* Checks for required dependencies and provides install instructions
|
|
5
5
|
*/
|
|
6
6
|
import { execSync } from 'node:child_process';
|
|
7
|
+
import { existsSync } from 'node:fs';
|
|
8
|
+
import { homedir } from 'node:os';
|
|
9
|
+
import { resolve } from 'node:path';
|
|
7
10
|
const LLM_MODEL_TIERS = [
|
|
8
11
|
{ model: 'qwen3.5:27b', tier: 4, minRamGB: 32, label: 'best' },
|
|
9
12
|
{ model: 'qwen3:14b', tier: 3, minRamGB: 20, label: 'very good' },
|
|
@@ -125,18 +128,66 @@ function checkLLMModels() {
|
|
|
125
128
|
installCommand: 'ollama pull qwen3:8b',
|
|
126
129
|
};
|
|
127
130
|
}
|
|
131
|
+
function getPythonPath() {
|
|
132
|
+
if (process.env.ESCRIBANO_PYTHON_PATH) {
|
|
133
|
+
return process.env.ESCRIBANO_PYTHON_PATH;
|
|
134
|
+
}
|
|
135
|
+
if (process.env.VIRTUAL_ENV) {
|
|
136
|
+
return resolve(process.env.VIRTUAL_ENV, 'bin', 'python3');
|
|
137
|
+
}
|
|
138
|
+
const uvHomeVenv = resolve(homedir(), '.venv', 'bin', 'python3');
|
|
139
|
+
if (existsSync(uvHomeVenv)) {
|
|
140
|
+
return uvHomeVenv;
|
|
141
|
+
}
|
|
142
|
+
return 'python3';
|
|
143
|
+
}
|
|
128
144
|
function checkPythonPackage(packageName) {
|
|
145
|
+
const pythonPath = getPythonPath();
|
|
129
146
|
try {
|
|
130
|
-
execSync(`
|
|
147
|
+
execSync(`"${pythonPath}" -c "import ${packageName}"`, {
|
|
131
148
|
encoding: 'utf-8',
|
|
132
149
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
133
150
|
timeout: 5000,
|
|
134
151
|
});
|
|
135
|
-
return true;
|
|
152
|
+
return { found: true, pythonPath };
|
|
136
153
|
}
|
|
137
154
|
catch {
|
|
138
|
-
return false;
|
|
155
|
+
return { found: false };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function detectPipCommand() {
|
|
159
|
+
// Check for uv first (fastest, recommended)
|
|
160
|
+
try {
|
|
161
|
+
execSync('uv --version', {
|
|
162
|
+
encoding: 'utf-8',
|
|
163
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
164
|
+
timeout: 3000,
|
|
165
|
+
});
|
|
166
|
+
return 'uv pip install mlx-vlm';
|
|
139
167
|
}
|
|
168
|
+
catch { }
|
|
169
|
+
// Check for pip3
|
|
170
|
+
try {
|
|
171
|
+
execSync('pip3 --version', {
|
|
172
|
+
encoding: 'utf-8',
|
|
173
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
174
|
+
timeout: 3000,
|
|
175
|
+
});
|
|
176
|
+
return 'pip3 install mlx-vlm';
|
|
177
|
+
}
|
|
178
|
+
catch { }
|
|
179
|
+
// Check for pip
|
|
180
|
+
try {
|
|
181
|
+
execSync('pip --version', {
|
|
182
|
+
encoding: 'utf-8',
|
|
183
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
184
|
+
timeout: 3000,
|
|
185
|
+
});
|
|
186
|
+
return 'pip install mlx-vlm';
|
|
187
|
+
}
|
|
188
|
+
catch { }
|
|
189
|
+
// Fallback: python3 -m pip
|
|
190
|
+
return 'python3 -m pip install mlx-vlm';
|
|
140
191
|
}
|
|
141
192
|
export function checkPrerequisites() {
|
|
142
193
|
const results = [];
|
|
@@ -187,7 +238,14 @@ export function checkPrerequisites() {
|
|
|
187
238
|
break;
|
|
188
239
|
}
|
|
189
240
|
case 'mlx-vlm': {
|
|
190
|
-
|
|
241
|
+
const check = checkPythonPackage('mlx_vlm');
|
|
242
|
+
result.found = check.found;
|
|
243
|
+
if (check.found && check.pythonPath) {
|
|
244
|
+
result.notes = `via ${check.pythonPath}`;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
result.installCommand = detectPipCommand();
|
|
248
|
+
}
|
|
191
249
|
break;
|
|
192
250
|
}
|
|
193
251
|
}
|