Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ dist/
.DS_Store

extension/dist

.tmp/
594 changes: 481 additions & 113 deletions Agents.md

Large diffs are not rendered by default.

Binary file added assets/debug-send-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4,661 changes: 2,521 additions & 2,140 deletions calcit.cirru

Large diffs are not rendered by default.

478 changes: 352 additions & 126 deletions compact.cirru

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions deps.cirru
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

{} (:calcit-version |0.10.4)
:dependencies $ {} (|Respo/alerts.calcit |0.10.2)
{} (:calcit-version |0.10.9)
:dependencies $ {} (|Respo/alerts.calcit |0.10.4)
|Respo/reel.calcit |main
|Respo/respo-markdown.calcit |0.4.11
|Respo/respo-ui.calcit |0.6.3
|Respo/respo.calcit |0.16.22
|Respo/respo.calcit |0.16.24
|calcit-lang/lilac |main
|calcit-lang/memof |main
|calcit-lang/memof |0.0.17
|Respo/respo-feather.calcit |main
37 changes: 37 additions & 0 deletions extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
// Call the specified callback, passing
// the web-page's DOM content as argument
sendResponse(getSelectedText());
return;
}
if (msg.action === "fill-text") {
insertTextAtCursor(String(msg.text || ""));
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Missing return statement after handling the 'fill-text' action. While JavaScript will implicitly return undefined, this is inconsistent with the explicit return statement at line 9 for the 'selected' action. For consistency and clarity, add an explicit return statement after calling insertTextAtCursor.

Suggested change
insertTextAtCursor(String(msg.text || ""));
insertTextAtCursor(String(msg.text || ""));
return;

Copilot uses AI. Check for mistakes.
}
});

Expand All @@ -22,3 +26,36 @@ let getSelectedText = () => {
};

console.log("[Side Message] prepared content script");

function insertTextAtCursor(text) {
try {
const active = document.activeElement;
if (!active) return;

if (active.tagName === "INPUT" || active.tagName === "TEXTAREA") {
const input = active;
if (input.readOnly || input.disabled) return;
const start = input.selectionStart ?? input.value.length;
const end = input.selectionEnd ?? input.value.length;
input.setRangeText(text, start, end, "end");
input.dispatchEvent(new Event("input", { bubbles: true }));
return;
}

if (active.isContentEditable) {
const sel = window.getSelection();
if (!sel || sel.rangeCount === 0) return;
const range = sel.getRangeAt(0);
if (!active.contains(range.commonAncestorContainer)) return;
range.deleteContents();
const textNode = document.createTextNode(text);
range.insertNode(textNode);
range.setStartAfter(textNode);
range.setEndAfter(textNode);
sel.removeAllRanges();
sel.addRange(range);
}
} catch (err) {
console.error("[Side Message] failed to insert text", err);
}
}
53 changes: 50 additions & 3 deletions extension/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,73 @@ chrome.runtime.onInstalled.addListener(() => {

chrome.runtime.onInstalled.addListener(async () => {
chrome.contextMenus.create({
id: "msg-gemeni-selection",
id: "msg-gemini-root",
title: "Msg Gemini",
type: "normal",
contexts: ["selection"],
});
chrome.contextMenus.create({
id: "msg-gemini-summary",
title: "Summary",
type: "normal",
contexts: ["selection"],
parentId: "msg-gemini-root",
});
chrome.contextMenus.create({
id: "msg-gemini-translate",
title: "Translate",
type: "normal",
contexts: ["selection"],
parentId: "msg-gemini-root",
});
chrome.contextMenus.create({
id: "msg-gemini-custom",
title: "Custom...",
type: "normal",
contexts: ["selection"],
parentId: "msg-gemini-root",
});
});

chrome.contextMenus.onClicked.addListener((item, tab) => {
let content = item.selectionText;
chrome.runtime.sendMessage({ action: "menu-trigger", content });
if (item.menuItemId === "msg-gemini-translate") {
chrome.runtime.sendMessage({ action: "menu-translate", content });
} else if (item.menuItemId === "msg-gemini-custom") {
chrome.runtime.sendMessage({ action: "menu-custom", content });
} else {
chrome.runtime.sendMessage({ action: "menu-summary", content });
}
chrome.sidePanel.open({ tabId: tab.id }, () => {
// also try to open
if (!sidepanelOpen) {
setTimeout(() => {
chrome.runtime.sendMessage({ action: "menu-trigger", content });
if (item.menuItemId === "msg-gemini-translate") {
chrome.runtime.sendMessage({ action: "menu-translate", content });
} else if (item.menuItemId === "msg-gemini-custom") {
chrome.runtime.sendMessage({ action: "menu-custom", content });
} else {
chrome.runtime.sendMessage({ action: "menu-summary", content });
}
}, 1000);
}
});
});

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message && message.action === "fill-text") {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const tab = tabs && tabs[0];
if (tab && tab.id != null) {
chrome.tabs.sendMessage(tab.id, {
action: "fill-text",
text: message.text || "",
});
Comment on lines +67 to +70
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Missing error handling for chrome.tabs.sendMessage. If the message fails to send (e.g., content script not loaded on the page), this will fail silently. Consider adding error handling or checking chrome.runtime.lastError in a callback to provide feedback when text filling fails.

Suggested change
chrome.tabs.sendMessage(tab.id, {
action: "fill-text",
text: message.text || "",
});
chrome.tabs.sendMessage(
tab.id,
{
action: "fill-text",
text: message.text || "",
},
(response) => {
if (chrome.runtime.lastError) {
console.error(
"Failed to send 'fill-text' message to tab",
tab.id,
chrome.runtime.lastError.message
);
}
}
);

Copilot uses AI. Check for mistakes.
}
});
}
});

// https://stackoverflow.com/a/77106777/883571
chrome.runtime.onConnect.addListener(function (port) {
if (port.name === "mySidepanel") {
Expand Down
166 changes: 82 additions & 84 deletions llms/Respo.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"dependencies": {
"@calcit/procs": "^0.10.4",
"@google/genai": "^1.34.0",
"@calcit/procs": "^0.10.9",
"@google/genai": "^1.37.0",
"axios": "^1.12.2",
"cirru-color": "^0.2.4",
"copy-text-to-clipboard": "^3.2.2",
"openai": "^6.15.0"
"feather-icons": "^4.29.2",
"openai": "^6.16.0"
},
"devDependencies": {
"bottom-tip": "^0.1.5",
Expand Down
Loading
Loading