Skip to content

feat(extensions): add custom dialog surfaces - #944

Merged
benvinegar merged 12 commits into
feat/bundled-editor-extensionfrom
feat/bundled-agent-skill-extension
Sep 7, 2026
Merged

feat(extensions): add custom dialog surfaces#944
benvinegar merged 12 commits into
feat/bundled-editor-extensionfrom
feat/bundled-agent-skill-extension

Conversation

@benvinegar

@benvinegar benvinegar commented Aug 31, 2026

Copy link
Copy Markdown
Member

Summary

  • add API v17 ctx.dialogs.open(...) for trusted extensions to render bounded React/OpenTUI components inside Hunk-owned modal chrome
  • provide exact clamped width/height, semantic theme colors, clipboard availability, and guarded close, copy, and notify actions to the mounted component
  • keep queueing, Escape, attribution, geometry, focus isolation/restoration, clipboard mediation, reload retirement, and render-failure containment under host control
  • remount reused component functions per request and make retained actions inert after close, queue promotion, reload, or unmount
  • register hunk.app.openAgentSkill through the bundled UI extension and implement its existing prompt as a custom dialog component

Why a generic dialog surface

The Agent Skill command is a product workflow rather than shared review semantics, so it belongs in a bundled extension. The dialog API now follows the pane model instead of adding a specialized read-only document method: trusted extension code owns the contents, while Hunk owns the modal boundary and lifecycle.

ctx.dialogs.open(...) joins the same FIFO queue as confirm, select, and input. A custom component receives only its bounded geometry, Hunk's public paint theme, clipboard capability, and request-scoped actions. User-installed extensions retain explicit attribution, render failures stay inside the frame, Escape remains host-owned, and unhandled component keys cannot mutate a focused review widget behind the modal.

Before / after

Both captures use the same diff and a 120x24 Linux tmux PTY. Before is the original stacked base; after is the bundled Agent Skill extension. The current generic component implementation preserves this native chrome and interaction.

Before

Agent Skill dialog before the extension migration

After

Agent Skill dialog after the extension migration

Stack

This PR is stacked on #943 and should merge after it. Its base is feat/bundled-editor-extension, so the diff contains only the Agent Skill and generic dialog work.

Verification

  • bun run typecheck
  • bun run lint
  • bun run format:check
  • bun run deps:check
  • bun run check:docs
  • bun run build:npm
  • bun run changeset:status
  • bun run test (3,658 passed, 12 skipped)
  • bun run test:integration (141 passed, 1 skipped)
  • bun run test:tty-smoke (9 passed)
  • website Astro check (0 errors, warnings, or hints)
  • source-run TTY launch on the actual 28-file working-tree diff

Interaction coverage

Integration coverage exercises custom rendering, nested focused inputs, component key hooks, mouse and keyboard copy, rejected clipboard writes, render failures, per-request remounting, stale actions, open-to-input queue promotion, soft reload cleanup, Escape, and prior-focus restoration.

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
hunk-web Ignored Ignored Preview Sep 3, 2026 1:29pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds API v17 custom extension dialog surfaces and migrates Agent Skill onboarding into the bundled UI extension.

  • Adds bounded custom React/OpenTUI dialogs with host-controlled lifecycle, focus, keyboard routing, clipboard mediation, attribution, and failure containment.
  • Registers Agent Skill onboarding as a bundled extension command using the new dialog API.
  • Expands unit, integration, and terminal interaction coverage for dialog rendering and lifecycle behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/ui/lib/extensionDialogs.ts Adds validated custom-dialog requests, FIFO settlement, request-scoped liveness, and clipboard normalization.
src/ui/components/chrome/ExtensionDialog.tsx Renders custom components within host-owned modal chrome with guarded actions and render-failure containment.
src/ui/App.tsx Integrates custom dialogs with clipboard support, focus restoration, keyboard isolation, reload retirement, and bundled commands.
src/extensions/default/ui/agentSkill/index.tsx Implements Agent Skill onboarding as a bundled custom-dialog component with inert unavailable-copy behavior.
src/extension-api/types.ts Introduces API v17 types and contracts for custom extension dialog components and actions.

Sequence Diagram

sequenceDiagram
    participant Extension
    participant Queue as Dialog Queue
    participant Host as Hunk Host
    participant Component as Extension Component
    Extension->>Queue: ctx.dialogs.open(options)
    Queue->>Host: Promote FIFO request
    Host->>Component: Mount with bounds, theme, and guarded actions
    Component->>Host: copy / notify / close
    Host->>Host: Validate current request lease
    Host->>Queue: Settle request on close, Escape, reload, or unmount
    Queue-->>Extension: Resolve open() promise
Loading

Reviews (2): Last reviewed commit: "fix(extensions): harden dialog lifecycle..." | Re-trigger Greptile

Comment thread src/ui/components/chrome/ExtensionDialog.tsx Outdated
@@ -241,7 +241,7 @@ text into a request the host draws, and answering by request id so a duplicated
Enter cannot spill onto whatever was queued behind. App subscribes with

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Documentation exceeds line limit

This edited line exceeds the repository's 120-character limit; the same pattern occurs in website/src/content/docs/docs/extend/extension-api.md:318. Wrapping both lines keeps the documentation consistent with the project style guide.

Context Used: guidelines.mdc Cursor rule (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/extension-architecture.md
Line: 241

Comment:
**Documentation exceeds line limit**

This edited line exceeds the repository's 120-character limit; the same pattern occurs in `website/src/content/docs/docs/extend/extension-api.md:318`. Wrapping both lines keeps the documentation consistent with the project style guide.

**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c206852. Wrapped the edited architecture paragraph and the website API documentation, including the newly documented document-size limits and clipboard normalization behavior.

Responded by OpenCode using openai/gpt-5.6-sol.

@benvinegar
benvinegar marked this pull request as draft August 31, 2026 12:30
…skill-extension

# Conflicts:
#	docs/extensions.md
#	skills/hunk-extensions/SKILL.md
#	website/src/content/docs/docs/extend/extension-api.md
…skill-extension

# Conflicts:
#	docs/extensions.md
#	src/ui/App.tsx
#	website/src/content/docs/docs/extend/extension-api.md
@benvinegar benvinegar changed the title feat(extensions): move agent skill into bundled extension feat(extensions): add custom dialog surfaces Sep 1, 2026
@benvinegar
benvinegar marked this pull request as ready for review September 5, 2026 22:44
@benvinegar
benvinegar merged commit 6e5c0ca into feat/bundled-editor-extension Sep 7, 2026
13 checks passed
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