Reference example proposal: desktop plugin (context-menu interception + composer middleware)

未关闭
#18 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript
领域
desktop

调研方向

Start with the proposed quote-comment-desktop/ directory and the desktop/plugin.js disk-plugin entry point, then compare the linked hermes-quote-comment source and gist. Check the contributing notes and developer-guide coverage before choosing the example shape. Done means an accepted, self-contained reference example demonstrating context-menu interception, fixed UI mounting, and COMPOSER_AREAS.middleware.

由索引模型根据 Issue 内容生成。

描述

Proposal: a desktop-side reference example (context menu + composer middleware)

The current index covers agent-side (ctx.llm.*) and dashboard plugins, but nothing here shows a desktop/plugin.js end to end — while the desktop SDK docs send plugin authors to this repo for reference demos. Three seams this example would cover are currently discoverable only from the app source, and two of them bit us in practice:

  1. Context-menu interception. The app's own menu system listens on window capture and calls stopPropagation() on every right-click, so document-level listeners never run (window-capture listeners still do — stopPropagation does not affect same-target listeners). To keep the app's menu from flashing underneath, the example stamps message roots with data-hermes-context-menu-trigger during the right-button mousedown; on Windows contextmenu fires after mouseup, so the stamps cannot be cleared there.
  2. Floating UI without react-dom. Disk plugins cannot import react-dom, so menus/dialogs render as position: fixed nodes from a STATUSBAR_AREAS.right contribution — the only always-mounted, non-closable mount point.
  3. COMPOSER_AREAS.middleware. A queue drained on send: handler(draft) => { ...draft, text }, null to cancel, throw = pass-through.

The example is a slimmed version of a working community plugin — pwwang/hermes-quote-comment (MIT): select text in a response → right-click → Comment → the quote + comment is appended to your next message.

Per the contributing notes ("open an issue first if the surface you want to demonstrate isn't already covered in the developer-guide docs"): the context-menu interception + trigger-attribute behavior is exactly such a surface. Happy to wait if you would rather land a docs page for it first, or to restructure the example to your preferred shape — it is slightly over the ~200 LOC note, with ~80 lines being the window-capture/attribute machinery.

Would a PR for quote-comment-desktop/ be welcome?

主要语言
Python
星标
49
派生
34
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。