@locusai/cli 0.3.1 → 0.3.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/bin/locus.js +23 -8
- package/package.json +5 -4
package/bin/locus.js
CHANGED
|
@@ -17026,7 +17026,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
17026
17026
|
|
|
17027
17027
|
// src/cli.ts
|
|
17028
17028
|
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
|
|
17029
|
-
import { dirname as
|
|
17029
|
+
import { dirname as dirname3, join as join6 } from "node:path";
|
|
17030
17030
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
17031
17031
|
import { parseArgs } from "node:util";
|
|
17032
17032
|
|
|
@@ -30543,7 +30543,7 @@ if (process.argv[1]?.includes("agent-worker") || process.argv[1]?.includes("work
|
|
|
30543
30543
|
// ../sdk/src/orchestrator.ts
|
|
30544
30544
|
import { spawn as spawn2 } from "node:child_process";
|
|
30545
30545
|
import { existsSync as existsSync4 } from "node:fs";
|
|
30546
|
-
import { join as join4 } from "node:path";
|
|
30546
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
30547
30547
|
import { EventEmitter as EventEmitter3 } from "events";
|
|
30548
30548
|
var __dirname = "/home/runner/work/locusai/locusai/packages/sdk/src";
|
|
30549
30549
|
|
|
@@ -30624,6 +30624,16 @@ class AgentOrchestrator extends EventEmitter3 {
|
|
|
30624
30624
|
console.log(`
|
|
30625
30625
|
✅ Orchestrator finished`);
|
|
30626
30626
|
}
|
|
30627
|
+
findPackageRoot(startPath) {
|
|
30628
|
+
let currentDir = startPath;
|
|
30629
|
+
while (currentDir !== "/") {
|
|
30630
|
+
if (existsSync4(join4(currentDir, "package.json"))) {
|
|
30631
|
+
return currentDir;
|
|
30632
|
+
}
|
|
30633
|
+
currentDir = dirname2(currentDir);
|
|
30634
|
+
}
|
|
30635
|
+
return startPath;
|
|
30636
|
+
}
|
|
30627
30637
|
async spawnAgent() {
|
|
30628
30638
|
const agentId = `agent-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
30629
30639
|
const agentState = {
|
|
@@ -30637,13 +30647,18 @@ class AgentOrchestrator extends EventEmitter3 {
|
|
|
30637
30647
|
this.agents.set(agentId, agentState);
|
|
30638
30648
|
console.log(`\uD83D\uDE80 Agent started: ${agentId}
|
|
30639
30649
|
`);
|
|
30640
|
-
const potentialPaths = [
|
|
30641
|
-
|
|
30642
|
-
|
|
30643
|
-
|
|
30650
|
+
const potentialPaths = [];
|
|
30651
|
+
try {
|
|
30652
|
+
const sdkIndexPath = import.meta.resolve("@locusai/sdk");
|
|
30653
|
+
const sdkDir = dirname2(sdkIndexPath.replace("file://", ""));
|
|
30654
|
+
const sdkRoot = this.findPackageRoot(sdkDir);
|
|
30655
|
+
potentialPaths.push(join4(sdkRoot, "dist", "agent", "worker.js"), join4(sdkRoot, "src", "agent", "worker.ts"));
|
|
30656
|
+
} catch {}
|
|
30657
|
+
const packageRoot = this.findPackageRoot(__dirname);
|
|
30658
|
+
potentialPaths.push(join4(packageRoot, "dist", "agent", "worker.js"), join4(packageRoot, "src", "agent", "worker.ts"), join4(__dirname, "agent", "worker.ts"), join4(__dirname, "agent", "worker.js"));
|
|
30644
30659
|
const workerPath = potentialPaths.find((p) => existsSync4(p));
|
|
30645
30660
|
if (!workerPath) {
|
|
30646
|
-
throw new Error(`Worker file not found. Checked: ${potentialPaths.join(", ")}. ` + `Make sure the SDK is properly built
|
|
30661
|
+
throw new Error(`Worker file not found. Checked: ${potentialPaths.join(", ")}. ` + `Make sure the SDK is properly built and installed.`);
|
|
30647
30662
|
}
|
|
30648
30663
|
const workerArgs = [
|
|
30649
30664
|
"--agent-id",
|
|
@@ -30901,7 +30916,7 @@ ${tree}`;
|
|
|
30901
30916
|
function getVersion() {
|
|
30902
30917
|
try {
|
|
30903
30918
|
const __filename2 = fileURLToPath2(import.meta.url);
|
|
30904
|
-
const __dirname2 =
|
|
30919
|
+
const __dirname2 = dirname3(__filename2);
|
|
30905
30920
|
const packagePath = join6(__dirname2, "..", "package.json");
|
|
30906
30921
|
if (existsSync6(packagePath)) {
|
|
30907
30922
|
const pkg = JSON.parse(readFileSync5(packagePath, "utf-8"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locusai/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Local-first AI development platform & engineering workspace",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
],
|
|
31
31
|
"author": "",
|
|
32
32
|
"license": "MIT",
|
|
33
|
-
"
|
|
34
|
-
"@locusai/sdk": "
|
|
35
|
-
}
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@locusai/sdk": "^0.3.3"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {}
|
|
36
37
|
}
|