@nxxxsooo/opencode-annotate 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -3
- package/README.md +11 -4
- package/browser/capture.js +31 -10
- package/browser/inspector.js +12 -2
- package/browser/manifest.json +1 -1
- package/browser/panel.css +3 -0
- package/browser/panel.html +2 -2
- package/browser/panel.mjs +30 -9
- package/browser/protocol.mjs +3 -2
- package/browser/worker.mjs +96 -26
- package/package.json +1 -1
- package/tui/bin/darwin-arm64/annotate-tui +0 -0
- package/tui/bin/darwin-x64/annotate-tui +0 -0
- package/tui/bin/linux-arm64/annotate-tui +0 -0
- package/tui/bin/linux-x64/annotate-tui +0 -0
- package/tui/bin/win32-x64/annotate-tui.exe +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.0 — clear the round
|
|
4
|
+
|
|
5
|
+
- **Clear** in the notes header removes every unsent note in the round; each page
|
|
6
|
+
group also has its own **Clear**. One **Undo** restores the whole removed batch.
|
|
7
|
+
- Keep delivered history, **Restore last round** and page-local drafts. A pending
|
|
8
|
+
retry batch is dropped only after inline confirmation when clearing the round.
|
|
9
|
+
- Browser protocol 8 requires matching companion files: reload the Chrome extension
|
|
10
|
+
and restart OpenCode after updating.
|
|
11
|
+
|
|
12
|
+
## 0.16.1 — picking inside frames
|
|
13
|
+
|
|
14
|
+
- Fix picking and text selection inside same-origin iframes, legacy framesets and
|
|
15
|
+
nested frames. Reveal and page markers find notes in frames after a reload.
|
|
16
|
+
- Record each note's frame in a `Frame:` line in delivered Markdown. Cross-origin
|
|
17
|
+
frames show a clear message instead of silently failing to pick.
|
|
18
|
+
- Browser protocol 7 requires matching companion files: reload the Chrome extension
|
|
19
|
+
and restart OpenCode after updating.
|
|
20
|
+
|
|
3
21
|
## 0.16.0 — /ref moves to Another
|
|
4
22
|
|
|
5
23
|
- **Breaking:** remove `/ref`, `/ref --all`, `/ref --tui` and the agent session
|
|
6
|
-
search/read tools. Conversation references now belong to Another;
|
|
7
|
-
|
|
8
|
-
Until that release, stay on Annotate 0.15.0 if you need `/ref`.
|
|
24
|
+
search/read tools. Conversation references now belong to Another; Another 0.28.0
|
|
25
|
+
ships a cross-agent `/ref`; install it and run `another setup`.
|
|
9
26
|
- Existing `opencode.json(c)` plugin entries keep working, including option sync.
|
|
10
27
|
Remove any `annotate_session_*` permission rules. Reply, document and webpage
|
|
11
28
|
annotation remain in Annotate.
|
package/README.md
CHANGED
|
@@ -116,9 +116,8 @@ Move its entry from `cli.json` to `opencode.json(c)`, retaining the whole entry
|
|
|
116
116
|
## Upgrading to 0.16.0
|
|
117
117
|
|
|
118
118
|
**Breaking:** `/ref` (including `--all` and `--tui`) and the agent session search/read
|
|
119
|
-
tools have moved out of Annotate to Another.
|
|
120
|
-
|
|
121
|
-
on Annotate 0.15.0 if you need `/ref`.
|
|
119
|
+
tools have moved out of Annotate to Another. Install Another 0.28.0 or later and run
|
|
120
|
+
`another setup` to get its cross-agent `/ref` in OpenCode.
|
|
122
121
|
|
|
123
122
|
Existing `opencode.json(c)` entries and plugin options keep working. Remove any
|
|
124
123
|
`annotate_session_*` permission rules. Annotate continues to review replies,
|
|
@@ -181,6 +180,8 @@ Choose **Pick element** or select text, then write a comment or question. The co
|
|
|
181
180
|
|
|
182
181
|
The queue groups notes by page, with contiguous numbers matching page markers and delivered Markdown. Click a note's quoted target to show it on its page without activating the element; off-page notes can open their page. **Edit** changes the feedback, and **Undo** restores a deleted note. The delivery bar shows the whole round's count and destination; drafts remain page-local.
|
|
183
182
|
|
|
183
|
+
**Clear** in the notes header removes every unsent note in the round; each page group has its own **Clear**. One **Undo** restores the whole removed batch. Drafts, delivered history and **Restore last round** stay intact. Clearing the round drops a pending retry batch only after inline confirmation.
|
|
184
|
+
|
|
184
185
|
Each send closes the global review round: delivered notes leave the list and the panel is ready for the next round. **Restore last round** returns the most recent round's notes across pages; the last ten rounds are kept globally.
|
|
185
186
|
|
|
186
187
|
**Send** and **Copy instead** remain separate actions. Send requires a live destination; Copy instead copies the grouped round as Markdown for any agent and closes it the same way. If a session drops during Send, notes remain available for retry or copying. **More review options** contains a non-closing Markdown copy, JSON export, and a preview of the current round.
|
|
@@ -193,6 +194,12 @@ Plain `/annotate`, `/annotate-pick` and `/annotate-selection` use the TUI; Markd
|
|
|
193
194
|
|
|
194
195
|
### Browser safeguards and limitations
|
|
195
196
|
|
|
197
|
+
Picking and text selection work inside same-origin iframes, legacy framesets and
|
|
198
|
+
nested frames. Reveal and page markers can find those notes after reload; delivered
|
|
199
|
+
Markdown includes a `Frame:` line for frame context. Cross-origin frames cannot be
|
|
200
|
+
picked and show a clear message. After updating to 0.17.0 (browser protocol 8), reload
|
|
201
|
+
the Chrome extension and restart OpenCode.
|
|
202
|
+
|
|
196
203
|
Written drafts autosave locally and restore after panel reload or a return to the same URL, including SPA routes. Selecting another target with unfinished feedback offers **Add/Save & switch**, **Keep editing**, or **Discard & switch**. Storage failures keep the input and offer a retry; competing panels require an explicit choice of draft. Saved-note revision checks likewise prevent stale tabs overwriting newer feedback. Full JSON/Markdown exports include redacted URLs, exact selected text/context, verified selector hints, styles and accessibility. Missing/changed/ambiguous targets are labeled in the sidebar instead of silently rebound. Comments and drafts live in extension-owned UI/storage; the page receives only selection metadata and numbered markers, not your written feedback.
|
|
197
204
|
|
|
198
205
|
Native delivery requires an open local TUI and a connected destination. If the receiver closes, feedback stays pending. A failed batch retains its original target and ID for safe retry; if that session is permanently gone, export the notes before starting a new review. **Retry N notes & continue** retries that original batch; newly composed feedback stays local for the next send. Copying a round instead supersedes a failed batch. Clipboard failures expose a selectable preview and keep the round open. Browser-internal pages, PDF, cross-origin iframes, Canvas and remote SSH TUI clients are outside this version's scope. Page Context is retired only after exporting its drafts and verifying this replacement.
|
|
@@ -340,7 +347,7 @@ See [release instructions](docs/releasing.md) and [changelog](CHANGELOG.md).
|
|
|
340
347
|
- `/annotate 文档.md`:批注文档,支持中文、空格和相对路径。
|
|
341
348
|
- `/annotate-pick`:从最近的回复和运行中的进度说明里选一条批注。
|
|
342
349
|
- `/annotate-selection`:先在会话里拖选文字,再批注包含这段文字的消息。
|
|
343
|
-
- 0.16.0 移除 `/ref` 和代理会话搜索/读取工具,交由 Another
|
|
350
|
+
- 0.16.0 移除 `/ref` 和代理会话搜索/读取工具,交由 Another 提供跨代理引用:安装 Another 0.28.0 或更高版本并运行 `another setup` 即可。原有插件配置继续有效,请移除 `annotate_session_*` 权限规则。
|
|
344
351
|
- `/annotate 页面.html`、`/annotate https://…`:打开网页批注。Chrome 自动注册主机和会话,扩展目的地菜单可筛选、新建空会话、断开及重连;Safari 保持仅复制。跨页备注汇成一轮,Send 与 Copy instead 分开,确认发送后自动继续原会话。
|
|
345
352
|
- 选中文字 → `c` 写批注 → Enter 保存 → `q` 发送并返回。
|
|
346
353
|
- 写批注中途按 `Ctrl+S`,一步保存、返回并发送(中文输入法开着也有效);`Ctrl+C` 返回后由 OpenCode 询问。
|
package/browser/capture.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
if (globalThis.__opencodeAnnotate === true) throw new Error("Refresh this page once to update annotation tools. Saved notes will remain.")
|
|
3
|
+
if (globalThis.__opencodeAnnotate?.version === 7) return
|
|
3
4
|
globalThis.__opencodeAnnotate?.dispose()
|
|
4
5
|
if (!["text/html", "application/xhtml+xml"].includes(document.contentType)) throw new Error("Only HTML pages are supported")
|
|
5
6
|
const listeners = new AbortController()
|
|
@@ -15,15 +16,17 @@
|
|
|
15
16
|
const highlight = document.createElement("div"); highlight.className = "box"
|
|
16
17
|
let highlighted, highlightTimer
|
|
17
18
|
let picking = false, url = location.href, timer, markers = [], active = true
|
|
18
|
-
function send(anchor = null, error = null, modeOnly = false) {
|
|
19
|
+
function send(anchor = null, error = null, modeOnly = false, ready = false) {
|
|
19
20
|
if (!active) return
|
|
20
21
|
try {
|
|
21
|
-
chrome.runtime.sendMessage({ action: "capture", page: { url: location.href, title: document.title }, anchor, error, picking, modeOnly }).catch(dispose)
|
|
22
|
+
chrome.runtime.sendMessage({ action: "capture", page: { url: location.href, title: document.title }, frame: AnnotateInspector.frame(), anchor, error, picking, modeOnly, ready }).catch(dispose)
|
|
22
23
|
} catch { dispose() }
|
|
23
24
|
}
|
|
24
25
|
function setPicking(value, notify = true) {
|
|
25
26
|
picking = value
|
|
26
|
-
|
|
27
|
+
// Only a hover over a real element adds the box. Reapplying frame-wide
|
|
28
|
+
// picker state must not resurrect a box hidden at an iframe boundary.
|
|
29
|
+
if (!picking) box.remove()
|
|
27
30
|
if (notify) send(null, null, true)
|
|
28
31
|
}
|
|
29
32
|
function selection() {
|
|
@@ -37,14 +40,29 @@
|
|
|
37
40
|
}
|
|
38
41
|
on(document, "selectionchange", () => { clearTimeout(timer); timer = setTimeout(selection, 160) })
|
|
39
42
|
on(document, "pointerup", selection)
|
|
40
|
-
|
|
43
|
+
const hover = event => {
|
|
41
44
|
if (!picking) return
|
|
45
|
+
if (["iframe", "frame", "frameset"].includes(event.target.localName)) {
|
|
46
|
+
box.remove()
|
|
47
|
+
if (event.target.localName !== "frameset") {
|
|
48
|
+
try { if (!event.target.contentDocument) throw new Error() }
|
|
49
|
+
catch { send(null, "This frame is from another site; Annotate can't read it", true) }
|
|
50
|
+
}
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
root.append(box)
|
|
42
54
|
const rect = event.target.getBoundingClientRect()
|
|
43
55
|
box.style.cssText = `left:${rect.x}px;top:${rect.y}px;width:${rect.width}px;height:${rect.height}px`
|
|
44
|
-
}
|
|
56
|
+
}
|
|
57
|
+
on(document, "mousemove", hover, { capture: true })
|
|
58
|
+
on(document, "pointerover", hover, { capture: true })
|
|
45
59
|
on(document, "pointerdown", event => { if (picking) { event.preventDefault(); event.stopImmediatePropagation() } }, { capture: true })
|
|
46
60
|
on(document, "click", event => {
|
|
47
61
|
if (!picking) return
|
|
62
|
+
if (event.target.localName === "frameset") return
|
|
63
|
+
if (["iframe", "frame"].includes(event.target.localName)) {
|
|
64
|
+
try { if (event.target.contentDocument) { box.remove(); return } } catch { /* inaccessible frame: explain below */ }
|
|
65
|
+
}
|
|
48
66
|
event.preventDefault(); event.stopImmediatePropagation()
|
|
49
67
|
// A failed pick must never leave the page trapped in interception mode.
|
|
50
68
|
setPicking(false, false)
|
|
@@ -53,7 +71,7 @@
|
|
|
53
71
|
on(document, "keydown", event => { if (picking && event.key === "Escape") setPicking(false) })
|
|
54
72
|
const onMessage = (message, _sender, respond) => {
|
|
55
73
|
if (message.action === "annotate-ping") { respond({ ok: true }); return }
|
|
56
|
-
if (message.action === "pick") { setPicking(
|
|
74
|
+
if (message.action === "pick") { setPicking(message.picking, false); respond({ ok: true, picking }) }
|
|
57
75
|
if (message.action === "markers") { markers = message.notes || []; draw(); respond({ ok: true }) }
|
|
58
76
|
if (message.action === "locate") respond({ states: message.anchors.map(locate) })
|
|
59
77
|
if (message.action === "reveal") {
|
|
@@ -62,7 +80,7 @@
|
|
|
62
80
|
respond({ ok: false, error: `This element is ${state}. Your feedback is kept.` })
|
|
63
81
|
return
|
|
64
82
|
}
|
|
65
|
-
setPicking(false)
|
|
83
|
+
setPicking(false, false)
|
|
66
84
|
highlighted = document.querySelector(message.anchor.selector)
|
|
67
85
|
highlighted.scrollIntoView({ block: "center", inline: "nearest", behavior: matchMedia("(prefers-reduced-motion: reduce)").matches ? "instant" : "smooth" })
|
|
68
86
|
root.append(highlight); draw()
|
|
@@ -104,7 +122,10 @@
|
|
|
104
122
|
}
|
|
105
123
|
on(document, "scroll", draw, { capture: true, passive: true }); on(window, "resize", draw)
|
|
106
124
|
const observer = new MutationObserver(() => { clearTimeout(timer); timer = setTimeout(draw, 160) })
|
|
107
|
-
observer.observe(document.
|
|
125
|
+
observer.observe(document.documentElement, { childList: true, subtree: true, characterData: true })
|
|
126
|
+
on(document, "load", event => {
|
|
127
|
+
if (["iframe", "frame"].includes(event.target.localName)) chrome.runtime.sendMessage({ action: "frames-changed" }).catch(() => {})
|
|
128
|
+
}, { capture: true })
|
|
108
129
|
const routeTimer = setInterval(() => { if (!active) { observer.disconnect(); return } if (url !== location.href) { url = location.href; markers = []; draw(); send() } }, 700)
|
|
109
130
|
function dispose() {
|
|
110
131
|
if (!active) return
|
|
@@ -112,6 +133,6 @@
|
|
|
112
133
|
try { chrome.runtime.onMessage.removeListener(onMessage) } catch { /* previous extension context may already be invalidated */ }
|
|
113
134
|
delete globalThis.__opencodeAnnotate
|
|
114
135
|
}
|
|
115
|
-
globalThis.__opencodeAnnotate = { dispose }
|
|
116
|
-
send()
|
|
136
|
+
globalThis.__opencodeAnnotate = { dispose, version: 7 }
|
|
137
|
+
send(null, null, true, true)
|
|
117
138
|
})();
|
package/browser/inspector.js
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
return parts.join(", ")
|
|
39
39
|
}
|
|
40
40
|
function selector(element) {
|
|
41
|
+
const document = element.ownerDocument
|
|
41
42
|
const parts = []
|
|
42
43
|
for (let node = element; node?.nodeType === 1; node = node.parentElement) {
|
|
43
44
|
if (node.id && document.querySelectorAll(`#${CSS.escape(node.id)}`).length === 1) { parts.unshift(`#${CSS.escape(node.id)}`); break }
|
|
@@ -92,7 +93,8 @@
|
|
|
92
93
|
if (!element) throw new Error("Choose a visible page element")
|
|
93
94
|
const style = getComputedStyle(element)
|
|
94
95
|
if (element.closest("[hidden],script,style,noscript,template") || style.display === "none" || style.visibility === "hidden") throw new Error("Choose a visible page element")
|
|
95
|
-
if (["iframe", "
|
|
96
|
+
if (["iframe", "frame"].includes(element.localName)) throw new Error("This frame is from another site; Annotate can't read it")
|
|
97
|
+
if (["canvas", "embed", "object"].includes(element.localName)) throw new Error("This content type is unsupported")
|
|
96
98
|
const omitted = textFilter()
|
|
97
99
|
const contents = document.createRange(); contents.selectNodeContents(element)
|
|
98
100
|
const visibleText = safeText(contents, omitted).trim()
|
|
@@ -121,5 +123,13 @@
|
|
|
121
123
|
rect: Object.fromEntries(["x", "y", "width", "height"].map(key => [key, Math.round(rect[key])])),
|
|
122
124
|
viewport: { width: innerWidth, height: innerHeight, scrollX, scrollY } }
|
|
123
125
|
}
|
|
124
|
-
|
|
126
|
+
function frame() {
|
|
127
|
+
const selectors = []
|
|
128
|
+
for (let current = window; current !== current.top; current = current.parent) {
|
|
129
|
+
// Access is deliberately limited to same-origin ancestors.
|
|
130
|
+
selectors.unshift(selector(current.frameElement))
|
|
131
|
+
}
|
|
132
|
+
return selectors.length ? { selectors, url: location.href } : null
|
|
133
|
+
}
|
|
134
|
+
globalThis.AnnotateInspector = { capture, text: elementText, frame }
|
|
125
135
|
})();
|
package/browser/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "OpenCode Annotate",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"description": "Annotate HTML-based page feedback, private drafts, and paired OpenCode delivery.",
|
|
6
6
|
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp7TG2yzekNKpQvHBtj4jqkOxtoeDIBhNIjPi37Os/ksuhzPp1pHnrJPV4WV2ToatUaD5x5/SpLP8qZKLBD+wuraEE/TeclEZ8HvEs1yhlnx/S7piTG/s0eV5umuTEx2w66Hi0w3dhTC7ZZfJXCLyqs1feBtWzQx6ClgaHNYly4iJ03pV7RfguqpIaG9LV8Oa8ELA+7Ubr0BAujXrSlvqLF5oAKGoXXcpvTL5rgMRIH4Q/85tnvrk0pRVg+1z9IGNzSfjN82iveC/JAriyWABp8YuswtvKfI2Wb+KspaisBh39Y3BRqlyo8I2Cr+01uE6G5pWiJIWMLhe0glrMr5I2wIDAQAB",
|
|
7
7
|
"permissions": ["activeTab", "scripting", "storage", "sidePanel", "nativeMessaging", "clipboardWrite"],
|
package/browser/panel.css
CHANGED
|
@@ -138,3 +138,6 @@ pre { max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: a
|
|
|
138
138
|
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
|
|
139
139
|
.page-group { list-style: none; display: grid; gap: 2px; padding: 12px 0 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
|
|
140
140
|
.page-group strong { color: var(--text); font-size: 13px; font-weight: 650; }
|
|
141
|
+
.page-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
142
|
+
.page-group-heading strong { min-width: 0; overflow-wrap: anywhere; }
|
|
143
|
+
.page-group-heading button { flex-shrink: 0; }
|
package/browser/panel.html
CHANGED
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
<div id="draft-error" class="draft-error" hidden><p id="draft-error-text" class="error" role="alert"></p><div class="switch-actions"><button id="retry-draft">Retry saving draft</button><button id="reload-draft">Load saved draft</button><button id="keep-draft">Keep my draft</button><button id="copy-draft" class="text-button">Copy my draft</button></div></div>
|
|
39
39
|
<div class="composer-actions"><button id="save" aria-keyshortcuts="Control+Enter Meta+Enter"><span id="save-label">Add note</span><kbd id="save-shortcut" title="Command or Control + Enter" aria-hidden="true">⌘↵</kbd></button><button id="cancel" class="text-button">Discard draft</button></div>
|
|
40
40
|
</section>
|
|
41
|
-
<div id="undo-notice" class="inline-notice" aria-live="polite" hidden><span>Note removed.</span><button id="undo" class="text-button">Undo</button></div>
|
|
42
|
-
<section id="notes-section" class="notes-section" aria-label="Collected notes" hidden><div class="section-heading"><h2>Notes</h2><span id="count">0 notes</span></div><ol id="notes"></ol></section>
|
|
41
|
+
<div id="undo-notice" class="inline-notice" aria-live="polite" hidden><span id="undo-text">Note removed.</span><button id="undo" class="text-button">Undo</button></div>
|
|
42
|
+
<section id="notes-section" class="notes-section" aria-label="Collected notes" hidden><div class="section-heading"><h2>Notes</h2><span id="count">0 notes</span><button id="clear" class="text-button" aria-label="Clear whole round">Clear</button></div><div id="clear-warning" class="inline-notice" role="status" hidden><span>The pending retry batch will be dropped. Undo restores notes only.</span><button id="confirm-clear" class="text-button">Clear anyway</button><button id="cancel-clear" class="text-button">Cancel</button></div><ol id="notes"></ol></section>
|
|
43
43
|
<section id="empty-state" class="empty-state"><h2 id="empty-title">Start with what you see.</h2><p>Pick an element or highlight text on the page, then describe what needs attention.</p><p id="empty-footnote" class="empty-footnote">Send one note straight away, or collect a few first. Your feedback stays local until you send.</p><button id="restore-round" class="text-button" hidden>Restore last round</button></section>
|
|
44
44
|
</main>
|
|
45
45
|
<footer class="delivery">
|
package/browser/panel.mjs
CHANGED
|
@@ -12,7 +12,7 @@ let state, model, destination, available, targets = [], workspaces = [], disconn
|
|
|
12
12
|
// Safari has no reachable bridge, so the panel offers copy instead of session delivery.
|
|
13
13
|
let deliverySupported = true
|
|
14
14
|
let refreshID = 0, connectionRevision = 0, connectionRefresh, connectionRefreshRevision, connectionTimer, scheduledRefresh
|
|
15
|
-
let pendingAction, pendingFocus, undoRecord, selectedNoteID, noteRenderKey, notice, outdated = false
|
|
15
|
+
let pendingAction, pendingFocus, undoRecord, clearBatchID, selectedNoteID, noteRenderKey, notice, outdated = false
|
|
16
16
|
let sessionSort = localStorage.getItem("sessionSort") || "updated", showAllSessions = false
|
|
17
17
|
|
|
18
18
|
function icon(name) {
|
|
@@ -59,7 +59,7 @@ async function run(id, fn) {
|
|
|
59
59
|
model.conflict = error; model.error = error
|
|
60
60
|
renderComposer()
|
|
61
61
|
}
|
|
62
|
-
status(error.message, "error", ["send", "copy-round", "restore-round", "undo", "delete"].includes(id) ? null : page)
|
|
62
|
+
status(error.message, "error", ["send", "copy-round", "restore-round", "undo", "delete", "clear"].includes(id) ? null : page)
|
|
63
63
|
} finally {
|
|
64
64
|
busy.delete(id); if ($(id)) $(id).disabled = false; controls()
|
|
65
65
|
if (!flushFocus() && !pendingFocus && document.activeElement === document.body && page === state?.page.url &&
|
|
@@ -74,12 +74,12 @@ function dirty(m = model) {
|
|
|
74
74
|
anchorIdentity(value.anchor) !== anchorIdentity(value.editing.anchor) : !!value.comment.trim()
|
|
75
75
|
}
|
|
76
76
|
const validDraft = () => !!model?.value?.comment.trim() && dirty()
|
|
77
|
-
const anchorIdentity = anchor => anchor ? JSON.stringify([anchor.type, anchor.selector, anchor.quote, anchor.prefix, anchor.suffix]) : ""
|
|
77
|
+
const anchorIdentity = anchor => anchor ? JSON.stringify([anchor.frame, anchor.type, anchor.selector, anchor.quote, anchor.prefix, anchor.suffix]) : ""
|
|
78
78
|
function pendingCount() {
|
|
79
79
|
const pending = state?.notes.filter(note => note.sentRevision !== note.revision) || []
|
|
80
80
|
return pending.length + (validDraft() && !pending.some(note => note.id === model.value.editing?.id) ? 1 : 0)
|
|
81
81
|
}
|
|
82
|
-
function locked() { return ["save", "send", "copy-round", "restore-round", "cancel", "save-switch", "discard-switch", "delete", "undo", "reload-draft", "keep-draft", "targets", "new-session", "disconnect", "change-target"].some(id => busy.has(id)) }
|
|
82
|
+
function locked() { return ["clear", "save", "send", "copy-round", "restore-round", "cancel", "save-switch", "discard-switch", "delete", "undo", "reload-draft", "keep-draft", "targets", "new-session", "disconnect", "change-target"].some(id => busy.has(id)) }
|
|
83
83
|
function controls() {
|
|
84
84
|
const lock = locked() || outdated
|
|
85
85
|
$("comment").disabled = lock
|
|
@@ -100,6 +100,7 @@ function controls() {
|
|
|
100
100
|
$("disconnect").disabled = lock || !available
|
|
101
101
|
$("copy").disabled = $("export").disabled = !state?.notes.length
|
|
102
102
|
for (const button of $("notes").querySelectorAll("button")) button.disabled = lock
|
|
103
|
+
for (const id of ["clear", "confirm-clear", "cancel-clear"]) $(id).disabled = lock || !state?.notes.length
|
|
103
104
|
for (const id of busy) if ($(id)) $(id).disabled = true
|
|
104
105
|
if (outdated) for (const button of document.querySelectorAll("button:not(#reload-extension)")) button.disabled = true
|
|
105
106
|
renderDelivery()
|
|
@@ -206,7 +207,18 @@ async function deleteNote(id) {
|
|
|
206
207
|
const result = await call({ action: "delete", url: state.page.url, note, baseRevision: note.revision,
|
|
207
208
|
...(clearDraft ? { draftRevision: m.record.revision, captures: m.value.captures } : {}) })
|
|
208
209
|
if (clearDraft) { m.record = result.draft; m.value = null; m.touched = false }
|
|
209
|
-
undoRecord = {
|
|
210
|
+
undoRecord = { notes: [result.note] }
|
|
211
|
+
await refresh(); focusWhenReady("#undo")
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function clearNotes(url, dropBatchID) {
|
|
215
|
+
if (!url && state.outbox && dropBatchID !== state.outbox.batchID) {
|
|
216
|
+
clearBatchID = state.outbox.batchID; $("clear-warning").hidden = false
|
|
217
|
+
focusWhenReady("#confirm-clear"); return
|
|
218
|
+
}
|
|
219
|
+
const notes = state.notes.filter(note => !url || note.page.url === url)
|
|
220
|
+
const result = await call({ action: "clear", notes: notes.map(note => ({ url: note.page.url, id: note.id, revision: note.revision })), wholeRound: !url, dropBatchID })
|
|
221
|
+
undoRecord = { notes: result.notes }; clearBatchID = null; $("clear-warning").hidden = true
|
|
210
222
|
await refresh(); focusWhenReady("#undo")
|
|
211
223
|
}
|
|
212
224
|
|
|
@@ -261,7 +273,12 @@ function renderNotes() {
|
|
|
261
273
|
pageURL = note.page.url
|
|
262
274
|
const page = note.page, url = new URL(page.url), header = make("li"), title = make("strong", page.title)
|
|
263
275
|
header.className = "page-group"; header.title = page.url
|
|
264
|
-
|
|
276
|
+
const heading = make("div"), clear = make("button", "Clear")
|
|
277
|
+
heading.className = "page-group-heading"; clear.className = "text-button"
|
|
278
|
+
clear.setAttribute("aria-label", `Clear notes from ${page.title}`)
|
|
279
|
+
clear.onclick = () => run("clear", () => clearNotes(page.url))
|
|
280
|
+
heading.append(title, clear)
|
|
281
|
+
header.append(heading, make("span", `${url.host}${url.pathname}${page.url === state.page.url ? " · This page" : ""}`))
|
|
265
282
|
$("notes").append(header)
|
|
266
283
|
}
|
|
267
284
|
const item = make("li"), number = make("span", index + 1), content = make("div"), target = make("button"), bottom = make("div"), meta = make("span")
|
|
@@ -340,6 +357,7 @@ function renderDelivery() {
|
|
|
340
357
|
function render() {
|
|
341
358
|
renderComposer(); renderNotes()
|
|
342
359
|
$("undo-notice").hidden = !undoRecord
|
|
360
|
+
$("undo-text").textContent = undoRecord ? `${plural(undoRecord.notes.length)} removed.` : ""
|
|
343
361
|
controls()
|
|
344
362
|
}
|
|
345
363
|
function scheduleRefresh() { clearTimeout(scheduledRefresh); scheduledRefresh = setTimeout(() => refresh(), 30) }
|
|
@@ -520,10 +538,13 @@ task("copy-draft", async () => {
|
|
|
520
538
|
catch { $("comment").focus(); $("comment").select(); status("Automatic copy was blocked. Press Cmd/Ctrl+C to copy your draft.", "error") }
|
|
521
539
|
})
|
|
522
540
|
task("undo", async () => {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
await refresh(); status(
|
|
541
|
+
const { notes } = undoRecord
|
|
542
|
+
await call({ action: "restore-notes", notes: notes.map(note => ({ url: note.page.url, id: note.id, revision: note.revision })) }); undoRecord = null
|
|
543
|
+
await refresh(); status(`${plural(notes.length)} restored`); focusWhenReady(`[data-note-id="${CSS.escape(notes[0].id)}"] .note-target`)
|
|
526
544
|
})
|
|
545
|
+
task("clear", () => clearNotes())
|
|
546
|
+
$("confirm-clear").addEventListener("click", () => run("clear", () => clearNotes(undefined, clearBatchID)))
|
|
547
|
+
task("cancel-clear", () => { clearBatchID = null; $("clear-warning").hidden = true; focusWhenReady("#clear") })
|
|
527
548
|
task("more", () => { const show = $("utilities").hidden; $("utilities").hidden = !show; $("more").setAttribute("aria-expanded", String(show)); if (show) $("panel-body").scrollTop = 0 })
|
|
528
549
|
task("change-target", async () => { showSessionOptions($("session-options").hidden); if (!$("session-options").hidden) await refreshConnection() })
|
|
529
550
|
$("session-sort").value = sessionSort
|
package/browser/protocol.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const MAX_BYTES = 512 * 1024
|
|
2
2
|
export const HOST = "fun.mjshao.annotate"
|
|
3
3
|
// Bump when panel ↔ worker actions change. Chrome can keep an older worker running beside a newer panel.
|
|
4
|
-
export const PROTOCOL =
|
|
4
|
+
export const PROTOCOL = 8
|
|
5
5
|
export function safeUrl(input) {
|
|
6
6
|
const url = new URL(input)
|
|
7
7
|
if (!["http:", "https:", "file:"].includes(url.protocol)) throw new Error("Unsupported page URL")
|
|
@@ -23,7 +23,7 @@ export function validateReview(review) {
|
|
|
23
23
|
!["comment", "ask"].includes(note.kind) || typeof note.comment !== "string" || !note.comment.trim() || note.comment.length > 8000 ||
|
|
24
24
|
typeof note.anchor?.quote !== "string" || note.anchor.quote.length > 4000 || typeof note.anchor.selector !== "string" ||
|
|
25
25
|
!["text", "element"].includes(note.anchor.type)) throw new Error("Invalid annotation")
|
|
26
|
-
for (const key of ["prefix", "suffix", "styles", "accessibility", "element", "fullPath"]) {
|
|
26
|
+
for (const key of ["prefix", "suffix", "styles", "accessibility", "element", "fullPath", "frame"]) {
|
|
27
27
|
if (note.anchor[key] !== undefined && typeof note.anchor[key] !== "string") throw new Error("Invalid anchor field")
|
|
28
28
|
}
|
|
29
29
|
if (typeof note.createdAt !== "string" || Number.isNaN(Date.parse(note.createdAt))) throw new Error("Invalid annotation timestamp")
|
|
@@ -55,6 +55,7 @@ export function markdown(review) {
|
|
|
55
55
|
lines.push(`### Annotation ${index + 1} (${note.kind})`, `Captured: ${note.createdAt}`, `Selector hint: ${a.selector}`, `Element: ${a.element || a.type}`, "", "Page evidence:")
|
|
56
56
|
lines.push(...`${a.prefix || ""}【${a.quote}】${a.suffix || ""}`.split("\n").map(line => `> ${line}`))
|
|
57
57
|
if (a.fullPath) lines.push(`DOM path: ${a.fullPath}`)
|
|
58
|
+
if (a.frame) lines.push(`Frame: ${a.frame}`)
|
|
58
59
|
if (a.rect) lines.push(`Position: ${JSON.stringify(a.rect)}; viewport: ${JSON.stringify(a.viewport)}`)
|
|
59
60
|
if (a.styles) lines.push(`Styles: ${a.styles}`)
|
|
60
61
|
if (a.accessibility) lines.push(`Accessibility: ${a.accessibility}`)
|
package/browser/worker.mjs
CHANGED
|
@@ -13,30 +13,32 @@ const native = message => {
|
|
|
13
13
|
return chrome.runtime.sendNativeMessage(HOST, message)
|
|
14
14
|
}
|
|
15
15
|
const KEPT_ROUNDS = 10
|
|
16
|
-
|
|
16
|
+
// Inherited-origin blank/srcdoc documents have no HTTP URL to sanitize.
|
|
17
|
+
const frameLocator = frame => frame ? JSON.stringify({ selectors: frame.selectors, url: ["about:blank", "about:srcdoc"].includes(frame.url) ? frame.url : safeUrl(frame.url) }) : undefined
|
|
18
|
+
async function inject(tabId) {
|
|
19
|
+
try { await chrome.scripting.executeScript({ target: { tabId, allFrames: true }, files: ["inspector.js", "capture.js"] }) }
|
|
20
|
+
catch (error) { throw new Error(String(error.message).includes("HTML") ? error.message : RECONNECT) }
|
|
21
|
+
const frames = await chrome.scripting.executeScript({ target: { tabId, allFrames: true }, func: () => {
|
|
22
|
+
try { return { frame: globalThis.AnnotateInspector.frame() } } catch { return null }
|
|
23
|
+
} })
|
|
24
|
+
return frames.filter(item => item.result).map(item => ({ frameId: item.frameId, frame: frameLocator(item.result.frame) }))
|
|
25
|
+
}
|
|
26
|
+
async function pickFrames(tabId, picking, frames = undefined) {
|
|
27
|
+
frames ??= await inject(tabId)
|
|
28
|
+
await Promise.all(frames.map(({ frameId }) => chrome.tabs.sendMessage(tabId, { action: "pick", picking }, { frameId })))
|
|
29
|
+
return { picking }
|
|
30
|
+
}
|
|
31
|
+
async function anchorMessage(tabId, message, frames = undefined) {
|
|
32
|
+
frames ??= await inject(tabId)
|
|
33
|
+
const frame = frames.find(item => item.frame === message.anchor?.frame)
|
|
34
|
+
if (!frame) return { ok: false, error: "This frame is missing or has navigated. Your feedback is kept." }
|
|
35
|
+
return chrome.tabs.sendMessage(tabId, message, { frameId: frame.frameId })
|
|
36
|
+
}
|
|
17
37
|
async function activate(tab) {
|
|
18
38
|
if (!tab?.id || !/^(https?|file):/.test(tab.url || "")) throw new Error("Open an ordinary webpage or authorized local HTML")
|
|
19
39
|
await inject(tab.id)
|
|
20
40
|
await chrome.storage.session.set({ [`tab:${tab.id}`]: { page: { url: safeUrl(tab.url), title: pageTitle(tab.title || "") }, anchor: null } })
|
|
21
41
|
}
|
|
22
|
-
// A reload or navigation removes the page tools; reinject them while activeTab still grants this tab.
|
|
23
|
-
// The receiver-missing wording differs per engine, so detect it by asking the tab instead.
|
|
24
|
-
async function tabMessage(tabId, message) {
|
|
25
|
-
try { return await chrome.tabs.sendMessage(tabId, message) }
|
|
26
|
-
catch (error) {
|
|
27
|
-
if (!await receiverMissing(tabId)) throw error
|
|
28
|
-
try { await inject(tabId) } catch (injectError) {
|
|
29
|
-
throw new Error(String(injectError.message).includes("HTML") ? injectError.message : RECONNECT)
|
|
30
|
-
}
|
|
31
|
-
return chrome.tabs.sendMessage(tabId, message)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// Chrome reports a missing content script with a fixed string; Safari does not. Probe
|
|
35
|
-
// the tab with a message only the content script answers.
|
|
36
|
-
async function receiverMissing(tabId) {
|
|
37
|
-
try { await chrome.tabs.sendMessage(tabId, { action: "annotate-ping" }); return false }
|
|
38
|
-
catch { return true }
|
|
39
|
-
}
|
|
40
42
|
async function waitLoaded(tabID) {
|
|
41
43
|
await new Promise((resolve, reject) => {
|
|
42
44
|
const finish = error => { clearTimeout(timer); chrome.tabs.onUpdated.removeListener(updated); error ? reject(error) : resolve() }
|
|
@@ -47,6 +49,17 @@ async function waitLoaded(tabID) {
|
|
|
47
49
|
})
|
|
48
50
|
}
|
|
49
51
|
const delivered = note => !note.deleted && note.sentRevision === note.revision
|
|
52
|
+
async function updateMarkers(notes) {
|
|
53
|
+
const session = await chrome.storage.session.get(null)
|
|
54
|
+
await Promise.all((await chrome.tabs.query({})).map(async tab => {
|
|
55
|
+
const page = session[`tab:${tab.id}`]?.page
|
|
56
|
+
if (!page) return
|
|
57
|
+
try {
|
|
58
|
+
const frames = await inject(tab.id)
|
|
59
|
+
await Promise.all(frames.map(({ frameId, frame }) => chrome.tabs.sendMessage(tab.id, { action: "markers", notes: notes.map(note => ({ anchor: note.page.url === page.url && note.anchor.frame === frame ? note.anchor : null })) }, { frameId })))
|
|
60
|
+
} catch { /* Closed or navigated tabs are refreshed when reopened. */ }
|
|
61
|
+
}))
|
|
62
|
+
}
|
|
50
63
|
async function closeRound(annotations, details) {
|
|
51
64
|
const storage = await chrome.storage.local.get(null), sentAt = new Date().toISOString(), updates = {}
|
|
52
65
|
for (const sent of annotations) {
|
|
@@ -94,13 +107,19 @@ async function current(message) {
|
|
|
94
107
|
let anchorStates = notes.map(note => note.page.url === state.page.url ? "unavailable" : "elsewhere"), draftAnchorState = draft.value ? "unavailable" : undefined, detached = null
|
|
95
108
|
try {
|
|
96
109
|
const anchors = localNotes.map(note => note.anchor).concat(draft.value ? [draft.value.anchor] : [])
|
|
97
|
-
const
|
|
110
|
+
const frames = await inject(tab.id)
|
|
111
|
+
const latest = (await chrome.storage.session.get(`tab:${tab.id}`))[`tab:${tab.id}`]
|
|
112
|
+
await pickFrames(tab.id, !!latest?.picking, frames)
|
|
113
|
+
const states = await Promise.all(anchors.map(async anchor => {
|
|
114
|
+
const result = await anchorMessage(tab.id, { action: "locate", anchor, anchors: [anchor] }, frames)
|
|
115
|
+
return result.states?.[0] || "missing frame"
|
|
116
|
+
}))
|
|
98
117
|
let index = 0
|
|
99
118
|
anchorStates = notes.map(note => note.page.url === state.page.url ? states[index++] : "elsewhere")
|
|
100
119
|
if (draft.value) draftAnchorState = states[localNotes.length]
|
|
101
120
|
} catch (error) { if (error.message === RECONNECT) detached = RECONNECT /* otherwise visibly unavailable while navigating */ }
|
|
102
121
|
return { protocol: PROTOCOL, tabID: tab.id, ...state, notes, anchorStates, hash, draft, draftAnchorState, detached, lastRound: lastRound(entries),
|
|
103
|
-
outbox: outbox ? { targetID: outbox.targetID, count: outbox.review.annotations.length } : null }
|
|
122
|
+
outbox: outbox ? { batchID: outbox.batchID, targetID: outbox.targetID, count: outbox.review.annotations.length } : null }
|
|
104
123
|
}
|
|
105
124
|
function draftConflict(draft) {
|
|
106
125
|
return Object.assign(new Error("This draft changed in another panel. Choose which version to keep."), { code: "draft-conflict", draft })
|
|
@@ -162,12 +181,27 @@ async function liveTarget(paired, targets, current) {
|
|
|
162
181
|
})
|
|
163
182
|
}
|
|
164
183
|
async function handle(message, sender) {
|
|
184
|
+
if (message.action === "frames-changed") {
|
|
185
|
+
if (!sender.tab) throw new Error("Invalid page source")
|
|
186
|
+
const state = (await chrome.storage.session.get(`tab:${sender.tab.id}`))[`tab:${sender.tab.id}`]
|
|
187
|
+
if (state?.page) await pickFrames(sender.tab.id, !!state.picking)
|
|
188
|
+
return {}
|
|
189
|
+
}
|
|
165
190
|
if (message.action === "capture") {
|
|
166
191
|
if (!sender.tab || !sender.url || new URL(message.page.url).origin !== new URL(sender.url).origin) throw new Error("Invalid page source")
|
|
167
192
|
const key = `tab:${sender.tab.id}`
|
|
168
193
|
const previous = (await chrome.storage.session.get(key))[key] || {}
|
|
169
|
-
|
|
170
|
-
|
|
194
|
+
const tab = await chrome.tabs.get(sender.tab.id)
|
|
195
|
+
if ((sender.origin || new URL(sender.url).origin) !== new URL(tab.url).origin) throw new Error("Invalid frame source")
|
|
196
|
+
const frame = sender.frameId ? frameLocator(message.frame) : undefined
|
|
197
|
+
if (sender.frameId && !frame) throw new Error("Missing frame locator")
|
|
198
|
+
const captured = !message.modeOnly
|
|
199
|
+
const changedPage = previous.page?.url !== safeUrl(tab.url)
|
|
200
|
+
const picking = changedPage || captured ? false : message.ready ? !!previous.picking : !!message.picking
|
|
201
|
+
await chrome.storage.session.set({ [key]: { ...previous, page: { url: safeUrl(tab.url), title: pageTitle(tab.title || "") }, picking,
|
|
202
|
+
...(captured ? { anchor: message.anchor ? { ...message.anchor, ...(frame ? { frame } : {}) } : null, error: message.error, captureID: crypto.randomUUID() } : changedPage ? { anchor: null, error: null } : message.error ? { error: message.error } : {}) } })
|
|
203
|
+
if (message.ready) await chrome.tabs.sendMessage(sender.tab.id, { action: "pick", picking }, { frameId: sender.frameId || 0 })
|
|
204
|
+
if (!picking && previous.picking) await pickFrames(sender.tab.id, false)
|
|
171
205
|
return {}
|
|
172
206
|
}
|
|
173
207
|
if (sender.url && !sameExtensionURL(sender.url)) throw new Error("Only the extension panel can manage feedback")
|
|
@@ -237,7 +271,12 @@ async function handle(message, sender) {
|
|
|
237
271
|
})
|
|
238
272
|
const state = await current(message)
|
|
239
273
|
if (["save", "pick"].includes(message.action) && message.url && message.url !== state.page.url) throw new Error("The active page changed; retry on the original page")
|
|
240
|
-
if (message.action === "pick")
|
|
274
|
+
if (message.action === "pick") {
|
|
275
|
+
const picking = !state.picking
|
|
276
|
+
const key = `tab:${state.tabID}`, previous = (await chrome.storage.session.get(key))[key]
|
|
277
|
+
await chrome.storage.session.set({ [key]: { ...previous, picking } })
|
|
278
|
+
return pickFrames(state.tabID, picking)
|
|
279
|
+
}
|
|
241
280
|
if (message.action === "reveal") {
|
|
242
281
|
const note = state.notes.find(note => note.id === message.noteID)
|
|
243
282
|
if (!note) throw new Error("This note is no longer on the page")
|
|
@@ -262,10 +301,37 @@ async function handle(message, sender) {
|
|
|
262
301
|
try { await activate(await chrome.tabs.get(tabID)) }
|
|
263
302
|
catch { throw new Error(RECONNECT) }
|
|
264
303
|
}
|
|
265
|
-
const
|
|
304
|
+
const key = `tab:${tabID}`, previous = (await chrome.storage.session.get(key))[key]
|
|
305
|
+
await chrome.storage.session.set({ [key]: { ...previous, picking: false } })
|
|
306
|
+
await pickFrames(tabID, false)
|
|
307
|
+
const result = await anchorMessage(tabID, { action: "reveal", anchor: note.anchor })
|
|
266
308
|
if (!result.ok) throw new Error(result.error)
|
|
267
309
|
return result
|
|
268
310
|
}
|
|
311
|
+
if (["clear", "restore-notes"].includes(message.action)) return serial(async () => {
|
|
312
|
+
if (!Array.isArray(message.notes) || !message.notes.length) throw new Error("No notes to change")
|
|
313
|
+
const storage = await chrome.storage.local.get(null), updates = {}, restoring = message.action === "restore-notes"
|
|
314
|
+
for (const ref of message.notes) {
|
|
315
|
+
const key = `note:${await pageKey(safeUrl(ref.url))}:${ref.id}`, old = storage[key]
|
|
316
|
+
if (!old || old.revision !== ref.revision || !!old.deleted !== restoring || delivered(old))
|
|
317
|
+
throw Object.assign(new Error("A note changed in another tab. Refresh and try again."), { code: "note-conflict", note: old || null })
|
|
318
|
+
if (updates[key]) throw new Error("Duplicate note")
|
|
319
|
+
updates[key] = { ...old, revision: old.revision + 1, deleted: !restoring }
|
|
320
|
+
}
|
|
321
|
+
if (restoring) {
|
|
322
|
+
const round = Object.entries(storage).filter(([key, note]) => key.startsWith("note:") && !note.deleted && !delivered(note)).map(([, note]) => note)
|
|
323
|
+
if (round.length + Object.keys(updates).length > 200) throw new Error("This round would exceed 200 notes; send or remove some first")
|
|
324
|
+
validateReview({ version: 2, annotations: [...round, ...Object.values(updates)] })
|
|
325
|
+
}
|
|
326
|
+
const notes = Object.values(updates)
|
|
327
|
+
if (!restoring && message.wholeRound && storage.outbox) {
|
|
328
|
+
if (message.dropBatchID !== storage.outbox.batchID) throw new Error("A pending retry batch will be dropped. Confirm Clear again.")
|
|
329
|
+
updates.outbox = null
|
|
330
|
+
}
|
|
331
|
+
await chrome.storage.local.set(updates)
|
|
332
|
+
await updateMarkers(orderedNotes(Object.entries({ ...storage, ...updates }).filter(([key, note]) => key.startsWith("note:") && !note.deleted && !delivered(note)).map(([, note]) => note)))
|
|
333
|
+
return { notes }
|
|
334
|
+
})
|
|
269
335
|
if (["save", "delete", "restore"].includes(message.action)) return serial(async () => {
|
|
270
336
|
const page = message.note.page || state.page
|
|
271
337
|
const key = `note:${await pageKey(page.url)}:${message.note.id}`
|
|
@@ -295,7 +361,11 @@ async function handle(message, sender) {
|
|
|
295
361
|
}
|
|
296
362
|
await chrome.storage.local.set(updates); return { note, draft }
|
|
297
363
|
})
|
|
298
|
-
if (message.action === "markers")
|
|
364
|
+
if (message.action === "markers") {
|
|
365
|
+
const frames = await inject(state.tabID)
|
|
366
|
+
await Promise.all(frames.map(({ frameId, frame }) => chrome.tabs.sendMessage(state.tabID, { action: "markers", notes: state.notes.map(note => ({ anchor: note.page.url === state.page.url && note.anchor.frame === frame ? note.anchor : null })) }, { frameId })))
|
|
367
|
+
return {}
|
|
368
|
+
}
|
|
299
369
|
if (message.action === "copied") return serial(async () => {
|
|
300
370
|
if (!Array.isArray(message.notes) || !message.notes.length) throw new Error("No copied feedback to record")
|
|
301
371
|
const count = await closeRound(message.notes, { sentRound: crypto.randomUUID(), sentVia: "clipboard", sentTo: null })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxxxsooo/opencode-annotate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Unofficial OpenCode annotation plugin: review AI replies and Markdown with a bundled terminal reviewer; annotate webpages with the browser companion.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|