Hosanna UI API v2.3.0-next
    Preparing search index...

    Remote debug client extension for the hosanna-debugger MCP proxy:

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    addOnConnectionOpenListener analyzeRendererEvents analyzeViewEvents buildFocusContext buildViewLifecycleInfo captureCustomViewState captureCustomViewStateFromView configure connect detectStateCycles disconnnect dispatchRemoteDebugCommand extractRowsSlice extractSingleRow extractViewInfo findCollectionViewByHid findRendererByHid findViewByHid getAppId getIsConnected getIsKeyEventNotificationsEnabled getPhaseInfo getRenderedCells getRendererType handleCaptureScreenshot handleGetAppStructure handleGetCVRowLifecycleTrace handleGetDebugContext handleGetFocusGraph handleGetFocusResolutionTrace handleGetHandlerTrace handleGetHsViewByHidWithCVFallback handleGetRenderFrequencyTrace handleGetRenderTrace handleGetRowsSlice handleGetTestStatus handleGetTestStatusInternal handleGetViewLifecycle handleReloadPage handleResetPerfData handleSetCVRowLifecycleTracing handleSetFocusTracing handleSetHandlerTracing handleSetLifecycleTracing handleSetRenderFrequencyTracing handleSetRenderTracing handleValidateDataBindings peekRenderedCells processRemoteDebugCommand relayOnFocusedViewChanged relayOnKeyDown safeCall sendExternalDebugResponse serializeCVElement setKeyEventNotificationsEnabled traceValuesDiffer trackValueForCycleDetection unwrapAllRenderFreqTracedNodes unwrapAllTracedHandlers unwrapAllTracedLifecycleViews unwrapAllTracedRows unwrapAllTracedViews validateCellDataBindings wrapCustomViewLifecycle wrapFieldSetter wrapGetSubViewTemporarily wrapRendererNode wrapRenderersByType wrapRowLifecycle wrapViewForRenderFreq wrapViewHandlers wrapViewPhase wrapViewPropertySetters wrapViewSetState

    Constructors

    Properties

    currentRequestId?: string
    currentTraceEvent: null | IHandlerTraceEvent = null

    Current trace event being recorded (set during handler execution). Used by property change and getSubView wrappers to append data.

    cvRowTraceEnabled: boolean = false

    Whether CV row lifecycle tracing is enabled

    cvRowTraceEvents: ICVRowLifecycleEvent[] = []

    Recorded row lifecycle events

    cvRowTraceStart: number = 0

    When tracing started

    handlerTraceEnabled: boolean = false

    Whether handler tracing is currently active

    handlerTraceEvents: IHandlerTraceEvent[] = []

    Recorded handler execution events

    handlerTraceStart: number = 0

    Timestamp when handler tracing started

    lifecycleTraceEnabled: boolean = false

    Whether lifecycle tracing is currently active

    originalCustomViewMethods: Map<string, (...args: unknown[]) => unknown> = ...

    Stores original CustomViewRow inner view methods (hibernateView, wakeView). Key: ${customViewHid}:${methodName} Value: original bound method

    originalFieldSetters: Map<string, (value: unknown) => void> = ...

    Original field setter functions for wrapped renderers. Key: ${nodeHid}:${fieldName} Value: original setter function

    originalGetSubViewMethods: Map<string, BoundGetSubView> = ...

    Stores original getSubView methods for wrapped views (when tracking getSubView). Key: viewHid Value: original bound getSubView function

    originalHandlerMethods: Map<string, TracedHandlerFn> = ...

    Stores original handler methods for wrapped views. Key: ${viewHid}:${handlerName} Value: original bound handler function

    originalRenderMethods: Map<string, () => void> = ...

    Original render methods for wrapped renderers

    originalRowMethods: Map<string, (...args: unknown[]) => unknown> = ...

    Stores original row methods for wrapped rows. Key: ${rowHid}:${methodName} (methodName = 'onEnterScreen' | 'onExitScreen') Value: original bound method

    originalSetStateMethods: Map<string, (field: string, value: any) => void> = ...

    Stores original setField methods for wrapped views. Key: view._hid, Value: original bound setField function Used to restore views when tracing is disabled.

    Note: We use any here because BaseView.setField has a generic signature setField<K extends keyof T>(field: K, value: T[K]) where T varies per view. Since we're storing/restoring without modification, the exact type doesn't matter.

    originalViewPhaseDescriptors: Map<string, PropertyDescriptor> = ...

    Stores original viewPhase property descriptors for wrapped views. Key: view._hid Value: original property descriptor from prototype Used to restore views when tracing is disabled.

    pendingTriggerField?: string

    Pending trigger field (set by field setter, consumed by render wrapper)

    phaseNames: string[] = ...

    Map phase number to human-readable name

    phaseTimestamps: Map<
        string,
        {
            history: { fromPhase: number; timestamp: number; toPhase: number }[];
            phase: number;
            since: number;
        },
    > = ...

    Tracks phase timestamps for wrapped views. Key: view._hid Value: { phase, since (timestamp), history of changes }

    recentFieldValues: Map<string, { timestamps: number[]; values: unknown[] }> = ...

    Recent field values for cycle detection. Key: ${targetHid}:${fieldName} Value: { values: [], timestamps: [] }

    rendererEvents: IRendererCallEvent[] = []

    Recorded renderer-level events

    renderFreqEnabled: boolean = false

    Whether render frequency tracing is enabled

    renderFreqEnd: number = 0

    When tracing ended (for duration calculation after disable)

    renderFreqHotspotThreshold: number = 10

    Hotspot threshold in calls/sec

    renderFreqStart: number = 0

    When tracing started

    renderTraceEnabled: boolean = false

    Whether render tracing is currently active

    renderTraceMutations: {
        newValue: unknown;
        oldValue: unknown;
        property: string;
        timestamp: number;
        triggeredRebuild: boolean;
        viewHid: string;
        viewId: string;
        viewType: string;
    }[] = []

    Recorded state mutations from wrapped views. Each entry captures: which view, what property, old/new values.

    renderTraceRebuilds: {
        childrenRebuilt: number;
        duration_ms: number;
        timestamp: number;
        trigger: "unknown" | "parent" | "mount" | "setState";
        triggerProperty?: string;
        viewHid: string;
        viewId: string;
        viewType: string;
    }[] = []

    Recorded rebuild events (when getViews is called). Note: Rebuild tracking requires additional instrumentation not yet implemented.

    renderTraceStart: number = 0

    Timestamp when tracing started (for duration calculation)

    tracedCvHid: string = ''

    _hid of the traced CollectionView

    tracedFreqViewHids: string[] = []

    List of view _hids being traced

    tracedHandlerNames: TracedHandlerName[] = []

    Which handlers are being traced

    tracedHandlerViewHids: string[] = []

    List of _hids currently being handler-traced

    tracedLifecycleViewHids: string[] = []

    List of _hids currently being lifecycle-traced

    tracedRendererHids: string[] = []

    List of renderer _hids being traced

    tracedRowIndices: number[] = []

    Row indices being watched

    tracedViewHids: string[] = []

    List of _hids currently being traced. Used for reporting and cleanup.

    trackGetSubView: boolean = true

    Whether to track getSubView calls during handler execution

    trackPropertyChanges: boolean = true

    Whether to track property changes during handler execution

    viewStateEvents: IViewStateEvent[] = []

    Recorded view-level events

    CYCLE_WINDOW_MS: 250

    Cycle detection window in ms

    Methods

    • Register a callback when the remote debug WebSocket connects (or immediately if already connected). Used to flush early remote.log() calls that occur before on_open.

      Parameters

      • listener: () => void

      Returns void

    • Analyzes renderer events and produces per-renderer stats.

      Parameters

      • durationSec: number

      Returns IRendererStats[]

    • Analyzes view events and produces per-view stats.

      Parameters

      • durationSec: number

      Returns IViewStats[]

    • Build focus context with siblings and parent focus manager info.

      Returns null | IFocusContext

    • Builds lifecycle info for a view and optionally its descendants.

      When lifecycle tracing is enabled for a view:

      • currentPhaseDuration_ms shows how long it's been in current phase
      • phaseHistory shows all transitions since tracing started
      • stuckViews include stuckDuration_ms

      When tracing is disabled:

      • Only point-in-time phase snapshot is available
      • No duration information

      Parameters

      • view: BaseView.BaseView<ViewState>

        The view to inspect

      • includeChildren: boolean

        Whether to recursively check children for stuck views

      Returns {
          _hid: string;
          childrenCount: number;
          currentPhaseDuration_ms?: number;
          customViewInfo?: {
              _hid: string;
              id: string;
              rendererAttached: boolean;
              type: string;
              viewPhase: number;
              viewPhaseName: string;
          };
          id: string;
          isOnScreen?: boolean;
          phaseHistory?: {
              fromPhase: number;
              fromPhaseName: string;
              timestamp: number;
              toPhase: number;
              toPhaseName: string;
          }[];
          rendererAttached: boolean;
          rendererParentHid?: string;
          rowIndex?: number;
          stuckViews: {
              _hid: string;
              id: string;
              stuckDuration_ms?: number;
              viewPhase: number;
              viewPhaseName: string;
          }[];
          tracingEnabled: boolean;
          type: string;
          viewPhase: number;
          viewPhaseName: string;
      }

    • Parameters

      • app: BaseApp.BaseApp
      • OptionalwebAppServerPort: number
      • OptionaldeviceAppServerPort: number
      • OptionalassignPortConnectionTimeoutMs: number
      • OptionalconfigAppName: string
      • OptionalmanagementServerPort: number

      Returns void

    • Starts the remote debugger by initializing and connecting the WebSocketClient. Requests port assignment from the management server for multi-app support unless the caller supplies an explicit direct port.

      Parameters

      • ip: string
      • Optionalport: number

      Returns void

    • Detects state cycling patterns from tracked field values. A cycle is when value goes A→B→A (or more) within the window.

      Parameters

      • durationMs: number

      Returns IStateCycleEvent[]

    • Extracts row and cell data from CV for specific row indices. Much lighter than full GetCollectionView serialization when targeting specific rows.

      Parameters

      • cv: BaseView.BaseView<ViewState>
      • OptionalrowIndices: number[]
      • options: {
            includeCellIdentity?: boolean;
            includeCells?: boolean;
            includeCellTranslation?: boolean;
            maxCellsPerRow?: number;
        } = {}

      Returns IRowsSliceResult

    • Parameters

      • rowIdx: number
      • row: ICVRowInternal
      • options: {
            includeCellIdentity?: boolean;
            includeCells?: boolean;
            includeCellTranslation?: boolean;
            maxCellsPerRow?: number;
        } = {}

      Returns IRowSliceRow

    • Finds a renderer by its _hid in the view hierarchy.

      Parameters

      Returns unknown

    • Gets phase info for a view, including duration if tracing is enabled.

      Parameters

      Returns {
          name: string;
          phase: number;
          tracking?: {
              history: { fromPhase: number; timestamp: number; toPhase: number }[];
              since: number;
          };
      }

      Phase number, name, and optional tracking data

    • Parameters

      • row: ICVRowInternal

      Returns unknown[]

    • Gets the renderer type name (e.g., 'WebSGPoster').

      Parameters

      • renderer: unknown

      Returns string

    • Returns void

    • Returns void

    • Handles GetCVRowLifecycleTrace command.

      Returns the collected trace data and optionally clears it.

      Parameters

      Returns void

    • Returns void

    • Returns void

    • Returns void

    • Handles GetHandlerTrace command.

      Returns the collected trace data and optionally clears it.

      Parameters

      Returns void

    • Handle GetHsViewByHid with fallback to CollectionView rows/cells. Returns true if handled (found in CV), false to let base class handle it.

      Parameters

      Returns boolean

    • Returns the collected render trace data.

      Includes:

      • enabled: whether tracing is currently active
      • startTime: when tracing began
      • mutations: array of state changes with before/after values
      • rebuilds: array of getViews calls (if instrumented)

      Returns void

    • Handles GetRowsSlice command.

      Returns row and cell data for specific row indices - much lighter than GetCollectionView when you only need specific rows. Includes essential data for animation tracking and debugging.

      Payload: { cv_hid?: string, row_indices?: number[], include_cells?: boolean, max_cells_per_row?: number, include_cell_identity?: boolean, include_cell_translation?: boolean } Response: { cv_hid, rows: [{ index, translation, rowLabel, cells: [{ index, translation, cellTitle, ... }] }] }

      Parameters

      Returns void

      // Get data for rows 0, 1, 2 of a specific CV
      GetRowsSlice({ cv_hid: "506", row_indices: [0, 1, 2] })

      // Get only row-level state for animation/focus tracking without rendered cell extraction
      GetRowsSlice({ row_indices: [0], include_cells: false })

      // Limit cell payload size and omit expensive identity/translation fields
      GetRowsSlice({
      row_indices: [0],
      max_cells_per_row: 4,
      include_cell_identity: false,
      include_cell_translation: false
      })

      // Get all rows of first CV found (use sparingly - prefer specific indices)
      GetRowsSlice({})
    • Returns void

    • Returns void

    • Handles GetViewLifecycle command.

      Returns lifecycle info for a view including:

      • Current viewPhase and human-readable name
      • If tracing enabled: duration in current phase, phase history
      • Stuck views (phase < 2) with optional duration

      Parameters

      Returns void

    • Returns void

    • Handles SetCVRowLifecycleTracing command.

      Parameters

      Returns void

      // Enable tracing for specific rows
      SetCVRowLifecycleTracing({
      enabled: true,
      cv_hid: "506",
      watch_row_indices: [0, 1, 2]
      })

      // Disable and cleanup
      SetCVRowLifecycleTracing({ enabled: false })
    • Handles SetHandlerTracing command.

      Parameters

      Returns void

      // Enable tracing for specific views and handlers
      SetHandlerTracing({
      enabled: true,
      watch_hids: ["1234"],
      handlers: ["onFocusedChildChange"],
      track_property_changes: true,
      track_getSubView: true
      })

      // Disable and cleanup
      SetHandlerTracing({ enabled: false })
    • Handles SetLifecycleTracing command.

      When enabled with watch_hids:

      • Wraps viewPhase setter on each specified view
      • Records initial phase and timestamp
      • Subsequent phase changes are logged with timestamps

      When disabled:

      • Restores original viewPhase property descriptors
      • Clears timestamp tracking

      Parameters

      Returns void

      // Enable tracing for specific views
      SetLifecycleTracing({ enabled: true, watch_hids: ["506", "434"] })

      // Disable and cleanup
      SetLifecycleTracing({ enabled: false })
    • Handles SetRenderTracing command.

      When enabled with watch_hids:

      • Wraps setState on each specified view
      • Mutations are logged to renderTraceMutations

      When disabled:

      • Restores original setState methods
      • Clears mutation/rebuild arrays

      Parameters

      Returns void

      // Enable tracing for specific views
      SetRenderTracing({ enabled: true, watch_hids: ["506", "434"] })

      // Disable and cleanup
      SetRenderTracing({ enabled: false })
    • Parameters

      • row: ICVRowInternal

      Returns unknown[]

    • Focus relay: called when focused view changes (from FocusManager via focus-dev-relay).

      Parameters

      • focus: FocusSnapshotRelayPayload

      Returns void

    • Focus relay: called when a key is pressed (from FocusManager via focus-dev-relay).

      Parameters

      • keyName: string
      • focus: FocusSnapshotRelayPayload

      Returns void

    • Call a method if it exists, swallowing errors. Returns undefined on failure.

      Type Parameters

      • T

      Parameters

      • fn: undefined | (() => T)
      • thisArg: unknown

      Returns undefined | T

    • Type Parameters

      • T extends keyof RemoteDebugResponsePayloadMap

      Parameters

      • command: T
      • data: RemoteDebugResponsePayloadMap[T]

      Returns void

    • Serialize a CollectionView row or cell with debug-relevant properties.

      Parameters

      • element: FindViewByHidResult

      Returns JsonData

    • Roku-safe value inequality (avoids === on IHsIdentifiable; HS-1054 / HS-1074).

      Parameters

      • a: unknown
      • b: unknown

      Returns boolean

    • Tracks a value for state cycling detection. Detects patterns like A→B→A within a short window.

      Parameters

      • targetHid: string
      • field: string
      • value: unknown
      • targetType: "view" | "renderer"

      Returns void

    • Unwraps all render frequency traced nodes.

      Returns void

    • Restores all original handler methods and getSubView methods.

      Returns void

    • Restores original viewPhase property descriptors on all traced views.

      Deletes the instance-level property override, which automatically restores access to the prototype's getter/setter.

      Called when tracing is disabled to ensure views return to their normal behavior with zero overhead.

      Returns void

    • Restores all wrapped row methods to their originals.

      Returns void

    • Restores original setField methods on all traced views.

      Called when tracing is disabled to ensure views return to their normal behavior with zero overhead.

      Returns void

    • Parameters

      Returns {
          cellHid: string;
          configBindings: string[];
          itemFields: string[];
          mismatches: { binding: string; expectedField: string; suggestion?: string }[];
          settingsKey: string;
          unusedFields: string[];
      }

    • Wraps a CustomViewRow's inner customView's hibernateView and wakeView methods.

      Parameters

      • customView: unknown
      • rowIndex: number
      • rowHid: string
      • rowType: string

      Returns void

    • Wraps a single field setter on a renderer to detect trigger fields.

      Parameters

      • renderer: unknown
      • field: string
      • nodeHid: string

      Returns void

    • Temporarily wraps getSubView on a view to log calls during handler execution.

      Parameters

      Returns BoundGetSubView

      The original getSubView method to restore after handler completes

    • Wraps a single renderer node for render frequency tracking.

      Parameters

      • renderer: unknown
      • boundViewHid: string

      Returns void

    • Recursively finds and wraps all renderers of specified types.

      Parameters

      Returns void

    • Wraps a row's lifecycle methods (onEnterScreen, onExitScreen). For CustomViewRow, also wraps the inner customView's hibernateView/wakeView.

      Parameters

      • row: unknown
      • rowIndex: number

      Returns boolean

    • Wraps a view's renderer for render frequency tracking.

      Parameters

      Returns void

    • Wraps a view's event handlers to intercept calls and log trace data.

      Parameters

      • hid: string

        The _hid of the view to wrap

      • handlers: TracedHandlerName[]

        Which handlers to wrap

      Returns boolean

      true if view was found and at least one handler wrapped

    • Wraps a view's viewPhase property to intercept phase changes.

      The wrapper:

      1. Records timestamp when phase changes
      2. Maintains history of phase transitions
      3. Calls original setter to apply the change

      Uses Object.defineProperty to override the prototype's getter/setter with an instance-level property that intercepts writes.

      Parameters

      • hid: string

        The _hid of the view to wrap

      Returns boolean

      true if view was found and wrapped, false otherwise

    • Wraps common property setters on a view to track changes.

      We wrap the 'visible' property since that's a common source of bugs (parent handler setting visible=true after child set it false).

      Parameters

      Returns void

    • Wraps a view's setField method to intercept state mutations.

      The wrapper:

      1. Logs each property change to renderTraceMutations
      2. Calls the original setField to apply changes normally

      Parameters

      • hid: string

        The _hid of the view to wrap

      Returns boolean

      true if view was found and wrapped, false otherwise

      decorator calls setLayoutField() which calls setField()

      • setState() internally calls setField() for each property So setField() is the true bottleneck for all state mutations.