@kernlang/agon-dedup 0.2.5 → 0.2.7

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
@@ -71,7 +71,7 @@ Per-call subprocess. Agon spawns `python3 sidecar.py` only when it has drafts to
71
71
 
72
72
  - [x] Sidecar built and smoke-tested
73
73
  - [x] Workspace registered
74
- - [x] Wired into `runBrainstorm` (`packages/forge/src/kern/dedup-bridge.kern` spawns the sidecar; result attached as `BrainstormResult.groups`)
74
+ - [x] Wired into `runBrainstorm` (`packages/forge/src/dedup-bridge.ts` spawns the sidecar; result attached as `BrainstormResult.groups`)
75
75
  - [x] CLI `agon brainstorm` shows `(N engines agree)` tag in the bids table
76
76
  - [ ] Integration test against a real `agon brainstorm` call (manual for now — brainstorms run 8-12 min with 6 engines)
77
77
  - [ ] Optional: cache embeddings per session so identical drafts across re-runs reuse vectors
@@ -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.5",
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.",
3
+ "version": "0.2.7",
4
+ "description": "Python sidecars for Agon AI — semantic embeddings (fastembed/MiniLM) and tree-sitter syntax validation. Bridged over 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": "python3 -m pip install --user -r requirements.txt",
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",