feat(client): add server client stack (HTTP, sync, WebSocket, remote projects) #676

Closed
freemo wants to merge 4 commits from feature/m7-post-server into master
Owner

Summary

Implement the complete server client stack for CleverAgents.

Commits

  1. feat(client): add server http client (#335)
  2. feat(client): add plan sync and remote execution (#336)
  3. feat(client): add websocket updates (#337)
  4. feat(client): add remote project support (#338)

Closes #335
Closes #336
Closes #337
Closes #338

## Summary Implement the complete server client stack for CleverAgents. ## Commits 1. feat(client): add server http client (#335) 2. feat(client): add plan sync and remote execution (#336) 3. feat(client): add websocket updates (#337) 4. feat(client): add remote project support (#338) Closes #335 Closes #336 Closes #337 Closes #338
freemo added this to the v3.6.0 milestone 2026-03-10 09:10:38 +00:00
Implement ServerHttpClient with httpx for server communication including:
- Health check endpoint (GET /health)
- Version negotiation (GET /version, POST /version/negotiate)
- Pagination helpers for list endpoints
- Per-request timeout and retry policy with exponential backoff
- Request/response logging with auth header redaction
- TLS verification toggle with warning when disabled
- Server error responses mapped to domain errors (AcpNotAvailableError, etc.)
- Client-specific exceptions (ServerConnectionError, ServerTimeoutError, ServerVersionMismatchError)
- Settings fields: server_base_url, server_api_token, server_tls_verify, server_request_timeout
- Factory function create_client_from_settings wired to Settings
- httpx added to pyproject.toml dependencies

ISSUES CLOSED: #335
Implement PlanSyncClient for synchronizing local resources with a remote
CleverAgents server and submitting plans for remote execution:
- Sync actions, skills, tools, projects with configurable scope flags
- Conflict resolution policies (local_wins / server_wins)
- Remote plan execution, apply, and status query endpoints
- Server-side ID persistence in local item metadata
- Sync summary output (created/updated/skipped/errors)
- Dry-run mode that skips server mutations
- SyncScope, SyncSummary, ExecutionResult data models

ISSUES CLOSED: #336
Implement WebSocketClient for receiving real-time plan update events
from a CleverAgents server via WebSocket connection:
- Plan update subscription with reconnect/exponential backoff
- Event schema for plan status, progress, and log stream updates
- Heartbeat/ping handling that resets reconnect counter
- Resume from last event ID on reconnect
- Event version negotiation
- Event de-duplication by event_id via LRU-bounded EventDeduplicator
- Ordered delivery guarantees with thread-safe callback dispatch
- Configurable reconnect backoff parameters (base, max, max_reconnects)
- ConnectionState model tracking lifecycle state
- websockets library added to pyproject.toml dependencies

ISSUES CLOSED: #337
feat(client): add remote project support
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Failing after 14s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 19s
CI / typecheck (pull_request) Successful in 38s
CI / security (pull_request) Successful in 39s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / unit_tests (pull_request) Successful in 2m36s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m9s
ac89ba6460
Implement RemoteProjectClient for accessing and executing projects
hosted on a remote CleverAgents server:
- Remote resource selection and server execution request wiring
- Project-name resolution for remote namespaces and server aliases
- Resolve project with fallback from custom to default namespace
- Remote project caching with configurable TTL (default 5 min)
- Explicit ResourceNotFoundError when remote project not found
- Cache invalidation per-namespace or global
- RemoteProject dataclass with project_id, name, namespace, alias, description

ISSUES CLOSED: #338
freemo force-pushed feature/m7-post-server from ac89ba6460
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Failing after 14s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 19s
CI / typecheck (pull_request) Successful in 38s
CI / security (pull_request) Successful in 39s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / unit_tests (pull_request) Successful in 2m36s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m9s
to bd291fbc4a
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 2m33s
CI / docker (pull_request) Successful in 41s
CI / integration_tests (pull_request) Successful in 3m20s
CI / coverage (pull_request) Successful in 5m6s
CI / benchmark-regression (pull_request) Successful in 32m41s
2026-03-10 17:41:42 +00:00
Compare
freemo self-assigned this 2026-03-11 05:46:44 +00:00
Author
Owner

PM Compliance Update (Day 31):

Fixed by PM:

  • Added Type/Feature label
  • Added assignee (@freemo)
  • Added closing keyword to PR body

Remaining issue: Merge conflict. Please rebase against current develop branch (17 PRs merged Days 30-31).

Priority: M6 work — continue at current pace.

**PM Compliance Update (Day 31)**: Fixed by PM: - Added `Type/Feature` label - Added assignee (@freemo) - Added closing keyword to PR body **Remaining issue**: Merge conflict. Please rebase against current `develop` branch (17 PRs merged Days 30-31). **Priority**: M6 work — continue at current pace.
Author
Owner

PM Decision — Closing PR (Day 31)

This PR is being closed due to a fundamental specification change that renders the implementation obsolete.

What Changed

As of today (2026-03-11), the specification was updated to adopt the A2A (Agent-to-Agent) Protocol standard (see ADR-047). Key changes:

  • No REST API: The old HTTP/REST client design (http_client.py, sync_client.py, ws_client.py) is replaced by a single JSON-RPC 2.0 endpoint
  • A2A over stdio for local mode (agent as subprocess)
  • A2A over HTTP for server mode (single JSON-RPC endpoint, not REST)
  • SSE streaming via TaskStatusUpdateEvent / TaskArtifactUpdateEvent (not WebSocket)
  • LangGraph Platform with RemoteGraph for server-side execution

Impact

This PR creates:

  • src/cleveragents/client/http_client.pyobsolete (no REST API)
  • src/cleveragents/client/sync_client.pyobsolete (A2A SDK replaces)
  • src/cleveragents/client/ws_client.pyobsolete (SSE, not WebSocket)
  • src/cleveragents/client/remote_project.py — needs redesign for A2A task model

Replacement

New issues will be created in v3.8.0 (M9 — Server) for:

  1. A2A JSON-RPC 2.0 wire format and method routing
  2. A2A stdio transport (local mode)
  3. A2A HTTP transport (server mode)
  4. LangGraph Platform RemoteGraph integration

The feature/m7-post-server branch can be archived. @freemo — the architectural patterns here (DI wiring, error handling) are still valuable as reference for the A2A implementation.

This closure is due to a change in specification, not a quality issue with the code.

## PM Decision — Closing PR (Day 31) This PR is being **closed** due to a fundamental specification change that renders the implementation obsolete. ### What Changed As of today (2026-03-11), the specification was updated to adopt the **A2A (Agent-to-Agent) Protocol** standard (see ADR-047). Key changes: - **No REST API**: The old HTTP/REST client design (`http_client.py`, `sync_client.py`, `ws_client.py`) is replaced by a single **JSON-RPC 2.0** endpoint - **A2A over stdio** for local mode (agent as subprocess) - **A2A over HTTP** for server mode (single JSON-RPC endpoint, not REST) - **SSE streaming** via `TaskStatusUpdateEvent` / `TaskArtifactUpdateEvent` (not WebSocket) - **LangGraph Platform** with `RemoteGraph` for server-side execution ### Impact This PR creates: - `src/cleveragents/client/http_client.py` — **obsolete** (no REST API) - `src/cleveragents/client/sync_client.py` — **obsolete** (A2A SDK replaces) - `src/cleveragents/client/ws_client.py` — **obsolete** (SSE, not WebSocket) - `src/cleveragents/client/remote_project.py` — needs redesign for A2A task model ### Replacement New issues will be created in **v3.8.0 (M9 — Server)** for: 1. A2A JSON-RPC 2.0 wire format and method routing 2. A2A stdio transport (local mode) 3. A2A HTTP transport (server mode) 4. LangGraph Platform RemoteGraph integration The `feature/m7-post-server` branch can be archived. @freemo — the architectural patterns here (DI wiring, error handling) are still valuable as reference for the A2A implementation. **This closure is due to a change in specification, not a quality issue with the code.**
freemo closed this pull request 2026-03-11 18:09:40 +00:00
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
Required
Details
CI / build (pull_request) Successful in 15s
Required
Details
CI / quality (pull_request) Successful in 18s
Required
Details
CI / security (pull_request) Successful in 34s
Required
Details
CI / typecheck (pull_request) Successful in 38s
Required
Details
CI / unit_tests (pull_request) Successful in 2m33s
Required
Details
CI / docker (pull_request) Successful in 41s
Required
Details
CI / integration_tests (pull_request) Successful in 3m20s
Required
Details
CI / coverage (pull_request) Successful in 5m6s
Required
Details
CI / benchmark-regression (pull_request) Successful in 32m41s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#335 feat(client): add server http client
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core!676
No description provided.