feat(agent): default ria-agent register --hub to https://riahub.ai

Most users register against the production hub, so requiring --hub on
every invocation was friction. Default the flag to https://riahub.ai
via a module-level DEFAULT_HUB_URL constant; explicit --hub still wins,
so dev and self-hosted setups (e.g. http://whitehorse:3005) keep working.

The legacy `ria-agent run` path keeps its own --hub handling unchanged
— it has a config-file fallback and existing operators rely on it.

Bumps version to 0.1.8.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
J jonny 2026-06-01 13:05:11 -04:00
parent dd305aabeb
commit 5b7f487a5f
5 changed files with 85 additions and 8 deletions

View File

@ -1,5 +1,13 @@
# Changelog
## [0.1.8] - 2026-06-01
### Changed
- **`ria-agent register --hub` now defaults to `https://riahub.ai`** — most users can run `ria-agent register --api-key ria_reg_...` without the `--hub` flag. Dev and self-hosted users keep the existing override (`--hub http://my-hub:3005`). The default lives in `ria_toolkit_oss.agent.cli.DEFAULT_HUB_URL`.
---
## [0.1.7] - 2026-05-26
### Added

View File

@ -14,7 +14,7 @@ sys.path.insert(0, os.path.abspath(os.path.join('..', '..')))
project = 'ria-toolkit-oss'
copyright = '2026, Qoherent Inc'
author = 'Qoherent Inc.'
release = '0.1.7'
release = '0.1.8'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

View File

@ -1,6 +1,6 @@
[project]
name = "ria-toolkit-oss"
version = "0.1.7"
version = "0.1.8"
description = "An open-source version of the RIA Toolkit, including the fundamental tools to get started developing, testing, and deploying radio intelligence applications"
license = { text = "AGPL-3.0-only" }
readme = "README.md"

View File

@ -5,11 +5,13 @@ Subcommands:
- ``ria-agent run [legacy args]`` legacy long-poll NodeAgent (unchanged).
- ``ria-agent stream`` new WebSocket-based IQ streamer.
- ``ria-agent detect`` print SDR drivers whose modules import cleanly.
- ``ria-agent register --hub URL --api-key KEY`` register with the hub
using a personal registration key (minted from **Settings RIA Agents**
on the hub, shown once at mint time) and save credentials (and optional
TX interlocks) to ``~/.ria/agent.json``. The hub also accepts the legacy
shared ``[wac] API_KEY`` for back-compat, but that path is deprecated.
- ``ria-agent register --api-key KEY`` register with the production hub
(``https://riahub.ai`` by default; override with ``--hub URL`` for dev
or self-hosted) using a personal registration key (minted from
**Settings RIA Agents** on the hub, shown once at mint time) and save
credentials (and optional TX interlocks) to ``~/.ria/agent.json``. The
hub also accepts the legacy shared ``[wac] API_KEY`` for back-compat,
but that path is deprecated.
Invoking ``ria-agent`` with no subcommand falls through to the legacy
long-poll behavior for back-compatibility with existing deployments.
@ -52,6 +54,10 @@ def _user_agent() -> str:
# small DB lookup + insert; anything past this is a stuck hub, not a slow one.
_REGISTER_TIMEOUT_S = 15
# Production hub URL — used as the default for `ria-agent register` so most
# users don't need to pass --hub. Dev / self-hosted users override explicitly.
DEFAULT_HUB_URL = "https://riahub.ai"
REGISTRATION_REASON_MESSAGES = {
"invalid_key": (
@ -226,7 +232,14 @@ def main() -> None:
sub.add_parser("detect", help="List available SDR drivers")
p_reg = sub.add_parser("register", help="Register agent with RIA Hub and save credentials")
p_reg.add_argument("--hub", required=True, help="RIA Hub URL (e.g. http://whitehorse:3005)")
p_reg.add_argument(
"--hub",
default=DEFAULT_HUB_URL,
help=(
f"RIA Hub URL (default: {DEFAULT_HUB_URL}). "
"Override for dev or self-hosted hubs, e.g. http://whitehorse:3005."
),
)
p_reg.add_argument(
"--api-key",
dest="api_key",

View File

@ -140,3 +140,59 @@ def test_register_surfaces_reason_on_http_error(tmp_path, capsys):
assert "Settings → RIA Agents" in captured.err
# Config must NOT be written on failure.
assert not cfg_path.exists()
def test_default_hub_url_is_production():
"""Lock in the constant so a future typo doesn't silently redirect users."""
assert agent_cli.DEFAULT_HUB_URL == "https://riahub.ai"
def test_register_defaults_hub_to_production(tmp_path):
"""Omitting --hub uses the production hub URL constant."""
cfg_path = tmp_path / "agent.json"
captured: dict = {}
def _fake_urlopen(req, *args, **kwargs):
captured["url"] = req.full_url
raise urllib.error.HTTPError(
url=req.full_url, code=403, msg="", hdrs=None, # type: ignore[arg-type]
fp=BytesIO(_structured("invalid_key")),
)
with (
patch.dict("os.environ", {"RIA_AGENT_CONFIG": str(cfg_path)}, clear=False),
patch("urllib.request.urlopen", side_effect=_fake_urlopen),
patch.object(sys, "argv", ["ria-agent", "register", "--api-key", "ria_reg_x"]),
):
with pytest.raises(SystemExit):
agent_cli.main()
assert captured["url"] == f"{agent_cli.DEFAULT_HUB_URL}/screens/agents/register"
def test_register_hub_override_wins_over_default(tmp_path):
"""Explicit --hub still wins; default is only a fallback."""
cfg_path = tmp_path / "agent.json"
captured: dict = {}
def _fake_urlopen(req, *args, **kwargs):
captured["url"] = req.full_url
raise urllib.error.HTTPError(
url=req.full_url, code=403, msg="", hdrs=None, # type: ignore[arg-type]
fp=BytesIO(_structured("invalid_key")),
)
with (
patch.dict("os.environ", {"RIA_AGENT_CONFIG": str(cfg_path)}, clear=False),
patch("urllib.request.urlopen", side_effect=_fake_urlopen),
patch.object(
sys,
"argv",
["ria-agent", "register", "--hub", "http://whitehorse:3005", "--api-key", "ria_reg_x"],
),
):
with pytest.raises(SystemExit):
agent_cli.main()
assert captured["url"] == "http://whitehorse:3005/screens/agents/register"
assert agent_cli.DEFAULT_HUB_URL not in captured["url"]