From 3c77b4a31dd4a421a05e2ecd020da3ffd11ee4cd Mon Sep 17 00:00:00 2001 From: ZacharyZhang Date: Sat, 28 Feb 2026 21:23:27 -0500 Subject: [PATCH] Update client and plugin integrations - Client improvements - Update augment, claudecode, cursor, gemini, kiro, opencode plugins Co-Authored-By: Claude Opus 4.6 --- elydora/client.py | 24 ++++++++++++++++-------- elydora/plugins/augment.py | 2 +- elydora/plugins/claudecode.py | 2 +- elydora/plugins/cursor.py | 2 +- elydora/plugins/gemini.py | 2 +- elydora/plugins/kiro.py | 2 +- elydora/plugins/opencode.py | 2 ++ 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/elydora/client.py b/elydora/client.py index f4bd6be..ceb92d8 100644 --- a/elydora/client.py +++ b/elydora/client.py @@ -29,6 +29,10 @@ from .types import ( ) from .utils import generate_nonce, generate_uuidv7 +# The genesis chain hash: base64url encoding of 32 zero bytes. +# Must match the backend's GENESIS_CHAIN_HASH constant exactly. +GENESIS_CHAIN_HASH = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + class ElydoraClient: """Synchronous client for the Elydora API. @@ -62,7 +66,7 @@ class ElydoraClient: self.max_retries = max_retries self.token = token - self._prev_chain_hash = "" + self._prev_chain_hash = GENESIS_CHAIN_HASH self._kid = "" self._session = requests.Session() @@ -102,16 +106,20 @@ class ElydoraClient: resp = self._session.request( method, url, json=json_body, params=params, headers=hdrs, timeout=30 ) + # Retry on 429 or 5xx + if resp.status_code == 429 or resp.status_code >= 500: + if attempt < self.max_retries - 1: + retry_after = resp.headers.get("Retry-After") + if retry_after and retry_after.isdigit(): + delay = int(retry_after) + else: + delay = min(2 ** attempt, 8) + time.sleep(delay) + continue return self._handle_response(resp) except ElydoraError: raise - except requests.exceptions.ConnectionError as exc: - last_exc = exc - if attempt < self.max_retries - 1: - time.sleep(min(2 ** attempt, 8)) - continue - raise - except requests.exceptions.Timeout as exc: + except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as exc: last_exc = exc if attempt < self.max_retries - 1: time.sleep(min(2 ** attempt, 8)) diff --git a/elydora/plugins/augment.py b/elydora/plugins/augment.py index cfb0e23..5eed523 100644 --- a/elydora/plugins/augment.py +++ b/elydora/plugins/augment.py @@ -33,7 +33,7 @@ class AugmentPlugin(AgentPlugin): hook_path = self._hook_path() with open(hook_path, "w", encoding="utf-8") as f: f.write(script) - os.chmod(hook_path, os.stat(hook_path).st_mode | stat.S_IEXEC) + os.chmod(hook_path, stat.S_IRWXU) guard_script_path = config.get("guard_script_path", "") diff --git a/elydora/plugins/claudecode.py b/elydora/plugins/claudecode.py index 1e11d69..56302be 100644 --- a/elydora/plugins/claudecode.py +++ b/elydora/plugins/claudecode.py @@ -34,7 +34,7 @@ class ClaudeCodePlugin(AgentPlugin): hook_path = self._hook_path() with open(hook_path, "w", encoding="utf-8") as f: f.write(script) - os.chmod(hook_path, os.stat(hook_path).st_mode | stat.S_IEXEC) + os.chmod(hook_path, stat.S_IRWXU) guard_script_path = config.get("guard_script_path", "") diff --git a/elydora/plugins/cursor.py b/elydora/plugins/cursor.py index b5f18ad..f62ac2a 100644 --- a/elydora/plugins/cursor.py +++ b/elydora/plugins/cursor.py @@ -33,7 +33,7 @@ class CursorPlugin(AgentPlugin): hook_path = self._hook_path() with open(hook_path, "w", encoding="utf-8") as f: f.write(script) - os.chmod(hook_path, os.stat(hook_path).st_mode | stat.S_IEXEC) + os.chmod(hook_path, stat.S_IRWXU) guard_script_path = config.get("guard_script_path", "") diff --git a/elydora/plugins/gemini.py b/elydora/plugins/gemini.py index 4aa1c30..69c135c 100644 --- a/elydora/plugins/gemini.py +++ b/elydora/plugins/gemini.py @@ -33,7 +33,7 @@ class GeminiPlugin(AgentPlugin): hook_path = self._hook_path() with open(hook_path, "w", encoding="utf-8") as f: f.write(script) - os.chmod(hook_path, os.stat(hook_path).st_mode | stat.S_IEXEC) + os.chmod(hook_path, stat.S_IRWXU) guard_script_path = config.get("guard_script_path", "") diff --git a/elydora/plugins/kiro.py b/elydora/plugins/kiro.py index 40f8a99..024e424 100644 --- a/elydora/plugins/kiro.py +++ b/elydora/plugins/kiro.py @@ -37,7 +37,7 @@ class KiroPlugin(AgentPlugin): script_path = self._script_path() with open(script_path, "w", encoding="utf-8") as f: f.write(script) - os.chmod(script_path, os.stat(script_path).st_mode | stat.S_IEXEC) + os.chmod(script_path, stat.S_IRWXU) guard_script_path = config.get("guard_script_path", "") diff --git a/elydora/plugins/opencode.py b/elydora/plugins/opencode.py index d51fff9..58275cf 100644 --- a/elydora/plugins/opencode.py +++ b/elydora/plugins/opencode.py @@ -3,6 +3,7 @@ from __future__ import annotations import os +import stat from .base import AgentPlugin, InstallConfig, PluginStatus @@ -42,6 +43,7 @@ class OpenCodePlugin(AgentPlugin): plugin_path = self._plugin_path() with open(plugin_path, "w", encoding="utf-8") as f: f.write(js_content) + os.chmod(plugin_path, stat.S_IRWXU) print(f"Elydora hook installed for OpenCode.") print(f" Plugin: {plugin_path}")