hermes-agent/agent
Siddharth Balyan 9baad4e0aa
feat(cli): plan catalog on Free + plan= deep link + top-up/auto-refill copy split (#68689)
* feat(cli): plan catalog on Free + plan= deep link + top-up/auto-refill copy split

Bring the plain (non-TUI) CLI billing surface to parity with the desktop/TUI
billing changes:

- /subscription on Free (admin/owner, interactive) prints the plan catalog
  (name · $/mo · $credits/mo, from the same tiers[] data the TUI uses; monthly
  credits render as dollars). A numbered pick opens the manage-subscription
  deep-link directly with plan=<tier_id> appended.
- subscription_manage_url(state, tier_id=...) appends plan=<tier_id> (the stable
  tiers[] id) when a tier was picked, org_id first — mirrors the TUI's ?plan=.
  The paid change flow's blocked/unknown-preview portal fallback carries plan=
  for upgrades only; downgrades stay generic/native.
- /topup overview splits one-time top-up from automatic refill, the distinction
  stated in each first sentence ("Add funds now — a single charge…" vs "Refill
  when low — charges … automatically …"), keeping "credits" out of the
  dollars-only surface.
- Downgrades remain native (chargeless scheduled change), unchanged.

Updates the CLI-parity section of docs/billing-lifecycle.md and tests under
tests/hermes_cli + tests/agent.

* refactor(billing): share plan-catalog helpers + harden manage-url builder

- subscription_manage_url now preserves unrelated portal query params (parse_qsl,
  popping only the contract-owned org_id/plan) and restricts to http/https schemes,
  matching the desktop URL builder — the function owns the contract.
- Lift the plan-catalog derivation into agent/subscription_view.py so the CLI Free
  catalog and the paid picker/blocked-preview branch share one implementation:
  selectable_tiers (enabled paid, not current, sorted), format_tier_row (name · $/mo
  · $credits/mo — thousands-grouped like the TUI's toLocaleString, credits suffix
  hidden when absent/zero), and is_upgrade(state, tier_id).

* fix(cli): numbered pick, canonical guarded browser opener, partial auto-refill copy

- Free catalog: accept a bare digit as a pick (the shared normalizer only knows the
  confirm-dialog digit aliases, so `1` used to resolve to None → "Cancelled"). The
  Nth digit maps to the Nth printed row.
- Extract one _open_url_in_browser used by every "open the portal" path, applying the
  device-code flows' console-browser / remote-session guard (webbrowser.open returns
  True even for lynx/w3m over SSH) and returning whether a real browser opened.
- Consume the shared selectable_tiers / format_tier_row / is_upgrade helpers from the
  Free catalog, the paid picker, and the blocked-preview branch.
- /topup auto-refill copy: the concrete "charges $X … below $Y." sentence only when
  both amounts are present and finite; otherwise the generic sentence.

* docs(billing): correct CLI-parity rows (drop cross-repo ref, downgrade invariant)

Remove the other-repo PR reference from the manage-URL row, and state the real
downgrade invariant: a blocked downgrade may print the generic manage URL but never
carries plan=<tier_id> — selected-tier deep-links are reserved for new subscriptions
and upgrades.
2026-07-22 08:11:09 +05:30
..
lsp refactor(lsp): version-tagged _DocState replaces timestamp freshness tracking 2026-07-20 13:43:36 -04:00
pet
…
secret_sources feat(secrets): one-command token rotation + actionable startup errors for all secret sources (#68605) 2026-07-21 06:41:04 -07:00
transports feat(cache): persist the exact bytes sent to the API in an api_content sidecar 2026-07-19 08:25:35 +05:30
__init__.py
…
account_usage.py
…
agent_init.py fix(compression): report live-resolved Codex window in the autoraise notice 2026-07-21 04:29:34 -07:00
agent_runtime_helpers.py fix(desktop, ink): don't wipe messages before final message (#65919) 2026-07-20 11:42:29 -04:00
anthropic_adapter.py fix(models): complete kimi-k3 rollout across Kimi-direct catalog surfaces 2026-07-20 08:47:55 -07:00
async_utils.py
…
aux_accounting.py
…
auxiliary_client.py fix(auxiliary): resolve key_env in _resolve_task_provider_model (#66641) 2026-07-18 19:03:51 -04:00
azure_identity_adapter.py
…
background_review.py
…
battery.py feat(status-bar): add /battery toggle for a color-coded battery read-out 2026-07-21 13:54:11 -05:00
bedrock_adapter.py fix(bedrock): probe real context window instead of stale static table 2026-07-20 05:49:44 -07:00
billing_usage.py
…
billing_view.py fix(billing): rename user-facing "terminal billing" copy to Remote Spending (#68355) 2026-07-21 12:20:25 +05:30
bounded_response.py
…
browser_provider.py
…
browser_registry.py
…
chat_completion_helpers.py fix: widen geo-prefix parity to all Bedrock ID normalization sites 2026-07-20 05:38:45 -07:00
codex_responses_adapter.py
…
codex_runtime.py
…
coding_context.py fix(windows): share one bounded, tree-killing git probe across both call sites (#68997) 2026-07-21 20:18:43 -05:00
context_breakdown.py
…
context_compressor.py fix(compression): harden provider context handoff 2026-07-20 02:25:57 -07:00
context_engine.py fix(compression): harden provider context handoff 2026-07-20 02:25:57 -07:00
context_references.py
…
conversation_compression.py fix(agent): pass persisted-prefix boundary when rotation flushes on cold resume (#68196) 2026-07-21 12:11:31 +05:30
conversation_loop.py Revert "fix(agent): circuit-break AttributeError from commit-splice and detect code skew" 2026-07-21 03:26:17 -07:00
copilot_acp_client.py
…
credential_persistence.py
…
credential_pool.py
…
credential_sources.py
…
credits_tracker.py
…
curator.py
…
curator_backup.py
…
display.py feat(gateway): live per-tool status line on Slack 2026-07-18 12:28:59 -07:00
error_classifier.py fix(error_classifier): stop empty-response advisories from triggering compression 2026-07-18 12:54:58 -07:00
errors.py
…
file_safety.py
…
gemini_native_adapter.py
…
gemini_schema.py
…
i18n.py
…
image_gen_provider.py
…
image_gen_registry.py
…
image_routing.py
…
insights.py
…
iteration_budget.py
…
jiter_preload.py
…
kanban_stop.py
…
learn_prompt.py
…
learning_graph.py
…
learning_graph_render.py
…
learning_mutations.py
…
lmstudio_reasoning.py
…
manual_compression_feedback.py
…
markdown_tables.py
…
memory_manager.py
…
memory_provider.py
…
message_content.py
…
message_sanitization.py
…
moa_loop.py
…
moa_trace.py
…
model_metadata.py fix(codex): send ChatGPT-Account-Id on /models probes 2026-07-21 05:27:13 -07:00
models_dev.py
…
moonshot_schema.py fix(agent): inject empty required array on Moonshot object schemas 2026-07-20 11:05:52 -07:00
nous_rate_guard.py
…
onboarding.py
…
oneshot.py
…
plugin_llm.py
…
portal_tags.py
…
process_bootstrap.py
…
prompt_builder.py fix(matrix): correct platform hint over-claims, add regression tests + docs 2026-07-20 11:10:49 -07:00
prompt_caching.py
…
rate_limit_tracker.py
…
reactions.py
…
reasoning_timeouts.py feat(models): add Claude Sonnet 5 support 2026-07-20 02:25:44 -07:00
redact.py fix(redaction): normalize URL credential key aliases 2026-07-20 02:25:57 -07:00
replay_cleanup.py refactor: shared helpers for api_content sidecar pop/drop/extract 2026-07-19 08:25:35 +05:30
retry_utils.py
…
runtime_cwd.py
…
secret_scope.py
…
shell_hooks.py
…
skill_bundles.py
…
skill_commands.py
…
skill_preprocessing.py
…
skill_utils.py
…
ssl_guard.py
…
ssl_verify.py
…
stream_diag.py
…
stream_single_writer.py
…
subdirectory_hints.py
…
subscription_view.py feat(cli): plan catalog on Free + plan= deep link + top-up/auto-refill copy split (#68689) 2026-07-22 08:11:09 +05:30
system_prompt.py fix: replace hardcoded ~/.hermes with get_hermes_home() in system prompt (#66450) 2026-07-18 19:03:51 -04:00
think_scrubber.py
…
thinking_timeout_guidance.py
…
thread_scoped_output.py
…
title_generator.py
…
tool_dispatch_helpers.py
…
tool_executor.py fix(checkpoints): honor gateway config and task cwd (#68195) 2026-07-20 13:04:12 -07:00
tool_guardrails.py
…
tool_result_classification.py
…
trace_upload.py
…
trajectory.py
…
transcription_provider.py
…
transcription_registry.py
…
tts_provider.py
…
tts_registry.py
…
turn_context.py perf(gateway): byte-stable session context prompts 2026-07-19 14:58:59 +05:30
turn_finalizer.py fix(desktop, ink): don't wipe messages before final message (#65919) 2026-07-20 11:42:29 -04:00
turn_retry_state.py
…
usage_pricing.py fix(pricing): strip apac./au. Bedrock region prefixes so cost isn't unknown 2026-07-20 05:38:45 -07:00
verification_evidence.py fix(desktop, ink): don't wipe messages before final message (#65919) 2026-07-20 11:42:29 -04:00
verification_stop.py
…
verify_hooks.py
…
vertex_adapter.py
…
video_gen_provider.py
…
video_gen_registry.py
…
web_search_provider.py
…
web_search_registry.py
…