| 101 | self.hook("session-start", {"session_id": SESSION}) |
| 102 | |
| 103 | def run(self, *args, payload=None, timeout=45): |
| 104 | result = subprocess.run([self.binary, *args, "--no-color"], cwd=self.root, |
| 105 | input=payload, stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
| 106 | timeout=timeout, env=self.env) |
| 107 | if result.returncode: |
| 108 | raise RuntimeError(f"{' '.join(args)}: {result.stderr.decode(errors='replace')}") |
| 109 | return result |
| 110 | |
| 111 | def hook(self, verb, payload): |
| 112 | result = self.run("agent", "hooks", "claude-code", verb, "--foreground", |