Fix audit findings: security, types, KID, retry, and version alignment

- Fix critical OpenCode plugin: read private key from file instead of embedding in JS
- Add default KID (agent_id + '-key-1') matching Node and Go SDKs
- Fix Operation.subject and Operation.action types from str to Dict[str, Any]
- Fix retry off-by-one to give max_retries+1 total attempts
- Fix OpenCode operation_type from 'tool_use' to 'ai.tool_use'
- Update plugin path to .config/opencode/plugins matching Node SDK

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 4.6 committed 2026-03-02 15:56:31 -05:00
1 parent 21c63dbb28
commit 347d51febf
4 files changed
+18 -24

No files matched your search

+4 -4
View File
@@ -72,7 +72,7 @@ class ElydoraClient:
self.token = token
self._prev_chain_hash = GENESIS_CHAIN_HASH
self._kid = ""
self._kid = agent_id + '-key-1'
self._session = requests.Session()
def set_kid(self, kid: str) -> None:
@@ -106,14 +106,14 @@ class ElydoraClient:
hdrs = headers or self._headers()
last_exc: Optional[Exception] = None
for attempt in range(self.max_retries):
for attempt in range(0, self.max_retries + 1):
try:
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:
if attempt < self.max_retries:
retry_after = resp.headers.get("Retry-After")
if retry_after and retry_after.isdigit():
delay = int(retry_after)
@@ -126,7 +126,7 @@ class ElydoraClient:
raise
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as exc:
last_exc = exc
if attempt < self.max_retries - 1:
if attempt < self.max_retries:
time.sleep(min(2 ** attempt, 8))
continue
raise