Feature: Real LLM actor invocation in session tell
  As a user of CleverAgents
  I want `agents session tell` to invoke the real orchestrator actor
  So that I get meaningful AI responses instead of stub acknowledgements

  Background:
    Given a session tell LLM mock environment

  @session_tell_llm
  Scenario: Real LLM response is returned and persisted
    Given a session with actor "openai/gpt-4" exists
    When I invoke session tell with prompt "What can you do?"
    Then the tell command returns the LLM response
    And the assistant message is persisted to the session
    And token usage is recorded

  @session_tell_llm
  Scenario: --stream flag yields incremental tokens
    Given a session with actor "openai/gpt-4" exists
    When I invoke session tell with --stream and prompt "Hello"
    Then the streamed output contains the LLM response tokens
    And the assistant message is persisted after streaming

  @session_tell_llm
  Scenario: No actor configured raises clear error with exit code 1
    Given a session with no actor exists
    When I invoke session tell with prompt "Hello"
    Then the tell command exits with code 1
    And the error output mentions actor configuration

  @session_tell_llm
  Scenario: --actor flag overrides the session's bound actor
    Given a session with actor "anthropic/claude-3-haiku" exists
    When I invoke session tell with --actor "openai/gpt-4" and prompt "Hello"
    Then the tell command uses the override actor "openai/gpt-4"
    And the tell command returns the LLM response

  @session_tell_llm
  Scenario: --format json output includes usage object
    Given a session with actor "openai/gpt-4" exists
    When I invoke session tell with --format json and prompt "What can you do?"
    Then the tell output is valid JSON with a data envelope
    And the data section contains the session_id
    And the data section contains a usage object with expected keys

  @session_tell_llm
  Scenario: --stream --format json produces valid JSON with usage
    Given a session with actor "openai/gpt-4" exists
    When I invoke session tell with --stream --format json and prompt "Hello"
    Then the tell output is valid JSON with a data envelope
    And the data section contains a usage object with expected keys

  @session_tell_llm
  Scenario: Usage panel appears in Rich output
    Given a session with actor "openai/gpt-4" exists
    When I invoke session tell with prompt "What can you do?"
    Then the tell command returns the LLM response
    And the output contains a Usage panel
