mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-13 09:01:54 +00:00
* feat(billing): /usage → portal top-up browser handoff
Add the terminal side of the billing slice (phase 2a): start a top-up by
throwing the user to the portal billing page with the top-up modal open. The
terminal does not confirm, poll, or track payment — checkout completes in the
browser and the next /usage shows the new balance.
- nous_account.py: parse organisation.slug/name from /api/oauth/account into
NousPortalAccountInfo; add nous_portal_topup_url() building the org-pinned
{base}/orgs/{slug}/billing?topup=open with a null-slug fallback to the legacy
{base}/billing?topup=open (never /orgs/None/...).
- portal_cli.py: 'hermes portal topup' — fresh account fetch, identity line
(Topping up as <email> / org <name>), browser open with printed-URL fallback,
no-wait closing copy. No polling/confirmation (deferred to 2b).
- account_usage.py: the shared /usage credits block now links the org-pinned
top-up URL (auto-opens the modal) + points to the command.
Depends on NAS #409 (organisation.slug/name + ?topup=open). Do not merge until
that is live on the target env; until then /api/oauth/account returns
organisation: { id } only and the URL falls back to legacy.
* feat(billing): /credits command for balance + top-up handoff
Replace the standalone `hermes portal topup` subcommand with an in-session
/credits slash command — a focused money surface (balance in, top-up out) that
works in the CLI, TUI, and every messaging platform from one registry entry.
- commands.py: register /credits (Info category). Slack is at its 50-slash cap,
so /credits is routed via /hermes credits on Slack only (new
_SLACK_VIA_HERMES_ONLY set) to avoid clamping a canonical command off the
native list and breaking Telegram parity; native everywhere else.
- account_usage.py: build_credits_view() — one portal fetch → balance lines +
identity line + org-pinned top-up URL + depleted flag, consumed by all
surfaces. Reuses the same snapshot/URL builder as /usage so numbers match.
- cli.py: _show_credits() — balance block + identity line + 3-button panel
(Open top-up / Copy link / Cancel) via the existing prompt_toolkit modal.
ASK, never auto-launch; headless falls back to printing the URL.
- gateway/slash_commands.py: _handle_credits_command() — renders the block +
tappable top-up URL + no-wait copy; works on button and plain-text platforms.
- /usage credits line now points to /credits.
- Retire `hermes portal topup` (portal_cli.py back to baseline); the engine
(slug/name parse + nous_portal_topup_url) stays as the shared core.
No polling, no payment confirmation (billing phase 2a). Depends on NAS #409.
* fix(credits): /credits works in the TUI slash-worker (non-interactive)
In the TUI, /credits runs in the slash-worker subprocess where there is no
live prompt_toolkit app and stdin is the JSON-RPC pipe. _show_credits called
the 3-button modal unconditionally, which fell back to reading stdin →
exception → slash.exec rejected → the command produced no output (only the
pre-existing 'Credit access paused' banner showed).
- _show_credits: when self._app is None (TUI worker / piped / non-interactive),
render the text variant — balance block + tappable top-up URL + no-wait line,
same affordance as the messaging surfaces — and skip the modal entirely. The
3-button panel still renders in the interactive CLI.
- Depleted banner copy: 'run /usage for balance' → 'run /credits to top up'
now that /credits is the dedicated money surface (+ tests).
- Regression tests: _show_credits with self._app=None renders text and never
invokes the modal; logged-out path.
* feat(tui): credits.view RPC for the /credits tappable top-up button
Add a credits.view JSON-RPC method returning the structured CreditsView
(logged_in, balance_lines, identity_line, topup_url, depleted) so the TUI can
render a clickable <Link> top-up button instead of plain text. Account-
independent (portal fetch gated on a logged-in Nous account), fail-open to
{logged_in: false} on any hiccup. Mirrors session.usage's credits-block pattern.
Frontend (TUI-local /credits command + Ink component) lands separately.
* feat(tui): /credits command with keyboard-driven top-up confirm
TUI-local /credits: fetches the structured balance via the credits.view RPC,
prints the balance + identity + top-up URL, then arms the EXISTING confirm
overlay (Enter = open top-up in browser via openExternalUrl, Esc = cancel).
Reuses ConfirmReq — no new overlay component/state/input handler. Headless
(openExternalUrl returns false) falls back to printing the URL.
- gatewayTypes.ts: CreditsViewResponse.
- commands/credits.ts: the command (mirrors /status's rpc+guarded pattern).
- registry.ts: register creditsCommands.
- test: balance+overlay armed, headless fallback, no-url, logged-out (4 cases).
Matches the CLI /credits 'Enter to open' affordance. Phase 2a: no polling.
|
||
|---|---|---|
| .. | ||
| lsp | ||
| transports | ||
| __init__.py | ||
| test_anthropic_adapter.py | ||
| test_anthropic_keychain.py | ||
| test_anthropic_kwargs_sanitize.py | ||
| test_anthropic_mcp_prefix_strip.py | ||
| test_anthropic_oauth_pkce.py | ||
| test_anthropic_output_field_leak.py | ||
| test_anthropic_thinking_block_order.py | ||
| test_arcee_trinity_overrides.py | ||
| test_async_utils.py | ||
| test_auxiliary_client.py | ||
| test_auxiliary_client_anthropic_custom.py | ||
| test_auxiliary_client_azure_foundry.py | ||
| test_auxiliary_client_xai_oauth_recovery.py | ||
| test_auxiliary_config_bridge.py | ||
| test_auxiliary_main_first.py | ||
| test_auxiliary_named_custom_providers.py | ||
| test_auxiliary_transport_autodetect.py | ||
| test_auxiliary_user_default_headers.py | ||
| test_azure_identity_adapter.py | ||
| test_bedrock_1m_context.py | ||
| test_bedrock_adapter.py | ||
| test_bedrock_integration.py | ||
| test_cascading_interrupt_6600.py | ||
| test_codex_cloudflare_headers.py | ||
| test_codex_responses_adapter.py | ||
| test_codex_ttfb_watchdog.py | ||
| test_coding_context.py | ||
| test_compress_focus.py | ||
| test_compression_concurrent_fork.py | ||
| test_compression_logging_session_context.py | ||
| test_compressor_historical_media.py | ||
| test_compressor_image_tokens.py | ||
| test_compressor_media_stripping.py | ||
| test_context_compressor.py | ||
| test_context_compressor_cross_session_guard.py | ||
| test_context_compressor_summary_continuity.py | ||
| test_context_compressor_temporal_anchoring.py | ||
| test_context_engine.py | ||
| test_context_engine_host_contract.py | ||
| test_context_references.py | ||
| test_copilot_acp_client.py | ||
| test_copilot_acp_deprecation.py | ||
| test_credential_pool.py | ||
| test_credential_pool_routing.py | ||
| test_credits_cold_start.py | ||
| test_credits_fixture_snapshot.py | ||
| test_credits_policy.py | ||
| test_credits_tracker.py | ||
| test_credits_view.py | ||
| test_crossloop_client_cache.py | ||
| test_curator.py | ||
| test_curator_activity.py | ||
| test_curator_backup.py | ||
| test_curator_classification.py | ||
| test_curator_reports.py | ||
| test_custom_provider_extra_body.py | ||
| test_custom_providers_vision.py | ||
| test_deepseek_anthropic_thinking.py | ||
| test_direct_provider_url_detection.py | ||
| test_display.py | ||
| test_display_emoji.py | ||
| test_display_todo_progress.py | ||
| test_display_tool_failure.py | ||
| test_error_classifier.py | ||
| test_external_skills.py | ||
| test_external_skills_dirs_cache.py | ||
| test_file_safety.py | ||
| test_file_safety_container_mirror.py | ||
| test_file_safety_credentials.py | ||
| test_file_safety_cross_profile.py | ||
| test_file_safety_sandbox_mirror.py | ||
| test_gemini_cloudcode.py | ||
| test_gemini_fast_fallback.py | ||
| test_gemini_free_tier_gate.py | ||
| test_gemini_native_adapter.py | ||
| test_gemini_schema.py | ||
| test_i18n.py | ||
| test_image_gen_registry.py | ||
| test_image_routing.py | ||
| test_insights.py | ||
| test_jiter_preload.py | ||
| test_kimi_coding_anthropic_thinking.py | ||
| test_last_total_tokens.py | ||
| test_local_stream_timeout.py | ||
| test_markdown_tables.py | ||
| test_memory_async_sync.py | ||
| test_memory_provider.py | ||
| test_memory_session_switch.py | ||
| test_memory_user_id.py | ||
| test_minimax_auxiliary_url.py | ||
| test_minimax_provider.py | ||
| test_model_metadata.py | ||
| test_model_metadata_local_ctx.py | ||
| test_model_metadata_ssl.py | ||
| test_models_dev.py | ||
| test_moonshot_schema.py | ||
| test_non_stream_stale_timeout.py | ||
| test_nous_credits_gauge.py | ||
| test_nous_credits_snapshot.py | ||
| test_nous_oauth_401_guidance.py | ||
| test_nous_rate_guard.py | ||
| test_onboarding.py | ||
| test_openrouter_response_cache.py | ||
| test_plugin_llm.py | ||
| test_portal_tags.py | ||
| test_prompt_builder.py | ||
| test_prompt_caching.py | ||
| test_proxy_and_url_validation.py | ||
| test_rate_limit_tracker.py | ||
| test_redact.py | ||
| test_resume_stale_active_task.py | ||
| test_runtime_cwd.py | ||
| test_save_url_image.py | ||
| test_set_runtime_main_custom_provider.py | ||
| test_shell_hooks.py | ||
| test_shell_hooks_consent.py | ||
| test_skill_bundles.py | ||
| test_skill_commands.py | ||
| test_skill_commands_reload.py | ||
| test_skill_utils.py | ||
| test_stream_read_timeout_floor.py | ||
| test_streaming_context_scrubber.py | ||
| test_subagent_progress.py | ||
| test_subagent_stop_hook.py | ||
| test_subdirectory_hints.py | ||
| test_summary_prefix_semantics.py | ||
| test_system_prompt.py | ||
| test_system_prompt_restore.py | ||
| test_think_scrubber.py | ||
| test_title_generator.py | ||
| test_tool_dispatch_helpers.py | ||
| test_tool_guardrails.py | ||
| test_tool_result_classification.py | ||
| test_transcription_registry.py | ||
| test_tts_registry.py | ||
| test_turn_context.py | ||
| test_turn_retry_state.py | ||
| test_unsupported_parameter_retry.py | ||
| test_unsupported_temperature_retry.py | ||
| test_usage_pricing.py | ||
| test_video_gen_registry.py | ||
| test_vision_resolved_args.py | ||
| test_vision_routing_31179.py | ||