mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
Unified streaming architecture combining the best of PRs #774 and #798, with improvements. This is a draft — awaiting proper streaming token implementation and testing before merge. Layer 1 — Core streaming (run_agent.py): - stream_delta_callback on AIAgent.__init__ (per-instance) - _interruptible_streaming_api_call() for chat completions with SimpleNamespace response reconstruction - Tool-call suppression (callback only fires for text-only responses) - on_first_delta callback (stops thinking spinner on first token) - Provider fallback when streaming unsupported - reasoning_content accumulation - Interrupt support (client.close() + rebuild) Layer 2 — Display (cli.py, gateway/): - CLI: line-buffered _stream_delta/_flush_stream via _cprint - Gateway: async stream consumer with dual transport: * Draft (Bot API 9.3+ sendMessageDraft) as primary * Progressive editMessageText as fallback * Auto mode tries draft, falls back seamlessly - Config-driven: streaming.enabled, edit_interval, buffer_threshold, cursor, transport (auto/draft/edit) - Uses self.config (no duplicate yaml reads) - already_sent flag prevents duplicate sends in base.py Telegram-specific (gateway/platforms/telegram.py): - send_raw / edit_message_raw (plain text, no MarkdownV2) - send_draft / finalize_draft (Bot API 9.3+) - delete_message - All methods pass message_thread_id for forum topic support (fix for #774's missing thread_id bug) Tests: 10 new tests covering accumulator shape, callback order, tool-call suppression, provider fallback, already_sent contract. Config example: streaming: enabled: true edit_interval: 1.0 buffer_threshold: 100 cursor: ' ▉' transport: auto # auto, draft, or edit Supersedes: #774 (jobless0x), #798 (OutThisLife), #697 (clicksingh) |
||
|---|---|---|
| .. | ||
| agent | ||
| cron | ||
| fakes | ||
| gateway | ||
| hermes_cli | ||
| honcho_integration | ||
| integration | ||
| skills | ||
| tools | ||
| __init__.py | ||
| conftest.py | ||
| test_413_compression.py | ||
| test_860_dedup.py | ||
| test_api_key_providers.py | ||
| test_atomic_json_write.py | ||
| test_auth_codex_provider.py | ||
| test_auth_nous_provider.py | ||
| test_auxiliary_config_bridge.py | ||
| test_batch_runner_checkpoint.py | ||
| test_cli_init.py | ||
| test_cli_loading_indicator.py | ||
| test_cli_model_command.py | ||
| test_cli_provider_resolution.py | ||
| test_codex_execution_paths.py | ||
| test_codex_models.py | ||
| test_display.py | ||
| test_external_credential_detection.py | ||
| test_fallback_model.py | ||
| test_file_permissions.py | ||
| test_flush_memories_codex.py | ||
| test_hermes_state.py | ||
| test_honcho_client_config.py | ||
| test_insights.py | ||
| test_model_provider_persistence.py | ||
| test_model_tools.py | ||
| test_personality_none.py | ||
| test_provider_parity.py | ||
| test_quick_commands.py | ||
| test_resume_display.py | ||
| test_run_agent.py | ||
| test_run_agent_codex_responses.py | ||
| test_runtime_provider_resolution.py | ||
| test_streaming.py | ||
| test_timezone.py | ||
| test_toolset_distributions.py | ||
| test_toolsets.py | ||
| test_trajectory_compressor.py | ||
| test_worktree.py | ||