Metadata-Version: 2.4
Name: ai-devlease-client
Version: 0.1.32
Summary: Typed client of the ai-devlease lease manager - a wrapper over the mcp-proxy-adapter framework client
Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
License: Proprietary
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: mcp-proxy-adapter>=8.11.21

# ai-devlease-client

Typed async client of the ai-devlease lease manager (import `ai_devlease_client`).

The server and client require `mcp-proxy-adapter>=8.11.21`, which validates direct command parameters
before injecting trusted framework context. This is a minimum dependency version, with no upper cap.

Commands: `acquire` (adapter queue: submit, then poll the job), `renew` (holder only),
`release`, `status`, `lock_exclusive`, `unlock_exclusive`, `catalog`, `help`, `health`, and the registry commands
`register_service`, `list_services`, `remove_service`, `deploy_start`, `deploy_finish`, `stop_service`, `info`, `history`
(command line: `python -m ai_devlease_client <subcommand>`; the guide is returned by `info`).
Holder format is `<project>/<run_id>` (one `/`, each segment 1..64 of `[a-z0-9._-]`) and is
validated before the call. Errors map to typed exceptions: `-32602` to `ValidationError`
and `-32010..-32017` to `ServiceNotInCatalogError` .. `StorageError`.

Registered `expected_version` is a minimum for acquire, dependency starts, restarts and monitoring:
the actual healthy registered version must be at least that floor under PEP 440 ordering.
Opaque nonblank versions retain exact-equality compatibility; lower, missing or unequal opaque versions fail.
Results report the actual service version. `deploy_finish` verification and build delivery still require
the exact intended artifact version, so a newer service alone cannot prove that deployment.

```python
async with AiDevleaseClient.from_document_path("config.json") as client:
    async with client.lease("proj/run1", "fake-a") as lease:
        ...  # renewed every 60 s; lease.restart_required lists services to reconnect to
```

`await client.history(service=None, service_id=None, holder=None, after_id=0, until_id=None, limit=100)`
returns `HistoryResult` containing typed `HistoryEvent` records. Omitted `until_id` snapshots the current
maximum event ID. Continue with `next_after_id` and the returned `until_id`, keeping filters unchanged.
`service` and `service_id` are mutually exclusive; holder combines with either. Unknown historical identities
return an empty page. IDs are 0..2^63-1, limit is 1..200. `None` omits optional wire fields.

Events survive service removal and process restart. Started and terminal records share `operation_id`;
an unmatched start after a crash has unknown outcome. Automatic events have source `sweeper` and no holder.
Safe parameters/results omit URLs, credentials and raw error text. A terminal storage failure can follow
already completed business or host effects; `StorageError` never promises rollback. There is no history CLI.
