diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-01 21:00:09 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-01 23:05:34 +0300 |
| commit | 28fb23cdaf4fce03ed6dbfcb4bb13be324b181ac (patch) | |
| tree | 0f33866cb872917d049bc8a38b857b5b8b0dd2b7 /src/integration/assets/codex | |
| parent | ca4270b31fe93c180f7321cb4006cb5e7307d889 (diff) | |
feat: add claude, codex, and opencode integrations
Diffstat (limited to 'src/integration/assets/codex')
| -rw-r--r-- | src/integration/assets/codex/herdr-agent-state.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/integration/assets/codex/herdr-agent-state.sh b/src/integration/assets/codex/herdr-agent-state.sh new file mode 100644 index 00000000..01510d6d --- /dev/null +++ b/src/integration/assets/codex/herdr-agent-state.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# installed by herdr +# safe to edit. this hook only activates inside herdr-managed panes. + +set -eu + +action="${1:-}" +cat >/dev/null 2>/dev/null || true + +case "$action" in + working|idle|blocked|release) ;; + *) exit 0 ;; +esac + +[ "${HERDR_ENV:-}" = "1" ] || exit 0 +[ -n "${HERDR_SOCKET_PATH:-}" ] || exit 0 +[ -n "${HERDR_PANE_ID:-}" ] || exit 0 +command -v python3 >/dev/null 2>&1 || exit 0 + +HERDR_ACTION="$action" python3 - <<'PY' +import json +import os +import random +import socket +import time + +source = "herdr:codex" +action = os.environ.get("HERDR_ACTION", "") +pane_id = os.environ.get("HERDR_PANE_ID") +socket_path = os.environ.get("HERDR_SOCKET_PATH") + +if not pane_id or not socket_path: + raise SystemExit(0) + +request_id = f"{source}:{int(time.time() * 1000)}:{random.randrange(1_000_000):06d}" +if action == "release": + request = { + "id": request_id, + "method": "pane.release_agent", + "params": { + "pane_id": pane_id, + "source": source, + "agent": "codex", + }, + } +else: + request = { + "id": request_id, + "method": "pane.report_agent", + "params": { + "pane_id": pane_id, + "source": source, + "agent": "codex", + "state": action, + }, + } + +try: + client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + client.settimeout(0.5) + client.connect(socket_path) + client.sendall((json.dumps(request) + "\n").encode()) + try: + client.recv(4096) + except Exception: + pass + client.close() +except Exception: + pass +PY |
