vibe.interview_modes.base

Protocol definition for interview mode extensions.

InterviewModeExtension

Protocol for interview mode extensions.

Interview modes control the UI layout and behavior for templates. Extensions can register custom modes to provide specialized interfaces without modifying core VIBE code.

Built-in modes (standard) are handled by the registry fallback and don't need explicit extensions.

Attributes:
  • name (str) –

    Mode name used in config.yml (e.g., "review", "assistant"). Must be unique across all registered modes.

get_layout_template

get_layout_template() -> str

Return the Jinja template path for this mode's layout.

The template should extend 'layout/shell.html' and define the main content area.

Returns:
  • str

    Template path relative to the template search path.

  • Example( str ) –

    'layout/review.html' or 'assistant/layout.html'

handle_start

handle_start(template: TemplateData, version: str | None) -> Optional[Response]

Handle the /interview// route for this mode.

Called when a user navigates to a template with this interview_mode. Use this to redirect to a custom entry point, perform initialization, or modify the default behavior.

Parameters:
  • template (TemplateData) –

    The loaded TemplateData for this template.

  • version (str | None) –

    Optional version identifier (None for WORKING_TREE).

Returns:
  • Optional[Response]
    • Response: Override the default behavior (e.g., redirect).
  • Optional[Response]
    • None: Use the standard interview page with this mode's layout.

get_template_context

get_template_context(template: TemplateData, base_context: dict[str, Any]) -> dict[str, Any]

Extend the template context for this mode's layout.

Called when rendering the interview page. Use this to add mode-specific variables or modify the base context.

Parameters:
  • template (TemplateData) –

    The TemplateData being rendered.

  • base_context (dict[str, Any]) –

    Standard context dict containing: - mode: The interview mode name - template_config: Template configuration dict - template_id: Template identifier - version_identifier: Version string - question_panel_ctx: Questions panel context - toolbar_ctx: Toolbar context - preview_ctx: Preview panel context - error_ctx: Error display context - assistant_ctx: Assistant context (if applicable)

Returns:
  • dict[str, Any]

    Extended context dict for the layout template.

  • dict[str, Any]

    Typically returns base_context with additions/modifications.