@locusai/sdk 0.2.2 → 0.3.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,IAAI,EAA4B,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACpD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC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OAAO,CAAC,IAAI,CAAC;IAM3B;;OAEG;YACW,OAAO;IAWrB;;OAEG;IACH,QAAQ;;;;;;IAeR,OAAO,CAAC,KAAK;CAGd"}
@@ -116,10 +116,14 @@ export class AgentOrchestrator extends EventEmitter {
116
116
  console.log(`🚀 Agent started: ${agentId}\n`);
117
117
  // Build arguments for agent worker
118
118
  // Resolve path relative to this file's location (works in both dev and production)
119
- const workerPath = join(__dirname, "agent", "worker.js");
119
+ const potentialPaths = [
120
+ join(__dirname, "agent", "worker.ts"), // Try TS source first (dev)
121
+ join(__dirname, "agent", "worker.js"), // Fallback to JS (prod/dist)
122
+ ];
123
+ const workerPath = potentialPaths.find((p) => existsSync(p));
120
124
  // Verify worker file exists
121
- if (!existsSync(workerPath)) {
122
- throw new Error(`Worker file not found at ${workerPath}. ` +
125
+ if (!workerPath) {
126
+ throw new Error(`Worker file not found. Checked: ${potentialPaths.join(", ")}. ` +
123
127
  `Make sure the SDK is properly built. __dirname: ${__dirname}`);
124
128
  }
125
129
  const workerArgs = [
@@ -146,9 +150,8 @@ export class AgentOrchestrator extends EventEmitter {
146
150
  if (this.resolvedSprintId) {
147
151
  workerArgs.push("--sprint-id", this.resolvedSprintId);
148
152
  }
149
- // Use bun to run TypeScript files directly
150
- const workerTsPath = workerPath.replace(/\.js$/, ".ts");
151
- const agentProcess = spawn("bun", ["run", workerTsPath, ...workerArgs]);
153
+ // Use bun to run the worker script
154
+ const agentProcess = spawn("bun", ["run", workerPath, ...workerArgs]);
152
155
  agentState.process = agentProcess;
153
156
  agentProcess.on("message", (msg) => {
154
157
  if (msg.type === "stats") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/sdk",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -164,12 +164,17 @@ export class AgentOrchestrator extends EventEmitter {
164
164
 
165
165
  // Build arguments for agent worker
166
166
  // Resolve path relative to this file's location (works in both dev and production)
167
- const workerPath = join(__dirname, "agent", "worker.js");
167
+ const potentialPaths = [
168
+ join(__dirname, "agent", "worker.ts"), // Try TS source first (dev)
169
+ join(__dirname, "agent", "worker.js"), // Fallback to JS (prod/dist)
170
+ ];
171
+
172
+ const workerPath = potentialPaths.find((p) => existsSync(p));
168
173
 
169
174
  // Verify worker file exists
170
- if (!existsSync(workerPath)) {
175
+ if (!workerPath) {
171
176
  throw new Error(
172
- `Worker file not found at ${workerPath}. ` +
177
+ `Worker file not found. Checked: ${potentialPaths.join(", ")}. ` +
173
178
  `Make sure the SDK is properly built. __dirname: ${__dirname}`
174
179
  );
175
180
  }
@@ -202,9 +207,8 @@ export class AgentOrchestrator extends EventEmitter {
202
207
  workerArgs.push("--sprint-id", this.resolvedSprintId);
203
208
  }
204
209
 
205
- // Use bun to run TypeScript files directly
206
- const workerTsPath = workerPath.replace(/\.js$/, ".ts");
207
- const agentProcess = spawn("bun", ["run", workerTsPath, ...workerArgs]);
210
+ // Use bun to run the worker script
211
+ const agentProcess = spawn("bun", ["run", workerPath, ...workerArgs]);
208
212
 
209
213
  agentState.process = agentProcess;
210
214