feat(client): server client chain (#335, #336, #337, #338) #1111

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

6 Commits

Author SHA1 Message Date
freemo c9be72a99f fix: rename cls to klass in _validate_protocol staticmethod for pyright compliance
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 25s
CI / lint (pull_request) Successful in 3m32s
CI / typecheck (pull_request) Successful in 3m59s
CI / quality (pull_request) Successful in 4m1s
CI / security (pull_request) Successful in 4m8s
CI / unit_tests (pull_request) Successful in 6m34s
CI / integration_tests (pull_request) Successful in 8m8s
CI / docker (pull_request) Successful in 1m22s
CI / e2e_tests (pull_request) Successful in 10m45s
CI / coverage (pull_request) Successful in 10m4s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 54m59s
2026-03-24 20:28:19 +00:00
freemo 8e9aa7af48 fix(client): address server client chain review findings
- Promote _request() to public method request() in ServerHttpClient
  to fix encapsulation violation across sync_client and remote_project
- Fix WebSocket connect() to raise NotImplementedError with clear TODO
  documenting that real websockets transport is not yet implemented
- Fix thread safety: protect last_event_id write under self._lock
  in ws_client.process_event()
- Broaden exception handling in sync() to catch ServerTimeoutError
  and A2aNotAvailableError in addition to ServerConnectionError
- Add has_next to PageResult in benchmark and test helpers
- Add comments explaining Retry-After header logging-only behavior
  and why blocking time.sleep is acceptable in sync client
- Update all test steps, robot helpers, and benchmarks to use the
  renamed public request() method and updated connect() behavior

Refs: #335, #336, #337, #338
2026-03-24 20:28:19 +00:00
freemo 3fe7dabb65 feat(client): add remote project support
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
- Behave scenarios (16 scenarios, 54 steps)
- Robot Framework smoke tests
- ASV benchmark for request overhead baseline
- Reference documentation at docs/reference/server_remote_projects.md

ISSUES CLOSED: #338
2026-03-24 20:28:19 +00:00
freemo 61dc421975 feat(client): add websocket updates
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
- Behave scenarios (16 scenarios, 62 steps)
- Robot Framework smoke tests
- ASV benchmark for message handling baseline
- Reference documentation at docs/reference/server_websocket.md

ISSUES CLOSED: #337
2026-03-24 20:28:19 +00:00
freemo ae1fd648d5 feat(client): add plan sync and remote execution
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
- Behave scenarios (18 scenarios, 62 steps)
- Robot Framework smoke tests
- ASV benchmark for sync throughput baseline
- Reference documentation at docs/reference/server_sync.md

ISSUES CLOSED: #336
2026-03-24 20:28:19 +00:00
freemo 5f7bba3e96 feat(client): add server http client
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 (A2aNotAvailableError, 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
- Behave scenarios (23 scenarios, 72 steps)
- Robot Framework smoke tests
- ASV benchmark for connection overhead baseline
- Reference documentation at docs/reference/server_client_http.md

ISSUES CLOSED: #335
2026-03-24 20:28:19 +00:00