@supaku/agentfactory-cli 0.4.8 → 0.5.0
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/dist/src/lib/worker-fleet-runner.d.ts +2 -0
- package/dist/src/lib/worker-fleet-runner.d.ts.map +1 -1
- package/dist/src/lib/worker-fleet-runner.js +8 -2
- package/dist/src/lib/worker-runner.d.ts +2 -0
- package/dist/src/lib/worker-runner.d.ts.map +1 -1
- package/dist/src/lib/worker-runner.js +2 -0
- package/dist/src/worker-fleet.d.ts +2 -0
- package/dist/src/worker-fleet.d.ts.map +1 -1
- package/dist/src/worker-fleet.js +15 -2
- package/dist/src/worker.d.ts +2 -0
- package/dist/src/worker.d.ts.map +1 -1
- package/dist/src/worker.js +12 -0
- package/package.json +4 -4
|
@@ -17,6 +17,8 @@ export interface FleetRunnerConfig {
|
|
|
17
17
|
apiKey: string;
|
|
18
18
|
/** Path to the worker script/binary (default: auto-detect from this package) */
|
|
19
19
|
workerScript?: string;
|
|
20
|
+
/** Linear project names for workers to accept (undefined = all) */
|
|
21
|
+
projects?: string[];
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Run a fleet of worker processes.
|
|
@@ -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;
|
|
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"}
|
|
@@ -70,6 +70,7 @@ ${colors.cyan}================================================================${
|
|
|
70
70
|
Workers: ${colors.green}${workers}${colors.reset}
|
|
71
71
|
Capacity/Worker: ${colors.green}${capacity}${colors.reset}
|
|
72
72
|
Total Capacity: ${colors.green}${totalCapacity}${colors.reset} concurrent agents
|
|
73
|
+
Projects: ${colors.green}${this.fleetConfig.projects?.length ? this.fleetConfig.projects.join(', ') : 'all'}${colors.reset}
|
|
73
74
|
|
|
74
75
|
System:
|
|
75
76
|
CPU Cores: ${os.cpus().length}
|
|
@@ -111,7 +112,7 @@ ${colors.cyan}================================================================${
|
|
|
111
112
|
const existingWorker = this.workers.get(id);
|
|
112
113
|
const restartCount = existingWorker?.restartCount ?? 0;
|
|
113
114
|
fleetLog(id, color, 'INF', `Starting worker (capacity: ${this.fleetConfig.capacity})${restartCount > 0 ? ` [restart #${restartCount}]` : ''}`);
|
|
114
|
-
const
|
|
115
|
+
const workerArgs = [
|
|
115
116
|
this.workerScript,
|
|
116
117
|
'--capacity',
|
|
117
118
|
String(this.fleetConfig.capacity),
|
|
@@ -119,7 +120,11 @@ ${colors.cyan}================================================================${
|
|
|
119
120
|
this.fleetConfig.apiUrl,
|
|
120
121
|
'--api-key',
|
|
121
122
|
this.fleetConfig.apiKey,
|
|
122
|
-
]
|
|
123
|
+
];
|
|
124
|
+
if (this.fleetConfig.projects?.length) {
|
|
125
|
+
workerArgs.push('--projects', this.fleetConfig.projects.join(','));
|
|
126
|
+
}
|
|
127
|
+
const workerProcess = spawn('node', workerArgs, {
|
|
123
128
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
124
129
|
env: {
|
|
125
130
|
...process.env,
|
|
@@ -219,6 +224,7 @@ export async function runWorkerFleet(config, signal) {
|
|
|
219
224
|
dryRun,
|
|
220
225
|
apiUrl: config.apiUrl,
|
|
221
226
|
apiKey: config.apiKey,
|
|
227
|
+
projects: config.projects?.length ? config.projects : undefined,
|
|
222
228
|
}, workerScript);
|
|
223
229
|
await fleet.start(signal);
|
|
224
230
|
}
|
|
@@ -20,6 +20,8 @@ export interface WorkerRunnerConfig {
|
|
|
20
20
|
linearApiKey?: string;
|
|
21
21
|
/** Git repository root (default: auto-detect) */
|
|
22
22
|
gitRoot?: string;
|
|
23
|
+
/** Linear project names to accept (undefined = all) */
|
|
24
|
+
projects?: string[];
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* Run a worker that polls the coordinator for work and executes agents.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-runner.d.ts","sourceRoot":"","sources":["../../../src/lib/worker-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"worker-runner.d.ts","sourceRoot":"","sources":["../../../src/lib/worker-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAwED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAg4Bf"}
|
|
@@ -143,6 +143,7 @@ export async function runWorker(config, signal) {
|
|
|
143
143
|
hostname: workerConfig.hostname,
|
|
144
144
|
capacity: workerConfig.capacity,
|
|
145
145
|
version: '1.0.0',
|
|
146
|
+
projects: config.projects,
|
|
146
147
|
}),
|
|
147
148
|
});
|
|
148
149
|
if (result) {
|
|
@@ -593,6 +594,7 @@ export async function runWorker(config, signal) {
|
|
|
593
594
|
hostname: workerConfig.hostname,
|
|
594
595
|
capacity: workerConfig.capacity,
|
|
595
596
|
dryRun: workerConfig.dryRun,
|
|
597
|
+
projects: config.projects?.length ? config.projects : 'all',
|
|
596
598
|
});
|
|
597
599
|
// Register with coordinator
|
|
598
600
|
const registration = await register();
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
* Options:
|
|
12
12
|
* -w, --workers <n> Number of worker processes (default: CPU cores / 2)
|
|
13
13
|
* -c, --capacity <n> Agents per worker (default: 3)
|
|
14
|
+
* -p, --projects <l> Comma-separated project names to accept (default: all)
|
|
14
15
|
* --dry-run Show configuration without starting workers
|
|
15
16
|
*
|
|
16
17
|
* Environment (loaded from .env.local in CWD):
|
|
17
18
|
* WORKER_FLEET_SIZE Number of workers (override)
|
|
18
19
|
* WORKER_CAPACITY Agents per worker (override)
|
|
20
|
+
* WORKER_PROJECTS Comma-separated project names to accept
|
|
19
21
|
* WORKER_API_URL Coordinator API URL (required)
|
|
20
22
|
* WORKER_API_KEY API key for authentication (required)
|
|
21
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-fleet.d.ts","sourceRoot":"","sources":["../../src/worker-fleet.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"worker-fleet.d.ts","sourceRoot":"","sources":["../../src/worker-fleet.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
|
package/dist/src/worker-fleet.js
CHANGED
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
* Options:
|
|
12
12
|
* -w, --workers <n> Number of worker processes (default: CPU cores / 2)
|
|
13
13
|
* -c, --capacity <n> Agents per worker (default: 3)
|
|
14
|
+
* -p, --projects <l> Comma-separated project names to accept (default: all)
|
|
14
15
|
* --dry-run Show configuration without starting workers
|
|
15
16
|
*
|
|
16
17
|
* Environment (loaded from .env.local in CWD):
|
|
17
18
|
* WORKER_FLEET_SIZE Number of workers (override)
|
|
18
19
|
* WORKER_CAPACITY Agents per worker (override)
|
|
20
|
+
* WORKER_PROJECTS Comma-separated project names to accept
|
|
19
21
|
* WORKER_API_URL Coordinator API URL (required)
|
|
20
22
|
* WORKER_API_KEY API key for authentication (required)
|
|
21
23
|
*/
|
|
@@ -39,6 +41,7 @@ function parseArgs() {
|
|
|
39
41
|
Math.max(1, Math.floor(os.cpus().length / 2));
|
|
40
42
|
let capacity = parseInt(process.env.WORKER_CAPACITY ?? '3', 10);
|
|
41
43
|
let dryRun = false;
|
|
44
|
+
let projects;
|
|
42
45
|
for (let i = 0; i < args.length; i++) {
|
|
43
46
|
if (args[i] === '--workers' || args[i] === '-w') {
|
|
44
47
|
workers = parseInt(args[++i], 10);
|
|
@@ -46,6 +49,9 @@ function parseArgs() {
|
|
|
46
49
|
else if (args[i] === '--capacity' || args[i] === '-c') {
|
|
47
50
|
capacity = parseInt(args[++i], 10);
|
|
48
51
|
}
|
|
52
|
+
else if (args[i] === '--projects' || args[i] === '-p') {
|
|
53
|
+
projects = args[++i].split(',').map(s => s.trim()).filter(Boolean);
|
|
54
|
+
}
|
|
49
55
|
else if (args[i] === '--dry-run') {
|
|
50
56
|
dryRun = true;
|
|
51
57
|
}
|
|
@@ -54,7 +60,7 @@ function parseArgs() {
|
|
|
54
60
|
process.exit(0);
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
|
-
return { workers, capacity, dryRun };
|
|
63
|
+
return { workers, capacity, dryRun, projects };
|
|
58
64
|
}
|
|
59
65
|
function printHelp() {
|
|
60
66
|
console.log(`
|
|
@@ -67,17 +73,19 @@ ${colors.yellow}Usage:${colors.reset}
|
|
|
67
73
|
${colors.yellow}Options:${colors.reset}
|
|
68
74
|
-w, --workers <n> Number of worker processes (default: CPU cores / 2)
|
|
69
75
|
-c, --capacity <n> Agents per worker (default: 3)
|
|
76
|
+
-p, --projects <l> Comma-separated project names to accept (default: all)
|
|
70
77
|
--dry-run Show configuration without starting workers
|
|
71
78
|
-h, --help Show this help message
|
|
72
79
|
|
|
73
80
|
${colors.yellow}Examples:${colors.reset}
|
|
74
81
|
af-worker-fleet # Auto-detect optimal settings
|
|
75
82
|
af-worker-fleet -w 8 -c 5 # 8 workers x 5 agents = 40 concurrent
|
|
76
|
-
af-worker-fleet
|
|
83
|
+
af-worker-fleet -p Social,Agent # Only accept Social and Agent projects
|
|
77
84
|
|
|
78
85
|
${colors.yellow}Environment (loaded from .env.local in CWD):${colors.reset}
|
|
79
86
|
WORKER_FLEET_SIZE Override number of workers
|
|
80
87
|
WORKER_CAPACITY Override agents per worker
|
|
88
|
+
WORKER_PROJECTS Comma-separated project names to accept
|
|
81
89
|
WORKER_API_URL API endpoint (required)
|
|
82
90
|
WORKER_API_KEY API key for authentication (required)
|
|
83
91
|
|
|
@@ -101,12 +109,17 @@ if (!process.env.WORKER_API_KEY) {
|
|
|
101
109
|
const controller = new AbortController();
|
|
102
110
|
process.on('SIGINT', () => controller.abort());
|
|
103
111
|
process.on('SIGTERM', () => controller.abort());
|
|
112
|
+
const projects = fleetArgs.projects ??
|
|
113
|
+
(process.env.WORKER_PROJECTS
|
|
114
|
+
? process.env.WORKER_PROJECTS.split(',').map(s => s.trim()).filter(Boolean)
|
|
115
|
+
: undefined);
|
|
104
116
|
runWorkerFleet({
|
|
105
117
|
workers: fleetArgs.workers,
|
|
106
118
|
capacity: fleetArgs.capacity,
|
|
107
119
|
dryRun: fleetArgs.dryRun,
|
|
108
120
|
apiUrl: process.env.WORKER_API_URL,
|
|
109
121
|
apiKey: process.env.WORKER_API_KEY,
|
|
122
|
+
projects,
|
|
110
123
|
}, controller.signal)
|
|
111
124
|
.then(() => {
|
|
112
125
|
process.exit(0);
|
package/dist/src/worker.d.ts
CHANGED
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
* --hostname <name> Worker hostname (default: os.hostname())
|
|
14
14
|
* --api-url <url> Coordinator API URL (default: WORKER_API_URL env)
|
|
15
15
|
* --api-key <key> API key (default: WORKER_API_KEY env)
|
|
16
|
+
* --projects <list> Comma-separated project names to accept (default: all)
|
|
16
17
|
* --dry-run Poll but don't execute work
|
|
17
18
|
*
|
|
18
19
|
* Environment (loaded from .env.local in CWD):
|
|
19
20
|
* WORKER_API_URL Coordinator API URL (e.g., https://agent.example.com)
|
|
20
21
|
* WORKER_API_KEY API key for authentication
|
|
22
|
+
* WORKER_PROJECTS Comma-separated project names to accept (e.g., Social,Agent)
|
|
21
23
|
* LINEAR_API_KEY Required for agent operations
|
|
22
24
|
*/
|
|
23
25
|
export {};
|
package/dist/src/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/worker.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/worker.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
package/dist/src/worker.js
CHANGED
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
* --hostname <name> Worker hostname (default: os.hostname())
|
|
14
14
|
* --api-url <url> Coordinator API URL (default: WORKER_API_URL env)
|
|
15
15
|
* --api-key <key> API key (default: WORKER_API_KEY env)
|
|
16
|
+
* --projects <list> Comma-separated project names to accept (default: all)
|
|
16
17
|
* --dry-run Poll but don't execute work
|
|
17
18
|
*
|
|
18
19
|
* Environment (loaded from .env.local in CWD):
|
|
19
20
|
* WORKER_API_URL Coordinator API URL (e.g., https://agent.example.com)
|
|
20
21
|
* WORKER_API_KEY API key for authentication
|
|
22
|
+
* WORKER_PROJECTS Comma-separated project names to accept (e.g., Social,Agent)
|
|
21
23
|
* LINEAR_API_KEY Required for agent operations
|
|
22
24
|
*/
|
|
23
25
|
import path from 'path';
|
|
@@ -53,6 +55,9 @@ function parseArgs() {
|
|
|
53
55
|
case '--dry-run':
|
|
54
56
|
parsed.dryRun = true;
|
|
55
57
|
break;
|
|
58
|
+
case '--projects':
|
|
59
|
+
parsed.projects = args[++i].split(',').map(s => s.trim()).filter(Boolean);
|
|
60
|
+
break;
|
|
56
61
|
case '--help':
|
|
57
62
|
case '-h':
|
|
58
63
|
printHelp();
|
|
@@ -73,12 +78,14 @@ Options:
|
|
|
73
78
|
--hostname <name> Worker hostname (default: ${os.hostname()})
|
|
74
79
|
--api-url <url> Coordinator API URL
|
|
75
80
|
--api-key <key> API key for authentication
|
|
81
|
+
--projects <list> Comma-separated project names to accept (default: all)
|
|
76
82
|
--dry-run Poll but don't execute work
|
|
77
83
|
--help, -h Show this help message
|
|
78
84
|
|
|
79
85
|
Environment (loaded from .env.local in CWD):
|
|
80
86
|
WORKER_API_URL Coordinator API URL
|
|
81
87
|
WORKER_API_KEY API key for authentication
|
|
88
|
+
WORKER_PROJECTS Comma-separated project names to accept
|
|
82
89
|
LINEAR_API_KEY Required for agent operations
|
|
83
90
|
|
|
84
91
|
Examples:
|
|
@@ -106,6 +113,10 @@ if (!process.env.LINEAR_API_KEY) {
|
|
|
106
113
|
const controller = new AbortController();
|
|
107
114
|
process.on('SIGINT', () => controller.abort());
|
|
108
115
|
process.on('SIGTERM', () => controller.abort());
|
|
116
|
+
const projects = cliArgs.projects ??
|
|
117
|
+
(process.env.WORKER_PROJECTS
|
|
118
|
+
? process.env.WORKER_PROJECTS.split(',').map(s => s.trim()).filter(Boolean)
|
|
119
|
+
: undefined);
|
|
109
120
|
runWorker({
|
|
110
121
|
apiUrl: cliArgs.apiUrl,
|
|
111
122
|
apiKey: cliArgs.apiKey,
|
|
@@ -113,6 +124,7 @@ runWorker({
|
|
|
113
124
|
capacity: cliArgs.capacity,
|
|
114
125
|
dryRun: cliArgs.dryRun,
|
|
115
126
|
linearApiKey: process.env.LINEAR_API_KEY,
|
|
127
|
+
projects,
|
|
116
128
|
}, controller.signal)
|
|
117
129
|
.then(() => {
|
|
118
130
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supaku/agentfactory-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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.
|
|
86
|
-
"@supaku/agentfactory-
|
|
87
|
-
"@supaku/agentfactory-
|
|
85
|
+
"@supaku/agentfactory": "0.5.0",
|
|
86
|
+
"@supaku/agentfactory-server": "0.5.0",
|
|
87
|
+
"@supaku/agentfactory-linear": "0.5.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@types/node": "^22.5.4",
|