openagentflow 0.1.2 → 0.1.3
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/cli/index.js +29 -7
- package/package.json +13 -1
package/cli/index.js
CHANGED
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
* langgraph Generate executable LangGraph Python code
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { readFileSync, writeFileSync, existsSync, unlinkSync } from 'fs';
|
|
20
|
+
import { readFileSync, writeFileSync, existsSync, unlinkSync, realpathSync } from 'fs';
|
|
21
21
|
import { resolve, basename, join } from 'path';
|
|
22
|
+
import { fileURLToPath } from 'url';
|
|
22
23
|
import { execSync, spawn } from 'child_process';
|
|
23
24
|
import os from 'os';
|
|
24
25
|
import { Compiler } from '../compiler/compiler.js';
|
|
@@ -456,17 +457,27 @@ function cmdRun(filePath, flags, positional = []) {
|
|
|
456
457
|
}
|
|
457
458
|
}
|
|
458
459
|
|
|
459
|
-
function getPythonCommand() {
|
|
460
|
+
export function getPythonCommand() {
|
|
460
461
|
if (process.env.VIRTUAL_ENV) {
|
|
461
462
|
const venvWin = join(process.env.VIRTUAL_ENV, 'Scripts', 'python.exe');
|
|
462
463
|
const venvPosix = join(process.env.VIRTUAL_ENV, 'bin', 'python');
|
|
463
464
|
if (existsSync(venvWin)) return venvWin;
|
|
464
465
|
if (existsSync(venvPosix)) return venvPosix;
|
|
465
466
|
}
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
for (const venvDir of ['.venv', 'venv']) {
|
|
468
|
+
const localWin = join(process.cwd(), venvDir, 'Scripts', 'python.exe');
|
|
469
|
+
const localPosix = join(process.cwd(), venvDir, 'bin', 'python');
|
|
470
|
+
if (existsSync(localWin)) return localWin;
|
|
471
|
+
if (existsSync(localPosix)) return localPosix;
|
|
472
|
+
}
|
|
473
|
+
for (const cmd of ['python3', 'python']) {
|
|
474
|
+
try {
|
|
475
|
+
execSync(`${cmd} --version`, { stdio: 'ignore' });
|
|
476
|
+
return cmd;
|
|
477
|
+
} catch (e) {
|
|
478
|
+
// try next
|
|
479
|
+
}
|
|
480
|
+
}
|
|
470
481
|
return 'python';
|
|
471
482
|
}
|
|
472
483
|
|
|
@@ -577,4 +588,15 @@ function main() {
|
|
|
577
588
|
}
|
|
578
589
|
}
|
|
579
590
|
|
|
580
|
-
|
|
591
|
+
let isMain = false;
|
|
592
|
+
try {
|
|
593
|
+
if (process.argv[1]) {
|
|
594
|
+
const argPath = realpathSync(resolve(process.argv[1]));
|
|
595
|
+
const modPath = realpathSync(resolve(fileURLToPath(import.meta.url)));
|
|
596
|
+
isMain = argPath === modPath;
|
|
597
|
+
}
|
|
598
|
+
} catch (e) {}
|
|
599
|
+
|
|
600
|
+
if (isMain) {
|
|
601
|
+
main();
|
|
602
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openagentflow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "An open, portable specification for describing AI agent workflows using a human-readable text language.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "compiler/index.js",
|
|
@@ -37,6 +37,18 @@
|
|
|
37
37
|
"openagentflow"
|
|
38
38
|
],
|
|
39
39
|
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/OpenAgentFlow/OpenAgentFlow.git"
|
|
43
|
+
},
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/OpenAgentFlow/OpenAgentFlow/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/OpenAgentFlow/OpenAgentFlow#readme",
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public",
|
|
50
|
+
"provenance": true
|
|
51
|
+
},
|
|
40
52
|
"engines": {
|
|
41
53
|
"node": ">=18.0.0"
|
|
42
54
|
}
|