Fix shadow DOM text extraction for Monica.im and Cline#7
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
Co-authored-by: kristoffersodersten <60147923+kristoffersodersten@users.noreply.github.com> Agent-Logs-Url: https://github.com/kristoffersodersten/selectpilot/sessions/2ce2ecbd-2e6c-4ca9-8eef-102a4402362a
Copilot
AI
changed the title
[WIP] Fix issues with Monica.im and Cline in container
Fix shadow DOM text extraction for Monica.im and Cline
Mar 25, 2026
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.
Monica.im and Cline inject their UI via open shadow roots.
element.innerTextdoes not descend into shadow roots, so both document text extraction and selections within these containers were silently returning empty content.Changes
content/extract-text.tscollectShadowText(root)— new exported recursive helper that walks all shadow hosts in a subtree, collectsinnerTextfrom each shadow root's directHTMLElementchildren, and recurses into nested shadow roots.extractDocumentText()— appendscollectShadowText()output to the regularinnerTextresult before theclean()pass.extractSelection()— adds agetComposedRanges()fallback (Chrome 111+, within the extension's minimum of Chrome 127). Whenselection.toString()returns empty but a non-collapsed composed range exists, converts it to a liveRangeto recover the shadow-boundary selection text.tests/panel/extract-text.test.mjsFive new tests covering
collectShadowText: no shadow roots, single shadow root, blank text ignored, nested shadow roots, multiple independent hosts.Original prompt
Monica.im and Cline dont seem to work in the container.
[Chronological Review: The conversation began with the user requesting to initialize a process. The user then attached files and requested inspections and modifications related to the "selectpilot" repository. The user expressed a desire to remove certain elements, check the functionality of "package-lock.json," and sought recommendations. The user later requested to revert changes and to make "Cline" and "Monica.imn" work, indicating issues with these components in a container environment.][Intent Mapping:
[Technical Inventory:
[Code Archaeology:
[Progress Assessment:
[Context Validation: All critical information for continuation is captured, including user requests for inspections, modifications, and troubleshooting of specific files.]
[Recent Commands Analysis:
1. Conversation Overview: - Primary Objectives: User requested to initialize a process, inspect files, remove components, check package-lock.json, seek recommendations, revert changes, and fix specific files. - Session Context: The conversation involved multiple requests for file inspections and modifications, indicating a focus on resolving issues within the "selectpilot" repository. - User Intent Evolution: The user transitioned from initialization and inspection to troubleshooting specific files that were not functioning as expected.- Technical Foundation:
- Repository: "selectpilot" - A project repository the user is working on.
- Files: "Cline", "Monica.imn", "package-lock.json" - Specific files mentioned for inspection and modification.
- Codebase Status:
- File Name: "package-lock.json"
- Purpose: Manages dependencies for the project.
- Current State: User requested to check its functionality.
- Key Code Segments: Not specified in the conversation.
- Dependencies: Related to the overall project dependencies.
- Problem Resolution:
- Issues Encountered: User reported that "Cline" and "Monica.imn" do not work in the container.
- Solutions Implemented: None documented yet; user is seeking recommendations.
- Debugging Context: Ongoing troubleshooting of specific files in a container environment.
- Lessons Learned: User is actively engaging in problem-solving for file functionality.
- Progress Tracking:
- Completed Tasks: User has attached files and made several requests for inspections and modifications.
- Partially Complete Work: User is still working on resolving issues with "Cline" and "Monica.imn."
- Validated Outcomes: None confirmed yet.
- Active Work State:
- Current Focus: User is addressing issues with "Cline" and "Monica.imn" in the container.
- Recent Context: User reported functionality issues with specific files.
- Working Code: No specific code snippets were discussed recently.
- Immediate Context: User is troubleshooting the functionality of "Cline" and "Monica.imn."
- Recent Operations:
- Last Agent Commands: User requested to inspect files, remove components, check package-lock.json, and make specific files work.
- Tool Results Summary: No specific tool results were provided; user is actively seeking to understan...
Created from VS Code.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.