agent-dag 1.0.2 → 1.0.3
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/bin/{ccgraph.js → agent-dag.js} +7 -7
- package/dist/web/assets/{index-BbbosdE2.css → index-oVfhlSKU.css} +1 -1
- package/dist/web/assets/{index-BgTeq5uZ.js → index-tk_6Nfei.js} +1 -1
- package/dist/web/index.html +2 -2
- package/hook/hook.js +5 -5
- package/package.json +3 -3
- package/src/server/index.mjs +5 -5
- package/src/server/installer.mjs +8 -8
package/dist/web/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>agent-dag</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='84' font-size='84'%3E%E2%97%89%3C/text%3E%3C/svg%3E" />
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-tk_6Nfei.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-oVfhlSKU.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
package/hook/hook.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//
|
|
3
|
-
// It reads stdin (CC event JSON), finds the matching
|
|
4
|
-
// per-workspace discovery files in ~/.claude/
|
|
2
|
+
// agent-dag hook forwarder. Claude Code invokes this as a command hook.
|
|
3
|
+
// It reads stdin (CC event JSON), finds the matching agent-dag server via
|
|
4
|
+
// per-workspace discovery files in ~/.claude/agent-dag/, and forwards the
|
|
5
5
|
// payload to it via HTTP POST. Dead instances are cleaned up.
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ const os = require("os");
|
|
|
13
13
|
// Hard cap so a stuck server can never wedge Claude Code.
|
|
14
14
|
setTimeout(() => process.exit(0), 1500);
|
|
15
15
|
|
|
16
|
-
const DIR = path.join(os.homedir(), ".claude", "
|
|
16
|
+
const DIR = path.join(os.homedir(), ".claude", "agent-dag");
|
|
17
17
|
const IS_WIN = process.platform === "win32";
|
|
18
18
|
|
|
19
19
|
function normPath(p) {
|
|
@@ -56,7 +56,7 @@ process.stdin.on("end", () => {
|
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// Empty workspace = match-all (used by `
|
|
59
|
+
// Empty workspace = match-all (used by `agent-dag --all`).
|
|
60
60
|
if (d.workspace === "") {
|
|
61
61
|
matches.push({ d, wsLen: 0 });
|
|
62
62
|
continue;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-dag",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Live DAG of Claude Code agents — watch parallel subagents fork, call tools, and return on one calm canvas.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"agent-dag": "bin/
|
|
7
|
+
"agent-dag": "bin/agent-dag.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dev:web": "vite",
|
|
19
19
|
"build:web": "vite build",
|
|
20
20
|
"dev:server": "node src/server/index.mjs",
|
|
21
|
-
"start": "node bin/
|
|
21
|
+
"start": "node bin/agent-dag.js",
|
|
22
22
|
"build": "vite build",
|
|
23
23
|
"prepublishOnly": "vite build"
|
|
24
24
|
},
|
package/src/server/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// agent-dag server: HTTP ingest + SSE broadcast + static file serving.
|
|
2
2
|
// Single-file pure Node HTTP server, zero deps.
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
import { readFile, stat, mkdir, appendFile, open, truncate, readdir, unlink } from "node:fs/promises";
|
|
@@ -160,7 +160,7 @@ function handleSse(req, res) {
|
|
|
160
160
|
function handleHealth(_req, res) {
|
|
161
161
|
send(res, 200, {
|
|
162
162
|
ok: true,
|
|
163
|
-
name: "
|
|
163
|
+
name: "agent-dag",
|
|
164
164
|
seq: nextSeq - 1,
|
|
165
165
|
clients: sseClients.size,
|
|
166
166
|
uptimeMs: Math.round(process.uptime() * 1000),
|
|
@@ -173,7 +173,7 @@ function isProcessAlive(pid) {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
async function sweepStaleDiscovery() {
|
|
176
|
-
const dir = join(homedir(), ".claude", "
|
|
176
|
+
const dir = join(homedir(), ".claude", "agent-dag");
|
|
177
177
|
let files;
|
|
178
178
|
try { files = await readdir(dir); } catch { return 0; }
|
|
179
179
|
let removed = 0;
|
|
@@ -263,9 +263,9 @@ if (import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
|
263
263
|
startServer({ port }).then(s => {
|
|
264
264
|
const addr = s.address();
|
|
265
265
|
const p = typeof addr === "object" && addr ? addr.port : port;
|
|
266
|
-
console.log(`
|
|
266
|
+
console.log(`agent-dag server: http://127.0.0.1:${p}`);
|
|
267
267
|
}).catch(e => {
|
|
268
|
-
console.error("
|
|
268
|
+
console.error("agent-dag server failed:", e.message);
|
|
269
269
|
process.exit(1);
|
|
270
270
|
});
|
|
271
271
|
}
|
package/src/server/installer.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Idempotent hook installer for ~/.claude/settings.json.
|
|
2
2
|
// Adds a single command-hook entry per CC hook event pointing at our forwarder.
|
|
3
|
-
// Re-runs are safe (entries are tagged with
|
|
3
|
+
// Re-runs are safe (entries are tagged with __agent-dag and de-duped).
|
|
4
4
|
import { readFile, writeFile, mkdir, copyFile, unlink } from "node:fs/promises";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { homedir, platform } from "node:os";
|
|
@@ -13,7 +13,7 @@ const PKG_ROOT = resolve(__dirname, "..", "..");
|
|
|
13
13
|
const HOME = homedir();
|
|
14
14
|
const CLAUDE_DIR = join(HOME, ".claude");
|
|
15
15
|
const SETTINGS = join(CLAUDE_DIR, "settings.json");
|
|
16
|
-
const
|
|
16
|
+
const AGENT_DAG_DIR = join(CLAUDE_DIR, "agent-dag");
|
|
17
17
|
|
|
18
18
|
export const HOOK_EVENTS = [
|
|
19
19
|
"SessionStart",
|
|
@@ -28,7 +28,7 @@ export const HOOK_EVENTS = [
|
|
|
28
28
|
"Notification",
|
|
29
29
|
];
|
|
30
30
|
|
|
31
|
-
const MARK_KEY = "
|
|
31
|
+
const MARK_KEY = "__agent-dag";
|
|
32
32
|
|
|
33
33
|
function hookCommand(installedHookPath) {
|
|
34
34
|
// process.execPath = absolute path to current node (works on Win + *nix).
|
|
@@ -45,9 +45,9 @@ async function readJsonSafe(p) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
async function installHookScript() {
|
|
48
|
-
await ensureDir(
|
|
48
|
+
await ensureDir(AGENT_DAG_DIR);
|
|
49
49
|
const src = join(PKG_ROOT, "hook", "hook.js");
|
|
50
|
-
const dst = join(
|
|
50
|
+
const dst = join(AGENT_DAG_DIR, "hook.js");
|
|
51
51
|
await copyFile(src, dst);
|
|
52
52
|
return dst;
|
|
53
53
|
}
|
|
@@ -97,8 +97,8 @@ export async function uninstallHooks() {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export async function writeDiscovery({ port, workspace }) {
|
|
100
|
-
await ensureDir(
|
|
101
|
-
const file = join(
|
|
100
|
+
await ensureDir(AGENT_DAG_DIR);
|
|
101
|
+
const file = join(AGENT_DAG_DIR, `${process.pid}.json`);
|
|
102
102
|
const data = {
|
|
103
103
|
pid: process.pid,
|
|
104
104
|
port,
|
|
@@ -113,4 +113,4 @@ export async function removeDiscovery(file) {
|
|
|
113
113
|
try { await unlink(file); } catch {}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export {
|
|
116
|
+
export { AGENT_DAG_DIR, SETTINGS };
|