agent-dag 1.34.0 → 1.34.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.
@@ -17,6 +17,7 @@ import { homedir } from "node:os";
17
17
  import { fileURLToPath } from "node:url";
18
18
  import { claudeConfigDir } from "./claude-dir.mjs";
19
19
  import { readSettingsForWrite, writeFileAtomic, installScript } from "./installer.mjs";
20
+ import { shellQuoteArg } from "./exec.mjs";
20
21
 
21
22
  const PKG_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
22
23
  const CLAUDE_DIR = claudeConfigDir();
@@ -34,6 +35,18 @@ const PARKED_PATH = join(homedir(), ".agents-deck", "parked-sound-hooks.json");
34
35
  // what is already there — never to modify or remove it.
35
36
  const SOUND_HINTS = [/\bafplay\b/i, /Media\.SoundPlayer/i, /\bpaplay\b/i, /\baplay\b/i, /canberra-gtk-play/i];
36
37
 
38
+ /**
39
+ * The Stop hook's `command` string, escaped for the shell that will run it.
40
+ *
41
+ * Same shape and same reasoning as installer.mjs's hookCommand — see the note
42
+ * there — kept separate because this entry takes no `--provider` and is written
43
+ * to a different key. Exported, with the node path injectable, so the escaping
44
+ * is checked against a path the test names.
45
+ */
46
+ export function soundHookCommand(notifyPath, node = process.execPath) {
47
+ return `${shellQuoteArg(node)} ${shellQuoteArg(notifyPath)}`;
48
+ }
49
+
37
50
  /**
38
51
  * Read settings.json, refusing to guess at a file that will not parse.
39
52
  *
@@ -338,8 +351,13 @@ export async function setSoundHook(enabled) {
338
351
  hooks: [{
339
352
  type: "command",
340
353
  // Absolute node path, matching how the event hooks are installed: the
341
- // shell a hook runs in does not necessarily have the user's PATH.
342
- command: `"${process.execPath}" "${NOTIFY_PATH}"`,
354
+ // shell a hook runs in does not necessarily have the user's PATH. And
355
+ // properly escaped for that shell, for the reason installer.mjs's
356
+ // hookCommand spells out — NOTIFY_PATH is built from
357
+ // $CLAUDE_CONFIG_DIR, double quotes do not suppress `$(…)` or a
358
+ // backtick on POSIX, and this string is executed at the end of every
359
+ // turn.
360
+ command: soundHookCommand(NOTIFY_PATH),
343
361
  timeout: 5,
344
362
  }],
345
363
  });