@locusai/cli 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. package/bin/locus.js +17 -4
  2. package/package.json +1 -1
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 dirname2, join as join6 } from "node:path";
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,16 @@ class AgentOrchestrator extends EventEmitter3 {
30637
30647
  this.agents.set(agentId, agentState);
30638
30648
  console.log(`\uD83D\uDE80 Agent started: ${agentId}
30639
30649
  `);
30650
+ const packageRoot = this.findPackageRoot(__dirname);
30640
30651
  const potentialPaths = [
30652
+ join4(packageRoot, "dist", "agent", "worker.js"),
30653
+ join4(packageRoot, "src", "agent", "worker.ts"),
30641
30654
  join4(__dirname, "agent", "worker.ts"),
30642
30655
  join4(__dirname, "agent", "worker.js")
30643
30656
  ];
30644
30657
  const workerPath = potentialPaths.find((p) => existsSync4(p));
30645
30658
  if (!workerPath) {
30646
- throw new Error(`Worker file not found. Checked: ${potentialPaths.join(", ")}. ` + `Make sure the SDK is properly built. __dirname: ${__dirname}`);
30659
+ throw new Error(`Worker file not found. Checked: ${potentialPaths.join(", ")}. ` + `Make sure the SDK is properly built. __dirname: ${__dirname}, Package Root: ${packageRoot}`);
30647
30660
  }
30648
30661
  const workerArgs = [
30649
30662
  "--agent-id",
@@ -30901,7 +30914,7 @@ ${tree}`;
30901
30914
  function getVersion() {
30902
30915
  try {
30903
30916
  const __filename2 = fileURLToPath2(import.meta.url);
30904
- const __dirname2 = dirname2(__filename2);
30917
+ const __dirname2 = dirname3(__filename2);
30905
30918
  const packagePath = join6(__dirname2, "..", "package.json");
30906
30919
  if (existsSync6(packagePath)) {
30907
30920
  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.1",
3
+ "version": "0.3.2",
4
4
  "description": "Local-first AI development platform & engineering workspace",
5
5
  "type": "module",
6
6
  "bin": {