Feature: LSP Actor Service — wire LspRuntime and LspToolAdapter into actor execution

  Background:
    Given a clean LSP actor service registry
    And a test workspace directory

  Scenario: LspActorService activates bindings and generates tool specs
    Given an LSP server "local/pyright" is registered with capabilities:
      | DIAGNOSTICS |
      | HOVER       |
      | COMPLETIONS |
    And an actor with LSP bindings:
      | lsp_server_name |
      | local/pyright   |
    When the actor bindings are activated with workspace path
    Then the LSP runtime has started the "local/pyright" server
    And tool specs are generated for the actor:
      | local/pyright/diagnostics |
      | local/pyright/hover       |
      | local/pyright/completions |

  Scenario: LspActorService handles multiple LSP servers
    Given an LSP server "local/pyright" is registered with capabilities:
      | CAPABILITIES |
      | DIAGNOSTICS  |
    And an LSP server "local/eslint" is registered with capabilities:
      | CAPABILITIES |
      | DIAGNOSTICS  |
    And an actor with LSP bindings:
      | lsp_server_name |
      | local/pyright   |
      | local/eslint    |
    When the actor bindings are activated with workspace path
    Then the LSP runtime has started the "local/pyright" server
    And the LSP runtime has started the "local/eslint" server
    And tool specs are generated for both servers

  Scenario: LspActorService deactivates bindings on shutdown
    Given an LSP server "local/pyright" is registered with capabilities:
      | DIAGNOSTICS |
    And an actor with LSP bindings:
      | lsp_server_name |
      | local/pyright   |
    And the actor bindings are activated with workspace path
    When the actor bindings are deactivated
    Then the LSP runtime has released the "local/pyright" server

  Scenario: LspActorService handles missing servers gracefully
    Given an LSP server "local/pyright" is registered with capabilities:
      | DIAGNOSTICS |
    And an actor with LSP bindings:
      | lsp_server_name |
      | local/missing   |
    When the actor bindings are activated with workspace path
    Then the activation completes with warnings
    And no tool specs are generated for the missing server

  Scenario: LspActorService validates input parameters
    Given an LSP server "local/pyright" is registered with capabilities:
      | DIAGNOSTICS |
    And an actor with LSP bindings:
      | lsp_server_name |
      | local/pyright   |
    When activation is attempted with empty actor name
    Then a ValueError is raised with message "actor_name must be a non-empty string"
    When activation is attempted with empty workspace path
    Then a ValueError is raised with message "workspace_path must be a non-empty string"

  Scenario: LspActorService integrates with actor execution
    Given an LSP server "local/pyright" is registered with capabilities:
      | DIAGNOSTICS |
    And an actor "local/code-reviewer" with LSP bindings:
      | lsp_server_name |
      | local/pyright   |
    When the actor is loaded and activated
    Then the actor has access to LSP tools:
      | local/pyright/diagnostics |
    And the LSP server is running in the background

  Scenario: LspActorService tool specs have correct schema
    Given an LSP server "local/pyright" is registered with capabilities:
      | CAPABILITIES |
      | DIAGNOSTICS  |
      | HOVER        |
    And an actor with LSP bindings:
      | lsp_server_name |
      | local/pyright   |
    When the actor bindings are activated with workspace path
    Then each tool spec has required fields:
      | name           |
      | description    |
      | handler        |
      | input_schema   |
    And the input_schema for "local/pyright/diagnostics" requires "file_path"
    And the input_schema for "local/pyright/hover" requires "file_path", "line", "column"
