feat: bridge Studio profiles into web composers - #43
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Reviewer's GuideBridges rendered Studio profiles into empty, focused provider web composers through guarded WebView JavaScript, preserves a clipboard fallback for unsafe or unavailable insertion, exposes the action in existing UI entry points, and adds focused Rhino tests for the bridge’s safety and behavior. Sequence diagram for applying Studio to a web composersequenceDiagram
actor User
participant Toolbar as WebChatToolbar
participant Screen as WebChatScreen
participant WebView
participant Bridge as StudioPromptBridge
participant Composer as ProviderComposer
participant Clipboard
User->>Toolbar: onApplyStudio()
Toolbar->>Screen: applyStudioPrompt()
Screen->>Bridge: applyStudioPromptToFocusedEditor(webView, service, prompt)
Bridge->>WebView: evaluateJavascript(studioPromptApplyScript)
WebView->>Composer: Find focused or remembered editor
alt Empty editor on owned HTTPS provider
Composer-->>WebView: inserted
WebView-->>Bridge: JavaScript result
Bridge-->>Screen: INSERTED
Screen-->>User: Show inserted snackbar
else Unsafe, unavailable, non-empty, or rejected editor
Composer-->>WebView: failure result
WebView-->>Bridge: JavaScript result
Bridge-->>Screen: Apply failure result
Screen->>Clipboard: setPrimaryClip(studioPrompt)
Screen-->>User: Show clipboard fallback snackbar
end
State diagram for Studio prompt application outcomesstateDiagram-v2
[*] --> Ready
Ready --> Inserted: applyStudioPromptToFocusedEditor()
Ready --> ClipboardFallback: webView unavailable or off-provider
Inserted --> [*]
Ready --> ValidateEditor
ValidateEditor --> ClipboardFallback: no editor
ValidateEditor --> ClipboardFallback: editor not empty
ValidateEditor --> DispatchInput
DispatchInput --> Inserted: beforeinput accepted
DispatchInput --> ClipboardFallback: beforeinput rejected or script failed
ClipboardFallback --> [*]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
|
Overall Grade Focus Area: Security |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Kotlin | Sep 3, 2026 11:39p.m. | Review ↗ | |
| Secrets | Sep 3, 2026 11:39p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
|
Tick the box to add this pull request to the merge queue (same as
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough新增 Studio 指令应用流程。WebView 仅在受支持服务的 HTTPS 页面中跟踪最近聚焦的可编辑元素,并向空编辑器注入指令。流程排除搜索框、邮箱框、隐藏、禁用和只读元素。注入失败、页面不匹配或编辑器不可用时复制指令。WebChat 界面新增应用入口、结果提示和测试覆盖。 Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change safely applies Studio content only to eligible empty web composers and falls back to the clipboard when insertion is unavailable. No merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant WebChatScreen
participant StudioPromptBridge
participant WebView
participant FocusedEditor
WebChatScreen->>StudioPromptBridge: 应用 Studio 指令
StudioPromptBridge->>WebView: 执行注入脚本
WebView->>FocusedEditor: 写入空编辑器并派发事件
FocusedEditor-->>WebView: 返回注入状态
WebView-->>StudioPromptBridge: 返回结果令牌
StudioPromptBridge-->>WebChatScreen: 显示结果或复制指令
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
✨ Simplify code
Comment |
Sourcery withdrew this approval because the latest commits introduced blocking findings.
🐤 Kanarek · 🟣 merged
Documentation, App · 4 files |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/main/java/com/twojstar/llmbench/web/StudioPromptBridge.kt (1)
47-76: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift恢复受控的文本 composer 支持。
当支持的服务使用
input type="text"作为 composer 时,llmbenchFindEditable会在tag === 'input'分支无条件返回null。studioPromptApplyScript因此返回"no-editor",界面会复制内容,而不会插入内容。仅接受带明确 composer 标记的输入框,或使用静态服务注册表。保留对密码、搜索和账户输入框的拒绝逻辑,并添加允许的文本 composer 回归测试。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Team
Run ID: d6a87858-392d-49e0-8ad3-87379d84d028
📒 Files selected for processing (2)
app/src/main/java/com/twojstar/llmbench/web/StudioPromptBridge.ktapp/src/test/java/com/twojstar/llmbench/web/StudioPromptBridgeTest.kt
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review.
Summary
Generic text inputs intentionally remain clipboard-only unless a reliable provider composer marker is verified.
Validation:
git diff --checkpassed. Final-head Android + KMP CI and CodeQL passed; debug APK artifact uploaded. No local Gradle run.