Files
zeekay 1d0478e0c5 Resolve every credential through hanzo-login
A stale sk- key in ~/.hanzo/config.json beat the person's login
because the file was read before the hanzo CLI was asked. Every Python
tool had its own copy of that order, and research ran whatever `hanzo`
was first on PATH, which on Debian is the hanzo-ide GUI.

hanzo-login (stdlib only) is the one resolver: HANZO_API_KEY, then the
CLI's login at ~/.local/bin/hanzo (`auth token`, `--as` for another
identity, kept 300 s per identity), then config.json apiKey last. An
identity named per call or with use() always asks the login and never
falls through to another account. Identities are validated before
they reach argv. The CLI owns its store; nothing here reads it.

HanzoCloud resolves per request, so a refreshed or switched login is
followed, takes identity and org (X-Org-Id) per call, and sends
hanzo-tools/<version>. hanzo-research and HanzoSession call the same
resolver instead of their own.

The hanzo router answers service="auth" locally: whoami (source,
identity, email, name, org, orgs, a key's prefix only), list, use (this
process) and switch (the machine). Every call takes `as` and `org`.
params is now declared as an object or its string: FastMCP parsed the
JSON string into a dict and refused it against a str-only schema.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
2026-11-08 16:06:17 -08:00

62 lines
1.7 KiB
TOML

[project]
name = "hanzo-tools-api"
version = "0.3.3"
description = "Generic API tool for calling any REST API via OpenAPI specs - search, explore, and dynamically use ANY API"
readme = "README.md"
requires-python = ">=3.12"
license = { text = "MIT" }
authors = [{ name = "Hanzo AI", email = "[email protected]" }]
keywords = ["hanzo", "mcp", "api", "openapi", "tools"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
# hanzo_tool.py imports HanzoCloud from hanzo_tools.core, which canonical
# hanzo-tools owns and first shipped in 0.3.3. The old hanzo-tools-core dep
# named a shim whose floor (0.1.0) both allowed the shadowing duplicate and
# guaranteed nothing about HanzoCloud, so the unified tool failed to import.
"hanzo-tools>=0.3.10",
"hanzo-login>=0.1.0",
"httpx>=0.27.0",
"pydantic>=2.0",
"pyyaml>=6.0",
"aiofiles>=24.1.0",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0",
"pytest-asyncio>=0.24.0",
"respx>=0.22.0", # Mock httpx requests
]
[project.entry-points."hanzo.tools"]
api = "hanzo_tools.api:TOOLS"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel.force-include]
"hanzo_tools/api/catalog.json" = "hanzo_tools/api/catalog.json"
[tool.hatch.build.targets.wheel]
packages = ["hanzo_tools"]
[tool.ruff]
line-length = 120
target-version = "py311"
[tool.ruff.lint]
select = ["E", "F", "I", "B", "UP"]
ignore = ["E501"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"