Metadata-Version: 2.4
Name: rinzo
Version: 0.17.1
Summary: Manage a Rinzo phone system from the terminal or an AI agent
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Rinzo CLI (`rinzo`)

Manage a Rinzo phone system from a terminal, a script or an AI agent: users and extensions, SIP
phones, SIP trunks, numbers, call routing, voicemail, ring groups, call logs and webhooks.

```sh
curl -fsSL https://rinzo.ai/install.sh | sh     # or: uv tool install ./rinzo-*.whl
rinzo login                                      # approve in the browser as an account admin
rinzo users list
rinzo skill install                              # the rinzo skill for Claude Code / Codex
```

User guide: https://rinzo.ai/docs/developers-agents/ (source: [docs/rinzo-cli.md](../docs/rinzo-cli.md)).
Python 3.10+, standard library only. Rinzo was called Topaz: this package replaces `topaz-tel`, still
installs `topaz` as a deprecated alias, and brings a topaz login over on first use (see the guide's
"Upgrading from the topaz CLI").

## Layout

| Module | Role |
|---|---|
| `main.py` | argument parser, dispatch, error/exit-code handling, `rinzo schema`; `legacy_main` is the `topaz` alias |
| `brand.py` | product name, default API URL, SIP proxy, support address (checked against `config/brand.json`) and the old Topaz names |
| `auth.py` | login (browser device flow, password, API key), logout, whoami, key rotation, doctor |
| `client.py` | Crossbar HTTP client: API key → cached 1 h token, 401/429 handling, pagination, errors |
| `credentials.py` | key storage: macOS Keychain (`security`), Secret Service (`secret-tool`), 0600 file; copies `topaz-cli` keychain entries to `rinzo-cli` |
| `config.py` | profiles and private files under `~/.config/rinzo` (copied once from `~/.config/topaz`); `RINZO_*` settings with `TOPAZ_*` fallback |
| `resources.py` | resource commands and the specialised ones (numbers, calls, voicemail, media, webhooks, api) |
| `builders.py` | SmartPBX-shaped multi-document changes: users, devices, ring groups, forwarding |
| `trunks.py` | native SIP trunks, connection details, lifecycle and number routing |
| `plan.py` | `rinzo plan`: the Rinzo plan view (term, renewal, minutes, offers), renewal on/off, term changes, invoices, Billing link to start one |
| `receptionists.py` | native AI receptionist drafts/publication, immutable knowledge uploads and job polling; private original-request receipts |
| `receptionist_spec.py` | declarative draft apply/dry-run, stable source reuse, export and explicit destination remapping |
| `receptionist_routes.py` | read-only saved AI entries, their actual human/fallback branches and static incoming callflow links |
| `simulate.py` | read-only local previews of native callflows, including explicit hypothetical AI outcomes without model or latency claims |
| `data.py`, `output.py` | `--data`/`--set` bodies, Gregorian time, JSON vs table output |
| `skill/rinzo/` | the agent skill shipped in the wheel (`rinzo skill install`) |

