def on_input_changed(self, event: Input.Changed) -> None:
        """Filter list items based on input"""
        filter_text = event.value.lower()
        list_view = self.query_one("#trajectory-list", ListView)

        # Filter items and keep track of original indices
        self.filtered_indices = [i for i, item in enumerate(self.all_items) if filter_text in item.lower()]
        filtered_items = [self.all_items[i] for i in self.filtered_indices]

        if len(filtered_items) == 1:
            # Find the index of the filtered item in the original list
            selected_index = self.all_items.index(filtered_items[0])
            self.dismiss(selected_index)
            return

        # Update ListView with filtered items
        list_view.clear()
        for item in filtered_items:
            list_view.append(ListItem(Static(item, markup=False)))
Filter list items based on input
sweagent/run/inspector_cli.py