mcp_server_webcrawl.interactive package
Submodules
mcp_server_webcrawl.interactive.highlights module
- class HighlightProcessor[source]
Bases:
objectShared highlight processing utilities
- QUOTED_PHRASE_PATTERN = re.compile('"([^"]+)"')
- WORD_PATTERN = re.compile('\\b\\w+\\b')
- SNIPPET_MARKER_PATTERN = re.compile("\\*\\*([a-zA-Z\\-_' ]+)\\*\\*")
- IGNORE_WORDS = {'AND', 'NOT', 'OR', 'and', 'id', 'not', 'or', 'size', 'status', 'type', 'url'}
- static extract_search_terms(query)[source]
Extract search terms from query, handling quoted phrases and individual keywords.
- static find_highlights_in_text(text, search_terms)[source]
Find all highlight spans in text for the given search terms.
- Parameters:
- Return type:
- static extract_snippet_highlights(snippet_text)[source]
Extract highlights from snippet text with markers, returning clean text and highlights.
- Parameters:
snippet_text (str) –
- Return type:
- static merge_overlapping_highlights(highlights, text)[source]
Merge overlapping or adjacent highlight spans.
- Parameters:
highlights (List[HighlightSpan]) –
text (str) –
- Return type:
mcp_server_webcrawl.interactive.search module
- class SearchManager[source]
Bases:
objectManages search operations including async search and debouncing. Works with session’s controlled interface - never touches private state directly.
- __init__(session)[source]
- Parameters:
session (InteractiveSession) –
- autosearch(immediate=False)[source]
Trigger search with optional immediate execution.
- Parameters:
immediate (bool) – If True, execute search synchronously without debouncing. If False, use debounced async execution (default).
- Return type:
None
mcp_server_webcrawl.interactive.session module
- class InteractiveSession[source]
Bases:
objectMain session coordinator that manages the interactive terminal application.
Initialize the interactive session with crawler and data source.
- __init__(crawler, datasrc)[source]
Initialize the interactive session with crawler and data source.
- property ui_focused: UiFocusable
- property crawler: BaseCrawler
- property document: SearchDocumentView
- property results: SearchResultsView
- property searchform: SearchFormView
- property searchman: SearchManager
- property sites: list[SiteResult]
- set_ui_state(state, focus=None)[source]
Transition between UI states cleanly.
- Parameters:
state (UiState) –
focus (UiFocusable | None) –
- Return type:
None
- set_init_crawler(crawler)[source]
- Parameters:
crawler (BaseCrawler) –
- Return type:
None
- set_init_searchform(searchform)[source]
- Parameters:
searchform (BaseCursesView) –
- Return type:
None
- get_theme_color_pair(theme)[source]
- Parameters:
theme (ThemeDefinition) –
- Return type:
int | None
mcp_server_webcrawl.interactive.ui module
Bases:
EnumAn enumeration.
- class ThemeDefinition[source]
Bases:
EnumAn enumeration.
- DOCUMENT_MODE = (1, 1, 51)
- HEADER_ACTIVE = (2, 7, 17)
- HEADER_INACTIVE = (3, 7, 233)
- HEADER_OUTER = (4, 7, 235)
- HELP_LINK = (5, 7, 27)
- HTTP_ERROR = (6, 7, 88)
- HTTP_WARN = (7, 7, 130)
- INACTIVE_QUERY = (8, 245, 237)
- SNIPPET_DEFAULT = (9, 243, 0)
- SNIPPET_HIGHLIGHT = (10, 232, 51)
- UI_ERROR = (11, 7, 88)
- class UiFocusable[source]
Bases:
EnumAn enumeration.
- UNDEFINED = 1
- SEARCH_FORM = 2
- SEARCH_RESULTS = 3
- class UiState[source]
Bases:
EnumAn enumeration.
- UNDEFINED = 1
- REQUIREMENTS = 2
- SEARCH_INIT = 3
- SEARCH_RESULTS = 4
- DOCUMENT = 5
- HELP = 6
- class InputRadio[source]
Bases:
objectRadio input with 2-3 possible states (e.g., on/off or state1/state2/off)
- Parameters:
group – The InputRadioGroup this radio belongs to
name – The form radio group name
label – The form radio label
index – The current state index
states – List of InputRadioState objects defining each possible state
- __init__(group, name, label, index, states=None)[source]
Radio input with 2-3 possible states (e.g., on/off or state1/state2/off)
- property current_state
Get the current state
- render(stdscr, y, x, field_index, max_width=None, focused=False)[source]
Render a single radio option.
- class InputRadioGroup[source]
Bases:
objectRadio group with navigation and layout management capabilities.
Radio input group with layout and navigation support.
- Parameters:
name – The form radio group name (“filter”, “sort”, “site”, or “crawler”)
sites – List of SiteResult objects, required only for “site” group type
- set_layout_constraints(available_width, available_height, is_constrained=False)[source]
Set layout constraints for grid-based groups (like sites).
- get_grid_position(radio_index)[source]
Convert linear radio index to grid position. Only applies to site groups; other groups return (radio_index, 0).
- get_index_from_grid(row, col)[source]
Convert grid position to linear radio index. Only works for site groups; returns None for other group types.
Navigate left within this group’s layout.
Navigate right within this group’s layout.
Navigate to a specific row from an external column position.
- class InputRadioState[source]
Bases:
NamedTupleInputRadioState(label, value)
Create new instance of InputRadioState(label, value)
- class InputText[source]
Bases:
objectA reusable text input field with cursor management, rendering, and input handling. Consolidates the common text input functionality used across the application.
Initialize the text input field.
- Parameters:
initial_value – Starting text value
max_length – Maximum allowed text length (None for unlimited)
label – Display label for the field
- insert_char(char)[source]
Insert a character at the current cursor position.
- Parameters:
char (str) –
- Return type:
None