feat(extensions): 扩展交互 GUI 适配——对话框四件套 + notify Toast(#45) - #49
Merged
Conversation
ImageTray 原在 Composer 文档流内,粘贴后撑高输入框列压缩 main, 正在阅读的消息被齐边切掉(视觉上像被白底盖住)。改为 absolute bottom-full 悬浮在对话区之上:无包裹卡片,容器透明只做排布, 每张缩略图自带 shadow-pop 单独浮起;多图列宽内换行、向上生长。 Composer 内容列加 relative 作为悬浮锚。
梳理 ExtensionUIContext ~30 方法的交互全景(阻塞对话框/即发即忘/数据旁路), 对齐官方 RPC 降级语义,给出 P0-P3 分层与落地路径(issue #45 根因分析)。 INDEX 的 ui-context 条目挂调研文档链接。
pi 扩展的 ctx.ui 从全量 no-op 升级为真实 GUI 交互(issue #45:ask-user-question 类插件此前静默返回「用户取消」,AI 被误导): - backend:ExtensionDialogHost(每会话队列 + timeout/signal 宿主裁决 + fail-closed 取消值 + dispose 兜底);makeUiContext(deps) 重写——select/input/editor/confirm 走对话框宿主、notify/setEditorText 走回调、setTheme 诚实失败、getEditorText 对齐 RPC 降级;bindExtensions 无条件绑定 + mode rpc + onError→log/trace(与权限门逃生 舱解耦) - renderer:DockSlot 同槽仲裁(权限>对话框>Composer)+ InteractionDock 四卡 (键盘/倒计时/排队);notify→Toast 限流(8s 去重/上限 3/溢出折叠);setEditorText →草稿+一次性来源提示;后台 tab attention 呼吸点扩展 - 权限审批卡迁移无边框设计语言(amber glyph + 幽灵按钮,行为/记忆逻辑不变) - 第三方 confirm 走通用中性卡(权限通道不经通用对话框,不双弹) - 验证:backend 473 + desktop 328 测试全绿(新增 21 例)、冒烟脚本 4 断言、 CDP E2E 手测 8 命令
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
close #45 —— pi 扩展的
ctx.ui此前在 Percho 是全量 no-op:select/input/editor静默返回取消值,ask-user-question类插件误以为「用户拒绝回答」,AI 被误导,用户毫不知情。调研与方案:
docs/extension-ui.md(ExtensionUIContext 全景 + 对齐官方 RPC 降级语义 + P0-P3 分层)。本期落地(P0+P1 核心)
select/input/editor/confirm→ 底部停靠槽(与权限审批同位互换 Composer),opts.timeout/signal由 backend 宿主裁决(超时/中止自动按取消值 resolve,fail-closed,绝不伪造用户输入)onError接 log/trace;setTheme诚实失败;mode 改绑rpc;绑定与权限门逃生舱解耦明确不做(本期冻结)
setStatus/setWidget/setTitle、custom() 及组件工厂系(终端渲染模型,对齐 RPC 返回降级值)、P2 显示层投影、LAN 应答。
验证
npm run typecheck && npm run lint && npm run test全绿(backend 473 + desktop 328,新增 21 例)scripts/smoke-extension-dialogs.mts4 断言全 PASS(形状/超时/AbortSignal/应答链)