Skip to content

feat(extensions): add pane activation callback - #965

Merged
benvinegar merged 1 commit into
mainfrom
feat/extension-pane-activate
Sep 1, 2026
Merged

benvinegar merged 1 commit into
mainfrom
feat/extension-pane-activate

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

  • add extension API v16 with an optional onActivate() callback for docked panes
  • invoke it on primary mouse press from the host-owned pane boundary, including buffered <scrollbox> body content
  • preserve extension-local mouse propagation and contain thrown or rejected callbacks as attributed warnings
  • document the contract and ship a minor Changeset

Why core

Hunk owns the pane rectangle and is the only layer that can reliably observe presses across native OpenTUI scrollbox content. This is a generic focus/active-state capability for extension panes; it adds no integration-specific behavior.

Testing

  • bun run typecheck
  • bun run lint
  • bun run format:check
  • bun run deps:check
  • bun run check:docs
  • bun run changeset:status
  • bun run test (2,152 passed, 3 skipped)
  • bun run test:integration (140 passed, 1 macOS-only skipped)
  • bun run test:tty-smoke (9 passed)

The new PTY fixture exercises the real Hunk TUI at 240x24 in stack layout on Linux and clicks content inside an extension-owned scrollbox. There is no visual styling change, so no before/after media is included. macOS and Windows were not run locally.

Scope

This observes primary presses without changing focus policy itself. OpenTUI scrollbar thumb/track controls remain scrollbar-owned because they intentionally stop mouse propagation.

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hunk-web Ready Ready Preview Sep 1, 2026 4:00am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds extension API version 16 with a pane-wide onActivate() callback for primary mouse presses and contains synchronous throws and rejected thenables as attributed warnings.

  • Validates activation callbacks during pane registration.
  • Routes primary presses from the host-owned pane boundary while preserving child interaction.
  • Adds unit and PTY coverage for nested scrollbox content and failure containment.
  • Updates public documentation and includes a minor changeset.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issues identified.

The public type, registration validation, host event routing, failure containment, documentation, and unit and PTY coverage are aligned for the new pane activation behavior.

Important Files Changed

Filename Overview
src/ui/components/panes/ExtensionPane.tsx Adds primary-button pane activation at the host boundary and contains synchronous and asynchronous callback failures.
src/extension-api/types.ts Advances the public extension API generation to 16 and adds the optional pane activation callback.
src/extensions/runExtension.ts Validates that a supplied pane activation callback is callable before registration.
src/ui/components/panes/ExtensionPane.test.tsx Covers nested scrollbox event propagation, secondary-button exclusion, child interaction, and callback failure containment.
test/pty/extensions-integration.test.ts Exercises pane activation through real PTY mouse routing into buffered scrollbox content.
docs/extensions.md Documents API version 16 and the activation callback’s trigger, propagation, and failure semantics.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant C as Extension content
    participant H as Pane host
    participant E as onActivate callback
    participant N as Notification sink
    U->>C: Primary mouse press
    C-->>H: Mouse event bubbles
    H->>E: Invoke onActivate()
    alt callback succeeds
        E-->>H: void or fulfilled thenable
    else callback throws or rejects
        E-->>H: Error
        H->>N: Attributed warning
    end
    C-->>U: Extension-local interaction continues
Loading

Reviews (1): Last reviewed commit: "feat(extensions): add pane activation ca..." | Re-trigger Greptile

@benvinegar
benvinegar merged commit 034796a into main Sep 1, 2026
13 checks passed

This branch was successfully deployed

1 active deployment
Preview 5d3fadc5 Deployed Sep 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant