@supaku/agentfactory-cli 0.6.3 → 0.7.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":"worker-fleet-runner.d.ts","sourceRoot":"","sources":["../../../src/lib/worker-fleet-runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AA6SD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAoBf"}
1
+ {"version":3,"file":"worker-fleet-runner.d.ts","sourceRoot":"","sources":["../../../src/lib/worker-fleet-runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAsTD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAoBf"}
@@ -5,6 +5,7 @@
5
5
  * Each worker runs as a separate OS process with its own resources.
6
6
  */
7
7
  import { spawn } from 'child_process';
8
+ import fs from 'fs';
8
9
  import os from 'os';
9
10
  import path from 'path';
10
11
  import { fileURLToPath } from 'url';
@@ -44,8 +45,13 @@ function fleetLog(workerId, color, level, message) {
44
45
  function getDefaultWorkerScript() {
45
46
  const __filename = fileURLToPath(import.meta.url);
46
47
  const __dirname = path.dirname(__filename);
47
- // Runner lives in lib/, worker.js is one level up
48
- return path.resolve(__dirname, '..', 'worker.js');
48
+ // Runner lives in lib/, worker entry is one level up.
49
+ // When running from compiled dist/ the .js file exists; when running from
50
+ // source via tsx only the .ts file exists.
51
+ const jsPath = path.resolve(__dirname, '..', 'worker.js');
52
+ if (fs.existsSync(jsPath))
53
+ return jsPath;
54
+ return path.resolve(__dirname, '..', 'worker.ts');
49
55
  }
50
56
  // ---------------------------------------------------------------------------
51
57
  // WorkerFleet class (internal)
@@ -112,19 +118,16 @@ ${colors.cyan}================================================================${
112
118
  const existingWorker = this.workers.get(id);
113
119
  const restartCount = existingWorker?.restartCount ?? 0;
114
120
  fleetLog(id, color, 'INF', `Starting worker (capacity: ${this.fleetConfig.capacity})${restartCount > 0 ? ` [restart #${restartCount}]` : ''}`);
115
- const workerArgs = [
116
- this.workerScript,
117
- '--capacity',
118
- String(this.fleetConfig.capacity),
119
- '--api-url',
120
- this.fleetConfig.apiUrl,
121
- '--api-key',
122
- this.fleetConfig.apiKey,
123
- ];
121
+ const nodeArgs = [];
122
+ // When running a .ts worker script, register tsx so Node can load it
123
+ if (this.workerScript.endsWith('.ts')) {
124
+ nodeArgs.push('--import', 'tsx');
125
+ }
126
+ nodeArgs.push(this.workerScript, '--capacity', String(this.fleetConfig.capacity), '--api-url', this.fleetConfig.apiUrl, '--api-key', this.fleetConfig.apiKey);
124
127
  if (this.fleetConfig.projects?.length) {
125
- workerArgs.push('--projects', this.fleetConfig.projects.join(','));
128
+ nodeArgs.push('--projects', this.fleetConfig.projects.join(','));
126
129
  }
127
- const workerProcess = spawn('node', workerArgs, {
130
+ const workerProcess = spawn('node', nodeArgs, {
128
131
  stdio: ['ignore', 'pipe', 'pipe'],
129
132
  env: {
130
133
  ...process.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supaku/agentfactory-cli",
3
- "version": "0.6.3",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "description": "CLI tools for AgentFactory — local orchestrator, remote worker, queue admin",
6
6
  "author": "Supaku (https://supaku.com)",
@@ -82,9 +82,9 @@
82
82
  ],
83
83
  "dependencies": {
84
84
  "dotenv": "^17.2.3",
85
- "@supaku/agentfactory": "0.6.3",
86
- "@supaku/agentfactory-server": "0.6.3",
87
- "@supaku/agentfactory-linear": "0.6.3"
85
+ "@supaku/agentfactory": "0.7.1",
86
+ "@supaku/agentfactory-server": "0.7.1",
87
+ "@supaku/agentfactory-linear": "0.7.1"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@types/node": "^22.5.4",