mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
def463a5ac4e5ec095bccdb9e4efb923246790be
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
582b00d53a |
the examples call methods the client has
Twelve ids came from the document's own old->new map; the rest are generated method spellings the map does not carry, read off the regenerated client. Neither set follows a search-and-replace: the document renamed 2014 operations and 21 of those do not reduce to dropping `_v1_` — /tasks and /meet became `*_app` and `*_app_assets` when the SPA and the API stopped sharing a name, and `get_v1_team_transactor_api_v1_statistics` drops only the first, the second being part of the path. Checked, not assumed: every `.get_*`/`.post_*` an example calls resolves against the 7519 methods the client exposes. |
||
|
|
3a09eb4319 |
regenerate from cloud@5126939 — the client leaves the hand-merged lineage
pkg/hanzoai/cloud goes +2186 -2126 ~175: 1700 paths / 2354 operations / 2186 schemas, 182 api modules and 2172 model modules, against the 239/1116 it carried from hanzo.yaml. The document is hanzoai/cloud's own emission now, pinned in a new .spec-lock by commit and sha256, and generate.py reaches it by value — --skip-validate-spec means the 1012 missing-`responses` errors no longer write zero files, so a client can be cut from the authority instead of a projection of it. Two renamings come with that, and both are the fix rather than the damage. IAM's types are namespace-qualified (iam.Role, iam.Application, 95 of them) because a bare `Role` was two unrelated shapes wearing one name. And the <svc>_ prefix is gone from every operationId, so every generated method lost it. The prefix is what broke the examples, and the gate saw only two thirds of it. Four flows failed on their imports; `money` and `tools` PASSED while every call in them named a method that no longer existed — an import resolves the names in the `from … import` line and a method is looked up at call time. All five flows now name operations that exist, checked by resolving each one as an attribute, and hanzo.yml records that ceiling so the next reader does not trust the gate for more than it says. `chat` is removed, which is a measurement and not a preference: cloud declares POST /v1/chat/completions with no requestBody and no responses at all, so the generated method takes no body and returns None — the one call a chat example exists to make cannot be expressed. Inventing the type, or hand-rolling the HTTP inside a generated client, is the drift these SDKs exist to prevent; js-sdk dropped its own chat flow at 2.0.7 for exactly this. It returns the release cloud gives that route a body. Two smoke assertions were already red before this regeneration and are now true again: they pinned AIApi/APIKeysApi/MCPApi and AdminApi.plugin_admin_*, names from the retired lineage. The surface is all still there under AiApi/KeysApi/ McpApi and AdminApi.admin_plugins. tests/test_zap_transport.py still errors, exactly as it did before: it imports `Hanzo` from hanzoai, which the hand-written package does not define. That is not this document's business and is untouched. Minor rather than patch: every generated method changed name. Co-authored-by: Hanzo Dev <[email protected]> |
||
|
|
3a62c22256 |
regen the cloud client from the resynced spec (1f9b03b) and repoint every flow
The document grew: cloud's woven spec was merged and won, taking hanzo.yaml from
1132 paths / 1519 operations / 779 schemas to 1737 / 2452 / 1798.
pkg/hanzoai/cloud/ is now 263 api + 2031 model modules, all importing.
`generate.py python --check` reports [python] clean.
The resync also RENAMED nearly every operationId to cloud_<method>_<path>, which
renames every generated method: billing_billingBalance became
cloud_get_v1_billing_balance, cloud_AgentsController.Create became
cloud_post_v1_agents. Examples written against the old names stop resolving —
exactly what the examples gate exists to catch. It went red; this is the fix.
Every flow was re-probed against api.hanzo.ai unauthenticated and with a bogus
key, because a spec says what SHOULD be served and only a request says what IS.
All eleven operations answer 401/403 — routed and identity-gated. Two moved:
store to the PROVISIONING plane (POST /v1/kv, GET|DELETE /v1/kv/{name}). The
per-key data plane the spec also describes is mounted nowhere: GET
/v1/kv/keys/{key} 404s, PUT and DELETE 405, kv.hanzo.ai 404s the whole
prefix. A round-trip on keys could not run.
tools to GET /v1/tools, the catalog. A live JSON-RPC door at POST /v1/mcp
answers tools/list with 730 tools but is absent from hanzo.yaml, so the
generator emits no method and an example would have to bypass the SDK
to reach it. Of the declared MCP routes /v1/automations/mcp returns 405.
hello stays on bot_authMe: /v1/ai/account answers 200 with
type="anonymous-user" to a request with NO Authorization header, so a hello
built on it certifies a key that would 401 everywhere else.
All six run and report the server's own refusal for a bogus key:
hello 403 no validated principal store 403 X-Org-Id required
chat 401 API key validation failed agent 403 X-Org-Id required
money 401 sign in to view billing tools 403 a validated principal required
money goes through the generated *_without_preload_content variant, because its
two operations are declared with a `default` response and no content so the
typed methods return None though the server sends JSON — a spec gap, and not a
small one: 696 of 2425 operations model no response body. That raw variant does
NOT raise on 4xx (the check lives in the typed deserialization these lack), so
the example checks status itself; without it a 401 body printed as the balance.
3.1.5 -> 3.1.6. 3.1.5 is live on PyPI, so this is a real patch above it.
Co-authored-by: Hanzo Dev <[email protected]>
|
||
|
|
cd441d2362 |
regen the cloud client, add the six canonical flows, and gate them in CI
REGENERATED pkg/hanzoai/cloud/ from hanzo.yaml @ 07783f5 via the canonical
driver (hanzoai/openapi generate.py python) — 1132 paths, 1519 operations, 779
schemas, landing as 239 api + 1116 model modules. `generate.py python --check`
reports `[python] clean`: the committed tree is byte-identical to a fresh
generation, with no local strip of any kind.
The path count fell from 1885 because the spec deleted 18 products it authored
and served nowhere. Nothing here was lost to a collapse — LLM.md carried an open
defect saying 127 of 411 operations went missing to 23 case-variant tag groups
(AI/ai, Users/users). That is now fixed upstream, and this regeneration proves
it: 239 distinct tags produce 239 api modules, exactly 1:1.
Generating at all required two spec fixes. Both landed in hanzoai/openapi first,
neither is patched here:
- fc0c17a 35 /v1/platform operations carried no `responses`. OAS 3.x requires
it and openapi-generator aborts the whole document, so hanzo.yaml
was producing no client in ANY language.
- 07783f5 ChatCompletionResponse.choices was `items: {type: object}` — so
choices[0].message.content came out List[object], unusable without
a cast, on the most-called route in the API.
SIX EXAMPLES under examples/{hello,chat,money,store,agent,tools}, plus
examples/client.py as the single place a base URL or an env var is resolved.
Same six, same names, same order as the TypeScript set, so a reader who knows
one can navigate the other. They import from hanzoai.cloud — the generated
surface new work targets — not the frozen pkg/hanzoai/{api,models}.
Each flow's call sits behind `if __name__ == "__main__":` deliberately: that is
what lets the gate IMPORT all six to prove every `from hanzoai.cloud import X`
still resolves, with no API key and no socket. A spec change that renames or
drops an operation goes red in CI instead of in a user's app.
CI is the fleet convention and this repo had none: root hanzo.yml + a 7-line
cicd.yml importing hanzoai/ci. The gate is two blocks — import every generated
module (for generated code that IS the build step; there is no compiler to catch
a bad $ref or a model referencing a class the generator declined to emit), then
import the six flows. Both provision an interpreter with uv, because the arc
runner image promises none and a gate that silently no-ops is worse than none.
Scope is deliberate: the cloud client and its flows, not all 65 packages, so a
red gate means "the client the spec just produced is broken" rather than
"something, somewhere". Publishing is untouched — .hanzo/workflows/publish-pypi.yml
stays canonical because it reads the PyPI token from KMS. Two publish paths is
one too many.
3.1.4 -> 3.1.5. PyPI still serves 3.1.1; the tree has been ahead since the KMS
secret at hanzo/prod/python-sdk-publish went unseeded.
Co-authored-by: Hanzo Dev <[email protected]>
|