agent-valley 0.2.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/index.js +29041 -0
- package/dist/supervisor.js +62 -0
- package/package.json +42 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/supervisor.ts
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { appendFileSync } from "node:fs";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
var dashboardCwd = process.argv[2] ?? ".";
|
|
8
|
+
var port = process.argv[3] ?? "9741";
|
|
9
|
+
var mode = process.argv[4] ?? "start";
|
|
10
|
+
var logFile = resolve(process.cwd(), ".av.log");
|
|
11
|
+
var MAX_RESTARTS = 20;
|
|
12
|
+
var RESTART_DELAY = 3000;
|
|
13
|
+
var restarts = 0;
|
|
14
|
+
function log(msg) {
|
|
15
|
+
const line = `[${new Date().toISOString()}] [supervisor] ${msg}
|
|
16
|
+
`;
|
|
17
|
+
appendFileSync(logFile, line);
|
|
18
|
+
}
|
|
19
|
+
var currentProc = null;
|
|
20
|
+
function killCurrentProc() {
|
|
21
|
+
if (currentProc && currentProc.exitCode === null) {
|
|
22
|
+
try {
|
|
23
|
+
currentProc.kill("SIGKILL");
|
|
24
|
+
} catch {}
|
|
25
|
+
}
|
|
26
|
+
currentProc = null;
|
|
27
|
+
}
|
|
28
|
+
function startDashboard() {
|
|
29
|
+
killCurrentProc();
|
|
30
|
+
let proc;
|
|
31
|
+
if (mode === "start") {
|
|
32
|
+
proc = spawn("bun", ["next", "start", "-p", port], {
|
|
33
|
+
cwd: dashboardCwd,
|
|
34
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
35
|
+
env: { ...process.env, PORT: port, HOSTNAME: "0.0.0.0" }
|
|
36
|
+
});
|
|
37
|
+
log(`Dashboard started via next start (pid: ${proc.pid}, port: ${port})`);
|
|
38
|
+
} else {
|
|
39
|
+
proc = spawn("bun", ["next", "dev", "--turbopack", "-p", port], {
|
|
40
|
+
cwd: dashboardCwd,
|
|
41
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
42
|
+
env: { ...process.env, PORT: port, HOSTNAME: "0.0.0.0" }
|
|
43
|
+
});
|
|
44
|
+
log(`Dashboard started via next dev (pid: ${proc.pid}, port: ${port})`);
|
|
45
|
+
}
|
|
46
|
+
currentProc = proc;
|
|
47
|
+
proc.stdout?.on("data", (chunk) => appendFileSync(logFile, chunk));
|
|
48
|
+
proc.stderr?.on("data", (chunk) => appendFileSync(logFile, chunk));
|
|
49
|
+
proc.on("exit", (code, signal) => {
|
|
50
|
+
currentProc = null;
|
|
51
|
+
log(`Dashboard exited (code: ${code}, signal: ${signal})`);
|
|
52
|
+
restarts++;
|
|
53
|
+
if (restarts > MAX_RESTARTS) {
|
|
54
|
+
log(`Max restarts (${MAX_RESTARTS}) exceeded. Giving up.`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
log(`Restarting in ${RESTART_DELAY / 1000}s... (restart ${restarts}/${MAX_RESTARTS})`);
|
|
58
|
+
setTimeout(startDashboard, RESTART_DELAY);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
log(`Supervisor started — port ${port}, mode ${mode}, cwd ${dashboardCwd}`);
|
|
62
|
+
startDashboard();
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-valley",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "AI agent orchestrator — dispatch Linear issues to Claude, Codex, and Gemini agents in isolated git worktrees",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/first-fluke/agent-valley.git",
|
|
10
|
+
"directory": "apps/cli"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"ai",
|
|
14
|
+
"agent",
|
|
15
|
+
"orchestrator",
|
|
16
|
+
"linear",
|
|
17
|
+
"claude",
|
|
18
|
+
"codex",
|
|
19
|
+
"gemini",
|
|
20
|
+
"cli"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"av": "dist/index.js",
|
|
24
|
+
"agent-valley": "dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"av": "bun run src/index.ts",
|
|
31
|
+
"build": "bun run build.ts",
|
|
32
|
+
"prepublishOnly": "bun run build"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@agent-valley/core": "workspace:*",
|
|
36
|
+
"@clack/prompts": "^1.1.0",
|
|
37
|
+
"chokidar": "^5.0.0",
|
|
38
|
+
"commander": "^14.0.3",
|
|
39
|
+
"picocolors": "^1.1.1",
|
|
40
|
+
"yaml": "^2.8.3"
|
|
41
|
+
}
|
|
42
|
+
}
|