The browser login's server side is in the signup service: [`signup/cli_auth.py`](../signup/cli_auth.py)
(routes `/cli/*` on app.rinzo.ai; see [signup/README.md](../signup/README.md#cli-sign-in-device-flow)).

## Tests

```sh
python3 -m unittest discover -s tests/cli -v            # fake Crossbar; also parses every documented command
uv run --no-project --python 3.10 python -m unittest discover -s tests/cli   # oldest supported Python
tests/kazoo/cli_journey.py --api-key-file ~/.local/share/topaz5-local/signup/kazoo-api-key
```

The journey (laptop stack) builds a phone system with the CLI only — users with extensions, desk
phones from `devices create`, a ring group, a webhook — registers pjsua phones with the credentials
the CLI printed, and checks that real calls reach the right phone and appear in `rinzo calls list`.

Local browser login against the laptop stack: run `python3 scripts/local_dev.py signup`, then
`rinzo login --api-url http://127.0.0.1:18080/v2 --auth-url http://127.0.0.1:18100`.

AI receptionist commands use the native APIs deployed for owner testing. Broader voice, latency
and commercial release qualification remain in the implementation ledger. See the shipped [agent workflow](src/rinzo_cli/skill/rinzo/references/receptionists.md)
and `rinzo schema receptionists`. Apply/dry-run/export include the machine-readable spec contract.
`callflows simulate` leaves AI behavior unknown by default; `--ai-outcome human` (or another exact
entry child or published destination key) traces a hypothetical route. Explicit entry branches
win; otherwise the selected published default is used. Repeated options apply to
successive AI entries. This does not run a model, verify native admission or measure speech latency.
Schedule decisions are calculated locally using this computer's timezone data; they do not execute
Kazoo's temporal engine. The [native comparison](../docs/ai-receptionist-schedule-evidence.md)
reproduces different November Vancouver branches in the pinned image. Verify schedule boundaries
with answered calls before relying on a preview for deployment.
Typed destinations, native route attachment/restoration, sessions, capabilities, read-only account
pricing and posted AI charges are implemented on this branch. `receptionists charges --month YYYY-MM`
reads the existing native account ledger summary; omitting the month selects the current UTC month.
It reports net settled usage charges or credits, not total minutes or remaining included time.
Model-executing tests and aggregate commercial reporting remain pending. The full
feature's [implementation ledger](../docs/ai-receptionist-implementation.md) tracks runtime and
release gates separately. CLI 0.8.1 includes the published route-default simulation correction.

CLI 0.9.0 adds the self-serve service commands. `rinzo receptionists access` shows whether the
service is on, this month's included and remaining minutes, and the current price;
`rinzo receptionists activate` turns it on, showing the charges and requiring `--yes` to accept
them (`--months 12|36` prepays an access fee when the price has one); `rinzo receptionists
deactivate --yes` turns it off; `rinzo receptionists usage` combines this month's usage with the
posted ledger charges.

CLI 0.17.1 (2026-11-05): skill wording only, no command changes. The skill references now match the plan:
a new account has its included number, AI talk time is charged per minute, recordings are kept 90 days unless
a `url` is set, forwarded calls use the plan's minutes first, and `rinzo voicemail list` is named correctly.

CLI 0.17.0 (2026-10-25): spam screening. `rinzo blocked list|add NUMBER|remove NUMBER --yes|anonymous --on|--off`
manages the account's blocked callers (Kazoo's own blocklist, "Blocked callers"; blocked numbers get 603 Decline before
the receptionist runs). `rinzo receptionists sessions` flags calls the carrier reported as spoofed
(`screening.suspect`, STIR/SHAKEN) and points at `blocked add`; webhooks can filter on `suspect`
(`docs/ai-receptionist-spam-screening.md`).

CLI 0.16.0 (2026-10-25): stored call recordings and business lookups. `rinzo recording status|enable|disable
--number +1…|--user ID` turns recording on for a number (with a recording notice in the account's language, `--no-notice`
to skip it) or a person; `rinzo recordings list|get|delete` list, download and delete what Kazoo stored
(`docs/call-recording.md`). Receptionist spec: `tools` (at most five HTTPS lookups the receptionist can call mid-call,
`docs/ai-receptionist-tools.md`), `rinzo receptionists tools list|test ID TOOL --arg name=value`; header values are
never printed and come back as `**redacted**`, which re-applies safely. `retention.store_audio: true` keeps the audio of
AI-answered calls.

CLI 0.15.0 (2026-10-25): industry templates for the AI receptionist. `rinzo receptionists templates` lists
the catalogue (`src/rinzo_cli/templates/<id>/`, shipped in the wheel and published at
`https://rinzo.ai/agents/templates/`); `rinzo receptionists template ID --out DIR --set name=value ...`
renders `receptionist.json`, `after-hours.json` when the template has one, and `knowledge/*.md`, and
reports the information gaps (example values left in place, `[FILL IN: …]` markers, no website). The skill's
receptionist reference has the workflow and recipe 12, a plumbing company from the template. Also `rinzo mcp`: a
Model Context Protocol server over stdio (standard library only) exposing the CLI's commands as typed tools and
the skill as resources to Claude Code, Cursor or Claude Desktop (`claude mcp add rinzo -- rinzo mcp`;
`docs/rinzo-mcp.md`).

CLI 0.14.0 (2026-10-25): webhooks that work. Kazoo's `ai_call` event: one signed delivery per AI-answered
call (`webhooks create --event ai_call --secret-file`, `--receptionist`, `--outcome`, `--include-transcript`);
`webhooks attempts`, `webhooks test` (sends a sample with the same `X-Rinzo-Signature` header Kazoo sends)
and `webhooks re-enable`. Receptionist spec: `memory.enabled` (caller memory, on by default) and French
(`fr-CA`, `fr-FR`) as a third language.

CLI 0.13.1 (2026-10-24): `receptionists apply` reports `greeting_question` when the greeting does not end
with a question; the skill explains that the receptionist closes answers with an invitation and asks a
quiet caller once more before saying goodbye.

CLI 0.13.0 (2026-10-24): `knowledge import-site` and spec knowledge items with `url`: Rinzo reads the
business's public website and writes Markdown notes as a knowledge version; `ai-jobs wait` follows an
import through extraction and indexing (`knowledge imports` lists a source's imports).

CLI 0.12.0 (2026-10-24): the API has its own name, `https://api.rinzo.ai/v2` (the stock Kazoo
layout; the Control panel's cookies no longer reach it). New logins use it; saved profiles on the
old default `https://app.rinzo.ai/v2` move to it on first use, and that address keeps answering.
Browser sign-in stays on the Control panel (`https://app.rinzo.ai/cli/`).

CLI 0.11.1 (2026-10-24) changes wording only: the simulator, hints and the skill say Rinzo where they said Kazoo.

CLI 0.11.0 is the launch release. It follows the launch pricing (docs/launch-plan.md, 2026-10-22:
$39/$29/$19, 100 minutes, 2c calls, the AI receptionist at 10c a minute of talk time with 30 free in
the free month; the skill's cost references say so). The receptionist spec gains per-call summary
email and transcripts (`summary_recipients`, `retention.store_transcript`,
`retention.transcript_retention_days`; `rinzo receptionists sessions` shows `summary` and
`transcript`), Spanish answering (`language` accepts `es-US`, `es-MX`, `es-ES` beside English) and
appointment booking: `receptionists connectors`, `receptionists connect google-calendar` (prints the
Google sign-in URL; the CLI never holds the tokens; `--calendar ID` chooses the calendar) and
`receptionists disconnect`, plus the spec's `booking` policy (services, hours in the account's time
zone, limits). See docs/ai-receptionist-booking.md.

CLI 0.10.0 introduced the one-plan commands: `rinzo plan` shows the
plan's term, price per month and per renewal, renewal or end date, next charge, scheduled change,
included number, minutes used of this month's pool and the terms on offer with a command for each;
`plan renewal --off|--on`, `plan change --term monthly|12|24` and `plan cancel-change` change it
(each needs `--yes`; a longer term may return a `payment_url` to confirm the card payment);
`plan invoices` lists receipts; `plan buy` prints the Control panel Billing link, since starting a
plan is a card checkout. The skill drops lifetime, the one-time 24-month plan, channels and the old
rates; AI answering is described as part of the plan (its calls use the plan's minutes).

`rinzo receptionists routes ID` inspects saved references, including nested/skipped entries,
branch locations, numbers/extensions, dial patterns and static upstream callflow links. It uses
ordinary account reads and never substitutes editable draft bindings. When Crossbar permits
`full_docs`, returned documents avoid extra GETs; otherwise summaries are followed by document
reads. No server setting is changed. Failed document reads or traversal limits produce a nonzero
error with the partial report in `error.details.report`; permission/list/size failures remain errors. A
complete scan is not an atomic snapshot or proof of reachability, number provisioning or live
delivery. Inspection is bounded to 5,000 callflows, 100,000 nodes, depth 128 and 100,000 incoming
links in traversal/output; it adds no work to call dispatch or conversation turns.

## Release (maintainers)

The website publishes the wheel from `cli/release/`; its build refuses a release whose sources,
metadata or hashes differ from this tree. Build with the pinned tools in a dedicated environment
(Python 3.11+ for the builder):

```sh
export TMPDIR="$HOME/.cache/topaz5-build"                     # private scratch
python3 -m venv "$TMPDIR/topaz-wheel-build"
"$TMPDIR/topaz-wheel-build/bin/python" -m pip install setuptools==80.9.0 wheel==0.45.1
"$TMPDIR/topaz-wheel-build/bin/python" cli/tools/build_release.py
```

It builds twice in fresh trees from `pyproject.toml`, `README.md` and the package sources (Python and
skill files) with a fixed `SOURCE_DATE_EPOCH`, fails unless both wheels are byte-identical and match
the source hashes, and writes `release/*.whl` and `release/manifest.json`. Commit both with the
source change, then build and deploy the site. Bump `version` in `pyproject.toml` and
`src/rinzo_cli/__init__.py` together.
