@kernlang/agon-dedup 0.2.4 → 0.2.6
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/install-python.mjs +28 -0
- package/package.json +3 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const agonHome = process.env.AGON_HOME || join(homedir(), '.agon');
|
|
9
|
+
const venvDir = join(agonHome, 'python-sidecar');
|
|
10
|
+
const managedPython = process.platform === 'win32'
|
|
11
|
+
? join(venvDir, 'Scripts', 'python.exe')
|
|
12
|
+
: join(venvDir, 'bin', 'python');
|
|
13
|
+
const requirements = join(dirname(fileURLToPath(import.meta.url)), 'requirements.txt');
|
|
14
|
+
|
|
15
|
+
mkdirSync(agonHome, { recursive: true });
|
|
16
|
+
if (!existsSync(managedPython)) {
|
|
17
|
+
const configuredBootstrap = process.env.AGON_BOOTSTRAP_PYTHON;
|
|
18
|
+
const bootstrapCommand = configuredBootstrap || (process.platform === 'win32' ? 'py' : 'python3');
|
|
19
|
+
const bootstrapArgs = !configuredBootstrap && process.platform === 'win32' ? ['-3', '-m', 'venv', venvDir] : ['-m', 'venv', venvDir];
|
|
20
|
+
const create = spawnSync(bootstrapCommand, bootstrapArgs, { stdio: 'inherit' });
|
|
21
|
+
if (create.error) console.error(`[agon] could not start Python bootstrap ${bootstrapCommand}: ${create.error.message}`);
|
|
22
|
+
if (create.status !== 0) process.exit(create.status ?? 1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const install = spawnSync(managedPython, ['-m', 'pip', 'install', '-r', requirements], { stdio: 'inherit' });
|
|
26
|
+
if (install.error) console.error(`[agon] could not start managed Python ${managedPython}: ${install.error.message}`);
|
|
27
|
+
if (install.status !== 0 && !install.error) console.error('[agon] Python sidecar dependency installation failed.');
|
|
28
|
+
process.exit(install.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernlang/agon-dedup",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Python sidecars for Agon AI — semantic embeddings (fastembed/MiniLM) and tree-sitter syntax validation. Bridged from KERN via stdin/stdout JSON. Ships .py files that the @kernlang/agon-core bridges spawn at runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"*.py",
|
|
8
|
+
"install-python.mjs",
|
|
8
9
|
"requirements.txt",
|
|
9
10
|
"README.md",
|
|
10
11
|
"LICENSE"
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
"access": "public"
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|
|
16
|
-
"install:python": "
|
|
17
|
+
"install:python": "node install-python.mjs",
|
|
17
18
|
"test:sidecar": "node tests/smoke.mjs",
|
|
18
19
|
"test:classifier": "node tests/classifier-smoke.mjs",
|
|
19
20
|
"test:history-search": "node tests/history-search-smoke.mjs",
|