agent-dag 1.0.4 → 1.0.6

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.
@@ -5,7 +5,7 @@
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-CE9bBmyB.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DQXwB1Xy.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-oVfhlSKU.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-dag",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
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": {
@@ -29,6 +29,12 @@ export const HOOK_EVENTS = [
29
29
  ];
30
30
 
31
31
  const MARK_KEY = "__agent-dag";
32
+ // Legacy marks from earlier names — purged on every install/uninstall so
33
+ // duplicate forwarders don't pile up when the project gets renamed.
34
+ const LEGACY_MARKS = ["__ccgraph", "__agent-flow"];
35
+ // ~/.claude/<name>/hook.js paths used by old releases. Any unmarked entry
36
+ // pointing into one of these is recognised as ours and removed.
37
+ const LEGACY_DIRS = ["ccgraph", "agent-flow", "agent-dag"];
32
38
 
33
39
  function hookCommand(installedHookPath) {
34
40
  // process.execPath = absolute path to current node (works on Win + *nix).
@@ -36,6 +42,21 @@ function hookCommand(installedHookPath) {
36
42
  return `"${node}" "${installedHookPath}"`;
37
43
  }
38
44
 
45
+ function isOurEntry(g) {
46
+ if (!g || typeof g !== "object") return false;
47
+ if (g[MARK_KEY] === true) return true;
48
+ for (const k of LEGACY_MARKS) if (g[k] === true) return true;
49
+ // Heuristic: command points at ~/.claude/<legacy-dir>/hook.js.
50
+ const cmds = Array.isArray(g.hooks) ? g.hooks : [];
51
+ for (const h of cmds) {
52
+ const c = typeof h?.command === "string" ? h.command : "";
53
+ for (const dir of LEGACY_DIRS) {
54
+ if (c.includes(`.claude/${dir}/hook.js`) || c.includes(`.claude\\${dir}\\hook.js`)) return true;
55
+ }
56
+ }
57
+ return false;
58
+ }
59
+
39
60
  async function ensureDir(p) {
40
61
  if (!existsSync(p)) await mkdir(p, { recursive: true });
41
62
  }
@@ -61,7 +82,7 @@ function buildHookEntry(command) {
61
82
 
62
83
  function dedupeOurEntries(group) {
63
84
  if (!Array.isArray(group)) return [];
64
- return group.filter(g => !(g && typeof g === "object" && g[MARK_KEY] === true));
85
+ return group.filter(g => !isOurEntry(g));
65
86
  }
66
87
 
67
88
  export async function installHooks() {